#ifndef __OS_IF_H_
#define __OS_IF_H_

#define     PEX_RTOS_INIT       OS_init
#define     PEX_RTOS_START      OS_start

#include "Abstraction/Include/OS_Type.h"

/* OS */
void  OS_init();
void  OS_start();

/* Schedule */
void  OS_createTask(OS_TaskConfig* config);
void  OS_createQueue(OS_QueueConfig* config);
void  OS_sleep(uint32_t milliseconds);
uint32_t OS_getCurrentTime();

/* Memory */
void* OS_malloc(size_t size);
void  OS_free(void * mem);

/* Lock */
void* OS_createLock();
void  OS_destroyLock(void* mutex);
void  OS_lock(void* mutex);
void  OS_unlock(void* mutex);

/* Semaphore */
void* OS_createSemaphore(const uint8_t init_value);
void  OS_destroySemaphore(void* semaphore);
void  OS_wait(void* semaphore, uint32_t milliseconds);
void  OS_post(void* semaphore);

/* Timer */
void  OS_createTimer(uint8_t id, uint32_t milliseconds, uint8_t reload, TIMERPROC callback);
void  OS_destroyTimer(uint8_t id);
void  OS_startTimer(uint8_t id);
void  OS_stopTimer(uint8_t id);
void  OS_resetTimer(uint8_t id);
void  OS_changeTimer(uint8_t id, uint32_t milliseconds, TIMERPROC callback);

/* Message */
OS_Error OS_sndMsg(uint8_t queue_id, uint16_t event_code, void * data_buffer, uint32_t data_size, uint32_t milliseconds);
OS_Error OS_sndMsgFromISR(uint8_t queue_id, uint16_t event_code);
OS_Error OS_sndMsgToFront(uint8_t queue_id, uint16_t event_code, void * data_buffer, uint32_t data_size, uint32_t milliseconds);
OS_Error OS_sndMsgToFrontFromISR(uint8_t queue_id, uint16_t event_code);

#endif
