From bc57f4ea5afd29f2e0f0175d14cf1540b4408de8 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sun, 24 Jun 2018 16:41:58 +1000 Subject: Reformatting and add const qualifiers. --- Demos/Device/ClassDriver/CCID/CCID.c | 22 ++++++++++++++-------- Demos/Device/ClassDriver/CCID/CCID.h | 25 +++++++++++++++---------- Demos/Device/ClassDriver/CCID/Lib/Iso7816.c | 4 +++- Demos/Device/ClassDriver/CCID/Lib/Iso7816.h | 4 +++- Demos/Device/LowLevel/CCID/CCID.c | 14 +++++++------- Demos/Device/LowLevel/CCID/CCID.h | 17 ++++++++++++----- Demos/Device/LowLevel/CCID/Lib/Iso7816.c | 3 ++- Demos/Device/LowLevel/CCID/Lib/Iso7816.h | 4 +++- 8 files changed, 59 insertions(+), 34 deletions(-) (limited to 'Demos') diff --git a/Demos/Device/ClassDriver/CCID/CCID.c b/Demos/Device/ClassDriver/CCID/CCID.c index 916306505..9059ad40d 100644 --- a/Demos/Device/ClassDriver/CCID/CCID.c +++ b/Demos/Device/ClassDriver/CCID/CCID.c @@ -157,10 +157,11 @@ void EVENT_USB_Device_ControlRequest(void) * whenever an application at the host wants to send a power off signal to a slot. * THe slot must reply back with a recognizable ATR (answer to reset) */ -uint8_t CALLBACK_CCID_IccPowerOn(uint8_t slot, - uint8_t* atr, - uint8_t* attrSize, - uint8_t* error) +uint8_t CALLBACK_CCID_IccPowerOn(USB_ClassInfo_CCID_Device_t* const CCIDInterfaceInfo, + uint8_t slot, + uint8_t* const atr, + uint8_t* const attrSize, + uint8_t* const error) { if (slot < CCID_Interface.Config.TotalSlots) { @@ -176,7 +177,9 @@ uint8_t CALLBACK_CCID_IccPowerOn(uint8_t slot, /** Event handler for the CCID_PC_to_RDR_IccPowerOff message. This message is sent to the device * whenever an application at the host wants to send a power off signal to a slot. */ -uint8_t CALLBACK_CCID_IccPowerOff(uint8_t slot, uint8_t* error) +uint8_t CALLBACK_CCID_IccPowerOff(USB_ClassInfo_CCID_Device_t* const CCIDInterfaceInfo, + uint8_t slot, + uint8_t* const error) { if (slot < CCID_Interface.Config.TotalSlots) { @@ -194,7 +197,9 @@ uint8_t CALLBACK_CCID_IccPowerOff(uint8_t slot, uint8_t* error) * whenever an application at the host wants to the get the current slot status * */ -uint8_t CALLBACK_CCID_GetSlotStatus(uint8_t slot, uint8_t* error) +uint8_t CALLBACK_CCID_GetSlotStatus(USB_ClassInfo_CCID_Device_t* const CCIDInterfaceInfo, + uint8_t slot, + uint8_t* const error) { if (slot < CCID_Interface.Config.TotalSlots) { @@ -208,9 +213,10 @@ uint8_t CALLBACK_CCID_GetSlotStatus(uint8_t slot, uint8_t* error) } } -uint8_t CALLBACK_CCID_Abort(uint8_t slot, +uint8_t CALLBACK_CCID_Abort(USB_ClassInfo_CCID_Device_t* const CCIDInterfaceInfo, + uint8_t slot, uint8_t seq, - uint8_t* error) + uint8_t* const error) { if (CCID_Interface.State.Aborted && slot == 0 && CCID_Interface.State.AbortedSeq == seq) { diff --git a/Demos/Device/ClassDriver/CCID/CCID.h b/Demos/Device/ClassDriver/CCID/CCID.h index 608fb7801..f6dd4adf5 100644 --- a/Demos/Device/ClassDriver/CCID/CCID.h +++ b/Demos/Device/ClassDriver/CCID/CCID.h @@ -75,16 +75,21 @@ void EVENT_USB_Device_ConfigurationChanged(void); void EVENT_USB_Device_ControlRequest(void); - uint8_t CALLBACK_CCID_IccPowerOn(uint8_t slot, - uint8_t* atr, - uint8_t* atrSize, - uint8_t* error); - uint8_t CALLBACK_CCID_IccPowerOff(uint8_t slot, uint8_t* error); - uint8_t CALLBACK_CCID_GetSlotStatus(uint8_t slot, uint8_t* error); - uint8_t CALLBACK_CCID_Abort(uint8_t slot, - uint8_t seq, - uint8_t *error); - + uint8_t CALLBACK_CCID_IccPowerOn(USB_ClassInfo_CCID_Device_t* const CCIDInterfaceInfo, + uint8_t slot, + uint8_t* const atr, + uint8_t* const atrSize, + uint8_t* const error); + uint8_t CALLBACK_CCID_IccPowerOff(USB_ClassInfo_CCID_Device_t* const CCIDInterfaceInfo, + uint8_t slot, + uint8_t* const error); + uint8_t CALLBACK_CCID_GetSlotStatus(USB_ClassInfo_CCID_Device_t* const CCIDInterfaceInfo, + uint8_t slot, + uint8_t* const error); + uint8_t CALLBACK_CCID_Abort(USB_ClassInfo_CCID_Device_t* const CCIDInterfaceInfo, + uint8_t slot, + uint8_t seq, + uint8_t* const error); #endif diff --git a/Demos/Device/ClassDriver/CCID/Lib/Iso7816.c b/Demos/Device/ClassDriver/CCID/Lib/Iso7816.c index 1f9391d72..ec6e1f323 100644 --- a/Demos/Device/ClassDriver/CCID/Lib/Iso7816.c +++ b/Demos/Device/ClassDriver/CCID/Lib/Iso7816.c @@ -31,7 +31,9 @@ #include "Iso7816.h" -void Iso7816_CreateSimpleAtr(uint8_t* attr, uint8_t* attrLength) + +void Iso7816_CreateSimpleAtr(uint8_t* const attr, + uint8_t* const attrLength) { attr[0] = 0x3B; //TS: direct convention diff --git a/Demos/Device/ClassDriver/CCID/Lib/Iso7816.h b/Demos/Device/ClassDriver/CCID/Lib/Iso7816.h index f5fc1d70a..2a5570629 100644 --- a/Demos/Device/ClassDriver/CCID/Lib/Iso7816.h +++ b/Demos/Device/ClassDriver/CCID/Lib/Iso7816.h @@ -36,7 +36,9 @@ #include #include #include + #include /* Function Prototypes: */ - void Iso7816_CreateSimpleAtr(uint8_t* attr, uint8_t* attrLength); + void Iso7816_CreateSimpleAtr(uint8_t* const attr, + uint8_t* const attrLength); #endif diff --git a/Demos/Device/LowLevel/CCID/CCID.c b/Demos/Device/LowLevel/CCID/CCID.c index 8b46e89be..764392de0 100644 --- a/Demos/Device/LowLevel/CCID/CCID.c +++ b/Demos/Device/LowLevel/CCID/CCID.c @@ -197,9 +197,9 @@ void EVENT_USB_Device_ControlRequest(void) * THe slot must reply back with a recognizable ATR (answer to reset) */ uint8_t CCID_IccPowerOn(uint8_t slot, - uint8_t* atr, - uint8_t* atrLength, - uint8_t* error) + uint8_t* const atr, + uint8_t* const atrLength, + uint8_t* const error) { if (slot == 0) { @@ -219,7 +219,7 @@ uint8_t CCID_IccPowerOn(uint8_t slot, * whenever an application at the host wants to send a power off signal to a slot. */ uint8_t CCID_IccPowerOff(uint8_t slot, - uint8_t* error) + uint8_t* const error) { if (slot == 0) { @@ -238,7 +238,7 @@ uint8_t CCID_IccPowerOff(uint8_t slot, * slot status. */ uint8_t CCID_GetSlotStatus(uint8_t slot, - uint8_t* error) + uint8_t* const error) { if (slot == 0) { @@ -258,7 +258,7 @@ uint8_t CCID_GetSlotStatus(uint8_t slot, */ uint8_t CCID_Abort(uint8_t slot, uint8_t seq, - uint8_t* error) + uint8_t* const error) { if (Aborted && slot == 0 && AbortedSeq == seq) { @@ -283,7 +283,7 @@ uint8_t CCID_Abort(uint8_t slot, } /** Gets and status and verifies whether an error occurred. */ -bool CCID_CheckStatusNoError(int status) +bool CCID_CheckStatusNoError(uint8_t status) { return (status & 0xC0) == 0x0; } diff --git a/Demos/Device/LowLevel/CCID/CCID.h b/Demos/Device/LowLevel/CCID/CCID.h index 77bedcf0e..d4503597b 100644 --- a/Demos/Device/LowLevel/CCID/CCID.h +++ b/Demos/Device/LowLevel/CCID/CCID.h @@ -72,11 +72,18 @@ void SetupHardware(void); void CCID_Task(void); - uint8_t CCID_IccPowerOn(uint8_t slot, uint8_t* attr, uint8_t* attrLength, uint8_t* error); - uint8_t CCID_IccPowerOff(uint8_t slot, uint8_t* error); - uint8_t CCID_GetSlotStatus(uint8_t slot, uint8_t* error); - uint8_t CCID_Abort(uint8_t slot, uint8_t seq, uint8_t* error); - bool CCID_CheckStatusNoError(int status); + uint8_t CCID_IccPowerOn(uint8_t slot, + uint8_t* const attr, + uint8_t* const attrLength, + uint8_t* const error); + uint8_t CCID_IccPowerOff(uint8_t slot, + uint8_t* const error); + uint8_t CCID_GetSlotStatus(uint8_t slot, + uint8_t* const error); + uint8_t CCID_Abort(uint8_t slot, + uint8_t seq, + uint8_t* const error); + bool CCID_CheckStatusNoError(uint8_t status); void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); diff --git a/Demos/Device/LowLevel/CCID/Lib/Iso7816.c b/Demos/Device/LowLevel/CCID/Lib/Iso7816.c index 0c2e5e8b0..138c5b65f 100644 --- a/Demos/Device/LowLevel/CCID/Lib/Iso7816.c +++ b/Demos/Device/LowLevel/CCID/Lib/Iso7816.c @@ -31,7 +31,8 @@ #include "Iso7816.h" -void Iso7816_CreateSimpleAtr(uint8_t* atr, uint8_t* atrLength) +void Iso7816_CreateSimpleAtr(uint8_t* const atr, + uint8_t* const atrLength) { atr[0] = 0x3B; // TS: direct convention diff --git a/Demos/Device/LowLevel/CCID/Lib/Iso7816.h b/Demos/Device/LowLevel/CCID/Lib/Iso7816.h index aa5f4ba83..f73309d90 100644 --- a/Demos/Device/LowLevel/CCID/Lib/Iso7816.h +++ b/Demos/Device/LowLevel/CCID/Lib/Iso7816.h @@ -38,8 +38,10 @@ #include #include #include + #include /* Function Prototypes: */ - void Iso7816_CreateSimpleAtr(uint8_t* atr, uint8_t* atrLength); + void Iso7816_CreateSimpleAtr(uint8_t* const atr, + uint8_t* const atrLength); #endif -- cgit v1.2.3