AGHAF 5.0.9
Annecy electronique Generic Hardware Access Framework
Loading...
Searching...
No Matches
aghaf_can_v2.h
1#ifndef EXXOTEST_AGHAF_CAN_V2_H
2#define EXXOTEST_AGHAF_CAN_V2_H
3
4#include "aghaf_can_common.h"
5#include "aghaf_global.h"
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
13
15typedef void* AGHAF_CAN;
16
26typedef void (*AGHAF_CAN_onMessageTx)(uint64_t timestamp, uint32_t ident,
27 uint8_t flags, uint8_t dataLen,
28 uint8_t const* data, void* userContext);
29
39typedef void (*AGHAF_CAN_onMessageRx)(uint64_t timestamp, uint32_t ident,
40 uint8_t flags, uint8_t dataLen,
41 uint8_t const* data, void* userContext);
42
49typedef void (*AGHAF_CAN_onError)(uint64_t timestamp, AGHAF_CAN_Error error,
50 void* userContext);
51
58typedef void (*AGHAF_CAN_onBusChange)(uint64_t timestamp, uint8_t chipState,
59 void* userContext);
60
69typedef void (*AGHAF_CAN_onBusLoad)(uint64_t timestamp, uint8_t chipState,
70 uint8_t busLoad, AGHAF_CAN_Error error,
71 void* userContext);
72
76AGHAF_PUBLIC_FUNCTION(void, AGHAF_CAN_v2_useAPI, ());
77
84AGHAF_PUBLIC_FUNCTION(void, AGHAF_CAN_v2_setOnMessageTxCallback,
85 (AGHAF_CAN can, AGHAF_CAN_onMessageTx callback,
86 void* userContext));
87
94AGHAF_PUBLIC_FUNCTION(void, AGHAF_CAN_v2_setOnMessageRxCallback,
95 (AGHAF_CAN can, AGHAF_CAN_onMessageRx callback,
96 void* userContext));
97
104AGHAF_PUBLIC_FUNCTION(void, AGHAF_CAN_v2_setOnErrorCallback,
105 (AGHAF_CAN can, AGHAF_CAN_onError callback,
106 void* userContext));
107
114AGHAF_PUBLIC_FUNCTION(void, AGHAF_CAN_v2_setOnBusChangeCallback,
115 (AGHAF_CAN can, AGHAF_CAN_onBusChange callback,
116 void* userContext));
117
124AGHAF_PUBLIC_FUNCTION(void, AGHAF_CAN_v2_setOnBusLoadCallback,
125 (AGHAF_CAN can, AGHAF_CAN_onBusLoad callback,
126 void* userContext));
127
134AGHAF_PUBLIC_FUNCTION(AGHAF_CAN, AGHAF_CAN_v2_get,
135 (AGHAF_Device device, uint8_t index));
136
142AGHAF_PUBLIC_FUNCTION(uint8_t, AGHAF_CAN_v2_getIndex, (AGHAF_CAN can));
143
149AGHAF_PUBLIC_FUNCTION(uint8_t, AGHAF_CAN_v2_getCount, (AGHAF_Device device));
150
156AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_CAN_v2_activate, (AGHAF_CAN can));
157
163AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_CAN_v2_deactivate, (AGHAF_CAN can));
164
171AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_CAN_v2_isActivated,
172 (AGHAF_CAN can, AGHAF_BOOL* isActivated));
173
181AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_CAN_v2_getParam,
182 (AGHAF_CAN can, AGHAF_CAN_Param type, uint32_t* value));
183
191AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_CAN_v2_setParam,
192 (AGHAF_CAN can, AGHAF_CAN_Param type, uint32_t value));
193
203AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_CAN_v2_supportedModes,
204 (AGHAF_CAN can, AGHAF_CAN_Mode** modes,
205 uint8_t* nbModes));
206
211AGHAF_PUBLIC_FUNCTION(void, AGHAF_CAN_v2_freeSupportedModes,
212 (AGHAF_CAN_Mode * modes));
213
220AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_CAN_v2_getChipSstate,
221 (AGHAF_CAN can, AGHAF_CAN_ChipState* chipState));
222
228AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_CAN_v2_BusOn, (AGHAF_CAN can));
229
240 (AGHAF_CAN can, uint32_t** terminations,
241 uint32_t* nbTerminations));
242
253 (AGHAF_CAN can, uint32_t** terminations,
254 uint32_t* nbTerminations));
255
261AGHAF_PUBLIC_FUNCTION(void, AGHAF_CAN_v2_freeSupportedTerminations,
262 (uint32_t* terminations));
263
269AGHAF_PUBLIC_FUNCTION(uint8_t, AGHAF_CAN_v2_Periodic_getCount, (AGHAF_CAN can));
270
284AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_CAN_v2_Periodic_send,
285 (AGHAF_CAN can, uint8_t frameDatalen,
286 uint8_t const* frameData, uint8_t frameFlags,
287 uint32_t frameIdent, uint8_t index, uint8_t flags,
288 uint32_t period));
289
304AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_CAN_v2_Periodic_send_v2,
305 (AGHAF_CAN can, uint8_t frameDatalen,
306 uint8_t const* frameData, uint8_t frameFlags,
307 uint32_t frameIdent, uint8_t index, uint8_t flags,
308 uint32_t offset, uint32_t period));
309
321AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_CAN_v2_supportedFilters,
322 (AGHAF_CAN can, uint16_t* globalFilterCaps,
323 AGHAF_CAN_FilterDesc** values, uint16_t* size));
324
329AGHAF_PUBLIC_FUNCTION(void, AGHAF_CAN_v2_freeSupportedFilters,
330 (AGHAF_CAN_FilterDesc * values));
331
343AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_CAN_v2_addFilter,
344 (AGHAF_CAN can, AGHAF_CAN_FilterId idType,
346 uint32_t id1, uint32_t id2));
347
353AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_CAN_v2_clearFilters, (AGHAF_CAN can));
354
362AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_CAN_v2_filtersCount,
363 (AGHAF_CAN can, AGHAF_CAN_FilterId idType,
364 uint16_t* count));
365
373AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_CAN_v2_reject,
374 (AGHAF_CAN can, AGHAF_CAN_RejectType rejectType,
375 AGHAF_BOOL rejectRtr));
376
386AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_CAN_v2_sendMessage,
387 (AGHAF_CAN can, uint32_t ident, uint8_t flags,
388 uint16_t dataLen, uint8_t const* data));
389
391
392#ifdef __cplusplus
393}
394#endif
395
396#endif
AGHAF_CAN_FilterMode
enumerator to choose the type of the filter: accept or reject
Definition aghaf_can_enums.h:82
AGHAF_CAN_RejectType
enumerator to choose the type of exclusion filter
Definition aghaf_can_enums.h:66
AGHAF_CAN_Param
List of parameters used to configure a CAN bus.
Definition aghaf_can_enums.h:136
AGHAF_CAN_FilterId
enumerator to choose the identifier type for can filter
Definition aghaf_can_enums.h:76
AGHAF_CAN_Mode
Possible modes for CAN.
Definition aghaf_can_enums.h:118
AGHAF_CAN_ChipState
Enumeration of the chip states.
Definition aghaf_can_enums.h:39
AGHAF_CAN_Error
Enumerator to describe the error on the bus.
Definition aghaf_can_enums.h:100
AGHAF_CAN_FILTER_Type
type of the filter
Definition aghaf_can_enums.h:88
uint8_t AGHAF_CAN_v2_Periodic_getCount(AGHAF_CAN can)
Return the number of periodic message available on a CAN bus.
AGHAF_Status AGHAF_CAN_v2_getChipSstate(AGHAF_CAN can, AGHAF_CAN_ChipState *chipState)
Return the chip state from the bus.
AGHAF_Status AGHAF_CAN_v2_Periodic_send(AGHAF_CAN can, uint8_t frameDatalen, uint8_t const *frameData, uint8_t frameFlags, uint32_t frameIdent, uint8_t index, uint8_t flags, uint32_t period)
Add a periodic message to send.
AGHAF_Status AGHAF_CAN_v2_activate(AGHAF_CAN can)
activate a CAN bus
AGHAF_Status AGHAF_CAN_v2_supportedTerminationsLs(AGHAF_CAN can, uint32_t **terminations, uint32_t *nbTerminations)
Request the supported low speed terminations from a CAN bus.
AGHAF_CAN AGHAF_CAN_v2_get(AGHAF_Device device, uint8_t index)
return the CAN at index in parameter
AGHAF_Status AGHAF_CAN_v2_BusOn(AGHAF_CAN can)
reactivate the bus after an error
uint8_t AGHAF_CAN_v2_getIndex(AGHAF_CAN can)
return the index from a CAN bus
AGHAF_Status AGHAF_CAN_v2_getParam(AGHAF_CAN can, AGHAF_CAN_Param type, uint32_t *value)
Provide the value from a CAN parameter.
void(* AGHAF_CAN_onBusChange)(uint64_t timestamp, uint8_t chipState, void *userContext)
callback function called when a bus change happens on a CAN
Definition aghaf_can_v2.h:58
uint8_t AGHAF_CAN_v2_getCount(AGHAF_Device device)
return the number of CAN bus from a device
AGHAF_Status AGHAF_CAN_v2_Periodic_send_v2(AGHAF_CAN can, uint8_t frameDatalen, uint8_t const *frameData, uint8_t frameFlags, uint32_t frameIdent, uint8_t index, uint8_t flags, uint32_t offset, uint32_t period)
Add a periodic message to send.
AGHAF_Status AGHAF_CAN_v2_filtersCount(AGHAF_CAN can, AGHAF_CAN_FilterId idType, uint16_t *count)
Provide the current number of filters.
AGHAF_Status AGHAF_CAN_v2_isActivated(AGHAF_CAN can, AGHAF_BOOL *isActivated)
Request if a CAN bus is yet activated or not.
void(* AGHAF_CAN_onMessageRx)(uint64_t timestamp, uint32_t ident, uint8_t flags, uint8_t dataLen, uint8_t const *data, void *userContext)
callback function called when a message is received on a CAN
Definition aghaf_can_v2.h:39
AGHAF_Status AGHAF_CAN_v2_addFilter(AGHAF_CAN can, AGHAF_CAN_FilterId idType, AGHAF_CAN_FILTER_Type type, AGHAF_CAN_FilterMode mode, uint32_t id1, uint32_t id2)
add a filter to the CAN bus
AGHAF_Status AGHAF_CAN_v2_setParam(AGHAF_CAN can, AGHAF_CAN_Param type, uint32_t value)
Set the value from a CAN parameter.
void * AGHAF_CAN
handle on CAN
Definition aghaf_can_v2.h:15
AGHAF_Status AGHAF_CAN_v2_reject(AGHAF_CAN can, AGHAF_CAN_RejectType rejectType, AGHAF_BOOL rejectRtr)
Set a global filter.
void AGHAF_CAN_v2_freeSupportedFilters(AGHAF_CAN_FilterDesc *values)
Free the memory allocated with AGHAF_CAN_Bus_supportedFilters.
void(* AGHAF_CAN_onBusLoad)(uint64_t timestamp, uint8_t chipState, uint8_t busLoad, AGHAF_CAN_Error error, void *userContext)
callback function called when a bus laod is from a CAN is transmitted
Definition aghaf_can_v2.h:69
AGHAF_Status AGHAF_CAN_v2_supportedFilters(AGHAF_CAN can, uint16_t *globalFilterCaps, AGHAF_CAN_FilterDesc **values, uint16_t *size)
Provide the supported filters from a CAN bus.
void AGHAF_CAN_v2_freeSupportedModes(AGHAF_CAN_Mode *modes)
Free the memory allocated with AGHAF_CAN_Bus_supportedModes.
AGHAF_Status AGHAF_CAN_v2_sendMessage(AGHAF_CAN can, uint32_t ident, uint8_t flags, uint16_t dataLen, uint8_t const *data)
send data on a CAN bus
AGHAF_Status AGHAF_CAN_v2_supportedModes(AGHAF_CAN can, AGHAF_CAN_Mode **modes, uint8_t *nbModes)
Request the supported modes from the CAN bus in parameter.
void AGHAF_CAN_v2_setOnBusLoadCallback(AGHAF_CAN can, AGHAF_CAN_onBusLoad callback, void *userContext)
set the callback called on a bus noad event
void AGHAF_CAN_v2_setOnMessageRxCallback(AGHAF_CAN can, AGHAF_CAN_onMessageRx callback, void *userContext)
set the callback called on a rx event
void(* AGHAF_CAN_onError)(uint64_t timestamp, AGHAF_CAN_Error error, void *userContext)
callback function called when an error happens on a CAN
Definition aghaf_can_v2.h:49
void(* AGHAF_CAN_onMessageTx)(uint64_t timestamp, uint32_t ident, uint8_t flags, uint8_t dataLen, uint8_t const *data, void *userContext)
callback function called when a message is transmitted on a CAN
Definition aghaf_can_v2.h:26
AGHAF_Status AGHAF_CAN_v2_supportedTerminations(AGHAF_CAN can, uint32_t **terminations, uint32_t *nbTerminations)
Request the supported terminations from a CAN bus.
void AGHAF_CAN_v2_setOnBusChangeCallback(AGHAF_CAN can, AGHAF_CAN_onBusChange callback, void *userContext)
set the callback called on a bus change event
AGHAF_Status AGHAF_CAN_v2_clearFilters(AGHAF_CAN can)
clear the filters from a bus
void AGHAF_CAN_v2_useAPI()
Inform the library tu use the V2 CAN API.
void AGHAF_CAN_v2_freeSupportedTerminations(uint32_t *terminations)
Free the memory allocated with AGHAF_CAN_Bus_supportedTerminations or AGHAF_CAN_Bus_supportedTerminat...
void AGHAF_CAN_v2_setOnMessageTxCallback(AGHAF_CAN can, AGHAF_CAN_onMessageTx callback, void *userContext)
set the callback called on a tx event
AGHAF_Status AGHAF_CAN_v2_deactivate(AGHAF_CAN can)
deactivate a CAN bus
void AGHAF_CAN_v2_setOnErrorCallback(AGHAF_CAN can, AGHAF_CAN_onError callback, void *userContext)
set the callback called on error event
AGHAF_Status
enumerator to define the error type in aghaf functions
Definition aghaf_global.h:28
AGHAF_BOOL
enumerator to get a bool definition
Definition aghaf_global.h:22
void * AGHAF_Device
handle on an exxotest device
Definition aghaf_global.h:87