Designer Reference Manual
USB08 Evaluation Board
110
Source Code Files
MOTOROLA
Source Code Files
// handle IN Packet Transmit complete over EP1
//
void handleIN1() {
uchar n;
uchar *dest;
UCR1 &= ~BM_TX1E;
// Deactivate EP1 Transmitter
UIR2 = BM_TXD1FR;
// Reset EP1 Transmit complete Flag
// refill EP1 Tx Data Buffer
n = 0;
dest = &UE1D0;
while((TxBuf_RdIdx != TxBuf_WrIdx) && n<8) {
*dest = TxBuffer[TxBuf_RdIdx];
TxBuf_RdIdx = (TxBu1) & (MAX_TXBUF_SIZE-1);
dest++;
n++;
}
// Activate EP1 Transmitter to send n Bytes
UCR1 = ((UCR1^BM_T1SEQ) & BM_T1SEQ) + B n;
}
//----------------------------------------------------------------------------
// handle OUT Packet received over EP2
//
void handleOUT2() {
uchar n;
uchar newIdx;
uchar *src;
UCR2 &= ~BM_RX2E;
// Deactivate EP2 Receiver
UIR2 = BM_RXD2FR;
// Reset EP2 Receive Flag
// ### Sender’s DATA Toggle should be checked!
// read out EP2 Rx Data Buffer
src = &UE2D0;
n = USR1 & BM_RP2SIZ;
// Check Transfer Size
while(n) {
newIdx = (RxBu1) & (MAX_RXBUF_SIZE-1);
while(newIdx == RxBuf_RdIdx)
;
// wait if TxBuffer is full
RxBuffer[RxBuf_WrIdx] = *src;
RxBuf_WrIdx = newIdx;
src++;
n--;
}
UCR2 = BM_RX2E;
// Activate EP2 Receiver
}
//----------------------------------------------------------------------------
Содержание MC68HC908JB8
Страница 2: ...blank ...
Страница 6: ...Designer Reference Manual USB08 Evaluation Board 6 List of Sections MOTOROLA List of Sections ...
Страница 16: ...Designer Reference Manual USB08 Evaluation Board 16 List of Tables MOTOROLA List of Tables ...
Страница 42: ...Designer Reference Manual USB08 Evaluation Board 42 Hardware Description MOTOROLA Hardware Description ...
Страница 88: ...Designer Reference Manual USB08 Evaluation Board 88 USB08 Descriptors MOTOROLA USB08 Descriptors ...
Страница 243: ...blank ...