Binary Semaphore Problems

James Yates j.yates at
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, 

Then in the task:

    status2 = rtems_semaphore_obtain(sem_id, RTEMS_WAIT, 0);
    PDDR ^=0x0800; 
    PDDR ^=0x0800; 
     status2 = rtems_semaphore_release(sem_id);

More information about the users mailing list