
Designer Reference Manual USB08 Evaluation Board
104 Source Code Files MOTOROLA
Source Code Files
U08USB.C//===================== ======================== ======================= ========
// File: U08USB.C
// Func: USB Implementa tion Module for USB08 De mo Application
// Ver.: 1.00
// Auth: (C)2000,2001 b y Oliver Thamm, MCT Elek tronikladen GbR
// http://hc08web .de/usb08
// Rem.: View/Edit this File with TAB-Size=4
//===================== ======================== ======================= ========
//--------------------- ------------------------ ----------------------- --------
#include "u08usb.h" // Definitions for USB Data Types & Co ns ta nts
#include "u08desc.c" // const USB Descriptor Data
//--------------------- ------------------------ ----------------------- --------
// Source Code Option - set as required by Hard ware!
//
#define USB_IPUE1 // Internal Pull-up Ena ble
// 1=Enable(use build-in Pull-up Resistor)
// 0=Disable (external Pull-up req ui red)
//-- Variables -------- ------------------------ ----------------------- --------
volatile uchar USB_Stat e;
#define MAX_TXBUF_SIZE 16 // must be 2^x!
volatile uchar TxBuffer [MAX_TXBUF_SIZE];
volatile uchar TxBuf_Rd Idx;
volatile uchar TxBuf_Wr Idx;
#define MAX_RXBUF_SIZE 16 // must be 2^x!
volatile uchar RxBuffer [MAX_RXBUF_SIZE];
volatile uchar RxBuf_Rd Idx;
volatile uchar RxBuf_Wr Idx;
volatile uchar SuspendC ounter;
setup_buffer SetupBuffer;
uchar SetupSize;
uchar * SetupDataPtr;
uchar R0Sequence; // DATA0/1 Flag for EP0 Rx
uchar R2Sequence; // DATA0/1 Flag for EP2 Rx
//--------------------- ------------------------ ----------------------- --------
// Force STALL Condition for EP0 (both IN and OUT)
// as a Response to an invalid SETUP Req ues t
// Flags will be auto-cleared by the next SETUP Token
//
void forceSTALL() {
UCR3 |= BM_OSTALL0 + BM_ISTALL0;
}