Permalink
Browse files

Further fixups of const correctness

  • Loading branch information...
1 parent f3b662d commit 6f5855bf9cb3ba15c36cbbda2a6e543dd5f3dcc0 @martinbudden martinbudden committed Oct 14, 2016
@@ -35,7 +35,7 @@
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
-void UserToPMABufferCopy(uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes);
+void UserToPMABufferCopy(const uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes);
void PMAToUserBufferCopy(uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes);
/* External variables --------------------------------------------------------*/
@@ -45,7 +45,7 @@
* Output : None.
* Return : None .
*******************************************************************************/
-void UserToPMABufferCopy(uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes)
+void UserToPMABufferCopy(const uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes)
{
uint32_t n = (wNBytes + 1) >> 1; /* n = (wNBytes + 1) / 2 */
uint32_t i, temp1, temp2;
@@ -83,7 +83,7 @@ static uint8_t usbVcpRead(serialPort_t *instance)
return buf[0];
}
-static void usbVcpWriteBuf(serialPort_t *instance, void *data, int count)
+static void usbVcpWriteBuf(serialPort_t *instance, const void *data, int count)
{
UNUSED(instance);
@@ -92,9 +92,9 @@ static void usbVcpWriteBuf(serialPort_t *instance, void *data, int count)
return;
}
- uint32_t start = millis();
- for (uint8_t *p = data; count > 0; ) {
- uint32_t txed = CDC_Send_DATA(p, count);
+ const uint32_t start = millis();
+ for (const uint8_t *p = data; count > 0; ) {
+ const uint32_t txed = CDC_Send_DATA(p, count);
count -= txed;
p += txed;
@@ -106,7 +106,7 @@ static void usbVcpWriteBuf(serialPort_t *instance, void *data, int count)
static bool usbVcpFlush(vcpPort_t *port)
{
- uint8_t count = port->txAt;
+ const uint8_t count = port->txAt;
port->txAt = 0;
if (count == 0) {
@@ -117,7 +117,7 @@ static bool usbVcpFlush(vcpPort_t *port)
}
uint32_t txed;
- uint32_t start = millis();
+ const uint32_t start = millis();
do {
txed = CDC_Send_DATA(port->txBuf, count);
@@ -262,7 +262,7 @@ static void IntToUnicode(uint32_t value, uint8_t *pbuf, uint8_t len)
* Output : None.
* Return : None.
*******************************************************************************/
-uint32_t CDC_Send_DATA(uint8_t *ptrBuffer, uint8_t sendLength)
+uint32_t CDC_Send_DATA(const uint8_t *ptrBuffer, uint8_t sendLength)
{
/* Last transmission hasn't finished, abort */
if (packetSent) {
@@ -55,7 +55,7 @@ void Leave_LowPowerMode(void);
void USB_Interrupts_Config(void);
void USB_Cable_Config(FunctionalState NewState);
void Get_SerialNum(void);
-uint32_t CDC_Send_DATA(uint8_t *ptrBuffer, uint8_t sendLength); // HJI
+uint32_t CDC_Send_DATA(const uint8_t *ptrBuffer, uint8_t sendLength); // HJI
uint32_t CDC_Receive_DATA(uint8_t* recvBuf, uint32_t len); // HJI
uint8_t usbIsConfigured(void); // HJI
uint8_t usbIsConnected(void); // HJI

0 comments on commit 6f5855b

Please sign in to comment.