AVRISP-MKII Clone Programmer Project

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

## Macros

#define | XPROG_CMD_ENTER_PROGMODE 0x01
#define | XPROG_CMD_LEAVE_PROGMODE 0x02
#define | XPROG_CMD_ERASE 0x03
#define | XPROG_CMD_WRITE_MEM 0x04
#define | XPROG_CMD_READ_MEM 0x05
#define | XPROG_CMD_CRC 0x06
#define | XPROG_CMD_SET_PARAM 0x07
#define | XPROG_MEM_TYPE_APPL 1
#define | XPROG_MEM_TYPE_BOOT 2
#define | XPROG_MEM_TYPE_EEPROM 3
#define | XPROG_MEM_TYPE_FUSE 4
#define | XPROG_MEM_TYPE_LOCKBITS 5
#define | XPROG_MEM_TYPE_USERSIG 6
#define | XPROG_MEM_TYPE_FACTORY_CALIBRATION 7
#define | XPROG_ERASE_CHIP 1
#define | XPROG_ERASE_APP 2
#define | XPROG_ERASE_BOOT 3
#define | XPROG_ERASE_EEPROM 4
#define | XPROG_ERASE_APP_PAGE 5
#define | XPROG_ERASE_BOOT_PAGE 6
#define | XPROG_ERASE_EEPROM_PAGE 7
#define | XPROG_ERASE_USERSIG 8
#define | XPROG_MEM_WRITE_ERASE 0
#define | XPROG_MEM_WRITE_WRITE 1
#define | XPROG_CRC_APP 1
#define | XPROG_CRC_BOOT 2
#define | XPROG_CRC_FLASH 3
#define | XPROG_ERR_OK 0
#define | XPROG_ERR_FAILED 1
#define | XPROG_ERR_COLLISION 2
#define | XPROG_ERR_TIMEOUT 3
#define | XPROG_PARAM_NVMBASE 0x01
#define | XPROG_PARAM_EEPPAGESIZE 0x02
#define | XPROG_PARAM_NVMCMD_REG 0x03
#define | XPROG_PARAM_NVMCSR_REG 0x04
#define | XPROG_PARAM_UNKNOWN_1 0x05
#define | XPROG_PROTOCOL_PDI 0x00
#define | XPROG_PROTOCOL_JTAG 0x01
#define | XPROG_PROTOCOL_TPI 0x02
#define | XPROG_PAGEMODE_WRITE (1 << 1)
#define | XPROG_PAGEMODE_ERASE (1 << 0)

## Functions

void | XPROGProtocol_SetMode (void)
void | XPROGProtocol_Command (void)

## Variables

uint32_t | XPROG_Param_NVMBase
uint16_t | XPROG_Param_EEPageSize
uint8_t | XPROG_Param_NVMCSRRegAddr
uint8_t | XPROG_Param_NVMCMDRegAddr

## Detailed Description

Header file for XPROGProtocol.c.

## Macro Definition Documentation

## § XPROG_CMD_CRC

#define XPROG_CMD_CRC 0x06

## § XPROG_CMD_ENTER_PROGMODE

#define XPROG_CMD_ENTER_PROGMODE 0x01

## § XPROG_CMD_ERASE

#define XPROG_CMD_ERASE 0x03

## § XPROG_CMD_LEAVE_PROGMODE

#define XPROG_CMD_LEAVE_PROGMODE 0x02

## § XPROG_CMD_READ_MEM

#define XPROG_CMD_READ_MEM 0x05

## § XPROG_CMD_SET_PARAM

#define XPROG_CMD_SET_PARAM 0x07

## § XPROG_CMD_WRITE_MEM

#define XPROG_CMD_WRITE_MEM 0x04

## § XPROG_CRC_APP

#define XPROG_CRC_APP 1

## § XPROG_CRC_BOOT

#define XPROG_CRC_BOOT 2

## § XPROG_CRC_FLASH

#define XPROG_CRC_FLASH 3

## § XPROG_ERASE_APP

#define XPROG_ERASE_APP 2

## § XPROG_ERASE_APP_PAGE

#define XPROG_ERASE_APP_PAGE 5

## § XPROG_ERASE_BOOT

#define XPROG_ERASE_BOOT 3

## § XPROG_ERASE_BOOT_PAGE

#define XPROG_ERASE_BOOT_PAGE 6

## § XPROG_ERASE_CHIP

#define XPROG_ERASE_CHIP 1

## § XPROG_ERASE_EEPROM

#define XPROG_ERASE_EEPROM 4

## § XPROG_ERASE_EEPROM_PAGE

#define XPROG_ERASE_EEPROM_PAGE 7

## § XPROG_ERASE_USERSIG

#define XPROG_ERASE_USERSIG 8

## § XPROG_ERR_COLLISION

#define XPROG_ERR_COLLISION 2

## § XPROG_ERR_FAILED

#define XPROG_ERR_FAILED 1

## § XPROG_ERR_OK

#define XPROG_ERR_OK 0

## § XPROG_ERR_TIMEOUT

#define XPROG_ERR_TIMEOUT 3

## § XPROG_MEM_TYPE_APPL

#define XPROG_MEM_TYPE_APPL 1

## § XPROG_MEM_TYPE_BOOT

#define XPROG_MEM_TYPE_BOOT 2

## § XPROG_MEM_TYPE_EEPROM

#define XPROG_MEM_TYPE_EEPROM 3

## § XPROG_MEM_TYPE_FACTORY_CALIBRATION

#define XPROG_MEM_TYPE_FACTORY_CALIBRATION 7

## § XPROG_MEM_TYPE_FUSE

#define XPROG_MEM_TYPE_FUSE 4

## § XPROG_MEM_TYPE_LOCKBITS

#define XPROG_MEM_TYPE_LOCKBITS 5

## § XPROG_MEM_TYPE_USERSIG

#define XPROG_MEM_TYPE_USERSIG 6

## § XPROG_MEM_WRITE_ERASE

#define XPROG_MEM_WRITE_ERASE 0

## § XPROG_MEM_WRITE_WRITE

#define XPROG_MEM_WRITE_WRITE 1

## § XPROG_PAGEMODE_ERASE

#define XPROG_PAGEMODE_ERASE (1 << 0)

## § XPROG_PAGEMODE_WRITE

#define XPROG_PAGEMODE_WRITE (1 << 1)

## § XPROG_PARAM_EEPPAGESIZE

#define XPROG_PARAM_EEPPAGESIZE 0x02

## § XPROG_PARAM_NVMBASE

#define XPROG_PARAM_NVMBASE 0x01

## § XPROG_PARAM_NVMCMD_REG

#define XPROG_PARAM_NVMCMD_REG 0x03

## § XPROG_PARAM_NVMCSR_REG

#define XPROG_PARAM_NVMCSR_REG 0x04

## § XPROG_PARAM_UNKNOWN_1

#define XPROG_PARAM_UNKNOWN_1 0x05

## § XPROG_PROTOCOL_JTAG

#define XPROG_PROTOCOL_JTAG 0x01

## § XPROG_PROTOCOL_PDI

#define XPROG_PROTOCOL_PDI 0x00

## § XPROG_PROTOCOL_TPI

#define XPROG_PROTOCOL_TPI 0x02

## Function Documentation

## § XPROGProtocol_Command()

void XPROGProtocol_Command | ( | void |  | ) |

Handler for the CMD_XPROG command, which wraps up XPROG commands in a V2 wrapper which need to be removed and processed so that the underlying XPROG command can be handled.

## § XPROGProtocol_SetMode()

void XPROGProtocol_SetMode | ( | void |  | ) |

Handler for the CMD_XPROG_SETMODE command, which sets the programmer-to-target protocol used for PDI/TPI programming.

## Variable Documentation

## § XPROG_Param_EEPageSize

uint16_t XPROG_Param_EEPageSize

Size in bytes of the target's EEPROM page

## § XPROG_Param_NVMBase

uint32_t XPROG_Param_NVMBase

Base absolute address for the target's NVM controller for PDI programming

## § XPROG_Param_NVMCMDRegAddr

uint8_t XPROG_Param_NVMCMDRegAddr

Address of the TPI device's NVMCMD register for TPI programming

## § XPROG_Param_NVMCSRRegAddr

uint8_t XPROG_Param_NVMCSRRegAddr

Address of the TPI device's NVMCSR register for TPI programming