Skip to content

Commit

Permalink
sn32: usb hal cleanup (#42)
Browse files Browse the repository at this point in the history
* import helper header

* seperate usb buf init

* move usb init in chibios driver
handle the address set in a more elegant way

* clean up some code
move through sn32_usb
use macros for ep dir

* handle the setup interrupt

* report back the frame no
wake up directly

* further deviate from usbhw.c
call registers directly
use chibios for reset
interrupt party time

* flag update

* switch n/ack to simple macros

* even more native

* bye sonix mess

* bring functions up to the docs

* usb stop, setup error handling

* further cleanup

remove dead code
cleanup headers
add missing connect/dc functionality
bring ep0 init to platform correct

* usb restart is now working

* attempt to fix wakeup

* no more delay on init

* fix the usb wakeup

* improve the wakeup

* make sure the direction is not set before init

* only mess with one ep

* need to enable the bus override too in order to control it

* driver block checks

* allow wakeup time override

* dynamic sram allocation

* remove useless ep naming

* testing: remove packet limits

* guard all i/o ops

* better wakeup/suspend handling

* remove dead code

* code cleanup

* make sure all ep's are handled
  • Loading branch information
dexter93 authored Mar 3, 2022
1 parent d5e4fb2 commit ff55126
Show file tree
Hide file tree
Showing 10 changed files with 475 additions and 974 deletions.
4 changes: 0 additions & 4 deletions os/hal/boards/SN_SN32F240B/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,3 @@ void boardInit(void) {
SN_SYS0->EXRSTCTRL_b.RESETDIS = 1; // Disable RESET
SN_SYS0->SWDCTRL_b.SWDDIS = 1; // Disable SWD
}

void restart_usb_driver(USBDriver *usbp) {
// Do nothing. Restarting the USB driver on these boards breaks it.
}
4 changes: 0 additions & 4 deletions os/hal/boards/SN_SN32F260/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,3 @@ void __early_init(void) {
void boardInit(void) {
SN_SYS0->SWDCTRL_b.SWDDIS = 1; // Disable SWD
}

void restart_usb_driver(USBDriver *usbp) {
// Do nothing. Restarting the USB driver on these boards breaks it.
}
4 changes: 0 additions & 4 deletions os/hal/boards/SN_SN32F280/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,3 @@ void boardInit(void) {
SN_SYS0->EXRSTCTRL_b.RESETDIS = 1; // Disable RESET
SN_SYS0->SWDCTRL_b.SWDDIS = 1; // Disable SWD
}

void restart_usb_driver(USBDriver *usbp) {
// Do nothing. Restarting the USB driver on these boards breaks it.
}
4 changes: 0 additions & 4 deletions os/hal/boards/SN_SN32F290/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,3 @@ void boardInit(void) {
SN_SYS0->EXRSTCTRL_b.RESETDIS = 1; // Disable RESET
SN_SYS0->SWDCTRL_b.SWDDIS = 1; // Disable SWD
}

void restart_usb_driver(USBDriver *usbp) {
// Do nothing. Restarting the USB driver on these boards breaks it.
}
1 change: 0 additions & 1 deletion os/hal/ports/SN32/LLD/SN32F2xx/USB/driver.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
PLATFORMSRC += $(CHIBIOS_CONTRIB)/os/hal/ports/SN32/LLD/SN32F2xx/USB/hal_usb_lld.c
PLATFORMSRC += $(CHIBIOS_CONTRIB)/os/hal/ports/SN32/LLD/SN32F2xx/USB/usbhw.c

PLATFORMINC += $(CHIBIOS_CONTRIB)/os/hal/ports/SN32/LLD/SN32F2xx/USB
Loading

0 comments on commit ff55126

Please sign in to comment.