git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4565 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2012-08-14 06:58:24 +00:00
parent 55f4744930
commit 56dafb8295
2 changed files with 16 additions and 7 deletions

View File

@ -138,6 +138,7 @@ static void otg_disable_ep(void) {
OTG->oe[i].DOEPTSIZ = 0;
OTG->oe[i].DOEPINT = 0xFFFFFFFF;
}
OTG->DAINTMSK = DAINTMSK_OEPM(0) | DAINTMSK_IEPM(0);
}
static void otg_rxfifo_flush(void) {
@ -699,7 +700,10 @@ void usb_lld_start(USBDriver *usbp) {
void usb_lld_stop(USBDriver *usbp) {
/* If in ready state then disables the USB clock.*/
if (usbp->state == USB_STOP) {
if (usbp->state != USB_STOP) {
OTG->DAINTMSK = 0;
OTG->GCCFG = 0;
#if STM32_USB_USE_USB1
if (&USBD1 == usbp) {
nvicDisableVector(STM32_OTG1_NUMBER);
@ -707,7 +711,6 @@ void usb_lld_stop(USBDriver *usbp) {
}
#endif
}
OTG->GCCFG = 0;
}
/**
@ -809,10 +812,14 @@ void usb_lld_init_endpoint(USBDriver *usbp, usbep_t ep) {
/* OUT endpoint activation or deactivation.*/
OTG->oe[ep].DOEPTSIZ = 0;
if (usbp->epc[ep]->out_cb != NULL)
if (usbp->epc[ep]->out_cb != NULL) {
OTG->oe[ep].DOEPCTL = ctl | DOEPCTL_MPSIZ(usbp->epc[ep]->out_maxsize);
else
OTG->DAINTMSK |= DAINTMSK_OEPM(ep);
}
else {
OTG->oe[ep].DOEPCTL &= ~DOEPCTL_USBAEP;
OTG->DAINTMSK &= ~DAINTMSK_OEPM(ep);
}
/* IN endpoint activation or deactivation.*/
OTG->ie[ep].DIEPTSIZ = 0;
@ -828,11 +835,13 @@ void usb_lld_init_endpoint(USBDriver *usbp, usbep_t ep) {
OTG->ie[ep].DIEPCTL = ctl |
DIEPCTL_TXFNUM(ep) |
DIEPCTL_MPSIZ(usbp->epc[ep]->in_maxsize);
OTG->DAINTMSK |= DAINTMSK_IEPM(ep);
}
else {
OTG->DIEPTXF[ep - 1] = 0x02000400; /* Reset value.*/
otg_txfifo_flush(ep);
OTG->ie[ep].DIEPCTL &= ~DIEPCTL_USBAEP;
OTG->DAINTMSK &= ~DAINTMSK_IEPM(ep);
}
}

View File

@ -394,7 +394,7 @@ static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) {
chThdWait(tp);
}
static void cmd_usbblast(BaseSequentialStream *chp, int argc, char *argv[]) {
static void cmd_write(BaseSequentialStream *chp, int argc, char *argv[]) {
static uint8_t buf[] =
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
@ -431,7 +431,7 @@ static void cmd_usbblast(BaseSequentialStream *chp, int argc, char *argv[]) {
(void)argv;
if (argc > 0) {
chprintf(chp, "Usage: usbblast\r\n");
chprintf(chp, "Usage: write\r\n");
return;
}
@ -445,7 +445,7 @@ static const ShellCommand commands[] = {
{"mem", cmd_mem},
{"threads", cmd_threads},
{"test", cmd_test},
{"usbblast", cmd_usbblast},
{"write", cmd_write},
{NULL, NULL}
};