git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4079 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
ca05d68dab
commit
44a66d45ce
|
@ -373,7 +373,7 @@ typedef const USBDescriptor * (*usbgetdescriptor_t)(USBDriver *usbp,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reads from a dedicated packet buffer.
|
* @brief Reads from a dedicated packet buffer.
|
||||||
* @pre In order to use this function he endpoint must have been
|
* @pre In order to use this function the endpoint must have been
|
||||||
* initialized in packet mode.
|
* initialized in packet mode.
|
||||||
* @note This function can be invoked both in thread and IRQ context.
|
* @note This function can be invoked both in thread and IRQ context.
|
||||||
*
|
*
|
||||||
|
@ -393,7 +393,7 @@ typedef const USBDescriptor * (*usbgetdescriptor_t)(USBDriver *usbp,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Writes to a dedicated packet buffer.
|
* @brief Writes to a dedicated packet buffer.
|
||||||
* @pre In order to use this function he endpoint must have been
|
* @pre In order to use this function the endpoint must have been
|
||||||
* initialized in packet mode.
|
* initialized in packet mode.
|
||||||
* @note This function can be invoked both in thread and IRQ context.
|
* @note This function can be invoked both in thread and IRQ context.
|
||||||
*
|
*
|
||||||
|
@ -410,7 +410,7 @@ typedef const USBDescriptor * (*usbgetdescriptor_t)(USBDriver *usbp,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Prepares for a receive transaction on an OUT endpoint.
|
* @brief Prepares for a receive transaction on an OUT endpoint.
|
||||||
* @pre In order to use this function he endpoint must have been
|
* @pre In order to use this function the endpoint must have been
|
||||||
* initialized in transaction mode.
|
* initialized in transaction mode.
|
||||||
* @post The endpoint is ready for @p usbStartReceiveI().
|
* @post The endpoint is ready for @p usbStartReceiveI().
|
||||||
*
|
*
|
||||||
|
@ -426,7 +426,7 @@ typedef const USBDescriptor * (*usbgetdescriptor_t)(USBDriver *usbp,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Prepares for a transmit transaction on an IN endpoint.
|
* @brief Prepares for a transmit transaction on an IN endpoint.
|
||||||
* @pre In order to use this function he endpoint must have been
|
* @pre In order to use this function the endpoint must have been
|
||||||
* initialized in transaction mode.
|
* initialized in transaction mode.
|
||||||
* @post The endpoint is ready for @p usbStartTransmitI().
|
* @post The endpoint is ready for @p usbStartTransmitI().
|
||||||
*
|
*
|
||||||
|
|
|
@ -236,12 +236,7 @@ static void otg_rxfifo_handler(USBDriver *usbp) {
|
||||||
case GRXSTSP_SETUP_DATA:
|
case GRXSTSP_SETUP_DATA:
|
||||||
cnt = (sts & GRXSTSP_BCNT_MASK) >> GRXSTSP_BCNT_OFF;
|
cnt = (sts & GRXSTSP_BCNT_MASK) >> GRXSTSP_BCNT_OFF;
|
||||||
ep = (sts & GRXSTSP_EPNUM_MASK) >> GRXSTSP_EPNUM_OFF;
|
ep = (sts & GRXSTSP_EPNUM_MASK) >> GRXSTSP_EPNUM_OFF;
|
||||||
if (ep == 0)
|
otg_fifo_read(usbp->epc[ep]->setup_buf, cnt, 8);
|
||||||
otg_fifo_read(usbp->setup, cnt, 8);
|
|
||||||
else
|
|
||||||
otg_fifo_read(usbp->epc[ep]->out_state->rxbuf, cnt,
|
|
||||||
usbp->epc[ep]->out_state->rxsize);
|
|
||||||
usbp->epc[ep]->out_state->rxcnt = cnt;
|
|
||||||
break;
|
break;
|
||||||
case GRXSTSP_OUT_DATA:
|
case GRXSTSP_OUT_DATA:
|
||||||
cnt = (sts & GRXSTSP_BCNT_MASK) >> GRXSTSP_BCNT_OFF;
|
cnt = (sts & GRXSTSP_BCNT_MASK) >> GRXSTSP_BCNT_OFF;
|
||||||
|
@ -270,6 +265,7 @@ static void otg_rxfifo_handler(USBDriver *usbp) {
|
||||||
static void otg_txfifo_handler(USBDriver *usbp, usbep_t ep) {
|
static void otg_txfifo_handler(USBDriver *usbp, usbep_t ep) {
|
||||||
uint32_t n;
|
uint32_t n;
|
||||||
|
|
||||||
|
#if 0
|
||||||
if ((usbp->transmitting & (1 << ep))== 0) {
|
if ((usbp->transmitting & (1 << ep))== 0) {
|
||||||
/* Nothing to transmit.*/
|
/* Nothing to transmit.*/
|
||||||
/* ????????????????????? */
|
/* ????????????????????? */
|
||||||
|
@ -289,6 +285,8 @@ static void otg_txfifo_handler(USBDriver *usbp, usbep_t ep) {
|
||||||
OTG->ie[ep].DIEPTSIZ = DIEPTSIZ_PKTCNT(pcnt) |
|
OTG->ie[ep].DIEPTSIZ = DIEPTSIZ_PKTCNT(pcnt) |
|
||||||
DIEPTSIZ_XFRSIZ(usbp->epc[ep]->in_state->txsize);
|
DIEPTSIZ_XFRSIZ(usbp->epc[ep]->in_state->txsize);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
n = usbp->epc[ep]->in_state->txsize - usbp->epc[ep]->in_state->txcnt;
|
n = usbp->epc[ep]->in_state->txsize - usbp->epc[ep]->in_state->txcnt;
|
||||||
if (n > usbp->epc[ep]->in_maxsize)
|
if (n > usbp->epc[ep]->in_maxsize)
|
||||||
n = usbp->epc[ep]->in_maxsize;
|
n = usbp->epc[ep]->in_maxsize;
|
||||||
|
@ -298,7 +296,6 @@ static void otg_txfifo_handler(USBDriver *usbp, usbep_t ep) {
|
||||||
usbp->epc[ep]->in_state->txcnt += n;
|
usbp->epc[ep]->in_state->txcnt += n;
|
||||||
if (usbp->epc[ep]->in_state->txcnt >= usbp->epc[ep]->in_state->txsize) {
|
if (usbp->epc[ep]->in_state->txcnt >= usbp->epc[ep]->in_state->txsize) {
|
||||||
/* Transfer finished.*/
|
/* Transfer finished.*/
|
||||||
/* ????????????????????? */
|
|
||||||
OTG->DIEPEMPMSK &= ~DIEPEMPMSK_INEPTXFEM(ep);
|
OTG->DIEPEMPMSK &= ~DIEPEMPMSK_INEPTXFEM(ep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,6 +206,12 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
USBOutEndpointState *out_state;
|
USBOutEndpointState *out_state;
|
||||||
/* End of the mandatory fields.*/
|
/* End of the mandatory fields.*/
|
||||||
|
/**
|
||||||
|
* @brief Pointer to a buffer for setup packets.
|
||||||
|
* @details Setup packets require a dedicated 8-bytes buffer, set this
|
||||||
|
* field to @p NULL for non-control endpoints.
|
||||||
|
*/
|
||||||
|
uint8_t *setup_buf;
|
||||||
} USBEndpointConfig;
|
} USBEndpointConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue