/*
* ico_event.h - contains internal defines for event handling
*
* Copyright (c) 2012-2022 emotas embedded communication GmbH
*
*-------------------------------------------------------------------
* $Id: ico_event.h 49602 2023-09-26 13:00:59Z boe $

*-------------------------------------------------------------------
*
*
*/

/**
* \file
* \brief dataty type header
*/

#ifndef ICO_EVENT_H
#define ICO_EVENT_H 1


/* datatypes */
typedef enum  {
	CO_EVENT_TYPE_UNKNOWN = 0,
	CO_EVENT_TYPE_J1939_BAM_TX
} CO_EVENT_TYPE_T;


/**
* event structure
*/
typedef struct co_event {
	struct co_event	*pNext;			/**< pointer to next event */
	void			(*pFct)(CO_LINE_DECL, void *para);/**< pointer to own function */
	void			*pData;			/**< pointer for own data */
	CO_EVENT_TYPE_T	type;
} xEvent;
typedef struct co_event	CO_EVENT_T;


/** \brief function pointer to event indication
 * \param pFct - pointer to timer up function
 */
typedef void (* CO_EVENT_FCT_T)(CO_LINE_DECL, void *pFct);


/* function prototypes */

void	icoEventCheck(CO_LINE_DECL);
void	icoEventInit(void);
RET_T	icoEventStart(CO_LINE_DECL, CO_EVENT_T *pEvent,
			CO_EVENT_FCT_T ptrToFct, void *pData);
RET_T 	icoEventStop(CO_LINE_DECL, CO_CONST CO_EVENT_T *pEvent);
BOOL_T	icoEventIsActive(CO_LINE_DECL, CO_CONST CO_EVENT_T *pEvent);
BOOL_T	icoEventsAvailable(CO_LINE_DECL);

RET_T	icoEventPend(CO_LINE_DECL, CO_EVENT_T* pEvent,
			CO_EVENT_FCT_T ptrToFct, void* pData, CO_EVENT_TYPE_T type);
void	icoEventPost(CO_LINE_DECL, CO_EVENT_TYPE_T type);
BOOL_T	icoEventIsPending(CO_LINE_DECL, CO_CONST CO_EVENT_T* pEvent);

#endif /* ICO_EVENT_H */
