Pios sync primitives

* fixes #1113 
* fixes #1114 
* fixes #1115 
* takes next step in abstracting os api by adding pios_mutex
That 0xffff should probably be changed to PIOS_MUTEX_MAX_TIMEOUT. That was the same value as portMAX_DELAY