Source Code Files
Contents
USB08 Evaluation Board
Designer Reference Manual
MOTOROLA
Source Code Files
111
void initUSB() {
UADDR = BM 0;
// USB enable, default address
UCR0 = 0;
// reset EP0
UCR1 = 0;
// reset EP1
UCR2 = 0;
// reset EP2
UCR3 = BM_
// clear TX1ST Flag
USB_IPUE*BM_PULLEN;
// enable/disable internal Pull-up
UCR4 = 0;
// USB normal operation
UIR0 = 0;
// disable Interrupts
UIR2 = 0xff;
// clear all Flags in UIR1
R0Sequence = 0;
// EP0 Rx starts with DATA0
R2Sequence = 0;
// EP2 Rx starts with DATA0
USB_State = US_POWERED;
// powered, but not yet reset
TxBuf_RdIdx = 0;
// reset Buffer Indexes
TxBuf_WrIdx = 0;
RxBuf_RdIdx = 0;
RxBuf_WrIdx = 0;
}
//----------------------------------------------------------------------------
uchar getUSB() {
uchar c;
while(RxBuf_RdIdx == RxBuf_WrIdx)
;
// wait if RxBuffer is empty
c = RxBuffer[RxBuf_RdIdx];
RxBuf_RdIdx = (RxBu1) & (MAX_RXBUF_SIZE-1);
return c;
}
//----------------------------------------------------------------------------
void putUSB(uchar c) {
uchar newIdx;
newIdx = (TxBu1) & (MAX_TXBUF_SIZE-1);
while(newIdx == TxBuf_RdIdx)
;
// wait if TxBuffer is full
TxBuffer[TxBuf_WrIdx] = c;
TxBuf_WrIdx = newIdx;
}
//----------------------------------------------------------------------------
Содержание 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 ...