AVRISP-MKII Clone Programmer Project

Macros | Functions
ISPProtocol.h File Reference
`#include <avr/io.h>`
`#include <util/delay.h>`
`#include <LUFA/Drivers/USB/USB.h>`
`#include "../V2Protocol.h"`
`#include "Config/AppConfig.h"`

## Macros

#define | READ_WRITE_HIGH_BYTE_MASK (1 << 3)
#define | PROG_MODE_PAGED_WRITES_MASK (1 << 0)
#define | PROG_MODE_WORD_TIMEDELAY_MASK (1 << 1)
#define | PROG_MODE_WORD_VALUE_MASK (1 << 2)
#define | PROG_MODE_WORD_READYBUSY_MASK (1 << 3)
#define | PROG_MODE_PAGED_TIMEDELAY_MASK (1 << 4)
#define | PROG_MODE_PAGED_VALUE_MASK (1 << 5)
#define | PROG_MODE_PAGED_READYBUSY_MASK (1 << 6)
#define | PROG_MODE_COMMIT_PAGE_MASK (1 << 7)

## Functions

void | ISPProtocol_EnterISPMode (void)
void | ISPProtocol_LeaveISPMode (void)
void | ISPProtocol_ProgramMemory (const uint8_t V2Command)
void | ISPProtocol_ReadMemory (const uint8_t V2Command)
void | ISPProtocol_ChipErase (void)
void | ISPProtocol_ReadFuseLockSigOSCCAL (const uint8_t V2Command)
void | ISPProtocol_WriteFuseLock (const uint8_t V2Command)
void | ISPProtocol_SPIMulti (void)
void | ISPProtocol_DelayMS (uint8_t DelayMS)

## Detailed Description

Header file for ISPProtocol.c.

## Macro Definition Documentation

## § PROG_MODE_COMMIT_PAGE_MASK

#define PROG_MODE_COMMIT_PAGE_MASK (1 << 7)

## § PROG_MODE_PAGED_READYBUSY_MASK

#define PROG_MODE_PAGED_READYBUSY_MASK (1 << 6)

## § PROG_MODE_PAGED_TIMEDELAY_MASK

#define PROG_MODE_PAGED_TIMEDELAY_MASK (1 << 4)

## § PROG_MODE_PAGED_VALUE_MASK

#define PROG_MODE_PAGED_VALUE_MASK (1 << 5)

## § PROG_MODE_PAGED_WRITES_MASK

#define PROG_MODE_PAGED_WRITES_MASK (1 << 0)

## § PROG_MODE_WORD_READYBUSY_MASK

#define PROG_MODE_WORD_READYBUSY_MASK (1 << 3)

## § PROG_MODE_WORD_TIMEDELAY_MASK

#define PROG_MODE_WORD_TIMEDELAY_MASK (1 << 1)

## § PROG_MODE_WORD_VALUE_MASK

#define PROG_MODE_WORD_VALUE_MASK (1 << 2)

## § READ_WRITE_HIGH_BYTE_MASK

#define READ_WRITE_HIGH_BYTE_MASK (1 << 3)

Mask for the reading or writing of the high byte in a FLASH word when issuing a low-level programming command.

## Function Documentation

## § ISPProtocol_ChipErase()

void ISPProtocol_ChipErase | ( | void |  | ) |

Handler for the CMD_CHI_ERASE_ISP command, clearing the target's FLASH memory.

## § ISPProtocol_DelayMS()

void ISPProtocol_DelayMS | ( | uint8_t | DelayMS | ) |

Blocking delay for a given number of milliseconds. This provides a simple wrapper around the avr-libc provided delay function, so that the delay function can be called with a constant value (to prevent run-time floating point operations being required).

Parameters

  [in] | DelayMS | Number of milliseconds to delay for

## § ISPProtocol_EnterISPMode()

void ISPProtocol_EnterISPMode | ( | void |  | ) |

Handler for the CMD_ENTER_PROGMODE_ISP command, which attempts to enter programming mode on the attached device, returning success or failure back to the host.

## § ISPProtocol_LeaveISPMode()

void ISPProtocol_LeaveISPMode | ( | void |  | ) |

Handler for the CMD_LEAVE_ISP command, which releases the target from programming mode.

## § ISPProtocol_ProgramMemory()

void ISPProtocol_ProgramMemory | ( | uint8_t | V2Command | ) |

Handler for the CMD_PROGRAM_FLASH_ISP and CMD_PROGRAM_EEPROM_ISP commands, writing out bytes, words or pages of data to the attached device.

Parameters

  [in] | V2Command | Issued V2 Protocol command byte from the host

## § ISPProtocol_ReadFuseLockSigOSCCAL()

void ISPProtocol_ReadFuseLockSigOSCCAL | ( | uint8_t | V2Command | ) |

Handler for the CMD_READ_FUSE_ISP, CMD_READ_LOCK_ISP, CMD_READ_SIGNATURE_ISP and CMD_READ_OSCCAL commands, reading the requested configuration byte from the device.

Parameters

  [in] | V2Command | Issued V2 Protocol command byte from the host

## § ISPProtocol_ReadMemory()

void ISPProtocol_ReadMemory | ( | uint8_t | V2Command | ) |

Handler for the CMD_READ_FLASH_ISP and CMD_READ_EEPROM_ISP commands, reading in bytes, words or pages of data from the attached device.

Parameters

  [in] | V2Command | Issued V2 Protocol command byte from the host

## § ISPProtocol_SPIMulti()

void ISPProtocol_SPIMulti | ( | void |  | ) |

Handler for the CMD_SPI_MULTI command, writing and reading arbitrary SPI data to and from the attached device.

## § ISPProtocol_WriteFuseLock()

void ISPProtocol_WriteFuseLock | ( | uint8_t | V2Command | ) |

Handler for the CMD_WRITE_FUSE_ISP and CMD_WRITE_LOCK_ISP commands, writing the requested configuration byte to the device.

Parameters

  [in] | V2Command | Issued V2 Protocol command byte from the host