Information Technology Reference
In-Depth Information
a bulk OUT endpoint. The macro accepts the name of a buffer descriptor,
such as ep1Bi or ep1Bo.
#define _DTSEN
0x08
// data-toggle synchronization bit
#define _DTSMASK
0x40
// data-toggle bit
#define _USIE
0x80
// SIE owns the endpoint's buffer descriptor
#define _UCPU
0x00
// CPU owns the endpoint's buffer descriptor
#define mUSBBufferReady(buffer_dsc)
{
buffer_dsc.Stat._byte &= _DTSMASK;
// Get the data toggle state
buffer_dsc.Stat.DTS = !buffer_dsc.Stat.DTS;
// Toggle the data toggle
buffer_dsc.Stat._byte |= _USIE | _DTSEN;
// Give ownership to the SIE
}
Each bulk endpoint can transfer up to 64 bytes in each USB transaction:
#define MSD_OUT_EP_SIZE 64
#define MSD_IN_EP_SIZE 64
Each endpoint number also has a control register that can enable a control
endpoint, an IN endpoint, an OUT endpoint, or a pair of IN and OUT
endpoints with the same endpoint number. Other bits in the register can
stall the endpoint and disable handshaking (for isochronous transactions).
Additional registers provide general USB capabilities such as storing the
device's address on the bus and storing status and control information for
USB communications and interrupts. The chip's data sheet has more details
about these registers.
Search WWH ::




Custom Search