Hello all,
I'm using the TMS320F28335 with sysbios an in order to improve my program I would like to add the handles of two semaphores into a struct which some other variables and I'm having some troubles. I know that I'm doing something wrong because I get an stackoverflow of the task which uses these semaphores and doing it without the struct works. I cannont add the entire code but the most relevant parts are:
I define in a library the following struct
struct sem_struct {
Semaphore_Handle sem1;
Semaphore_Handle sem2;
};
Then I create the following variable
extern struct sem_struct *semHandle;
and before starting the bios I create the semaphores.
semHandle->sem1 = create_semaphore();
semHandle->sem2 = create_semaphore();
The function "create_semaphore() is defined as follows (it works for other semaphores and I don't think it could be the problem).
Semaphore_Handle create_semaphore(void)
{
Semaphore_Params semParams;
Error_Block eb;
Error_init(&eb);
Semaphore_Params_init(&semParams);
semParams.mode = Semaphore_Mode_BINARY;
return Semaphore_create(0,&semParams,&eb);
}
In the task that I need them I have defined:
struct sem_struct *semHandle;
And I'm using the semaphore as follows:
Semaphore_post(semHandle->sem1);
Semaphore_pendt(semHandle->sem1, 100);
The program compiles without problems but the stack that uses this semaphores gives and stackoverflow after 1s or so. Before getting the stackoverflow error, the tasks starts working but it seems that ignores the tiemouts of the semaphore pend function.
Does someone know what I'm doing wrong or a better way of doing it?
Thank in advance,
Aitor