aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/usb
diff options
context:
space:
mode:
Diffstat (limited to 'libmaple/usb')
-rw-r--r--libmaple/usb/usb.c12
-rw-r--r--libmaple/usb/usb.h2
-rw-r--r--libmaple/usb/usb_lib/usb_mem.c4
-rw-r--r--libmaple/usb/usb_lib/usb_mem.h2
4 files changed, 9 insertions, 11 deletions
diff --git a/libmaple/usb/usb.c b/libmaple/usb/usb.c
index 7b1dd4c..b34c4b6 100644
--- a/libmaple/usb/usb.c
+++ b/libmaple/usb/usb.c
@@ -343,23 +343,21 @@ void usbBlockingSendByte(char ch) {
countTx = 1;
while (countTx);
}
-uint32 usbSendBytes(uint8* sendBuf, uint32 len) {
- /* any checks on connection (via dtr/rts) done upstream in wirish or
- by user */
- /* last xmit hasnt finished, abort */
+uint32 usbSendBytes(const uint8* sendBuf, uint32 len) {
+ /* Last transmission hasn't finished, abort */
if (countTx) {
return 0;
}
// We can only put VCOM_TX_EPSIZE bytes in the buffer
- if(len > VCOM_TX_EPSIZE/2) {
- len = VCOM_TX_EPSIZE/2;
+ if (len > VCOM_TX_EPSIZE / 2) {
+ len = VCOM_TX_EPSIZE / 2;
}
// Try to load some bytes if we can
if (len) {
- UserToPMABufferCopy(sendBuf,VCOM_TX_ADDR, len);
+ UserToPMABufferCopy(sendBuf, VCOM_TX_ADDR, len);
_SetEPTxCount(VCOM_TX_ENDP, len);
countTx += len;
_SetEPTxValid(VCOM_TX_ENDP);
diff --git a/libmaple/usb/usb.h b/libmaple/usb/usb.h
index 92f606c..c724c54 100644
--- a/libmaple/usb/usb.h
+++ b/libmaple/usb/usb.h
@@ -74,7 +74,7 @@ void usbWaitReset(void);
/* blocking functions for send/receive */
void usbBlockingSendByte(char ch);
-uint32 usbSendBytes(uint8* sendBuf,uint32 len);
+uint32 usbSendBytes(const uint8* sendBuf,uint32 len);
uint32 usbBytesAvailable(void);
uint32 usbReceiveBytes(uint8* recvBuf, uint32 len);
uint8 usbGetDTR(void);
diff --git a/libmaple/usb/usb_lib/usb_mem.c b/libmaple/usb/usb_lib/usb_mem.c
index ee698c5..90ffc62 100644
--- a/libmaple/usb/usb_lib/usb_mem.c
+++ b/libmaple/usb/usb_lib/usb_mem.c
@@ -30,9 +30,9 @@
* - wPMABufAddr: address into PMA.
* - wNBytes: no. of bytes to be copied.
* Output : None.
-* Return : None .
+* Return : None .
*******************************************************************************/
-void UserToPMABufferCopy(u8 *pbUsrBuf, u16 wPMABufAddr, u16 wNBytes)
+void UserToPMABufferCopy(const u8 *pbUsrBuf, u16 wPMABufAddr, u16 wNBytes)
{
u32 n = (wNBytes + 1) >> 1; /* n = (wNBytes + 1) / 2 */
u32 i, temp1, temp2;
diff --git a/libmaple/usb/usb_lib/usb_mem.h b/libmaple/usb/usb_lib/usb_mem.h
index a3d7927..60ff9f1 100644
--- a/libmaple/usb/usb_lib/usb_mem.h
+++ b/libmaple/usb/usb_lib/usb_mem.h
@@ -26,7 +26,7 @@
extern "C" {
#endif
-void UserToPMABufferCopy(u8 *pbUsrBuf, u16 wPMABufAddr, u16 wNBytes);
+void UserToPMABufferCopy(const u8 *pbUsrBuf, u16 wPMABufAddr, u16 wNBytes);
void PMAToUserBufferCopy(u8 *pbUsrBuf, u16 wPMABufAddr, u16 wNBytes);
#if defined(__cplusplus)