diff options
author | Dean Camera <[email protected]> | 2009-12-02 12:02:01 +0000 |
---|---|---|
committer | Dean Camera <[email protected]> | 2009-12-02 12:02:01 +0000 |
commit | 1ed6925b5bf417848b83887b32e3ede05a1c691b (patch) | |
tree | e99aac1a5cbf4e1be0006e6f5fa8939afa1f00e4 /Projects/AVRISP/Lib/V2Protocol.h | |
parent | 1645c3d243e57134228d36c23687c2ab664c3f9c (diff) | |
download | qmk_firmware-1ed6925b5bf417848b83887b32e3ede05a1c691b.tar.gz qmk_firmware-1ed6925b5bf417848b83887b32e3ede05a1c691b.zip |
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.
Diffstat (limited to 'Projects/AVRISP/Lib/V2Protocol.h')
-rw-r--r-- | Projects/AVRISP/Lib/V2Protocol.h | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/Projects/AVRISP/Lib/V2Protocol.h b/Projects/AVRISP/Lib/V2Protocol.h index 63a2347a86..b311478469 100644 --- a/Projects/AVRISP/Lib/V2Protocol.h +++ b/Projects/AVRISP/Lib/V2Protocol.h @@ -43,24 +43,30 @@ #include "../Descriptors.h" #include "V2ProtocolConstants.h"
#include "V2ProtocolParams.h" - #include "V2ProtocolTarget.h"
+ #include "ISPProtocol.h"
/* Macros: */
/** Programmer ID string, returned to the host during the CMD_SIGN_ON command processing */ #define PROGRAMMER_ID "AVRISP_MK2"
-
- /** Mask for the reading or writing of the high byte in a FLASH word when issuing a low-level programming command */
- #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)
- + /** Timeout in milliseconds of target busy-wait loops waiting for a command to complete */
+ #define TARGET_BUSY_TIMEOUT_MS 240
+
+ /* 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);
+ } +
+ /* External Variables: */
+ extern uint32_t CurrentAddress;
+ extern bool MustSetAddress;
+
/* Function Prototypes: */
void V2Protocol_ProcessCommand(void);
@@ -70,14 +76,6 @@ static void V2Protocol_GetSetParam(uint8_t V2Command);
static void V2Protocol_ResetProtection(void);
static void V2Protocol_LoadAddress(void);
- static void V2Protocol_ISP_EnterISPMode(void);
- static void V2Protocol_ISP_LeaveISPMode(void);
- static void V2Protocol_ISP_ProgramMemory(uint8_t V2Command);
- static void V2Protocol_ISP_ReadMemory(uint8_t V2Command);
- static void V2Protocol_ISP_ChipErase(void);
- static void V2Protocol_ISP_ReadFuseLockSigOSCCAL(uint8_t V2Command);
- static void V2Protocol_ISP_WriteFuseLock(uint8_t V2Command);
- static void V2Protocol_ISP_SPIMulti(void);
#endif #endif |