Information Technology Reference
In-Depth Information
Table 2-3: Bit functions for an endpoint's buffer descriptor status register when
the SIE owns the buffer descriptor.
Bit
Name
Description
7
UOWN
1 = the SIE owns the buffer descriptor and its buffer.
6
reserved
Not written by the SIE.
5..2
PID3:PID0
Packet identifier. The PID of the last received IN, OUT, or Setup packet.
1
BC9
Byte count, bit 9.
0
BC8
Byte count, bit 8.
The BD_STAT structure enables access to the status register's eight bits:
typedef struct
{
unsigned BC8:1; // byte count, bit 8
unsigned BC9:1; // byte count, bit 9
unsigned BSTALL:1; // return STALL handshake: 1 = true; 0 = false
unsigned DTSEN:1; // ignore packets with incorrect data toggle:
// 1 = true; 0 = false
unsigned INCDIS:1; // disable address increment: 1 = true; 0 = false
// (normally false, set true to use SPP)
unsigned KEN:1; // SIE keeps control of endpoint's buffer after UOWN is set:
// 1 = true; 0 = false
// (normally false, set true to use SPP)
unsigned DTS:1; // Data Toggle: 1 = DATA1; 0 = DATA0
unsigned UOWN:1; // ownership of the endpoint's buffer and buffer descriptor:
// 0 = CPU; 1 = SIE
} BD_STAT;
Two macros determine who currently owns an endpoint's buffer descriptor
by reading the UOWN bit in the status register. The macros return true if
the SIE has ownership and false if the CPU has ownership.
The mMSDTxIsBusy macro is for the bulk IN (device to host) endpoint:
#define mMSDTxIsBusy() MSD_BD_IN.Stat.UOWN
The mMSDRxIsBusy macro is for the bulk OUT (host to device) endpoint:
#define mMSDRxIsBusy() MSD_BD_OUT.Stat.UOWN
The mUSBBufferReady macro gives ownership of an endpoint's buffer
descriptor and buffer to the SIE. Firmware calls the macro when a bulk IN
endpoint buffer has data ready to send and after reading received data from
Search WWH ::




Custom Search