summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Shawcroft <[email protected]>2018-11-24 10:55:51 -0800
committerScott Shawcroft <[email protected]>2018-11-25 11:46:06 -0800
commitbf70f89240de82b6a1a64909d96f582041db1148 (patch)
tree67cc01324cc69f5a4f68e98a3da986fda828c3b0 /src
parent3bb53273cd3770328f55ba317af3df0cce4333c1 (diff)
Introduce a Makefile for the OS_NONE device example
It currently supports the SAMD21 and SAMD51 only. More will be added later.
Diffstat (limited to 'src')
-rw-r--r--src/portable/microchip/samd21/dcd_samd21.c7
-rw-r--r--src/portable/microchip/samd21/hal_samd21.c5
-rw-r--r--src/portable/microchip/samd51/dcd_samd51.c6
-rw-r--r--src/portable/microchip/samd51/hal_samd51.c5
4 files changed, 10 insertions, 13 deletions
diff --git a/src/portable/microchip/samd21/dcd_samd21.c b/src/portable/microchip/samd21/dcd_samd21.c
index c2464d6b0..dda75cee8 100644
--- a/src/portable/microchip/samd21/dcd_samd21.c
+++ b/src/portable/microchip/samd21/dcd_samd21.c
@@ -71,13 +71,6 @@ static void bus_reset(void) {
*------------------------------------------------------------------*/
bool dcd_init (uint8_t rhport)
{
- // Reset to get in a clean state.
- USB->DEVICE.CTRLA.bit.SWRST = true;
- while (USB->DEVICE.SYNCBUSY.bit.SWRST == 0) {
-
- }
- while (USB->DEVICE.SYNCBUSY.bit.SWRST == 1) {}
-
(void) rhport;
USB->DEVICE.DESCADD.reg = (uint32_t) &sram_registers;
USB->DEVICE.CTRLB.reg = USB_DEVICE_CTRLB_SPDCONF_FS;
diff --git a/src/portable/microchip/samd21/hal_samd21.c b/src/portable/microchip/samd21/hal_samd21.c
index 0df8cfb9d..9f04630ea 100644
--- a/src/portable/microchip/samd21/hal_samd21.c
+++ b/src/portable/microchip/samd21/hal_samd21.c
@@ -50,6 +50,11 @@
*------------------------------------------------------------------*/
bool tusb_hal_init(void)
{
+ // Reset to get in a clean state.
+ USB->DEVICE.CTRLA.bit.SWRST = true;
+ while (USB->DEVICE.SYNCBUSY.bit.SWRST == 0) {}
+ while (USB->DEVICE.SYNCBUSY.bit.SWRST == 1) {}
+
USB->DEVICE.PADCAL.bit.TRANSP = (*((uint32_t*) USB_FUSES_TRANSP_ADDR) & USB_FUSES_TRANSP_Msk) >> USB_FUSES_TRANSP_Pos;
USB->DEVICE.PADCAL.bit.TRANSN = (*((uint32_t*) USB_FUSES_TRANSN_ADDR) & USB_FUSES_TRANSN_Msk) >> USB_FUSES_TRANSN_Pos;
USB->DEVICE.PADCAL.bit.TRIM = (*((uint32_t*) USB_FUSES_TRIM_ADDR) & USB_FUSES_TRIM_Msk) >> USB_FUSES_TRIM_Pos;
diff --git a/src/portable/microchip/samd51/dcd_samd51.c b/src/portable/microchip/samd51/dcd_samd51.c
index e53a8641f..e76b5a1fa 100644
--- a/src/portable/microchip/samd51/dcd_samd51.c
+++ b/src/portable/microchip/samd51/dcd_samd51.c
@@ -72,12 +72,6 @@ static void bus_reset(void) {
bool dcd_init (uint8_t rhport)
{
(void) rhport;
- // Reset to get in a clean state.
- USB->DEVICE.CTRLA.bit.SWRST = true;
- while (USB->DEVICE.SYNCBUSY.bit.SWRST == 0) {
-
- }
- while (USB->DEVICE.SYNCBUSY.bit.SWRST == 1) {}
USB->DEVICE.DESCADD.reg = (uint32_t) &sram_registers;
USB->DEVICE.CTRLB.reg = USB_DEVICE_CTRLB_SPDCONF_FS;
diff --git a/src/portable/microchip/samd51/hal_samd51.c b/src/portable/microchip/samd51/hal_samd51.c
index 775c29001..49212b74c 100644
--- a/src/portable/microchip/samd51/hal_samd51.c
+++ b/src/portable/microchip/samd51/hal_samd51.c
@@ -49,6 +49,11 @@
*------------------------------------------------------------------*/
bool tusb_hal_init(void)
{
+ // Reset to get in a clean state.
+ USB->DEVICE.CTRLA.bit.SWRST = true;
+ while (USB->DEVICE.SYNCBUSY.bit.SWRST == 0) {}
+ while (USB->DEVICE.SYNCBUSY.bit.SWRST == 1) {}
+
USB->DEVICE.PADCAL.bit.TRANSP = (*((uint32_t*) USB_FUSES_TRANSP_ADDR) & USB_FUSES_TRANSP_Msk) >> USB_FUSES_TRANSP_Pos;
USB->DEVICE.PADCAL.bit.TRANSN = (*((uint32_t*) USB_FUSES_TRANSN_ADDR) & USB_FUSES_TRANSN_Msk) >> USB_FUSES_TRANSN_Pos;
USB->DEVICE.PADCAL.bit.TRIM = (*((uint32_t*) USB_FUSES_TRIM_ADDR) & USB_FUSES_TRIM_Msk) >> USB_FUSES_TRIM_Pos;