summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-11-26 11:44:05 +0700
committerGitHub <[email protected]>2018-11-26 11:44:05 +0700
commit4ec7dba453d414d0c0c67c6f5bab5a9ca9eba388 (patch)
tree9d13e00d699168d4681617925fac8e102ccb1495 /src
parent3bb53273cd3770328f55ba317af3df0cce4333c1 (diff)
parent61bea0db1c645324a44b37327d6630ab85d40f39 (diff)
Merge pull request #15 from tannewt/makefile
Add Makefile support for the cdc_msc_hid example
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;