Binary Semaphore Problems
James Yates
j.yates at quartzuk.com
Wed Dec 3 16:56:14 UTC 2003
I am currently testing my port of RTEMS and have managed to get multiple tasks running. I start looking at
semaphores and have a small piece of test code with a binary semaphore blocking access to a register.
When I create the semaphore RTEMS_SUCCESSFUL is returned and I am given a semaphore id. But when
either of my tasks tries to obtain this semaphore, RTEMS_UNVALID_ID is returned, but I can't figure out
why. Does anyone have any ideas?
I create the semaphore using:
static rtems_id sem_id;
status = rtems_semaphore_create(rtems_build_name( 'S', 'E', 'M', '1' ), 1,
RTEMS_PRIORITY|RTEMS_BINARY_SEMAPHORE|RTEMS_INHERIT_PRIORITY|
RTEMS_NO_PRIORITY_CEILING|RTEMS_LOCAL,
0,
&sem_id);
Then in the task:
status2 = rtems_semaphore_obtain(sem_id, RTEMS_WAIT, 0);
PDDR ^=0x0800;
rtems_task_wake_after(500);
PDDR ^=0x0800;
status2 = rtems_semaphore_release(sem_id);
More information about the users
mailing list