Update all demos, projects and bootloaders to indent all function parameters, one per line, for better readability.
Add missing const qualifiers to the demos.
This commit is contained in:
parent
83e293a6ec
commit
6bda628718
271 changed files with 1312 additions and 621 deletions
|
@ -172,7 +172,9 @@ USB_Descriptor_String_t PROGMEM SerialString =
|
|||
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
|
||||
* USB host.
|
||||
*/
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress)
|
||||
{
|
||||
const uint8_t DescriptorType = (wValue >> 8);
|
||||
const uint8_t DescriptorNumber = (wValue & 0xFF);
|
||||
|
|
|
@ -73,7 +73,8 @@
|
|||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -109,8 +109,11 @@ void ISPTarget_ChangeTargetResetLine(const 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(const uint8_t ProgrammingMode, const uint16_t PollAddress, const uint8_t PollValue,
|
||||
const uint8_t DelayMS, const 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;
|
||||
|
||||
|
|
|
@ -65,8 +65,10 @@
|
|||
/* Function Prototypes: */
|
||||
uint8_t ISPTarget_GetSPIPrescalerMask(void);
|
||||
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,
|
||||
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);
|
||||
|
|
|
@ -151,7 +151,8 @@ uint8_t V2Params_GetParameterValue(const uint8_t ParamID)
|
|||
*
|
||||
* \return Pointer to the associated parameter information from the parameter table if found, NULL otherwise
|
||||
*/
|
||||
void V2Params_SetParameterValue(const uint8_t ParamID, const uint8_t Value)
|
||||
void V2Params_SetParameterValue(const uint8_t ParamID,
|
||||
const uint8_t Value)
|
||||
{
|
||||
ParameterItem_t* ParamInfo = V2Params_GetParamFromTable(ParamID);
|
||||
|
||||
|
|
|
@ -75,7 +75,8 @@
|
|||
|
||||
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);
|
||||
void V2Params_SetParameterValue(const uint8_t ParamID,
|
||||
const uint8_t Value);
|
||||
|
||||
#if defined(INCLUDE_FROM_V2PROTOCOL_PARAMS_C)
|
||||
static ParameterItem_t* V2Params_GetParamFromTable(const uint8_t ParamID);
|
||||
|
|
|
@ -127,7 +127,9 @@ bool TINYNVM_WaitWhileNVMControllerBusy(void)
|
|||
*
|
||||
* \return Boolean true if the command sequence complete successfully
|
||||
*/
|
||||
bool TINYNVM_ReadMemory(const uint16_t ReadAddress, uint8_t* ReadBuffer, uint16_t ReadSize)
|
||||
bool TINYNVM_ReadMemory(const uint16_t ReadAddress,
|
||||
uint8_t* ReadBuffer,
|
||||
uint16_t ReadSize)
|
||||
{
|
||||
/* Wait until the NVM controller is no longer busy */
|
||||
if (!(TINYNVM_WaitWhileNVMControllerBusy()))
|
||||
|
@ -158,7 +160,9 @@ bool TINYNVM_ReadMemory(const uint16_t ReadAddress, uint8_t* ReadBuffer, uint16_
|
|||
*
|
||||
* \return Boolean true if the command sequence complete successfully
|
||||
*/
|
||||
bool TINYNVM_WriteMemory(const uint16_t WriteAddress, uint8_t* WriteBuffer, uint16_t WriteLength)
|
||||
bool TINYNVM_WriteMemory(const uint16_t WriteAddress,
|
||||
uint8_t* WriteBuffer,
|
||||
uint16_t WriteLength)
|
||||
{
|
||||
/* Wait until the NVM controller is no longer busy */
|
||||
if (!(TINYNVM_WaitWhileNVMControllerBusy()))
|
||||
|
@ -203,7 +207,8 @@ bool TINYNVM_WriteMemory(const uint16_t WriteAddress, uint8_t* WriteBuffer, uint
|
|||
*
|
||||
* \return Boolean true if the command sequence complete successfully
|
||||
*/
|
||||
bool TINYNVM_EraseMemory(const uint8_t EraseCommand, const uint16_t Address)
|
||||
bool TINYNVM_EraseMemory(const uint8_t EraseCommand,
|
||||
const uint16_t Address)
|
||||
{
|
||||
/* Wait until the NVM controller is no longer busy */
|
||||
if (!(TINYNVM_WaitWhileNVMControllerBusy()))
|
||||
|
|
|
@ -64,9 +64,14 @@
|
|||
/* Function Prototypes: */
|
||||
bool TINYNVM_WaitWhileNVMBusBusy(void);
|
||||
bool TINYNVM_WaitWhileNVMControllerBusy(void);
|
||||
bool TINYNVM_ReadMemory(const uint16_t ReadAddress, uint8_t* ReadBuffer, uint16_t ReadLength);
|
||||
bool TINYNVM_WriteMemory(const uint16_t WriteAddress, uint8_t* WriteBuffer, uint16_t WriteLength);
|
||||
bool TINYNVM_EraseMemory(const uint8_t EraseCommand, const uint16_t Address);
|
||||
bool TINYNVM_ReadMemory(const uint16_t ReadAddress,
|
||||
uint8_t* ReadBuffer,
|
||||
uint16_t ReadLength);
|
||||
bool TINYNVM_WriteMemory(const uint16_t WriteAddress,
|
||||
uint8_t* WriteBuffer,
|
||||
uint16_t WriteLength);
|
||||
bool TINYNVM_EraseMemory(const uint8_t EraseCommand,
|
||||
const uint16_t Address);
|
||||
|
||||
#if (defined(INCLUDE_FROM_TINYNVM_C) && defined(ENABLE_XPROG_PROTOCOL))
|
||||
static void TINYNVM_SendReadNVMRegister(const uint8_t Address);
|
||||
|
|
|
@ -212,7 +212,9 @@ USB_Descriptor_String_t PROGMEM ProductString =
|
|||
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
|
||||
* USB host.
|
||||
*/
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress)
|
||||
{
|
||||
const uint8_t DescriptorType = (wValue >> 8);
|
||||
const uint8_t DescriptorNumber = (wValue & 0xFF);
|
||||
|
|
|
@ -77,7 +77,8 @@
|
|||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -100,7 +100,8 @@
|
|||
* \param[in,out] Buffer Pointer to a ring buffer structure to insert into
|
||||
* \param[in] Data Data element to insert into the buffer
|
||||
*/
|
||||
static inline void RingBuffer_AtomicInsert(RingBuff_t* const Buffer, RingBuff_Data_t Data)
|
||||
static inline void RingBuffer_AtomicInsert(RingBuff_t* const Buffer,
|
||||
const RingBuff_Data_t Data)
|
||||
{
|
||||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
|
||||
{
|
||||
|
@ -141,7 +142,8 @@
|
|||
* \param[in,out] Buffer Pointer to a ring buffer structure to insert into
|
||||
* \param[in] Data Data element to insert into the buffer
|
||||
*/
|
||||
static inline void RingBuffer_Insert(RingBuff_t* const Buffer, RingBuff_Data_t Data)
|
||||
static inline void RingBuffer_Insert(RingBuff_t* const Buffer,
|
||||
const RingBuff_Data_t Data)
|
||||
{
|
||||
*Buffer->In = Data;
|
||||
|
||||
|
|
|
@ -283,7 +283,9 @@ USB_Descriptor_String_t PROGMEM ProductString =
|
|||
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
|
||||
* USB host.
|
||||
*/
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress)
|
||||
{
|
||||
const uint8_t DescriptorType = (wValue >> 8);
|
||||
const uint8_t DescriptorNumber = (wValue & 0xFF);
|
||||
|
|
|
@ -75,7 +75,8 @@
|
|||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -176,7 +176,9 @@ USB_Descriptor_String_t PROGMEM ProductString =
|
|||
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
|
||||
* USB host.
|
||||
*/
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress)
|
||||
{
|
||||
const uint8_t DescriptorType = (wValue >> 8);
|
||||
const uint8_t DescriptorNumber = (wValue & 0xFF);
|
||||
|
|
|
@ -82,7 +82,8 @@
|
|||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -48,7 +48,9 @@
|
|||
* \param[in] BlockAddress Data block starting address for the write sequence
|
||||
* \param[in] TotalBlocks Number of blocks of data to write
|
||||
*/
|
||||
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks)
|
||||
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
|
||||
const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks)
|
||||
{
|
||||
uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
|
||||
uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
|
||||
|
@ -182,7 +184,9 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
|
|||
* \param[in] BlockAddress Data block starting address for the read sequence
|
||||
* \param[in] TotalBlocks Number of blocks of data to read
|
||||
*/
|
||||
void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks)
|
||||
void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
|
||||
const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks)
|
||||
{
|
||||
uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
|
||||
uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
|
||||
|
@ -290,7 +294,9 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
|
|||
* \param[in] TotalBlocks Number of blocks of data to write
|
||||
* \param[in] BufferPtr Pointer to the data source RAM buffer
|
||||
*/
|
||||
void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks, const uint8_t* BufferPtr)
|
||||
void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks,
|
||||
const uint8_t* BufferPtr)
|
||||
{
|
||||
uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
|
||||
uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
|
||||
|
@ -389,7 +395,9 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t Tota
|
|||
* \param[in] TotalBlocks Number of blocks of data to read
|
||||
* \param[out] BufferPtr Pointer to the data destination RAM buffer
|
||||
*/
|
||||
void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks, uint8_t* BufferPtr)
|
||||
void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks,
|
||||
uint8_t* BufferPtr)
|
||||
{
|
||||
uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
|
||||
uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
|
||||
|
|
|
@ -67,13 +67,17 @@
|
|||
|
||||
/* Function Prototypes: */
|
||||
#if defined(USB_CAN_BE_DEVICE)
|
||||
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress,
|
||||
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
|
||||
const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks);
|
||||
void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress,
|
||||
void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
|
||||
const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks);
|
||||
void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks,
|
||||
void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks,
|
||||
const uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
|
||||
void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks,
|
||||
void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks,
|
||||
uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
|
||||
void DataflashManager_ResetDataflashProtections(void);
|
||||
bool DataflashManager_CheckDataflashOperation(void);
|
||||
|
|
|
@ -248,7 +248,8 @@ static void SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInte
|
|||
* \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
|
||||
* \param[in] IsDataRead Indicates if the command is a READ (10) command or WRITE (10) command (DATA_READ or DATA_WRITE)
|
||||
*/
|
||||
static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const bool IsDataRead)
|
||||
static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
|
||||
const bool IsDataRead)
|
||||
{
|
||||
uint32_t BlockAddress = SwapEndian_32(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[2]);
|
||||
uint16_t TotalBlocks = SwapEndian_16(*(uint16_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[7]);
|
||||
|
|
|
@ -80,7 +80,8 @@
|
|||
static void SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
|
||||
static void SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
|
||||
static void SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
|
||||
static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const bool IsDataRead);
|
||||
static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
|
||||
const bool IsDataRead);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
#define LEDMASK_USB_BUSY LEDS_LED2
|
||||
|
||||
/* External Variables: */
|
||||
extern FILE DiskStream;
|
||||
extern FILE DiskStream;
|
||||
extern FATFS DiskFATState;
|
||||
|
||||
/* Function Prototypes: */
|
||||
|
|
|
@ -87,7 +87,8 @@
|
|||
PORTC = (PORTC & ~LEDS_ALL_LEDS) | LEDMask;
|
||||
}
|
||||
|
||||
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask)
|
||||
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
|
||||
const uint8_t ActiveMask)
|
||||
{
|
||||
PORTC = (PORTC & ~LEDMask) | ActiveMask;
|
||||
}
|
||||
|
|
|
@ -224,7 +224,9 @@ USB_Descriptor_String_t PROGMEM ProductString =
|
|||
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
|
||||
* USB host.
|
||||
*/
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress)
|
||||
{
|
||||
const uint8_t DescriptorType = (wValue >> 8);
|
||||
const uint8_t DescriptorNumber = (wValue & 0xFF);
|
||||
|
|
|
@ -77,7 +77,8 @@
|
|||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -196,7 +196,9 @@ USB_Descriptor_String_t PROGMEM ProductString =
|
|||
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
|
||||
* USB host.
|
||||
*/
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress)
|
||||
{
|
||||
const uint8_t DescriptorType = (wValue >> 8);
|
||||
const uint8_t DescriptorNumber = (wValue & 0xFF);
|
||||
|
|
|
@ -64,7 +64,8 @@
|
|||
#define KEYBOARD_EPSIZE 8
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -50,7 +50,8 @@ void BitBuffer_Init(BitBuffer_t* const Buffer)
|
|||
}
|
||||
|
||||
/** Function to store the given bit into the given bit buffer. */
|
||||
void BitBuffer_StoreNextBit(BitBuffer_t* const Buffer, const 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)
|
||||
|
|
|
@ -82,7 +82,8 @@
|
|||
* \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* const Buffer, const 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.
|
||||
*
|
||||
|
|
|
@ -171,8 +171,11 @@ void EVENT_USB_Device_StartOfFrame(void)
|
|||
*
|
||||
* \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
|
||||
*/
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
|
||||
const uint8_t ReportType, void* ReportData, uint16_t* const ReportSize)
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
|
||||
uint8_t* const ReportID,
|
||||
const uint8_t ReportType,
|
||||
void* ReportData,
|
||||
uint16_t* const ReportSize)
|
||||
{
|
||||
USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;
|
||||
|
||||
|
@ -210,8 +213,11 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
|
|||
* \param[in] ReportData Pointer to the report buffer where the received report is stored
|
||||
* \param[in] ReportSize Size in bytes of the report received from the host
|
||||
*/
|
||||
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,
|
||||
const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize)
|
||||
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
|
||||
const uint8_t ReportID,
|
||||
const uint8_t ReportType,
|
||||
const void* ReportData,
|
||||
const uint16_t ReportSize)
|
||||
{
|
||||
// Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports
|
||||
}
|
||||
|
|
|
@ -75,9 +75,15 @@
|
|||
void EVENT_USB_Device_UnhandledControlRequest(void);
|
||||
void EVENT_USB_Device_StartOfFrame(void);
|
||||
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
|
||||
const uint8_t ReportType, void* ReportData, uint16_t* const ReportSize);
|
||||
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,
|
||||
const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize);
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
|
||||
uint8_t* const ReportID,
|
||||
const uint8_t ReportType,
|
||||
void* ReportData,
|
||||
uint16_t* const ReportSize);
|
||||
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
|
||||
const uint8_t ReportID,
|
||||
const uint8_t ReportType,
|
||||
const void* ReportData,
|
||||
const uint16_t ReportSize);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -151,7 +151,8 @@ void Read_Joystick_Status(void)
|
|||
* \param[in] Report Report data to send.
|
||||
* \param[in] ReportSize Report length in bytes.
|
||||
*/
|
||||
void Send_Command_Report(uint8_t* const Report, const uint16_t ReportSize)
|
||||
void Send_Command_Report(uint8_t* const Report,
|
||||
const uint16_t ReportSize)
|
||||
{
|
||||
memcpy(CmdBuffer, Report, 8);
|
||||
WriteNextReport(CmdBuffer, ReportSize);
|
||||
|
@ -212,7 +213,8 @@ void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
|
|||
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
|
||||
* enumerating an attached USB device.
|
||||
*/
|
||||
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
|
||||
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
|
||||
const uint8_t SubErrorCode)
|
||||
{
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||
}
|
||||
|
@ -245,7 +247,8 @@ void DiscardNextReport(void)
|
|||
* \param[in] ReportOUTData Buffer containing the report to send to the device
|
||||
* \param[in] ReportLength Length of the report to send
|
||||
*/
|
||||
void WriteNextReport(uint8_t* const ReportOUTData, const uint16_t ReportLength)
|
||||
void WriteNextReport(uint8_t* const ReportOUTData,
|
||||
const uint16_t ReportLength)
|
||||
{
|
||||
/* Select and unfreeze HID data OUT pipe */
|
||||
Pipe_SelectPipe(HID_DATA_OUT_PIPE);
|
||||
|
|
|
@ -82,7 +82,8 @@
|
|||
void SetupHardware(void);
|
||||
|
||||
void Read_Joystick_Status(void);
|
||||
void Send_Command_Report(uint8_t* const Report, const uint16_t ReportSize);
|
||||
void Send_Command_Report(uint8_t* const Report,
|
||||
const uint16_t ReportSize);
|
||||
void Send_Command(uint8_t* const Command);
|
||||
|
||||
void HID_Host_Task(void);
|
||||
|
@ -90,10 +91,12 @@
|
|||
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
|
||||
void EVENT_USB_Host_DeviceAttached(void);
|
||||
void EVENT_USB_Host_DeviceUnattached(void);
|
||||
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
|
||||
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
|
||||
const uint8_t SubErrorCode);
|
||||
void EVENT_USB_Host_DeviceEnumerationComplete(void);
|
||||
|
||||
void DiscardNextReport(void);
|
||||
void WriteNextReport(uint8_t* const ReportOUTData, const uint16_t ReportLength);
|
||||
void WriteNextReport(uint8_t* const ReportOUTData,
|
||||
const uint16_t ReportLength);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -153,7 +153,9 @@ USB_Descriptor_String_t PROGMEM RelayBoard_SerialString =
|
|||
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
|
||||
* USB host.
|
||||
*/
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress)
|
||||
{
|
||||
const uint8_t DescriptorType = (wValue >> 8);
|
||||
const uint8_t DescriptorNumber = (wValue & 0xFF);
|
||||
|
|
|
@ -54,6 +54,8 @@
|
|||
} RelayBoard_USB_Descriptor_Configuration_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress);
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -237,7 +237,9 @@ USB_Descriptor_String_t PROGMEM ProductString =
|
|||
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
|
||||
* USB host.
|
||||
*/
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress)
|
||||
{
|
||||
const uint8_t DescriptorType = (wValue >> 8);
|
||||
const uint8_t DescriptorNumber = (wValue & 0xFF);
|
||||
|
|
|
@ -54,7 +54,8 @@
|
|||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
|
||||
#include "DS1307.h"
|
||||
|
||||
void DS1307_SetDate(uint8_t Day, uint8_t Month, uint8_t Year)
|
||||
void DS1307_SetDate(const uint8_t Day,
|
||||
const uint8_t Month,
|
||||
const uint8_t Year)
|
||||
{
|
||||
#if defined(DUMMY_RTC)
|
||||
return;
|
||||
|
@ -32,7 +34,9 @@ void DS1307_SetDate(uint8_t Day, uint8_t Month, uint8_t Year)
|
|||
}
|
||||
}
|
||||
|
||||
void DS1307_SetTime(uint8_t Hour, uint8_t Minute, uint8_t Second)
|
||||
void DS1307_SetTime(const uint8_t Hour,
|
||||
const uint8_t Minute,
|
||||
const uint8_t Second)
|
||||
{
|
||||
#if defined(DUMMY_RTC)
|
||||
return;
|
||||
|
@ -59,7 +63,9 @@ void DS1307_SetTime(uint8_t Hour, uint8_t Minute, uint8_t Second)
|
|||
}
|
||||
}
|
||||
|
||||
void DS1307_GetDate(uint8_t* Day, uint8_t* Month, uint8_t* Year)
|
||||
void DS1307_GetDate(uint8_t* const Day,
|
||||
uint8_t* const Month,
|
||||
uint8_t* const Year)
|
||||
{
|
||||
#if defined(DUMMY_RTC)
|
||||
*Day = 1;
|
||||
|
@ -91,7 +97,9 @@ void DS1307_GetDate(uint8_t* Day, uint8_t* Month, uint8_t* Year)
|
|||
*Year = (CurrentRTCDate.Byte3.Fields.TenYear * 10) + CurrentRTCDate.Byte3.Fields.Year;
|
||||
}
|
||||
|
||||
void DS1307_GetTime(uint8_t* Hour, uint8_t* Minute, uint8_t* Second)
|
||||
void DS1307_GetTime(uint8_t* const Hour,
|
||||
uint8_t* const Minute,
|
||||
uint8_t* const Second)
|
||||
{
|
||||
#if defined(DUMMY_RTC)
|
||||
*Hour = 1;
|
||||
|
|
|
@ -100,10 +100,17 @@
|
|||
#define DS1307_ADDRESS_WRITE 0b11010000
|
||||
|
||||
/* Function Prototypes: */
|
||||
void DS1307_SetDate(uint8_t Day, uint8_t Month, uint8_t Year);
|
||||
void DS1307_SetTime(uint8_t Hour, uint8_t Minute, uint8_t Second);
|
||||
|
||||
void DS1307_GetDate(uint8_t* Day, uint8_t* Month, uint8_t* Year);
|
||||
void DS1307_GetTime(uint8_t* Hour, uint8_t* Minute, uint8_t* Second);
|
||||
void DS1307_SetDate(const uint8_t Day,
|
||||
const uint8_t Month,
|
||||
const uint8_t Year);
|
||||
void DS1307_SetTime(const uint8_t Hour,
|
||||
const uint8_t Minute,
|
||||
const uint8_t Second);
|
||||
void DS1307_GetDate(uint8_t* const Day,
|
||||
uint8_t* const Month,
|
||||
uint8_t* const Year);
|
||||
void DS1307_GetTime(uint8_t* const Hour,
|
||||
uint8_t* const Minute,
|
||||
uint8_t* const Second);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -47,7 +47,9 @@
|
|||
* \param[in] BlockAddress Data block starting address for the write sequence
|
||||
* \param[in] TotalBlocks Number of blocks of data to write
|
||||
*/
|
||||
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks)
|
||||
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
|
||||
const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks)
|
||||
{
|
||||
uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
|
||||
uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
|
||||
|
@ -181,7 +183,9 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
|
|||
* \param[in] BlockAddress Data block starting address for the read sequence
|
||||
* \param[in] TotalBlocks Number of blocks of data to read
|
||||
*/
|
||||
void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks)
|
||||
void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
|
||||
const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks)
|
||||
{
|
||||
uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
|
||||
uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
|
||||
|
@ -289,7 +293,9 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
|
|||
* \param[in] TotalBlocks Number of blocks of data to write
|
||||
* \param[in] BufferPtr Pointer to the data source RAM buffer
|
||||
*/
|
||||
void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks, const uint8_t* BufferPtr)
|
||||
void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks,
|
||||
const uint8_t* BufferPtr)
|
||||
{
|
||||
uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
|
||||
uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
|
||||
|
@ -388,7 +394,9 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t Tota
|
|||
* \param[in] TotalBlocks Number of blocks of data to read
|
||||
* \param[out] BufferPtr Pointer to the data destination RAM buffer
|
||||
*/
|
||||
void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks, uint8_t* BufferPtr)
|
||||
void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks,
|
||||
uint8_t* BufferPtr)
|
||||
{
|
||||
uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
|
||||
uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
|
||||
|
|
|
@ -67,13 +67,17 @@
|
|||
#define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE)
|
||||
|
||||
/* Function Prototypes: */
|
||||
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress,
|
||||
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
|
||||
const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks);
|
||||
void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress,
|
||||
void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
|
||||
const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks);
|
||||
void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks,
|
||||
void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks,
|
||||
const uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
|
||||
void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks,
|
||||
void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks,
|
||||
uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
|
||||
void DataflashManager_ResetDataflashProtections(void);
|
||||
bool DataflashManager_CheckDataflashOperation(void);
|
||||
|
|
|
@ -247,7 +247,8 @@ static void SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInte
|
|||
* \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
|
||||
* \param[in] IsDataRead Indicates if the command is a READ (10) command or WRITE (10) command (DATA_READ or DATA_WRITE)
|
||||
*/
|
||||
static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const bool IsDataRead)
|
||||
static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
|
||||
const bool IsDataRead)
|
||||
{
|
||||
uint32_t BlockAddress = SwapEndian_32(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[2]);
|
||||
uint16_t TotalBlocks = SwapEndian_16(*(uint16_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[7]);
|
||||
|
|
|
@ -80,7 +80,8 @@
|
|||
static void SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
|
||||
static void SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
|
||||
static void SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
|
||||
static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const bool IsDataRead);
|
||||
static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
|
||||
const bool IsDataRead);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -279,8 +279,11 @@ bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSI
|
|||
*
|
||||
* \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
|
||||
*/
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
|
||||
const uint8_t ReportType, void* ReportData, uint16_t* const ReportSize)
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
|
||||
uint8_t* const ReportID,
|
||||
const uint8_t ReportType,
|
||||
void* ReportData,
|
||||
uint16_t* const ReportSize)
|
||||
{
|
||||
Device_Report_t* ReportParams = (Device_Report_t*)ReportData;
|
||||
|
||||
|
@ -301,8 +304,11 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
|
|||
* \param[in] ReportData Pointer to a buffer where the created report has been stored
|
||||
* \param[in] ReportSize Size in bytes of the received HID report
|
||||
*/
|
||||
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,
|
||||
const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize)
|
||||
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
|
||||
const uint8_t ReportID,
|
||||
const uint8_t ReportType,
|
||||
const void* ReportData,
|
||||
const uint16_t ReportSize)
|
||||
{
|
||||
Device_Report_t* ReportParams = (Device_Report_t*)ReportData;
|
||||
|
||||
|
|
|
@ -105,9 +105,15 @@
|
|||
void EVENT_USB_Device_UnhandledControlRequest(void);
|
||||
|
||||
bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
|
||||
const uint8_t ReportType, void* ReportData, uint16_t* const ReportSize);
|
||||
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,
|
||||
const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize);
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
|
||||
uint8_t* const ReportID,
|
||||
const uint8_t ReportType,
|
||||
void* ReportData,
|
||||
uint16_t* const ReportSize);
|
||||
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
|
||||
const uint8_t ReportID,
|
||||
const uint8_t ReportType,
|
||||
const void* ReportData,
|
||||
const uint16_t ReportSize);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -224,7 +224,9 @@ USB_Descriptor_String_t PROGMEM ProductString =
|
|||
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
|
||||
* USB host.
|
||||
*/
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress)
|
||||
{
|
||||
const uint8_t DescriptorType = (wValue >> 8);
|
||||
const uint8_t DescriptorNumber = (wValue & 0xFF);
|
||||
|
|
|
@ -77,7 +77,8 @@
|
|||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -100,7 +100,8 @@
|
|||
* \param[in,out] Buffer Pointer to a ring buffer structure to insert into
|
||||
* \param[in] Data Data element to insert into the buffer
|
||||
*/
|
||||
static inline void RingBuffer_AtomicInsert(RingBuff_t* const Buffer, RingBuff_Data_t Data)
|
||||
static inline void RingBuffer_AtomicInsert(RingBuff_t* const Buffer,
|
||||
const RingBuff_Data_t Data)
|
||||
{
|
||||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
|
||||
{
|
||||
|
@ -141,7 +142,8 @@
|
|||
* \param[in,out] Buffer Pointer to a ring buffer structure to insert into
|
||||
* \param[in] Data Data element to insert into the buffer
|
||||
*/
|
||||
static inline void RingBuffer_Insert(RingBuff_t* const Buffer, RingBuff_Data_t Data)
|
||||
static inline void RingBuffer_Insert(RingBuff_t* const Buffer,
|
||||
const RingBuff_Data_t Data)
|
||||
{
|
||||
*Buffer->In = Data;
|
||||
|
||||
|
|
|
@ -66,7 +66,8 @@
|
|||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -170,13 +170,15 @@ void DHCPClientApp_Callback(void)
|
|||
/** Fills the DHCP packet response with the appropriate BOOTP header for DHCP. This fills out all the required
|
||||
* fields, leaving only the additional DHCP options to be added to the packet before it is sent to the DHCP server.
|
||||
*
|
||||
* \param[out] DHCPHeader Location in the packet buffer where the BOOTP header should be written to
|
||||
* \param[out] DHCPHeader Location in the packet buffer where the BOOTP header should be written to
|
||||
* \param[in] DHCPMessageType DHCP Message type, such as DHCP_DISCOVER
|
||||
* \param[in] AppState Application state of the current UDP connection
|
||||
* \param[in] AppState Application state of the current UDP connection
|
||||
*
|
||||
* \return Size in bytes of the created DHCP packet
|
||||
*/
|
||||
static uint16_t DHCPClientApp_FillDHCPHeader(DHCP_Header_t* const DHCPHeader, const uint8_t DHCPMessageType, uip_udp_appstate_t* AppState)
|
||||
static uint16_t DHCPClientApp_FillDHCPHeader(DHCP_Header_t* const DHCPHeader,
|
||||
const uint8_t DHCPMessageType,
|
||||
uip_udp_appstate_t* const AppState)
|
||||
{
|
||||
/* Erase existing packet data so that we start will all 0x00 DHCP header data */
|
||||
memset(DHCPHeader, 0, sizeof(DHCP_Header_t));
|
||||
|
@ -215,7 +217,10 @@ static uint16_t DHCPClientApp_FillDHCPHeader(DHCP_Header_t* const DHCPHeader, co
|
|||
*
|
||||
* \return Number of bytes added to the DHCP packet
|
||||
*/
|
||||
static uint8_t DHCPClientApp_SetOption(uint8_t* DHCPOptionList, uint8_t Option, uint8_t DataLen, void* OptionData)
|
||||
static uint8_t DHCPClientApp_SetOption(uint8_t* DHCPOptionList,
|
||||
const uint8_t Option,
|
||||
const uint8_t DataLen,
|
||||
void* const OptionData)
|
||||
{
|
||||
/* Skip through the DHCP options list until the terminator option is found */
|
||||
while (*DHCPOptionList != DHCP_OPTION_END)
|
||||
|
@ -239,7 +244,9 @@ static uint8_t DHCPClientApp_SetOption(uint8_t* DHCPOptionList, uint8_t Option,
|
|||
*
|
||||
* \return Boolean true if the option was found in the DHCP packet's options list, false otherwise
|
||||
*/
|
||||
static bool DHCPClientApp_GetOption(const uint8_t* DHCPOptionList, const uint8_t Option, void* const Destination)
|
||||
static bool DHCPClientApp_GetOption(const uint8_t* DHCPOptionList,
|
||||
const uint8_t Option,
|
||||
void* const Destination)
|
||||
{
|
||||
/* Look through the incoming DHCP packet's options list for the requested option */
|
||||
while (*DHCPOptionList != DHCP_OPTION_END)
|
||||
|
|
|
@ -160,10 +160,15 @@
|
|||
void DHCPClientApp_Callback(void);
|
||||
|
||||
#if defined(INCLUDE_FROM_DHCPCLIENTAPP_C)
|
||||
static uint16_t DHCPClientApp_FillDHCPHeader(DHCP_Header_t* const DHCPHeader, const uint8_t DHCPMessageType,
|
||||
uip_udp_appstate_t* AppState);
|
||||
static uint8_t DHCPClientApp_SetOption(uint8_t* DHCPOptionList, uint8_t Option, uint8_t DataLen,
|
||||
void* OptionData);
|
||||
static bool DHCPClientApp_GetOption(const uint8_t* DHCPOptionList, const uint8_t Option, void* const Destination);
|
||||
static uint16_t DHCPClientApp_FillDHCPHeader(DHCP_Header_t* const DHCPHeader,
|
||||
const uint8_t DHCPMessageType,
|
||||
uip_udp_appstate_t* const AppState);
|
||||
static uint8_t DHCPClientApp_SetOption(uint8_t* DHCPOptionList,
|
||||
const uint8_t Option,
|
||||
const uint8_t DataLen,
|
||||
void* const OptionData);
|
||||
static bool DHCPClientApp_GetOption(const uint8_t* DHCPOptionList,
|
||||
const uint8_t Option,
|
||||
void* const Destination);
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -47,7 +47,9 @@
|
|||
* \param[in] BlockAddress Data block starting address for the write sequence
|
||||
* \param[in] TotalBlocks Number of blocks of data to write
|
||||
*/
|
||||
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks)
|
||||
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
|
||||
const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks)
|
||||
{
|
||||
uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
|
||||
uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
|
||||
|
@ -181,7 +183,9 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
|
|||
* \param[in] BlockAddress Data block starting address for the read sequence
|
||||
* \param[in] TotalBlocks Number of blocks of data to read
|
||||
*/
|
||||
void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks)
|
||||
void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
|
||||
const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks)
|
||||
{
|
||||
uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
|
||||
uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
|
||||
|
@ -289,7 +293,9 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
|
|||
* \param[in] TotalBlocks Number of blocks of data to write
|
||||
* \param[in] BufferPtr Pointer to the data source RAM buffer
|
||||
*/
|
||||
void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks, const uint8_t* BufferPtr)
|
||||
void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks,
|
||||
const uint8_t* BufferPtr)
|
||||
{
|
||||
uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
|
||||
uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
|
||||
|
@ -388,7 +394,9 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t Tota
|
|||
* \param[in] TotalBlocks Number of blocks of data to read
|
||||
* \param[out] BufferPtr Pointer to the data destination RAM buffer
|
||||
*/
|
||||
void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks, uint8_t* BufferPtr)
|
||||
void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks,
|
||||
uint8_t* BufferPtr)
|
||||
{
|
||||
uint16_t CurrDFPage = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);
|
||||
uint16_t CurrDFPageByte = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);
|
||||
|
|
|
@ -66,13 +66,17 @@
|
|||
#define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE)
|
||||
|
||||
/* Function Prototypes: */
|
||||
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress,
|
||||
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
|
||||
const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks);
|
||||
void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress,
|
||||
void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
|
||||
const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks);
|
||||
void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks,
|
||||
void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks,
|
||||
const uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
|
||||
void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks,
|
||||
void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
|
||||
uint16_t TotalBlocks,
|
||||
uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
|
||||
void DataflashManager_ResetDataflashProtections(void);
|
||||
bool DataflashManager_CheckDataflashOperation(void);
|
||||
|
|
|
@ -247,7 +247,8 @@ static void SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInte
|
|||
* \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
|
||||
* \param[in] IsDataRead Indicates if the command is a READ (10) command or WRITE (10) command (DATA_READ or DATA_WRITE)
|
||||
*/
|
||||
static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const bool IsDataRead)
|
||||
static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
|
||||
const bool IsDataRead)
|
||||
{
|
||||
uint32_t BlockAddress = SwapEndian_32(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[2]);
|
||||
uint16_t TotalBlocks = SwapEndian_16(*(uint16_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[7]);
|
||||
|
|
|
@ -79,7 +79,8 @@
|
|||
static void SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
|
||||
static void SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
|
||||
static void SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
|
||||
static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const bool IsDataRead);
|
||||
static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
|
||||
const bool IsDataRead);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -52,7 +52,8 @@
|
|||
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
|
||||
void EVENT_USB_Host_DeviceAttached(void);
|
||||
void EVENT_USB_Host_DeviceUnattached(void);
|
||||
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
|
||||
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
|
||||
const uint8_t SubErrorCode);
|
||||
void EVENT_USB_Host_DeviceEnumerationComplete(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -172,7 +172,9 @@ USB_Descriptor_String_t PROGMEM AVRISP_SerialString =
|
|||
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
|
||||
* USB host.
|
||||
*/
|
||||
uint16_t AVRISP_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||
uint16_t AVRISP_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress)
|
||||
{
|
||||
const uint8_t DescriptorType = (wValue >> 8);
|
||||
const uint8_t DescriptorNumber = (wValue & 0xFF);
|
||||
|
|
|
@ -73,6 +73,8 @@
|
|||
} AVRISP_USB_Descriptor_Configuration_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint16_t AVRISP_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress);
|
||||
uint16_t AVRISP_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -100,7 +100,8 @@
|
|||
* \param[in,out] Buffer Pointer to a ring buffer structure to insert into
|
||||
* \param[in] Data Data element to insert into the buffer
|
||||
*/
|
||||
static inline void RingBuffer_AtomicInsert(RingBuff_t* const Buffer, RingBuff_Data_t Data)
|
||||
static inline void RingBuffer_AtomicInsert(RingBuff_t* const Buffer,
|
||||
const RingBuff_Data_t Data)
|
||||
{
|
||||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
|
||||
{
|
||||
|
@ -141,7 +142,8 @@
|
|||
* \param[in,out] Buffer Pointer to a ring buffer structure to insert into
|
||||
* \param[in] Data Data element to insert into the buffer
|
||||
*/
|
||||
static inline void RingBuffer_Insert(RingBuff_t* const Buffer, RingBuff_Data_t Data)
|
||||
static inline void RingBuffer_Insert(RingBuff_t* const Buffer,
|
||||
const RingBuff_Data_t Data)
|
||||
{
|
||||
*Buffer->In = Data;
|
||||
|
||||
|
|
|
@ -60,6 +60,6 @@
|
|||
}
|
||||
|
||||
/* Function Prototypes: */
|
||||
void SoftUART_Init(void);
|
||||
void SoftUART_Init(void);
|
||||
|
||||
#endif
|
|
@ -221,7 +221,9 @@ USB_Descriptor_String_t PROGMEM USART_ProductString =
|
|||
/** Descriptor retrieval function for the USART Bridge descriptors. This function is in turn called by the GetDescriptor
|
||||
* callback function in the main source file, to retrieve the device's descriptors when in USART bridge mode.
|
||||
*/
|
||||
uint16_t USART_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||
uint16_t USART_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress)
|
||||
{
|
||||
const uint8_t DescriptorType = (wValue >> 8);
|
||||
const uint8_t DescriptorNumber = (wValue & 0xFF);
|
||||
|
|
|
@ -77,6 +77,8 @@
|
|||
} USART_USB_Descriptor_Configuration_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint16_t USART_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress);
|
||||
uint16_t USART_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -240,8 +240,16 @@ void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCI
|
|||
* to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
|
||||
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
|
||||
* USB host.
|
||||
*
|
||||
* \param[in] wValue Descriptor type and index to retrieve
|
||||
* \param[in] wIndex Sub-index to retrieve (such as a localized string language)
|
||||
* \param[out] DescriptorAddress Address of the retrieved descriptor
|
||||
*
|
||||
* \return Length of the retrieved descriptor in bytes, or NO_DESCRIPTOR if the descriptor was not found
|
||||
*/
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress)
|
||||
{
|
||||
/* Return the correct descriptors based on the selected mode */
|
||||
if (CurrentFirmwareMode == MODE_USART_BRIDGE)
|
||||
|
|
|
@ -93,6 +93,8 @@
|
|||
|
||||
void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
|
||||
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress);
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue