Merge pull request #350 from hathach/synopsys-msp430-dcd-disconnect-connect
Synopsys msp430 dcd disconnect connect
This commit is contained in:
commit
19e2eb66c0
|
@ -190,9 +190,6 @@ void dcd_init(uint8_t rhport)
|
||||||
USB_ENUMDONEMSK_M |
|
USB_ENUMDONEMSK_M |
|
||||||
USB_RESETDETMSK_M |
|
USB_RESETDETMSK_M |
|
||||||
USB_DISCONNINTMSK_M;
|
USB_DISCONNINTMSK_M;
|
||||||
|
|
||||||
ESP_LOGV(TAG, "DCD init - Soft CONNECT");
|
|
||||||
USB0.dctl &= ~USB_SFTDISCON_M; // Connect
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dcd_set_address(uint8_t rhport, uint8_t dev_addr)
|
void dcd_set_address(uint8_t rhport, uint8_t dev_addr)
|
||||||
|
@ -216,18 +213,20 @@ void dcd_remote_wakeup(uint8_t rhport)
|
||||||
(void)rhport;
|
(void)rhport;
|
||||||
}
|
}
|
||||||
|
|
||||||
// disconnect by disabling internal pull-up resistor on D+/D-
|
|
||||||
void dcd_disconnect(uint8_t rhport)
|
|
||||||
{
|
|
||||||
USB0.dctl |= USB_SFTDISCON_M;
|
|
||||||
}
|
|
||||||
|
|
||||||
// connect by enabling internal pull-up resistor on D+/D-
|
// connect by enabling internal pull-up resistor on D+/D-
|
||||||
void dcd_connect(uint8_t rhport)
|
void dcd_connect(uint8_t rhport)
|
||||||
{
|
{
|
||||||
|
(void) rhport;
|
||||||
USB0.dctl &= ~USB_SFTDISCON_M;
|
USB0.dctl &= ~USB_SFTDISCON_M;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// disconnect by disabling internal pull-up resistor on D+/D-
|
||||||
|
void dcd_disconnect(uint8_t rhport)
|
||||||
|
{
|
||||||
|
(void) rhport;
|
||||||
|
USB0.dctl |= USB_SFTDISCON_M;
|
||||||
|
}
|
||||||
|
|
||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
/* DCD Endpoint port
|
/* DCD Endpoint port
|
||||||
*------------------------------------------------------------------*/
|
*------------------------------------------------------------------*/
|
||||||
|
|
|
@ -201,6 +201,18 @@ void dcd_remote_wakeup(uint8_t rhport)
|
||||||
DEV_WAKEUP(usbdev);
|
DEV_WAKEUP(usbdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0 // TODO implement for Spresense
|
||||||
|
void dcd_connect(uint8_t rhport)
|
||||||
|
{
|
||||||
|
(void) rhport;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dcd_disconnect(uint8_t rhport)
|
||||||
|
{
|
||||||
|
(void) rhport;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// Endpoint API
|
// Endpoint API
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
|
|
@ -209,10 +209,6 @@ void dcd_init (uint8_t rhport)
|
||||||
|
|
||||||
// Enable USB transceiver.
|
// Enable USB transceiver.
|
||||||
USB_OTG_FS->GCCFG |= USB_OTG_GCCFG_PWRDWN;
|
USB_OTG_FS->GCCFG |= USB_OTG_GCCFG_PWRDWN;
|
||||||
|
|
||||||
// Soft Connect -> Enable pullup on D+/D-.
|
|
||||||
// This step does not appear to be specified in the programmer's model.
|
|
||||||
dev->DCTL &= ~USB_OTG_DCTL_SDIS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dcd_int_enable (uint8_t rhport)
|
void dcd_int_enable (uint8_t rhport)
|
||||||
|
@ -250,6 +246,23 @@ void dcd_remote_wakeup(uint8_t rhport)
|
||||||
(void) rhport;
|
(void) rhport;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dcd_connect(uint8_t rhport)
|
||||||
|
{
|
||||||
|
(void) rhport;
|
||||||
|
USB_OTG_DeviceTypeDef * dev = DEVICE_BASE;
|
||||||
|
|
||||||
|
dev->DCTL &= ~USB_OTG_DCTL_SDIS;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dcd_disconnect(uint8_t rhport)
|
||||||
|
{
|
||||||
|
(void) rhport;
|
||||||
|
USB_OTG_DeviceTypeDef * dev = DEVICE_BASE;
|
||||||
|
|
||||||
|
dev->DCTL |= USB_OTG_DCTL_SDIS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
/* DCD Endpoint port
|
/* DCD Endpoint port
|
||||||
*------------------------------------------------------------------*/
|
*------------------------------------------------------------------*/
|
||||||
|
|
|
@ -134,9 +134,6 @@ void dcd_init (uint8_t rhport)
|
||||||
// Enable reset and wait for it before continuing.
|
// Enable reset and wait for it before continuing.
|
||||||
USBIE |= RSTRIE;
|
USBIE |= RSTRIE;
|
||||||
|
|
||||||
// Enable pullup.
|
|
||||||
USBCNF |= PUR_EN;
|
|
||||||
|
|
||||||
USBKEYPID = 0;
|
USBKEYPID = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,6 +204,28 @@ void dcd_remote_wakeup(uint8_t rhport)
|
||||||
(void) rhport;
|
(void) rhport;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dcd_connect(uint8_t rhport)
|
||||||
|
{
|
||||||
|
dcd_int_disable(rhport);
|
||||||
|
|
||||||
|
USBKEYPID = USBKEY;
|
||||||
|
USBCNF |= PUR_EN; // Enable pullup.
|
||||||
|
USBKEYPID = 0;
|
||||||
|
|
||||||
|
dcd_int_enable(rhport);
|
||||||
|
}
|
||||||
|
|
||||||
|
void dcd_disconnect(uint8_t rhport)
|
||||||
|
{
|
||||||
|
dcd_int_disable(rhport);
|
||||||
|
|
||||||
|
USBKEYPID = USBKEY;
|
||||||
|
USBCNF &= ~PUR_EN; // Disable pullup.
|
||||||
|
USBKEYPID = 0;
|
||||||
|
|
||||||
|
dcd_int_enable(rhport);
|
||||||
|
}
|
||||||
|
|
||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
/* DCD Endpoint port
|
/* DCD Endpoint port
|
||||||
*------------------------------------------------------------------*/
|
*------------------------------------------------------------------*/
|
||||||
|
|
Loading…
Reference in New Issue