summaryrefslogtreecommitdiff
path: root/src/usbh_lld_stm32f4.c
diff options
context:
space:
mode:
authorAmir Hammad <amir.hammad@hotmail.com>2015-08-26 08:00:40 +0200
committerAmir Hammad <amir.hammad@hotmail.com>2015-08-26 08:00:40 +0200
commit4cbbb39624f2b1778fd3a3ade226957769234b29 (patch)
tree17ae13ff4cacffd9dfb5a18cabad56ec8aacf746 /src/usbh_lld_stm32f4.c
parent631a614c81820455a3dbf8f4bb689887ba768823 (diff)
downloadsecure-hid-4cbbb39624f2b1778fd3a3ade226957769234b29.tar.gz
secure-hid-4cbbb39624f2b1778fd3a3ade226957769234b29.tar.bz2
secure-hid-4cbbb39624f2b1778fd3a3ade226957769234b29.zip
lld/stm32f4: Send correct amount of data
+ added logging output of data that is going to be sent. Signed-off-by: Amir Hammad <amir.hammad@hotmail.com>
Diffstat (limited to 'src/usbh_lld_stm32f4.c')
-rw-r--r--src/usbh_lld_stm32f4.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/usbh_lld_stm32f4.c b/src/usbh_lld_stm32f4.c
index 2ad8190..8b98321 100644
--- a/src/usbh_lld_stm32f4.c
+++ b/src/usbh_lld_stm32f4.c
@@ -20,9 +20,9 @@
*
*/
+#include "driver/usbh_device_driver.h"
#include "usbh_lld_stm32f4.h"
#include "usart_helpers.h"
-#include "driver/usbh_device_driver.h"
#include <string.h>
#include <stdint.h>
@@ -301,9 +301,22 @@ static void write(void *drvdata, const usbh_packet_t *packet)
volatile uint32_t *fifo = &REBASE_CH(OTG_FIFO, channel) + RX_FIFO_SIZE;
const uint32_t * buf32 = packet->data;
int i;
- for(i = packet->datalen; i > 0; i-=4) {
+ LOG_PRINTF("\nSending[%d]: ", packet->datalen);
+ for(i = packet->datalen; i >= 4; i-=4) {
+ const uint8_t *buf8 = (const uint8_t *)buf32;
+ LOG_PRINTF("%02X %02X %02X %02X, ", buf8[0], buf8[1], buf8[2], buf8[3]);
*fifo++ = *buf32++;
+
+ }
+
+ if (i > 0) {
+ *fifo = *buf32&((1 << (8*i)) - 1);
+ uint8_t *buf8 = (uint8_t *)buf32;
+ while (i--) {
+ LOG_PRINTF("%02X ", *buf8++);
+ }
}
+ LOG_PRINTF("\n");
} else {
volatile uint32_t *fifo = &REBASE_CH(OTG_FIFO, channel) +