git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4257 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
36129fd993
commit
b8d35693b4
|
@ -849,6 +849,8 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
#define DOEPTSIZ_RXDPID_MASK (3U<<29) /**< Received data PID mask. */
|
#define DOEPTSIZ_RXDPID_MASK (3U<<29) /**< Received data PID mask. */
|
||||||
#define DOEPTSIZ_RXDPID(n) ((n)<<29) /**< Received data PID value. */
|
#define DOEPTSIZ_RXDPID(n) ((n)<<29) /**< Received data PID value. */
|
||||||
|
#define DOEPTSIZ_STUPCNT_MASK (3U<<29) /**< SETUP packet count mask. */
|
||||||
|
#define DOEPTSIZ_STUPCNT(n) ((n)<<29) /**< SETUP packet count value. */
|
||||||
#define DOEPTSIZ_PKTCNT_MASK (0x3FFU<<19)/**< Packet count mask. */
|
#define DOEPTSIZ_PKTCNT_MASK (0x3FFU<<19)/**< Packet count mask. */
|
||||||
#define DOEPTSIZ_PKTCNT(n) ((n)<<19) /**< Packet count value. */
|
#define DOEPTSIZ_PKTCNT(n) ((n)<<19) /**< Packet count value. */
|
||||||
#define DOEPTSIZ_XFRSIZ_MASK (0x7FFFFU<<0)/**< Transfer size mask. */
|
#define DOEPTSIZ_XFRSIZ_MASK (0x7FFFFU<<0)/**< Transfer size mask. */
|
||||||
|
|
|
@ -767,11 +767,15 @@ void usb_lld_write_packet_buffer(USBDriver *usbp, usbep_t ep,
|
||||||
*/
|
*/
|
||||||
void usb_lld_prepare_receive(USBDriver *usbp, usbep_t ep,
|
void usb_lld_prepare_receive(USBDriver *usbp, usbep_t ep,
|
||||||
uint8_t *buf, size_t n) {
|
uint8_t *buf, size_t n) {
|
||||||
|
uint32_t pcnt;
|
||||||
|
USBOutEndpointState *osp = usbp->epc[ep]->out_state;
|
||||||
|
|
||||||
(void)usbp;
|
osp->rxbuf = buf;
|
||||||
(void)ep;
|
osp->rxsize = n;
|
||||||
(void)buf;
|
osp->rxcnt = 0;
|
||||||
(void)n;
|
pcnt = (n + usbp->epc[ep]->out_maxsize - 1) / usbp->epc[ep]->out_maxsize;
|
||||||
|
OTG->oe[ep].DOEPTSIZ = DOEPTSIZ_STUPCNT(3) | DOEPTSIZ_PKTCNT(pcnt) |
|
||||||
|
DOEPTSIZ_XFRSIZ(usbp->epc[ep]->out_maxsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -786,6 +790,7 @@ void usb_lld_prepare_receive(USBDriver *usbp, usbep_t ep,
|
||||||
*/
|
*/
|
||||||
void usb_lld_prepare_transmit(USBDriver *usbp, usbep_t ep,
|
void usb_lld_prepare_transmit(USBDriver *usbp, usbep_t ep,
|
||||||
const uint8_t *buf, size_t n) {
|
const uint8_t *buf, size_t n) {
|
||||||
|
uint32_t pcnt;
|
||||||
USBInEndpointState *isp = usbp->epc[ep]->in_state;
|
USBInEndpointState *isp = usbp->epc[ep]->in_state;
|
||||||
|
|
||||||
isp->txbuf = buf;
|
isp->txbuf = buf;
|
||||||
|
@ -798,8 +803,7 @@ void usb_lld_prepare_transmit(USBDriver *usbp, usbep_t ep,
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Transfer initialization.*/
|
/* Transfer initialization.*/
|
||||||
uint32_t pcnt = (n + usbp->epc[ep]->in_maxsize - 1) /
|
pcnt = (n + usbp->epc[ep]->in_maxsize - 1) / usbp->epc[ep]->in_maxsize;
|
||||||
usbp->epc[ep]->in_maxsize;
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
@ -816,7 +820,8 @@ void usb_lld_prepare_transmit(USBDriver *usbp, usbep_t ep,
|
||||||
void usb_lld_start_out(USBDriver *usbp, usbep_t ep) {
|
void usb_lld_start_out(USBDriver *usbp, usbep_t ep) {
|
||||||
|
|
||||||
(void)usbp;
|
(void)usbp;
|
||||||
(void)ep;
|
|
||||||
|
OTG->oe[ep].DOEPCTL |= DOEPCTL_CNAK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue