Mock support for semaphores

This pull request implements semaphores for the "mock platform" used in testing. Once the API has been reviewed, I will implement the real (uc/OS-III) semaphores.