Download DRM065, USB2.0 Card Reader Designer
Transcript
Software Overview MAIN PROGRAM TIMER INTERRUPT USB INTERRUPTS INITIALIZATION CHECK AND SERVE ANY HOOK FUNCTION USB ENDPOINT 0 HANDLER USB EVENTS HANDLER INCREASE GLOBAL TIMER COUNTER FOR EVERY 1ms USBMS BULK IN HANDLER USBMS EVENTS HANDLER RETURN USBMS BULK OUT HANDLER CARD INSERTION & REMOVAL HANDLER RETURN Figure 3-2. Main Software Flow 3.2 Main Software Flow 3.2.1 Main Program The USB events handler puts the UF32 into suspend when USB bus suspend is detected. The USB Mass Storage (USBMS) handler calls corresponding routines for different USBMS commands. The card insertion and removal handler checks any card is inserted into or removed from the sockets. 3.2.1.1 USB Events Handler The USB Events Handler puts the UF32 into STOP mode when the USB suspend is detected. 3.2.1.2 USBMS Events Handler The USB Events Handler handles the USB Mass Storage reset and the USB Mass Storage Command Block Wrapper. 3.2.1.3 Card Insertion and Removal Handler The card insertion and removal handler checks any card inserted or removed from the sockets for every 100ms. The time interval is defined in the timer hook function. If any card is detected to be inserted, the handler will enable and initialize the card host controller. If any card is detected to be removed, the handler will disable the card host controller. MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 14 Freescale Semiconductor