|
@@ -204,7 +204,7 @@ _connect:
|
|
|
#define GPIO_CRx GPIO_CRH
|
|
#define GPIO_CRx GPIO_CRH
|
|
|
#define DP_PIN (4 * (USBD_DP_PIN - 8))
|
|
#define DP_PIN (4 * (USBD_DP_PIN - 8))
|
|
|
#endif
|
|
#endif
|
|
|
- ldr r3, =#USBD_DP_PORT
|
|
|
|
|
|
|
+ ldr r3, =USBD_DP_PORT
|
|
|
ldr r2, [r3, #GPIO_CRx]
|
|
ldr r2, [r3, #GPIO_CRx]
|
|
|
movs r1, #0x0F
|
|
movs r1, #0x0F
|
|
|
bics r2, r2, r1, LSL #DP_PIN
|
|
bics r2, r2, r1, LSL #DP_PIN
|
|
@@ -218,7 +218,7 @@ _connect:
|
|
|
orrs r2, r2, r1, LSL #DP_PIN
|
|
orrs r2, r2, r1, LSL #DP_PIN
|
|
|
str r2, [r3, #GPIO_CRx]
|
|
str r2, [r3, #GPIO_CRx]
|
|
|
#elif defined(USBD_DP_PORT) && defined(USBD_DP_PIN) && defined(STM32F3)
|
|
#elif defined(USBD_DP_PORT) && defined(USBD_DP_PIN) && defined(STM32F3)
|
|
|
- ldr r3, =#USBD_DP_PORT
|
|
|
|
|
|
|
+ ldr r3, =USBD_DP_PORT
|
|
|
ldr r2, [r3, #GPIO_MODER]
|
|
ldr r2, [r3, #GPIO_MODER]
|
|
|
movs r1, #0x03
|
|
movs r1, #0x03
|
|
|
bics r2, r2, r1, LSL #(2 * USBD_DP_PIN)
|
|
bics r2, r2, r1, LSL #(2 * USBD_DP_PIN)
|
|
@@ -237,7 +237,7 @@ _connect:
|
|
|
.thumb_func
|
|
.thumb_func
|
|
|
.type _setaddr, %function
|
|
.type _setaddr, %function
|
|
|
_setaddr:
|
|
_setaddr:
|
|
|
- ldr r1, =#USB_REGBASE
|
|
|
|
|
|
|
+ ldr r1, =USB_REGBASE
|
|
|
adds r0, #0x80
|
|
adds r0, #0x80
|
|
|
strh r0, [r1, #USB_DADDR] //USB->DADDR
|
|
strh r0, [r1, #USB_DADDR] //USB->DADDR
|
|
|
bx lr
|
|
bx lr
|
|
@@ -246,7 +246,7 @@ _setaddr:
|
|
|
.thumb_func
|
|
.thumb_func
|
|
|
.type _get_frame, %function
|
|
.type _get_frame, %function
|
|
|
_get_frame:
|
|
_get_frame:
|
|
|
- ldr r0, =#USB_REGBASE
|
|
|
|
|
|
|
+ ldr r0, =USB_REGBASE
|
|
|
ldrh r0, [r0, #USB_FNR] //FNR
|
|
ldrh r0, [r0, #USB_FNR] //FNR
|
|
|
lsls r0, #21
|
|
lsls r0, #21
|
|
|
lsrs r0, #21
|
|
lsrs r0, #21
|
|
@@ -256,7 +256,7 @@ _get_frame:
|
|
|
.thumb_func
|
|
.thumb_func
|
|
|
.type _enable, %function
|
|
.type _enable, %function
|
|
|
_enable:
|
|
_enable:
|
|
|
- ldr r2, =#RCC_BASE //RCC
|
|
|
|
|
|
|
+ ldr r2, =RCC_BASE //RCC
|
|
|
movs r1, #0x01
|
|
movs r1, #0x01
|
|
|
lsls r3, r1, #23 //USBEN or USBRST
|
|
lsls r3, r1, #23 //USBEN or USBRST
|
|
|
cbz r0, .L_disable
|
|
cbz r0, .L_disable
|
|
@@ -274,7 +274,7 @@ _enable:
|
|
|
orrs r0, r1
|
|
orrs r0, r1
|
|
|
str r0, [r2, #RCC_APB2ENR]
|
|
str r0, [r2, #RCC_APB2ENR]
|
|
|
#endif
|
|
#endif
|
|
|
- ldr r1, =#USB_REGBASE
|
|
|
|
|
|
|
+ ldr r1, =USB_REGBASE
|
|
|
ldr r0, [r2, #RCC_APB1ENR]
|
|
ldr r0, [r2, #RCC_APB1ENR]
|
|
|
orrs r0, r3
|
|
orrs r0, r3
|
|
|
str r0, [r2, #RCC_APB1ENR] //RCC->APB1ENR |= USBEN
|
|
str r0, [r2, #RCC_APB1ENR] //RCC->APB1ENR |= USBEN
|
|
@@ -309,13 +309,13 @@ _enable:
|
|
|
.type _getinfo, %function
|
|
.type _getinfo, %function
|
|
|
_getinfo:
|
|
_getinfo:
|
|
|
movs r0, #0
|
|
movs r0, #0
|
|
|
- ldr r2, =#RCC_BASE
|
|
|
|
|
|
|
+ ldr r2, =RCC_BASE
|
|
|
ldr r1, [r2, #RCC_APB1ENR]
|
|
ldr r1, [r2, #RCC_APB1ENR]
|
|
|
lsrs r1, #24 //USBEN -> CF
|
|
lsrs r1, #24 //USBEN -> CF
|
|
|
bcc .L_getinfo_end
|
|
bcc .L_getinfo_end
|
|
|
adds r0, #USBD_HW_ENABLED
|
|
adds r0, #USBD_HW_ENABLED
|
|
|
#if defined(USBD_DP_PORT) && defined(USBD_DP_PIN)
|
|
#if defined(USBD_DP_PORT) && defined(USBD_DP_PIN)
|
|
|
- ldr r2, =#USBD_DP_PORT
|
|
|
|
|
|
|
+ ldr r2, =USBD_DP_PORT
|
|
|
ldr r1, [r2, #GPIO_IDR]
|
|
ldr r1, [r2, #GPIO_IDR]
|
|
|
lsrs r1, #USBD_DP_PIN //USBD_DP_PIN -> CF
|
|
lsrs r1, #USBD_DP_PIN //USBD_DP_PIN -> CF
|
|
|
bcc .L_getinfo_end
|
|
bcc .L_getinfo_end
|
|
@@ -335,7 +335,7 @@ _ep_setstall:
|
|
|
push {r4, lr}
|
|
push {r4, lr}
|
|
|
lsls r2, r0, #28
|
|
lsls r2, r0, #28
|
|
|
lsrs r2, #26
|
|
lsrs r2, #26
|
|
|
- ldr r3, =#USB_EPBASE
|
|
|
|
|
|
|
+ ldr r3, =USB_EPBASE
|
|
|
adds r3, r2 // epr -> r3
|
|
adds r3, r2 // epr -> r3
|
|
|
movs r2, 0x30 // TX_STAT_MASK -> r2
|
|
movs r2, 0x30 // TX_STAT_MASK -> r2
|
|
|
ldrh r4, [r3]
|
|
ldrh r4, [r3]
|
|
@@ -346,25 +346,25 @@ _ep_setstall:
|
|
|
cmp r0, #0x80
|
|
cmp r0, #0x80
|
|
|
blo .L_eps_rx
|
|
blo .L_eps_rx
|
|
|
.L_eps_tx:
|
|
.L_eps_tx:
|
|
|
- ldr r0, =#TX_STALL //stall TX
|
|
|
|
|
|
|
+ ldr r0, =TX_STALL //stall TX
|
|
|
cmp r1, #0x00
|
|
cmp r1, #0x00
|
|
|
bne .L_eps_reg_set
|
|
bne .L_eps_reg_set
|
|
|
.L_eps_tx_unstall:
|
|
.L_eps_tx_unstall:
|
|
|
- ldr r0, =#DTX_USTALL //unstall dblbulk or iso TX (VALID and clr DTOG_TX & SWBUF_TX)
|
|
|
|
|
|
|
+ ldr r0, =DTX_USTALL //unstall dblbulk or iso TX (VALID and clr DTOG_TX & SWBUF_TX)
|
|
|
cmp r4, #0x01 // if doublebuffered bulk endpoint
|
|
cmp r4, #0x01 // if doublebuffered bulk endpoint
|
|
|
beq .L_eps_reg_set
|
|
beq .L_eps_reg_set
|
|
|
- ldr r0, =#TX_USTALL // unstall other TX (NAKED + clr DTOG_TX)
|
|
|
|
|
|
|
+ ldr r0, =TX_USTALL // unstall other TX (NAKED + clr DTOG_TX)
|
|
|
b .L_eps_reg_set
|
|
b .L_eps_reg_set
|
|
|
.L_eps_rx:
|
|
.L_eps_rx:
|
|
|
lsls r2, #8 // RX_STAT_MASK -> R2
|
|
lsls r2, #8 // RX_STAT_MASK -> R2
|
|
|
- ldr r0,=#RX_STALL //stall RX
|
|
|
|
|
|
|
+ ldr r0,=RX_STALL //stall RX
|
|
|
cmp r1, #0x00
|
|
cmp r1, #0x00
|
|
|
bne .L_eps_reg_set
|
|
bne .L_eps_reg_set
|
|
|
.L_eps_rx_unstall:
|
|
.L_eps_rx_unstall:
|
|
|
- ldr r0, =#DRX_USTALL //unstall dblbulk or iso (VALID. clr DTOG_RX set SWBUF_RX)
|
|
|
|
|
|
|
+ ldr r0, =DRX_USTALL //unstall dblbulk or iso (VALID. clr DTOG_RX set SWBUF_RX)
|
|
|
cmp r4, #0x01 // if dblbulk
|
|
cmp r4, #0x01 // if dblbulk
|
|
|
beq .L_eps_reg_set
|
|
beq .L_eps_reg_set
|
|
|
- ldr r0, =#RX_USTALL // unstall other RX (VALID + clr
|
|
|
|
|
|
|
+ ldr r0, =RX_USTALL // unstall other RX (VALID + clr
|
|
|
/* R0 - mask and toggle bits
|
|
/* R0 - mask and toggle bits
|
|
|
* R2 - mask for STAT bits
|
|
* R2 - mask for STAT bits
|
|
|
* R3 - endpoint register pointer
|
|
* R3 - endpoint register pointer
|
|
@@ -386,7 +386,7 @@ _ep_setstall:
|
|
|
.type _ep_isstalled, %function
|
|
.type _ep_isstalled, %function
|
|
|
/* bool ep_isstalled(uint8t ep) */
|
|
/* bool ep_isstalled(uint8t ep) */
|
|
|
_ep_isstalled:
|
|
_ep_isstalled:
|
|
|
- ldr r1, =#USB_EPBASE
|
|
|
|
|
|
|
+ ldr r1, =USB_EPBASE
|
|
|
lsls r2, r0, #28
|
|
lsls r2, r0, #28
|
|
|
lsrs r2, #26
|
|
lsrs r2, #26
|
|
|
ldr r1, [r1, r2]
|
|
ldr r1, [r1, r2]
|
|
@@ -414,8 +414,8 @@ _ep_isstalled:
|
|
|
*/
|
|
*/
|
|
|
_ep_read:
|
|
_ep_read:
|
|
|
push {r4, r5, r6, lr}
|
|
push {r4, r5, r6, lr}
|
|
|
- ldr r3, =#USB_EPBASE
|
|
|
|
|
- ldr r6, =#USB_PMABASE
|
|
|
|
|
|
|
+ ldr r3, =USB_EPBASE
|
|
|
|
|
+ ldr r6, =USB_PMABASE
|
|
|
lsls r0, #28
|
|
lsls r0, #28
|
|
|
add r3, r3, r0, LSR #26 //*EPR -> R3
|
|
add r3, r3, r0, LSR #26 //*EPR -> R3
|
|
|
add r4, r6, r0, LSR (28 - EPT_SHIFT) //*EPT -> R4
|
|
add r4, r6, r0, LSR (28 - EPT_SHIFT) //*EPT -> R4
|
|
@@ -441,7 +441,7 @@ _ep_read:
|
|
|
eors r0, r5, r5, LSR #8
|
|
eors r0, r5, r5, LSR #8
|
|
|
lsrs r0, #7 // SW_RX ^ DTOG_RX -> CF
|
|
lsrs r0, #7 // SW_RX ^ DTOG_RX -> CF
|
|
|
bcs .L_epr_notog // jmp if SW_RX != DTOG_RX (VALID)
|
|
bcs .L_epr_notog // jmp if SW_RX != DTOG_RX (VALID)
|
|
|
- ldr r0, =#EP_NOTOG
|
|
|
|
|
|
|
+ ldr r0, =EP_NOTOG
|
|
|
ands r5, r0
|
|
ands r5, r0
|
|
|
adds r5, #EP_RX_SWBUF
|
|
adds r5, #EP_RX_SWBUF
|
|
|
strh r5, [r3] // toggling SW_RX
|
|
strh r5, [r3] // toggling SW_RX
|
|
@@ -459,7 +459,6 @@ _ep_read:
|
|
|
strh r5, [r4, #RXCOUNT]
|
|
strh r5, [r4, #RXCOUNT]
|
|
|
eors r0, r5 // r0 &= 0x3FF (RX count)
|
|
eors r0, r5 // r0 &= 0x3FF (RX count)
|
|
|
ldrh r5, [r4, #RXADDR]
|
|
ldrh r5, [r4, #RXADDR]
|
|
|
-// ldr r4, =USB_PMABASE
|
|
|
|
|
adds r5, r4, r5, LSL (EPT_SHIFT - 3)
|
|
adds r5, r4, r5, LSL (EPT_SHIFT - 3)
|
|
|
cmp r2, r0
|
|
cmp r2, r0
|
|
|
blo .L_epr_read
|
|
blo .L_epr_read
|
|
@@ -484,7 +483,7 @@ _ep_read:
|
|
|
beq .L_epr_exit // ep is iso. no needs to set it to valid
|
|
beq .L_epr_exit // ep is iso. no needs to set it to valid
|
|
|
cmp r1, #0x01
|
|
cmp r1, #0x01
|
|
|
beq .L_epr_exit // ep is dblbulk. no needs to set it to valid
|
|
beq .L_epr_exit // ep is dblbulk. no needs to set it to valid
|
|
|
- ldr r2, =#TGL_SET(EP_RX_STAT , EP_RX_VAL)
|
|
|
|
|
|
|
+ ldr r2, =TGL_SET(EP_RX_STAT , EP_RX_VAL)
|
|
|
eors r5, r2
|
|
eors r5, r2
|
|
|
and r5, r5, r2, LSR #16
|
|
and r5, r5, r2, LSR #16
|
|
|
strh r5, [r3] // set ep to VALID state
|
|
strh r5, [r3] // set ep to VALID state
|
|
@@ -503,8 +502,8 @@ _ep_read:
|
|
|
*/
|
|
*/
|
|
|
_ep_write:
|
|
_ep_write:
|
|
|
push {r4, r5, r6, lr}
|
|
push {r4, r5, r6, lr}
|
|
|
- ldr r3, =#USB_EPBASE
|
|
|
|
|
- ldr r6, =#USB_PMABASE
|
|
|
|
|
|
|
+ ldr r3, =USB_EPBASE
|
|
|
|
|
+ ldr r6, =USB_PMABASE
|
|
|
lsls r0, #28
|
|
lsls r0, #28
|
|
|
add r3, r3, r0, LSR #26 //*EPR -> R3
|
|
add r3, r3, r0, LSR #26 //*EPR -> R3
|
|
|
add r4, r6, r0, LSR (28 - EPT_SHIFT) //*EPT -> R4
|
|
add r4, r6, r0, LSR (28 - EPT_SHIFT) //*EPT -> R4
|
|
@@ -555,10 +554,10 @@ _ep_write:
|
|
|
lsrs r1, #29
|
|
lsrs r1, #29
|
|
|
cmp r1, #0x04
|
|
cmp r1, #0x04
|
|
|
beq .L_epw_exit // isochronous ep. do nothing
|
|
beq .L_epw_exit // isochronous ep. do nothing
|
|
|
- ldr r2, =#TGL_SET(EP_TX_STAT, EP_TX_VAL)
|
|
|
|
|
|
|
+ ldr r2, =TGL_SET(EP_TX_STAT, EP_TX_VAL)
|
|
|
cmp r1, #0x01
|
|
cmp r1, #0x01
|
|
|
bne .L_epw_setstate // NOT a doublebuffered bulk
|
|
bne .L_epw_setstate // NOT a doublebuffered bulk
|
|
|
- ldr r2, =#TGL_SET(EP_TX_SWBUF, EP_TX_SWBUF)
|
|
|
|
|
|
|
+ ldr r2, =TGL_SET(EP_TX_SWBUF, EP_TX_SWBUF)
|
|
|
bics r5, r2 // clear TX_SWBUF
|
|
bics r5, r2 // clear TX_SWBUF
|
|
|
.L_epw_setstate:
|
|
.L_epw_setstate:
|
|
|
eors r5, r2
|
|
eors r5, r2
|
|
@@ -577,8 +576,8 @@ _ep_write:
|
|
|
_get_next_pma:
|
|
_get_next_pma:
|
|
|
push {r1, r3, r4, lr}
|
|
push {r1, r3, r4, lr}
|
|
|
movs r1, #16
|
|
movs r1, #16
|
|
|
- ldr r3, =#USB_PMASZ
|
|
|
|
|
- ldr r0, =#USB_PMABASE
|
|
|
|
|
|
|
+ ldr r3, =USB_PMASZ
|
|
|
|
|
+ ldr r0, =USB_PMABASE
|
|
|
.L_gnp_chkaddr:
|
|
.L_gnp_chkaddr:
|
|
|
ldrh r4, [r0, #0] //txaddr
|
|
ldrh r4, [r0, #0] //txaddr
|
|
|
tst r4, r4
|
|
tst r4, r4
|
|
@@ -628,14 +627,14 @@ _ep_config:
|
|
|
ands r4, r0
|
|
ands r4, r0
|
|
|
orrs r3, r4
|
|
orrs r3, r4
|
|
|
lsls r4, #2
|
|
lsls r4, #2
|
|
|
- ldr r5, =#USB_EPBASE
|
|
|
|
|
|
|
+ ldr r5, =USB_EPBASE
|
|
|
strh r3, [r5, r4] //setup EPTYPE EPKIND EPADDR
|
|
strh r3, [r5, r4] //setup EPTYPE EPKIND EPADDR
|
|
|
cmp r1, #0x00 // is a control ep ?
|
|
cmp r1, #0x00 // is a control ep ?
|
|
|
beq .L_epc_setuptx
|
|
beq .L_epc_setuptx
|
|
|
cmp r0, #0x80
|
|
cmp r0, #0x80
|
|
|
blo .L_epc_setuprx
|
|
blo .L_epc_setuprx
|
|
|
.L_epc_setuptx:
|
|
.L_epc_setuptx:
|
|
|
- ldr r5, =#USB_PMABASE
|
|
|
|
|
|
|
+ ldr r5, =USB_PMABASE
|
|
|
adds r5, r5, r4, LSL (EPT_SHIFT - 2)
|
|
adds r5, r5, r4, LSL (EPT_SHIFT - 2)
|
|
|
bl _get_next_pma
|
|
bl _get_next_pma
|
|
|
bcc .L_epc_fail
|
|
bcc .L_epc_fail
|
|
@@ -644,18 +643,18 @@ _ep_config:
|
|
|
strh r0, [r5, #TXCOUNT] //store txcnt
|
|
strh r0, [r5, #TXCOUNT] //store txcnt
|
|
|
cmp r1, #0x06 // is DBLBULK
|
|
cmp r1, #0x06 // is DBLBULK
|
|
|
beq .L_epc_txdbl
|
|
beq .L_epc_txdbl
|
|
|
- ldr r3, =#TX_USTALL //set state NAKED , clr DTOG_TX
|
|
|
|
|
|
|
+ ldr r3, =TX_USTALL //set state NAKED , clr DTOG_TX
|
|
|
cmp r1, #0x01 // is ISO
|
|
cmp r1, #0x01 // is ISO
|
|
|
bne .L_epc_txsetstate //
|
|
bne .L_epc_txsetstate //
|
|
|
.L_epc_txdbl:
|
|
.L_epc_txdbl:
|
|
|
- ldr r3, =#DTX_USTALL //set state VALID clr DTOG_TX & SWBUF_TX
|
|
|
|
|
|
|
+ ldr r3, =DTX_USTALL //set state VALID clr DTOG_TX & SWBUF_TX
|
|
|
bl _get_next_pma
|
|
bl _get_next_pma
|
|
|
bcc .L_epc_fail
|
|
bcc .L_epc_fail
|
|
|
strh r0, [r5, #TXADDR1] //store txaddr1
|
|
strh r0, [r5, #TXADDR1] //store txaddr1
|
|
|
movs r0, #0x00
|
|
movs r0, #0x00
|
|
|
strh r0, [r5, #TXCOUNT1] //store txcnt
|
|
strh r0, [r5, #TXCOUNT1] //store txcnt
|
|
|
.L_epc_txsetstate:
|
|
.L_epc_txsetstate:
|
|
|
- ldr r5, =#USB_EPBASE
|
|
|
|
|
|
|
+ ldr r5, =USB_EPBASE
|
|
|
ldrh r0, [r5, r4]
|
|
ldrh r0, [r5, r4]
|
|
|
eors r0, r3
|
|
eors r0, r3
|
|
|
lsrs r3, #16
|
|
lsrs r3, #16
|
|
@@ -674,14 +673,14 @@ _ep_config:
|
|
|
adds r3, #0x3E
|
|
adds r3, #0x3E
|
|
|
.L_epc_rxbb:
|
|
.L_epc_rxbb:
|
|
|
lsls r3, #9
|
|
lsls r3, #9
|
|
|
- ldr r5, =#USB_PMABASE
|
|
|
|
|
|
|
+ ldr r5, =USB_PMABASE
|
|
|
adds r5, r5, r4, LSL (EPT_SHIFT - 2)
|
|
adds r5, r5, r4, LSL (EPT_SHIFT - 2)
|
|
|
/* RX or RX1 */
|
|
/* RX or RX1 */
|
|
|
bl _get_next_pma
|
|
bl _get_next_pma
|
|
|
bcc .L_epc_fail
|
|
bcc .L_epc_fail
|
|
|
strh r0, [r5, #RXADDR]
|
|
strh r0, [r5, #RXADDR]
|
|
|
strh r3, [r5, #RXCOUNT]
|
|
strh r3, [r5, #RXCOUNT]
|
|
|
- ldr r0, =#RX_USTALL
|
|
|
|
|
|
|
+ ldr r0, =RX_USTALL
|
|
|
/* check if doublebuffered */
|
|
/* check if doublebuffered */
|
|
|
cmp r1, 0x06 //if dblbulk
|
|
cmp r1, 0x06 //if dblbulk
|
|
|
beq .L_epc_rxdbl
|
|
beq .L_epc_rxdbl
|
|
@@ -692,9 +691,9 @@ _ep_config:
|
|
|
bcc .L_epc_fail
|
|
bcc .L_epc_fail
|
|
|
strh r0, [r5, #RXADDR0] //store rxaddr0
|
|
strh r0, [r5, #RXADDR0] //store rxaddr0
|
|
|
strh r3, [r5, #RXCOUNT0] //store rxcnt0
|
|
strh r3, [r5, #RXCOUNT0] //store rxcnt0
|
|
|
- ldr r0, =#DRX_USTALL
|
|
|
|
|
|
|
+ ldr r0, =DRX_USTALL
|
|
|
.L_epc_rxsetstate:
|
|
.L_epc_rxsetstate:
|
|
|
- ldr r5, =#USB_EPBASE
|
|
|
|
|
|
|
+ ldr r5, =USB_EPBASE
|
|
|
ldrh r3, [r5, r4]
|
|
ldrh r3, [r5, r4]
|
|
|
eors r3, r0
|
|
eors r3, r0
|
|
|
lsrs r0, #16
|
|
lsrs r0, #16
|
|
@@ -719,12 +718,12 @@ _ep_config:
|
|
|
_ep_deconfig:
|
|
_ep_deconfig:
|
|
|
lsls r1, r0, #28
|
|
lsls r1, r0, #28
|
|
|
lsrs r1, #26
|
|
lsrs r1, #26
|
|
|
- ldr r2, =#USB_EPBASE
|
|
|
|
|
- ldr r3, =#USB_PMABASE
|
|
|
|
|
|
|
+ ldr r2, =USB_EPBASE
|
|
|
|
|
+ ldr r3, =USB_PMABASE
|
|
|
adds r2, r1
|
|
adds r2, r1
|
|
|
adds r3, r3, r1, LSL (EPT_SHIFT - 2)
|
|
adds r3, r3, r1, LSL (EPT_SHIFT - 2)
|
|
|
/* clearing endpoint register */
|
|
/* clearing endpoint register */
|
|
|
- ldr r1, =#EP_NOTOG
|
|
|
|
|
|
|
+ ldr r1, =EP_NOTOG
|
|
|
ldrh r0, [r2]
|
|
ldrh r0, [r2]
|
|
|
bics r0, r1
|
|
bics r0, r1
|
|
|
strh r0, [r2]
|
|
strh r0, [r2]
|
|
@@ -750,7 +749,7 @@ _ep_deconfig:
|
|
|
/*void evt_poll(usbd_device *dev, usbd_evt_callback callback)*/
|
|
/*void evt_poll(usbd_device *dev, usbd_evt_callback callback)*/
|
|
|
_evt_poll:
|
|
_evt_poll:
|
|
|
push {r0, r1, r4, r5}
|
|
push {r0, r1, r4, r5}
|
|
|
- ldr r3, =#USB_REGBASE
|
|
|
|
|
|
|
+ ldr r3, =USB_REGBASE
|
|
|
ldrh r0, [r3, #4] //USB->ISTR -> R2
|
|
ldrh r0, [r3, #4] //USB->ISTR -> R2
|
|
|
/* ep_index -> R2 */
|
|
/* ep_index -> R2 */
|
|
|
movs r2, 0x07
|
|
movs r2, 0x07
|
|
@@ -776,7 +775,7 @@ _evt_poll:
|
|
|
|
|
|
|
|
.L_ep_ctrm:
|
|
.L_ep_ctrm:
|
|
|
movs r5, #0x80 // CTR_TX mask to R5
|
|
movs r5, #0x80 // CTR_TX mask to R5
|
|
|
- ldr r0,=#USB_EPBASE
|
|
|
|
|
|
|
+ ldr r0,=USB_EPBASE
|
|
|
add r0, r0, r2, LSL #2 // R0 ep register address
|
|
add r0, r0, r2, LSL #2 // R0 ep register address
|
|
|
ldrh r4, [r0] // R4 EPR valur
|
|
ldrh r4, [r0] // R4 EPR valur
|
|
|
lsrs r3, r4, #8 // CTR_TX -> CF
|
|
lsrs r3, r4, #8 // CTR_TX -> CF
|
|
@@ -794,7 +793,7 @@ _evt_poll:
|
|
|
movs r1, #usbd_evt_epsetup
|
|
movs r1, #usbd_evt_epsetup
|
|
|
.L_ep_clr_ctr:
|
|
.L_ep_clr_ctr:
|
|
|
bics r4, r5 //clear CTR flag
|
|
bics r4, r5 //clear CTR flag
|
|
|
- ldr r5, =#EP_NOTOG
|
|
|
|
|
|
|
+ ldr r5, =EP_NOTOG
|
|
|
ands r4, r5
|
|
ands r4, r5
|
|
|
strh r4, [r0] // store
|
|
strh r4, [r0] // store
|
|
|
b .L_ep_callback
|
|
b .L_ep_callback
|
|
@@ -829,9 +828,9 @@ _evt_poll:
|
|
|
/* do reset routine */
|
|
/* do reset routine */
|
|
|
.L_ep_resetm:
|
|
.L_ep_resetm:
|
|
|
movs r1, #7
|
|
movs r1, #7
|
|
|
- ldr r2, =#USB_EPBASE
|
|
|
|
|
- ldr r0, =#USB_PMABASE
|
|
|
|
|
- ldr r5, =#EP_NOTOG
|
|
|
|
|
|
|
+ ldr r2, =USB_EPBASE
|
|
|
|
|
+ ldr r0, =USB_PMABASE
|
|
|
|
|
+ ldr r5, =EP_NOTOG
|
|
|
.L_ep_reset_loop:
|
|
.L_ep_reset_loop:
|
|
|
ldrh r4, [r2]
|
|
ldrh r4, [r2]
|
|
|
bics r4, r5
|
|
bics r4, r5
|