210 likes | 360 Views
Dynamic Donut. Software System Design Matthew Cohn. Microcontroller – MCF52233. Bus Speed – 60MHz On-Chip Resources Programmable Interrupt Timer 32kB SRAM 18kB Required 256kB Flash 37kB Required, No Paging Communications Modules UART I 2 C QSPI. Operating System – CuteC/OS.
E N D
Dynamic Donut Software System Design Matthew Cohn
Microcontroller – MCF52233 • Bus Speed – 60MHz • On-Chip Resources • Programmable Interrupt Timer • 32kB SRAM • 18kB Required • 256kB Flash • 37kB Required, No Paging • Communications Modules • UART • I2C • QSPI
Operating System – CuteC/OS • Implemented • Real-time, preemptive, multitasking kernel • Priority based • Automatically corrects priority inversion • Delays, with 1ms tick period • Dynamic memory allocation (memory pools) • Intertask synchronization and communication • Mutexes • Semaphores • Queues • Mailboxes
Operating System – CuteC/OS • Will Not Be Implemented • Changing task states in ISRs • Includes semaphores, mutexes, mailboxes, delays inside ISR • Deleting tasks • Returning from tasks • Flags
tskLoadAudio • Uses the EFSL library to load audio data from the SD card. Sends it to the appropriate decoding function (WAV or MP2) • Audio is then placed in the output circular buffer, and the buffer’s write position pointer is updated
tskKeypad • Polls the states of each key • Provides software debouncing • Upon keypress, sends a message to tskSystem’s mailbox
tskUART • Polls UART for new incoming data • If a command is received over UART, sends a message to TskSystem’s mailbox • If a command is queued in TskUART’s mailbox, sends the command over UART
tskSystem • Maintains the system state • Uses the EFSL library to read directory listings from the SD card, navigates files and directories • Provides the user interface by calling functions in the LCD module
tskLCD • Writes information to the LCD display • Handles multiple layers of information which is flattened to a final layer when displayed • Only transmits updated characters to the display
Audio Module • Public functions: • bool playAudio(char *path); • Checks to see if the file exists and can be open • Upon success, posts the playingAudio mutex and returns true • Upon failure, returns false • TskAudio pends on the playingAudio mutex • After the audio file has finished, playingAudio is pended on again • bool stopAudio(); • Upon success, returns true. If no audio playing, return false
Audio Module • Public functions: • bool nextTransition(); • Sets a flag specifying the user has requested the system stop looping at the next available transition • If an audio file is playing, returns true • If no audio file is playing, returns false • bool setTransition(int transNumber); • Sets an automatic transition • Can be called once for each embedded loop • Returns true on success, false on error
Audio Module • Public data: • INT32U audioBuffer[1765]; • 1,765 16-bit stereo samples • 441 x 4 + 1 • INT32U *writePointer; • Points past the last valid audio sample
Keypad Module • No public functions • No public data
UART Module • No public functions • Public data: • ccMailbox transmitMailbox for commands to transmit from the Dynamic Donut via UART
Main Module • Public functions: • void audioFinished(); • Called by TskAudio when audio has finished playing • void updateStatus(); • Updates the playback time of audio when playing • Public data: • ccMailbox commandMailbox for received commands from UART or keypad
I2C Module • Public functions: • void i2cInit(); • Initializes the I2C hardware • bool i2cTransmit(); • Initiates a transfer on the I2C bus. If the transfer was successful and an ACK was received, return true. Otherwise, return false. • No public data