Using GEL File for Parallel Development and Testing of DSP Applications

3. Illustration of the project code

The basic building blocks used in this project have been defined above. An in-depth description shall now follow as to the working of the code. Please read the instructions on loading the file.

Instructions to load in the file:

  1. Power up DSK board setup
  2. Initiate Code Composer Studio version 2.10
  3. Load in the project file
  4. Load in the GEL file
  5. Load in the .out (COFF) file in the project. The file will get loaded into onchip RAM
  6. Go to DSPBIOS menu and select Message Log to be able to view the log printf statements

Use GEL menu to activate and deactivate the task. The actions performed in the framework code are highlighted in the message log.

We shall first start with the GEL file hotmenu setup. This project assumes that the HPI memory interface between the DSP and the MCU lies within the 0x80 to 0x90 onchip memory space. The HOST to DSP commands are thus written into memory locations 0x85. The DSP will usually acknowledge the receipt of a message cue and reply back. The DSP to HOST acknowledgement is to be placed in onchip memory location 0x89 for this project.

When we activate the GEL Files, the commands are written to onchip memory. Please see the illustration below which shows how the GEL hotmenu activation changes the onchip memory location (0x85) and 0x89 during APP_start. The Memory View window is opened in the picture to show this point. The GEL file configuration used in this project is shown below for reference:

//Hotmenu commands
menuitem "FakeHPI"

hotmenu App_Start()
{
*(int *)0x85 = 0x1;
*(int *)0x86= 0;
*(int *)0x89 = 0x1;
*(int *)0x90 = 0;
}

hotmenu App_Stop()
{
     *(int *)0x85 = 0x2;
     *(int *)0x86= 0;
     *(int *)0x89 = 0x2;
     *(int *)0x90 = 0;
}

StartUp()
{
     GEL_XMDef(0,0x1e,1,0x8000,0x7f);
     GEL_XMOn();
     GEL_MapOn();
     GEL_MapReset();
     /* data space */
     GEL_MapAdd(0x00000,1,0x08000,1,1); /* DARAM0-3 */
     GEL_MapAdd(0x08000,1,0x08000,1,1); /* DARAM4-7 */
     /* program space */
     /* Set program space */
     GEL_MapAdd(0x00000,0,0x08000,1,1); /* DARAM0-3 */
     GEL_MapAdd(0x10000,0,0x08000,1,1); /* DARAM0-3 dup */
     GEL_MapAdd(0x18000,0,0x08000,1,1); /* DARAM4-7 */
     GEL_MapAdd(0x20000,0,0x08000,1,1); /* DARAM0-3 dup */
     GEL_MapAdd(0x28000,0,0x08000,1,1); /* SARAM0-3 */
     GEL_MapAdd(0x30000,0,0x08000,1,1); /* DARAM0-3 dup */
     GEL_MapAdd(0x38000,0,0x08000,1,1); /* SARAM4-7 */
}

how the GEL hotmenu activation changes the onchip memory location
[click image to enlarge - opens new window]

When the code is run, the periodic debug_stuff function will check the onchip memory 0x85 for any new messages. Once its notices a new message it will log_printf that a message has been received. It then triggers a HPI interrupt by issuing a software trap intr 25. This trap is mapped to HWI_SINT 9. In our code we have made this interrupt to go to the HPI interrupt service routine in our project. The picture below show the mapping in the DSPBIOS CDB file.


[click image to enlarge - opens new window]

To make this project simple, the use of message queues was avoided. Semaphore synchronization between tasks was thus used. When the HPI isr occurs, it will set a state in the APP_task and post a semaphore which is pending on the APP_task side.

On the APP_task side, we will activate variables Play and codec_On which are used in the periodic debug_stuff function. This function will simulate a codec isr calls once every 50 ms. The codec isr function is defined in the DRV_Codec.c file. Each time the codec isr occurs a fake sample is loaded into a buffer. Once the buffer is full a software interrupt is posted. This will trigger the callback function interrupt void APP_Start_Event(void) which will log_printf "DSP Algorithm Processing) each time the buffer gets full.

The APP_task apart from triggering the codec isr routine will also acknowledge the receipt of the message back to the MCU by calling the function APP_HPIAck(). This will post a semaphore (SEM_HPI_Ack) which is serviced the next time round HPI_task runs. The HPI_Task's associated function will then display the acknowledgement message on the message log using log_printf statements.

The whole framework basically works using tasks scheduled in a round robin framework in tandem using semaphores.

task scheduling

The way the task scheduling occurs is as follows. Each task has its own task to save its context information during a context switch. In the DSPBIOS framework, the interrupt service routines as well have a stack. When say the task scheduler is running task 1 and when an isr pre-empts its, the task 1 context is saved to the isr stack rather than the task's stack.

After the isr completes the task context is restored to task 1. In the event that the isr takes longer than expected and the scheduler now schedules task 2, the isr will restore the context back to task1 stack space.

The main intent of this article and the project is to describe a typical scenario in DSP development and illustrate the use of GEL hotmenu commands in initiating, developing and testing DSP code development without being hampered by the MCU side.

read - process

Previous Page | Next Page
1 | 2 | 3 | 4

If you found this page useful, bookmark and share it on:

 
Embedded Star Newsletter
Don't have time to visit Embedded Star everyday? Then sign up for our free newsletter. We'll send you an email when we have something to share with you. Your email address will be kept confidential and we will not share, sell, or rent it to anyone. You can unsubscribe at any time by clicking a link in the email.

Enter your email address to sign up for our free newsletter:   

If you are familiar with RSS feeds, you can also sign up for our free blog feed. Our RSS feed is updated in real-time while our newsletter is updated daily.