Software architecture The following figure shows the basic software architecture of the application:
h o s t _ m a s s _ s t o r a g e _ t a s k . c
u s b _ h o s t _ t a s k . c
ai usb ms.c
u s a r t . c s p i . c t w i . c s s c _ i 2 s . c f l a s h c . c p m . c g p i o . c
The application does not require any operating system to run. The main() function is in charge of calling the software «tasks» (using a scheduler) that make audio decoding, HMI, and USB man- agement possible. There are 5 tasks:
This task holds the real intelligence of the user application and interfaces directly with the Audio Interface. This is the task that the user should modify for his own application.
For example, if a new device using another class than the mass storage class is plugged, and of course if this class is supported by the application, then, this task will tell the audio interface to link the "Audio Interface" API to a low level API that supports this class. All the mechanism in place to dynamically link an API to this abstract API is located in the file: /SERVICES/AUDIO/AUDIO_PLAYER/audio_interface.[c|h] In this application, only the USB mass storage class is implemented, therefore, this function is not used.
involved will be the MP3 decoder, the USB stack and the host mass storage task:
The MP3 codec task: This task is in charge of the Audio Decoding management.
The USB task: This task handles the USB stack and events.
The Host Mass Storage task: This task will check for new devices connection and
initialize them using the USB Mass Storage class. The main loop of the application is a simple free-running task scheduler: