Factor out all the ISP related code into a seperate ISPProtocol set of files in the AVRISP Clone programmer project, to clearly seperate out the programming protocols when PDI programming is implemented.

This commit is contained in:
Dean Camera 2009-12-02 12:02:01 +00:00
parent 1645c3d243
commit 1ed6925b5b
10 changed files with 636 additions and 485 deletions

View file

@ -30,11 +30,11 @@
/** \file
*
* Header file for V2ProtocolTarget.c.
* Header file for ISPTarget.c.
*/
#ifndef _V2_PROTOCOL_TARGET_
#define _V2_PROTOCOL_TARGET_
#ifndef _ISP_TARGET_
#define _ISP_TARGET_
/* Includes: */
#include <avr/io.h>
@ -49,32 +49,14 @@
/* Macros: */
/** Total number of allowable ISP programming speeds supported by the device */
#define TOTAL_PROGRAMMING_SPEEDS 7
/** Timeout in milliseconds of target busy-wait loops waiting for a command to complete */
#define TARGET_BUSY_TIMEOUT_MS 240
/* External Variables: */
extern uint32_t CurrentAddress;
/* Inline Functions: */
/** Blocking delay for a given number of milliseconds, via a hardware timer.
*
* \param[in] DelayMS Number of milliseconds to delay for
*/
static inline void V2Protocol_DelayMS(uint8_t DelayMS)
{
TCNT0 = 0;
while (TCNT0 < DelayMS);
}
#define TOTAL_ISP_PROGRAMMING_SPEEDS 7
/* Function Prototypes: */
uint8_t V2Protocol_GetSPIPrescalerMask(void);
void V2Protocol_ChangeTargetResetLine(bool ResetTarget);
void V2Protocol_DelayMS(uint8_t MS);
uint8_t V2Protocol_WaitForProgComplete(uint8_t ProgrammingMode, uint16_t PollAddress, uint8_t PollValue,
uint8_t ISPTarget_GetSPIPrescalerMask(void);
void ISPTarget_ChangeTargetResetLine(bool ResetTarget);
uint8_t ISPTarget_WaitForProgComplete(uint8_t ProgrammingMode, uint16_t PollAddress, uint8_t PollValue,
uint8_t DelayMS, uint8_t ReadMemCommand);
uint8_t V2Protocol_WaitWhileTargetBusy(void);
void V2Protocol_LoadExtendedAddress(void);
uint8_t ISPTarget_WaitWhileTargetBusy(void);
void ISPTarget_LoadExtendedAddress(void);
#endif