Pios sync primitives

* fixes #1113 
* fixes #1114 
* fixes #1115 
* takes next step in abstracting os api by adding pios_mutex
When I remove these two lines, suddenly this branch works for me with Sparky. I haven't dug into the details yet, but I'm guessing it has to do with the priority differences between a semaphore and mutex discussed here: http://www.freertos.org/CreateMutex.html