AVRISP-MKII Clone Programmer Project

Functions
TINYNVM.c File Reference
`#include "TINYNVM.h"`

## Functions

static void | TINYNVM_SendPointerAddress (const uint16_t AbsoluteAddress)
static void | TINYNVM_SendReadNVMRegister (const uint8_t Address)
static void | TINYNVM_SendWriteNVMRegister (const uint8_t Address)
bool | TINYNVM_WaitWhileNVMBusBusy (void)
bool | TINYNVM_WaitWhileNVMControllerBusy (void)
bool | TINYNVM_EnableTPI (void)
void | TINYNVM_DisableTPI (void)
bool | TINYNVM_ReadMemory (const uint16_t ReadAddress, uint8_t *ReadBuffer, uint16_t ReadSize)
bool | TINYNVM_WriteMemory (const uint16_t WriteAddress, uint8_t *WriteBuffer, uint16_t WriteLength)
bool | TINYNVM_EraseMemory (const uint8_t EraseCommand, const uint16_t Address)

## Detailed Description

Target-related functions for the TINY target's NVM module.

## Function Documentation

## § TINYNVM_DisableTPI()

void TINYNVM_DisableTPI | ( | void |  | ) |

Removes access to the target's NVM controller and physically disables the target's physical TPI interface.

## § TINYNVM_EnableTPI()

bool TINYNVM_EnableTPI | ( | void |  | ) |

Enables the physical TPI interface on the target and enables access to the internal NVM controller.

Returns
  Boolean `true` if the TPI interface was enabled successfully, `false` otherwise

## § TINYNVM_EraseMemory()

bool TINYNVM_EraseMemory | ( | const uint8_t | EraseCommand,
|  | const uint16_t | Address
| ) |  |

Erases the target's memory space.

Parameters

  [in] | EraseCommand | NVM erase command to send to the device
  [in] | Address | Address inside the memory space to erase

Returns
  Boolean `true` if the command sequence complete successfully

## § TINYNVM_ReadMemory()

bool TINYNVM_ReadMemory | ( | const uint16_t | ReadAddress,
|  | uint8_t * | ReadBuffer,
|  | uint16_t | ReadSize
| ) |  |

Reads memory from the target's memory spaces.

Parameters

  [in] | ReadAddress | Start address to read from within the target's address space
  [out] | ReadBuffer | Buffer to store read data into
  [in] | ReadSize | Length of the data to read from the device

Returns
  Boolean `true` if the command sequence complete successfully

## § TINYNVM_SendPointerAddress()

static void TINYNVM_SendPointerAddress | ( | const uint16_t | AbsoluteAddress | ) |

static

Sends the given pointer address to the target's TPI pointer register

## § TINYNVM_SendReadNVMRegister()

static void TINYNVM_SendReadNVMRegister | ( | const uint8_t | Address | ) |

static

Sends a SIN command to the target with the specified I/O address, ready for the data byte to be written.

Parameters

  [in] | Address | 6-bit I/O address to write to in the target's I/O memory space

## § TINYNVM_SendWriteNVMRegister()

static void TINYNVM_SendWriteNVMRegister | ( | const uint8_t | Address | ) |

static

Sends a SOUT command to the target with the specified I/O address, ready for the data byte to be read.

Parameters

  [in] | Address | 6-bit I/O address to read from in the target's I/O memory space

## § TINYNVM_WaitWhileNVMBusBusy()

bool TINYNVM_WaitWhileNVMBusBusy | ( | void |  | ) |

Busy-waits while the NVM controller is busy performing a NVM operation, such as a FLASH page read.

Returns
  Boolean `true` if the NVM controller became ready within the timeout period, `false` otherwise

## § TINYNVM_WaitWhileNVMControllerBusy()

bool TINYNVM_WaitWhileNVMControllerBusy | ( | void |  | ) |

Waits while the target's NVM controller is busy performing an operation, exiting if the timeout period expires.

Returns
  Boolean `true` if the NVM controller became ready within the timeout period, `false` otherwise

## § TINYNVM_WriteMemory()

bool TINYNVM_WriteMemory | ( | const uint16_t | WriteAddress,
|  | uint8_t * | WriteBuffer,
|  | uint16_t | WriteLength
| ) |  |

Writes word addressed memory to the target's memory spaces.

Parameters

  [in] | WriteAddress | Start address to write to within the target's address space
  [in] | WriteBuffer | Buffer to source data from
  [in] | WriteLength | Total number of bytes to write to the device (must be an integer multiple of 2)

Returns
  Boolean `true` if the command sequence complete successfully