Forráskód Böngészése

Fix L1 PMA access (#104)

* Fix L1 PMA step
* fix EP size calculus in the ASM driver for the L1

closes #103
Dmitry Filimonchuk 4 éve
szülő
commit
c3bcfc9456
2 módosított fájl, 5 hozzáadás és 3 törlés
  1. 4 2
      src/usbd_stm32l100_devfs.c
  2. 1 1
      src/usbd_stm32l100_devfs_asm.S

+ 4 - 2
src/usbd_stm32l100_devfs.c

@@ -261,7 +261,8 @@ static uint16_t pma_read (uint8_t *buf, uint16_t blen, pma_rec *rx) {
     rx->cnt &= ~0x3FF;
     for(int idx = 0; idx < rxcnt; idx++) {
         if ((idx & 0x01) == 0) {
-            tmp = *pma++;
+            tmp = *pma;
+            pma += 2;
         }
         if (idx < blen) {
             buf[idx] = tmp & 0xFF;
@@ -323,7 +324,8 @@ static void pma_write(const uint8_t *buf, uint16_t blen, pma_rec *tx) {
     for (int idx=0; idx < blen; idx++) {
         tmp |= buf[idx] << ((idx & 0x01) ? 8 : 0);
         if ((idx & 0x01) || (idx + 1) == blen) {
-            *pma++ = tmp;
+            *pma = tmp;
+            pma += 2;
             tmp = 0;
         }
     }

+ 1 - 1
src/usbd_stm32l100_devfs_asm.S

@@ -629,7 +629,7 @@ _ep_config:
     movs    r3, #0x1F
     adds    r2, r3
     bics    r2, r3
-    lsrs    r3, r2, #5
+    lsrs    r3, r2, #4
     adds    r3, #0x3E
 .L_epc_rxbb:
     lsls    r3, #9