/*
* CANopen Task relevant settings for ThreadX usage
*
* This header is designed to include within gen_define.h .
*
*/
#ifndef CODRV_THREADX_H
#define CODRV_THREADX_H 1

#define CODRV_USE_THREADX 1

/* required header */

#include <tx_api.h>

/* required external variables */
/* semphCANopen is used to wake up the CANopen task */
extern TX_SEMAPHORE semphCANopen;
/* semphObjDir is used to Lock the object dictionary access */
extern TX_SEMAPHORE semphObjDir;

#define CO_OS_SIGNAL_CAN_TRANSMIT \
		do { (void)tx_semaphore_put(&semphCANopen); } while(0);

#define CO_OS_SIGNAL_CAN_RECEIVE  \
		do { (void)tx_semaphore_put(&semphCANopen); } while(0);

#define CO_OS_SIGNAL_TIMER \
		do { (void)tx_semaphore_put(&semphCANopen); } while(0);

#define CO_OS_SIGNAL_CAN_STATE \
		do { (void)tx_semaphore_put(&semphCANopen); } while(0);

#define CO_OS_LOCK_OD \
		do { (void)tx_semaphore_get(&semphObjDir, TX_WAIT_FOREVER); } while(0);

#define CO_OS_UNLOCK_OD \
		do { (void)tx_semaphore_put(&semphObjDir); } while(0);

		
#include <co_datatype.h>
/* function declarations */
RET_T codrvOSConfig(void);

#endif /* CODRV_THREADX_H */
