DSPRelated.com
Forums

DSP/BIOS-preliminary questions

Started by balasubramanian vaidhyanathan September 22, 2008
Hi

I am new to using DSP/BIOS. I yanked the code out of TI DSP/BIOS user guide. I made a project called slice.pjt and i am using TIC64x and I used the cdb in the configuration file there. Then I added this to the slice.c to the pjt apart from ofcourse the cdb files etc. But it is giving an error that it cannot recognise the trace variable....I addedSEM_Handle sem also.. is this right?.Can you please tell me what i have to do to get this running

/*slice.c*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "lab1cfg.h"
Void task(Arg id_arg);
Void hi_pri_task(Arg id_arg);
Uns counts_per_us;

extern LOG_Obj trace;
/* ======== main ======== */
int main()
{

//LOG_printf(&trace, "Slice example started!");
counts_per_us = CLK_countspms() / 1000;
return;
}
/* ======== task ======== */
Void task(Arg id_arg)
{
Int id = ArgToInt(id_arg);
LgUns time;
LgUns prevtime;
/*
* The while loop below simulates the work load of
* the time sharing tasks
*/
while (1) {
time = CLK_gethtime() / counts_per_us;
/* print time only every 200 usec */
if (time >= prevtime + 200) {
prevtime = time;
LOG_printf(&trace, "Task %d: time is(us) Ox%x",id, (Int)time);
}
/* check for rollover */
if (prevtime > time) {
prevtime = time;
}
/*
* pass through idle loop to pump data to the Real-Time
* Analysis tools
*/
TSK_disable();
IDL_run();
TSK_enable();
}
}
/* ======== hi_pri_task ======== */
Void hi_pri_task(Arg id_arg)
{
SEM_Handle sem;
Int id = ArgToInt(id_arg);
while (1) {
LOG_printf(&trace, "Task %d here", id);
SEM_pend(sem, SYS_FOREVER);
}
}
Balasubramanian,

I have added comments, begining with '<<-' to indicate what I see as undesirable
or wrong with the code.

I suspect there is also the problem that the two tasks are never run
but am not sure, as I have never used the BIOS.

Also, the 'sem' is for semaphore.
Are you needing a semaphore?
I do not see any need for one in the code.

The 'trace' is not recognized due to the missing 'space' in the definition, see
the related comment in the code.

R. Williams

---------- Original Message -----------
From: balasubramanian vaidhyanathan
To: c...
Sent: Mon, 22 Sep 2008 17:24:00 -0700 (PDT)
Subject: [c6x] DSP/BIOS-preliminary questions

> Hi
>
> I am new to using DSP/BIOS. I yanked the code out of TI DSP/BIOS user
> guide. I made a project called slice.pjt and i am using TIC64x and I
> used the cdb in the configuration file there. Then I added this to the
> slice.c to the pjt apart from ofcourse the cdb files etc. But it is
> giving an error that it cannot recognise the trace variable....I
> addedSEM_Handle sem also.. is this right?.Can you please tell me
> what i have to do to get this running

/*slice.c*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "lab1cfg.h"

Void task(Arg id_arg);
Void hi_pri_task(Arg id_arg);
Uns counts_per_us; // <<- should contain 'static' modifier

externLOG_Obj trace; // <<- missing space

/* ======== main ======== */
int main()
{

//LOG_printf(&trace, "Slice example started!");
counts_per_us = CLK_countspms() / 1000;
return;
}
/* ======== task ======== */
Void task(Arg id_arg)
{
Int id = ArgToInt(id_arg);
LgUns time;
LgUns prevtime;

/*
* The while loop below simulates the work load of
* the time sharing tasks
*/
while (1) {
time = CLK_gethtime() / counts_per_us;

/* print time only every 200 usec */
if (time >= prevtime + 200)
{
prevtime = time;
LOG_printf(&trace, "Task %d: time is(us) Ox%x",id, (Int)time);
} // endif()

/* check for rollover */
if (prevtime > time)
{
prevtime = time;
} // endif()

/*
* pass through idle loop to pump data to the Real-Time
* Analysis tools
*/
TSK_disable();
IDL_run();
TSK_enable();
} // endwhile()
return;
}
/* ======== hi_pri_task ======== */
Void hi_pri_task(Arg id_arg)
{
S!EM_Handlesem; // <<- missing space and contains '!' rather than '_'

Int id = ArgToInt(id_arg);
while (1)
{
LOG_printf(&trace, "Task %d here", id);
SEM_pend(sem, SYS_FOREVER);
} // endwhile()
return;
}

------- End of Original Message -------