Code style fixes to the AVRISP-MKII Clone programmer project.

pull/1469/head
Dean Camera 12 years ago
parent 7eaf3d18d2
commit f51c87b916

@ -309,7 +309,7 @@ void ISPTarget_LoadExtendedAddress(void)
{ {
ISPTarget_SendByte(LOAD_EXTENDED_ADDRESS_CMD); ISPTarget_SendByte(LOAD_EXTENDED_ADDRESS_CMD);
ISPTarget_SendByte(0x00); ISPTarget_SendByte(0x00);
ISPTarget_SendByte((CurrentAddress & 0x00FF0000) >> 16); ISPTarget_SendByte(CurrentAddress >> 16);
ISPTarget_SendByte(0x00); ISPTarget_SendByte(0x00);
} }

@ -106,16 +106,17 @@
*/ */
static inline uint8_t ISPTarget_ReceiveByte(void) static inline uint8_t ISPTarget_ReceiveByte(void)
{ {
#if !defined(INVERTED_ISP_MISO) uint8_t ReceivedByte;
if (HardwareSPIMode) if (HardwareSPIMode)
return SPI_ReceiveByte(); ReceivedByte = SPI_ReceiveByte();
else else
return ISPTarget_TransferSoftSPIByte(0x00); ReceivedByte = ISPTarget_TransferSoftSPIByte(0x00);
#if defined(INVERTED_ISP_MISO)
return ~ReceivedByte;
#else #else
if (HardwareSPIMode) return ReceivedByte;
return ~SPI_ReceiveByte();
else
return ~ISPTarget_TransferSoftSPIByte(0x00);
#endif #endif
} }
@ -128,16 +129,17 @@
*/ */
static inline uint8_t ISPTarget_TransferByte(const uint8_t Byte) static inline uint8_t ISPTarget_TransferByte(const uint8_t Byte)
{ {
#if !defined(INVERTED_ISP_MISO) uint8_t ReceivedByte;
if (HardwareSPIMode) if (HardwareSPIMode)
return SPI_TransferByte(Byte); ReceivedByte = SPI_TransferByte(Byte);
else else
return ISPTarget_TransferSoftSPIByte(Byte); ReceivedByte = ISPTarget_TransferSoftSPIByte(Byte);
#if defined(INVERTED_ISP_MISO)
return ~ReceivedByte;
#else #else
if (HardwareSPIMode) return ReceivedByte;
return ~SPI_TransferByte(Byte);
else
return ~ISPTarget_TransferSoftSPIByte(Byte);
#endif #endif
} }

@ -62,7 +62,7 @@
#if (!defined(FIRMWARE_VERSION_MINOR) || defined(__DOXYGEN__)) #if (!defined(FIRMWARE_VERSION_MINOR) || defined(__DOXYGEN__))
/** Minor firmware version, reported to the host on request; must match the version /** Minor firmware version, reported to the host on request; must match the version
* the host is expecting, or it (may) reject further communications with the programmer. */ * the host is expecting, or it (may) reject further communications with the programmer. */
#define FIRMWARE_VERSION_MINOR 0x11 #define FIRMWARE_VERSION_MINOR 0x14
#endif #endif
/* Type Defines: */ /* Type Defines: */

@ -172,7 +172,8 @@ void XMEGANVM_DisablePDI(void)
* *
* \return Boolean true if the command sequence complete successfully * \return Boolean true if the command sequence complete successfully
*/ */
bool XMEGANVM_GetMemoryCRC(const uint8_t CRCCommand, uint32_t* const CRCDest) bool XMEGANVM_GetMemoryCRC(const uint8_t CRCCommand,
uint32_t* const CRCDest)
{ {
*CRCDest = 0; *CRCDest = 0;
@ -222,7 +223,9 @@ bool XMEGANVM_GetMemoryCRC(const uint8_t CRCCommand, uint32_t* const CRCDest)
* *
* \return Boolean true if the command sequence complete successfully * \return Boolean true if the command sequence complete successfully
*/ */
bool XMEGANVM_ReadMemory(const uint32_t ReadAddress, uint8_t* ReadBuffer, uint16_t ReadSize) bool XMEGANVM_ReadMemory(const uint32_t ReadAddress,
uint8_t* ReadBuffer,
uint16_t ReadSize)
{ {
/* Wait until the NVM controller is no longer busy */ /* Wait until the NVM controller is no longer busy */
if (!(XMEGANVM_WaitWhileNVMControllerBusy())) if (!(XMEGANVM_WaitWhileNVMControllerBusy()))
@ -257,7 +260,9 @@ bool XMEGANVM_ReadMemory(const uint32_t ReadAddress, uint8_t* ReadBuffer, uint16
* *
* \return Boolean true if the command sequence complete successfully * \return Boolean true if the command sequence complete successfully
*/ */
bool XMEGANVM_WriteByteMemory(const uint8_t WriteCommand, const uint32_t WriteAddress, const uint8_t Byte) bool XMEGANVM_WriteByteMemory(const uint8_t WriteCommand,
const uint32_t WriteAddress,
const uint8_t Byte)
{ {
/* Wait until the NVM controller is no longer busy */ /* Wait until the NVM controller is no longer busy */
if (!(XMEGANVM_WaitWhileNVMControllerBusy())) if (!(XMEGANVM_WaitWhileNVMControllerBusy()))
@ -288,9 +293,13 @@ bool XMEGANVM_WriteByteMemory(const uint8_t WriteCommand, const uint32_t WriteAd
* *
* \return Boolean true if the command sequence complete successfully * \return Boolean true if the command sequence complete successfully
*/ */
bool XMEGANVM_WritePageMemory(const uint8_t WriteBuffCommand, const uint8_t EraseBuffCommand, bool XMEGANVM_WritePageMemory(const uint8_t WriteBuffCommand,
const uint8_t WritePageCommand, const uint8_t PageMode, const uint32_t WriteAddress, const uint8_t EraseBuffCommand,
const uint8_t* WriteBuffer, uint16_t WriteSize) const uint8_t WritePageCommand,
const uint8_t PageMode,
const uint32_t WriteAddress,
const uint8_t* WriteBuffer,
uint16_t WriteSize)
{ {
if (PageMode & XPRG_PAGEMODE_ERASE) if (PageMode & XPRG_PAGEMODE_ERASE)
{ {
@ -361,7 +370,8 @@ bool XMEGANVM_WritePageMemory(const uint8_t WriteBuffCommand, const uint8_t Eras
* *
* \return Boolean true if the command sequence complete successfully * \return Boolean true if the command sequence complete successfully
*/ */
bool XMEGANVM_EraseMemory(const uint8_t EraseCommand, const uint32_t Address) bool XMEGANVM_EraseMemory(const uint8_t EraseCommand,
const uint32_t Address)
{ {
/* Wait until the NVM controller is no longer busy */ /* Wait until the NVM controller is no longer busy */
if (!(XMEGANVM_WaitWhileNVMControllerBusy())) if (!(XMEGANVM_WaitWhileNVMControllerBusy()))

@ -113,13 +113,22 @@
bool XMEGANVM_WaitWhileNVMControllerBusy(void); bool XMEGANVM_WaitWhileNVMControllerBusy(void);
bool XMEGANVM_EnablePDI(void); bool XMEGANVM_EnablePDI(void);
void XMEGANVM_DisablePDI(void); void XMEGANVM_DisablePDI(void);
bool XMEGANVM_GetMemoryCRC(const uint8_t CRCCommand, uint32_t* const CRCDest); bool XMEGANVM_GetMemoryCRC(const uint8_t CRCCommand,
bool XMEGANVM_ReadMemory(const uint32_t ReadAddress, uint8_t* ReadBuffer, uint16_t ReadSize); uint32_t* const CRCDest);
bool XMEGANVM_WriteByteMemory(const uint8_t WriteCommand, const uint32_t WriteAddress, const uint8_t Byte); bool XMEGANVM_ReadMemory(const uint32_t ReadAddress,
bool XMEGANVM_WritePageMemory(const uint8_t WriteBuffCommand, const uint8_t EraseBuffCommand, uint8_t* ReadBuffer, uint16_t ReadSize);
const uint8_t WritePageCommand, const uint8_t PageMode, const uint32_t WriteAddress, bool XMEGANVM_WriteByteMemory(const uint8_t WriteCommand,
const uint8_t* WriteBuffer, uint16_t WriteSize); const uint32_t WriteAddress,
bool XMEGANVM_EraseMemory(const uint8_t EraseCommand, const uint32_t Address); const uint8_t Byte);
bool XMEGANVM_WritePageMemory(const uint8_t WriteBuffCommand,
const uint8_t EraseBuffCommand,
const uint8_t WritePageCommand,
const uint8_t PageMode,
const uint32_t WriteAddress,
const uint8_t* WriteBuffer,
uint16_t WriteSize);
bool XMEGANVM_EraseMemory(const uint8_t EraseCommand,
const uint32_t Address);
#if defined(INCLUDE_FROM_XMEGANVM_C) #if defined(INCLUDE_FROM_XMEGANVM_C)
static void XMEGANVM_SendNVMRegAddress(const uint8_t Register); static void XMEGANVM_SendNVMRegAddress(const uint8_t Register);

Loading…
Cancel
Save