Add const qualifier to the parameters of Projects' functions where possible.

pull/1469/head
Dean Camera 15 years ago
parent e73f05b8b2
commit b408a5fe62

File diff suppressed because one or more lines are too long

@ -66,11 +66,11 @@
/* Function Prototypes: */
void ISPProtocol_EnterISPMode(void);
void ISPProtocol_LeaveISPMode(void);
void ISPProtocol_ProgramMemory(uint8_t V2Command);
void ISPProtocol_ReadMemory(uint8_t V2Command);
void ISPProtocol_ProgramMemory(const uint8_t V2Command);
void ISPProtocol_ReadMemory(const uint8_t V2Command);
void ISPProtocol_ChipErase(void);
void ISPProtocol_ReadFuseLockSigOSCCAL(uint8_t V2Command);
void ISPProtocol_WriteFuseLock(uint8_t V2Command);
void ISPProtocol_ReadFuseLockSigOSCCAL(const uint8_t V2Command);
void ISPProtocol_WriteFuseLock(const uint8_t V2Command);
void ISPProtocol_SPIMulti(void);
#endif

@ -80,7 +80,7 @@ uint8_t ISPTarget_GetSPIPrescalerMask(void)
*
* \param[in] ResetTarget Boolean true when the target should be held in reset, false otherwise
*/
void ISPTarget_ChangeTargetResetLine(bool ResetTarget)
void ISPTarget_ChangeTargetResetLine(const bool ResetTarget)
{
if (ResetTarget)
{
@ -108,8 +108,8 @@ void ISPTarget_ChangeTargetResetLine(bool ResetTarget)
* \return V2 Protocol status \ref STATUS_CMD_OK if the no timeout occurred, \ref STATUS_RDY_BSY_TOUT or
* \ref STATUS_CMD_TOUT otherwise
*/
uint8_t ISPTarget_WaitForProgComplete(uint8_t ProgrammingMode, uint16_t PollAddress, uint8_t PollValue,
uint8_t DelayMS, uint8_t ReadMemCommand)
uint8_t ISPTarget_WaitForProgComplete(const uint8_t ProgrammingMode, const uint16_t PollAddress, const uint8_t PollValue,
const uint8_t DelayMS, const uint8_t ReadMemCommand)
{
uint8_t ProgrammingStatus = STATUS_CMD_OK;

@ -62,9 +62,10 @@
/* Function Prototypes: */
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);
void ISPTarget_ChangeTargetResetLine(const bool ResetTarget);
uint8_t ISPTarget_WaitForProgComplete(const uint8_t ProgrammingMode, const uint16_t PollAddress,
const uint8_t PollValue, const uint8_t DelayMS,
const uint8_t ReadMemCommand);
uint8_t ISPTarget_WaitWhileTargetBusy(void);
void ISPTarget_LoadExtendedAddress(void);

@ -42,7 +42,7 @@
*
* \param[in] Register NVM register whose absolute address is to be sent
*/
void NVMTarget_SendNVMRegAddress(uint8_t Register)
void NVMTarget_SendNVMRegAddress(const uint8_t Register)
{
/* Determine the absolute register address from the NVM base memory address and the NVM register address */
uint32_t Address = XPROG_Param_NVMBase | Register;
@ -55,7 +55,7 @@ void NVMTarget_SendNVMRegAddress(uint8_t Register)
*
* \param[in] AbsoluteAddress Absolute address to send to the target
*/
void NVMTarget_SendAddress(uint32_t AbsoluteAddress)
void NVMTarget_SendAddress(const uint32_t AbsoluteAddress)
{
/* Send the given 32-bit address to the target, LSB first */
PDITarget_SendByte(AbsoluteAddress & 0xFF);
@ -95,7 +95,7 @@ bool NVMTarget_WaitWhileNVMControllerBusy(void)
*
* \return Boolean true if the command sequence complete successfully
*/
bool NVMTarget_GetMemoryCRC(uint8_t CRCCommand, uint32_t* CRCDest)
bool NVMTarget_GetMemoryCRC(const uint8_t CRCCommand, uint32_t* const CRCDest)
{
/* Wait until the NVM controller is no longer busy */
if (!(NVMTarget_WaitWhileNVMControllerBusy()))
@ -147,7 +147,7 @@ bool NVMTarget_GetMemoryCRC(uint8_t CRCCommand, uint32_t* CRCDest)
*
* \return Boolean true if the command sequence complete successfully
*/
bool NVMTarget_ReadMemory(uint32_t ReadAddress, uint8_t* ReadBuffer, uint16_t ReadSize)
bool NVMTarget_ReadMemory(const uint32_t ReadAddress, uint8_t* ReadBuffer, const uint16_t ReadSize)
{
/* Wait until the NVM controller is no longer busy */
if (!(NVMTarget_WaitWhileNVMControllerBusy()))
@ -182,7 +182,7 @@ bool NVMTarget_ReadMemory(uint32_t ReadAddress, uint8_t* ReadBuffer, uint16_t Re
*
* \return Boolean true if the command sequence complete successfully
*/
bool NVMTarget_WriteByteMemory(uint8_t WriteCommand, uint32_t WriteAddress, uint8_t* WriteBuffer)
bool NVMTarget_WriteByteMemory(const uint8_t WriteCommand, const uint32_t WriteAddress, const uint8_t* WriteBuffer)
{
/* Wait until the NVM controller is no longer busy */
if (!(NVMTarget_WaitWhileNVMControllerBusy()))
@ -195,7 +195,7 @@ bool NVMTarget_WriteByteMemory(uint8_t WriteCommand, uint32_t WriteAddress, uint
/* Send new memory byte to the memory to the target */
PDITarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
NVMTarget_SendAddress(WriteAddress++);
NVMTarget_SendAddress(WriteAddress);
PDITarget_SendByte(*(WriteBuffer++));
return true;
@ -213,8 +213,9 @@ bool NVMTarget_WriteByteMemory(uint8_t WriteCommand, uint32_t WriteAddress, uint
*
* \return Boolean true if the command sequence complete successfully
*/
bool NVMTarget_WritePageMemory(uint8_t WriteBuffCommand, uint8_t EraseBuffCommand, uint8_t WritePageCommand,
uint8_t PageMode, uint32_t WriteAddress, uint8_t* WriteBuffer, uint16_t WriteSize)
bool NVMTarget_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, const uint16_t WriteSize)
{
if (PageMode & XPRG_PAGEMODE_ERASE)
{
@ -285,7 +286,7 @@ bool NVMTarget_WritePageMemory(uint8_t WriteBuffCommand, uint8_t EraseBuffComman
*
* \return Boolean true if the command sequence complete successfully
*/
bool NVMTarget_EraseMemory(uint8_t EraseCommand, uint32_t Address)
bool NVMTarget_EraseMemory(const uint8_t EraseCommand, const uint32_t Address)
{
/* Wait until the NVM controller is no longer busy */
if (!(NVMTarget_WaitWhileNVMControllerBusy()))

@ -106,14 +106,15 @@
#define NVM_CMD_READEEPROM 0x06
/* Function Prototypes: */
void NVMTarget_SendNVMRegAddress(uint8_t Register);
void NVMTarget_SendAddress(uint32_t AbsoluteAddress);
void NVMTarget_SendNVMRegAddress(const uint8_t Register);
void NVMTarget_SendAddress(const uint32_t AbsoluteAddress);
bool NVMTarget_WaitWhileNVMControllerBusy(void);
bool NVMTarget_GetMemoryCRC(uint8_t CRCCommand, uint32_t* CRCDest);
bool NVMTarget_ReadMemory(uint32_t ReadAddress, uint8_t* ReadBuffer, uint16_t ReadSize);
bool NVMTarget_WriteByteMemory(uint8_t WriteCommand, uint32_t WriteAddress, uint8_t* WriteBuffer);
bool NVMTarget_WritePageMemory(uint8_t WriteBuffCommand, uint8_t EraseBuffCommand, uint8_t WritePageCommand,
uint8_t PageMode, uint32_t WriteAddress, uint8_t* WriteBuffer, uint16_t WriteSize);
bool NVMTarget_EraseMemory(uint8_t EraseCommand, uint32_t Address);
bool NVMTarget_GetMemoryCRC(const uint8_t CRCCommand, uint32_t* const CRCDest);
bool NVMTarget_ReadMemory(const uint32_t ReadAddress, uint8_t* ReadBuffer, const uint16_t ReadSize);
bool NVMTarget_WriteByteMemory(const uint8_t WriteCommand, const uint32_t WriteAddress, const uint8_t* WriteBuffer);
bool NVMTarget_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, const uint16_t WriteSize);
bool NVMTarget_EraseMemory(const uint8_t EraseCommand, const uint32_t Address);
#endif

@ -167,7 +167,7 @@ void PDITarget_DisableTargetPDI(void)
*
* \param[in] Byte Byte to send through the USART
*/
void PDITarget_SendByte(uint8_t Byte)
void PDITarget_SendByte(const uint8_t Byte)
{
#if defined(PDI_VIA_HARDWARE_USART)
/* Switch to Tx mode if currently in Rx mode */

@ -101,7 +101,7 @@
/* Function Prototypes: */
void PDITarget_EnableTargetPDI(void);
void PDITarget_DisableTargetPDI(void);
void PDITarget_SendByte(uint8_t Byte);
void PDITarget_SendByte(const uint8_t Byte);
uint8_t PDITarget_ReceiveByte(void);
void PDITarget_SendBreak(void);
bool PDITarget_WaitWhileNVMBusBusy(void);

@ -120,7 +120,7 @@ void V2Protocol_ProcessCommand(void)
*
* \param[in] V2Command Issued V2 Protocol command byte from the host
*/
static void V2Protocol_UnknownCommand(uint8_t V2Command)
static void V2Protocol_UnknownCommand(const uint8_t V2Command)
{
/* Discard all incoming data */
while (Endpoint_BytesInEndpoint() == AVRISP_DATA_EPSIZE)
@ -169,7 +169,7 @@ static void V2Protocol_ResetProtection(void)
*
* \param[in] V2Command Issued V2 Protocol command byte from the host
*/
static void V2Protocol_GetSetParam(uint8_t V2Command)
static void V2Protocol_GetSetParam(const uint8_t V2Command)
{
uint8_t ParamID = Endpoint_Read_Byte();
uint8_t ParamValue;

@ -111,7 +111,7 @@ void V2Params_UpdateParamValues(void)
*
* \return Privileges for the requested parameter, as a mask of PARAM_PRIV_* masks
*/
uint8_t V2Params_GetParameterPrivileges(uint8_t ParamID)
uint8_t V2Params_GetParameterPrivileges(const uint8_t ParamID)
{
ParameterItem_t* ParamInfo = V2Params_GetParamFromTable(ParamID);
@ -127,7 +127,7 @@ uint8_t V2Params_GetParameterPrivileges(uint8_t ParamID)
*
* \return Current value of the parameter in the table, or 0 if not found
*/
uint8_t V2Params_GetParameterValue(uint8_t ParamID)
uint8_t V2Params_GetParameterValue(const uint8_t ParamID)
{
ParameterItem_t* ParamInfo = V2Params_GetParamFromTable(ParamID);
@ -144,7 +144,7 @@ uint8_t V2Params_GetParameterValue(uint8_t ParamID)
*
* \return Pointer to the associated parameter information from the parameter table if found, NULL otherwise
*/
void V2Params_SetParameterValue(uint8_t ParamID, uint8_t Value)
void V2Params_SetParameterValue(const uint8_t ParamID, const uint8_t Value)
{
ParameterItem_t* ParamInfo = V2Params_GetParamFromTable(ParamID);
@ -165,7 +165,7 @@ void V2Params_SetParameterValue(uint8_t ParamID, uint8_t Value)
*
* \return Pointer to the associated parameter information from the parameter table if found, NULL otherwise
*/
static ParameterItem_t* V2Params_GetParamFromTable(uint8_t ParamID)
static ParameterItem_t* V2Params_GetParamFromTable(const uint8_t ParamID)
{
/* Find the parameter in the parameter table if present */
for (uint8_t TableIndex = 0; TableIndex < (sizeof(ParameterTable) / sizeof(ParameterTable[0])); TableIndex++)

@ -70,12 +70,12 @@
void V2Params_LoadNonVolatileParamValues(void);
void V2Params_UpdateParamValues(void);
uint8_t V2Params_GetParameterPrivileges(uint8_t ParamID);
uint8_t V2Params_GetParameterValue(uint8_t ParamID);
void V2Params_SetParameterValue(uint8_t ParamID, uint8_t Value);
uint8_t V2Params_GetParameterPrivileges(const uint8_t ParamID);
uint8_t V2Params_GetParameterValue(const uint8_t ParamID);
void V2Params_SetParameterValue(const uint8_t ParamID, const uint8_t Value);
#if defined(INCLUDE_FROM_V2PROTOCOL_PARAMS_C)
static ParameterItem_t* V2Params_GetParamFromTable(uint8_t ParamID);
static ParameterItem_t* V2Params_GetParamFromTable(const uint8_t ParamID);
#endif
#endif

@ -30,7 +30,7 @@
#include "RingBuff.h"
void Buffer_Initialize(RingBuff_t* Buffer)
void Buffer_Initialize(RingBuff_t* const Buffer)
{
BUFF_ATOMIC_BLOCK
{
@ -40,7 +40,7 @@ void Buffer_Initialize(RingBuff_t* Buffer)
}
}
void Buffer_StoreElement(RingBuff_t* Buffer, RingBuff_Data_t Data)
void Buffer_StoreElement(RingBuff_t* const Buffer, RingBuff_Data_t Data)
{
BUFF_ATOMIC_BLOCK
{
@ -73,7 +73,7 @@ void Buffer_StoreElement(RingBuff_t* Buffer, RingBuff_Data_t Data)
}
}
RingBuff_Data_t Buffer_GetElement(RingBuff_t* Buffer)
RingBuff_Data_t Buffer_GetElement(RingBuff_t* const Buffer)
{
RingBuff_Data_t BuffData;
@ -99,7 +99,7 @@ RingBuff_Data_t Buffer_GetElement(RingBuff_t* Buffer)
}
#if defined(BUFF_USEPEEK)
RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* Buffer)
RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* const Buffer)
{
RingBuff_Data_t BuffData;

@ -106,11 +106,11 @@
} RingBuff_t;
/* Function Prototypes: */
void Buffer_Initialize(RingBuff_t* Buff);
void Buffer_StoreElement(RingBuff_t* Buffer, RingBuff_Data_t Data);
RingBuff_Data_t Buffer_GetElement(RingBuff_t* Buffer);
void Buffer_Initialize(RingBuff_t* const Buff);
void Buffer_StoreElement(RingBuff_t* const Buffer, RingBuff_Data_t Data);
RingBuff_Data_t Buffer_GetElement(RingBuff_t* const Buffer);
#if defined(BUFF_USEPEEK)
RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* Buffer);
RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* const Buffer);
#endif
#endif

@ -37,7 +37,7 @@
#include "CircularBitBuffer.h"
/** Function to initialize or reset a bit buffer, ready for data to be stored into it. */
void BitBuffer_Init(BitBuffer_t* Buffer)
void BitBuffer_Init(BitBuffer_t* const Buffer)
{
/* Reset the number of stored bits in the buffer */
Buffer->Elements = 0;
@ -50,7 +50,7 @@ void BitBuffer_Init(BitBuffer_t* Buffer)
}
/** Function to store the given bit into the given bit buffer. */
void BitBuffer_StoreNextBit(BitBuffer_t* Buffer, bool Bit)
void BitBuffer_StoreNextBit(BitBuffer_t* const Buffer, const bool Bit)
{
/* If the bit to store is true, set the next bit in the buffer */
if (Bit)
@ -79,7 +79,7 @@ void BitBuffer_StoreNextBit(BitBuffer_t* Buffer, bool Bit)
}
/** Function to retrieve the next bit stored in the given bit buffer. */
bool BitBuffer_GetNextBit(BitBuffer_t* Buffer)
bool BitBuffer_GetNextBit(BitBuffer_t* const Buffer)
{
/* Retrieve the value of the next bit stored in the buffer */
bool Bit = ((*Buffer->Out.CurrentByte & Buffer->Out.ByteMask) != 0);

@ -75,14 +75,14 @@
*
* \param[in,out] Buffer Bit buffer to initialize
*/
void BitBuffer_Init(BitBuffer_t* Buffer) ATTR_NON_NULL_PTR_ARG(1);
void BitBuffer_Init(BitBuffer_t* const Buffer) ATTR_NON_NULL_PTR_ARG(1);
/** Stores a bit into the next location inside a given bit buffer.
*
* \param[in,out] Buffer Bit buffer to store a bit into
* \param[in] Bit Bit to store into the buffer
*/
void BitBuffer_StoreNextBit(BitBuffer_t* Buffer, bool Bit) ATTR_NON_NULL_PTR_ARG(1);
void BitBuffer_StoreNextBit(BitBuffer_t* const Buffer, const bool Bit) ATTR_NON_NULL_PTR_ARG(1);
/** Retrieves a bit from the next location inside a given bit buffer.
*
@ -90,6 +90,6 @@
*
* \return Next bit from the buffer
*/
bool BitBuffer_GetNextBit(BitBuffer_t* Buffer) ATTR_NON_NULL_PTR_ARG(1);
bool BitBuffer_GetNextBit(BitBuffer_t* const Buffer) ATTR_NON_NULL_PTR_ARG(1);
#endif

@ -30,7 +30,7 @@
#include "RingBuff.h"
void Buffer_Initialize(RingBuff_t* Buffer)
void Buffer_Initialize(RingBuff_t* const Buffer)
{
BUFF_ATOMIC_BLOCK
{
@ -40,7 +40,7 @@ void Buffer_Initialize(RingBuff_t* Buffer)
}
}
void Buffer_StoreElement(RingBuff_t* Buffer, RingBuff_Data_t Data)
void Buffer_StoreElement(RingBuff_t* const Buffer, RingBuff_Data_t Data)
{
BUFF_ATOMIC_BLOCK
{
@ -73,7 +73,7 @@ void Buffer_StoreElement(RingBuff_t* Buffer, RingBuff_Data_t Data)
}
}
RingBuff_Data_t Buffer_GetElement(RingBuff_t* Buffer)
RingBuff_Data_t Buffer_GetElement(RingBuff_t* const Buffer)
{
RingBuff_Data_t BuffData;
@ -99,7 +99,7 @@ RingBuff_Data_t Buffer_GetElement(RingBuff_t* Buffer)
}
#if defined(BUFF_USEPEEK)
RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* Buffer)
RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* const Buffer)
{
RingBuff_Data_t BuffData;

@ -106,11 +106,11 @@
} RingBuff_t;
/* Function Prototypes: */
void Buffer_Initialize(RingBuff_t* Buff);
void Buffer_StoreElement(RingBuff_t* Buffer, RingBuff_Data_t Data);
RingBuff_Data_t Buffer_GetElement(RingBuff_t* Buffer);
void Buffer_Initialize(RingBuff_t* const Buff);
void Buffer_StoreElement(RingBuff_t* const Buffer, RingBuff_Data_t Data);
RingBuff_Data_t Buffer_GetElement(RingBuff_t* const Buffer);
#if defined(BUFF_USEPEEK)
RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* Buffer);
RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* const Buffer);
#endif
#endif

@ -30,7 +30,7 @@
#include "RingBuff.h"
void Buffer_Initialize(RingBuff_t* Buffer)
void Buffer_Initialize(RingBuff_t* const Buffer)
{
BUFF_ATOMIC_BLOCK
{
@ -40,7 +40,7 @@ void Buffer_Initialize(RingBuff_t* Buffer)
}
}
void Buffer_StoreElement(RingBuff_t* Buffer, RingBuff_Data_t Data)
void Buffer_StoreElement(RingBuff_t* const Buffer, RingBuff_Data_t Data)
{
BUFF_ATOMIC_BLOCK
{
@ -73,7 +73,7 @@ void Buffer_StoreElement(RingBuff_t* Buffer, RingBuff_Data_t Data)
}
}
RingBuff_Data_t Buffer_GetElement(RingBuff_t* Buffer)
RingBuff_Data_t Buffer_GetElement(RingBuff_t* const Buffer)
{
RingBuff_Data_t BuffData;
@ -99,7 +99,7 @@ RingBuff_Data_t Buffer_GetElement(RingBuff_t* Buffer)
}
#if defined(BUFF_USEPEEK)
RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* Buffer)
RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* const Buffer)
{
RingBuff_Data_t BuffData;

@ -106,11 +106,11 @@
} RingBuff_t;
/* Function Prototypes: */
void Buffer_Initialize(RingBuff_t* Buff);
void Buffer_StoreElement(RingBuff_t* Buffer, RingBuff_Data_t Data);
RingBuff_Data_t Buffer_GetElement(RingBuff_t* Buffer);
void Buffer_Initialize(RingBuff_t* const Buff);
void Buffer_StoreElement(RingBuff_t* const Buffer, RingBuff_Data_t Data);
RingBuff_Data_t Buffer_GetElement(RingBuff_t* const Buffer);
#if defined(BUFF_USEPEEK)
RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* Buffer);
RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* const Buffer);
#endif
#endif

Loading…
Cancel
Save