AGHAF  4.5.5
Annecy electronique Generic Hardware Access Framework
CAN V2

API to use CAN on exxotest devices. More...

typedef void * AGHAF_CAN
 handle on CAN
 
typedef void(* AGHAF_CAN_onMessageTx) (uint64_t timestamp, uint32_t ident, uint8_t flags, uint16_t dataLen, uint8_t const *data, void *userContext)
 callback function called when a message is transmitted on a CAN More...
 
typedef void(* AGHAF_CAN_onMessageRx) (uint64_t timestamp, uint32_t ident, uint8_t flags, uint16_t dataLen, uint8_t const *data, void *userContext)
 callback function called when a message is received on a CAN More...
 
typedef void(* AGHAF_CAN_onError) (uint64_t timestamp, AGHAF_CAN_Error error, void *userContext)
 callback function called when an error happens on a CAN More...
 
typedef void(* AGHAF_CAN_onBusChange) (uint64_t timestamp, uint8_t chipState, void *userContext)
 callback function called when a bus change happens on a CAN More...
 
typedef 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 More...
 
void AGHAF_CAN_v2_useAPI ()
 Inform the library tu use the V2 CAN API.
 
void AGHAF_CAN_v2_setOnMessageTxCallback (AGHAF_CAN can, AGHAF_CAN_onMessageTx callback, void *userContext)
 set the callback called on a tx event More...
 
void AGHAF_CAN_v2_setOnMessageRxCallback (AGHAF_CAN can, AGHAF_CAN_onMessageRx callback, void *userContext)
 set the callback called on a rx event More...
 
void AGHAF_CAN_v2_setOnErrorCallback (AGHAF_CAN can, AGHAF_CAN_onError callback, void *userContext)
 set the callback called on error event More...
 
void AGHAF_CAN_v2_setOnBusChangeCallback (AGHAF_CAN can, AGHAF_CAN_onBusChange callback, void *userContext)
 set the callback called on a bus change event More...
 
void AGHAF_CAN_v2_setOnBusLoadCallback (AGHAF_CAN can, AGHAF_CAN_onBusLoad callback, void *userContext)
 set the callback called on a bus noad event More...
 
AGHAF_CAN AGHAF_CAN_v2_get (AGHAF_Device device, uint8_t index)
 return the CAN bus at index in parameter More...
 
uint8_t AGHAF_CAN_v2_getIndex (AGHAF_CAN can)
 return the index from a CAN bus More...
 
uint8_t AGHAF_CAN_v2_getCount (AGHAF_Device device)
 return the number of CAN bus from a device More...
 
AGHAF_Status AGHAF_CAN_v2_activate (AGHAF_CAN can)
 activate a CAN bus More...
 
AGHAF_Status AGHAF_CAN_v2_deactivate (AGHAF_CAN can)
 deactivate a CAN bus More...
 
AGHAF_Status AGHAF_CAN_v2_isActivated (AGHAF_CAN can, AGHAF_BOOL *isActivated)
 Request if a CAN bus is yet activated or not. More...
 
AGHAF_Status AGHAF_CAN_v2_getParam (AGHAF_CAN can, AGHAF_CAN_Param param, uint32_t *value)
 Provide the value from a CAN parameter. More...
 
AGHAF_Status AGHAF_CAN_v2_setParam (AGHAF_CAN can, AGHAF_CAN_Param param, uint32_t value)
 Set the value from a CAN parameter. More...
 
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. More...
 
void AGHAF_CAN_v2_freeSupportedModes (AGHAF_CAN_Mode *modes)
 Free the memory allocated with AGHAF_CAN_Bus_supportedModes. More...
 
AGHAF_Status AGHAF_CAN_v2_getChipSstate (AGHAF_CAN can, AGHAF_CAN_ChipState *chipState)
 Return the chip state from the bus. More...
 
AGHAF_Status AGHAF_CAN_v2_BusOn (AGHAF_CAN can)
 reactivate the bus after an error More...
 
AGHAF_Status AGHAF_CAN_v2_supportedTerminations (AGHAF_CAN can, uint32_t **terminations, uint32_t *nbTerminations)
 Request the supported terminations from a CAN bus. More...
 
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. More...
 
void AGHAF_CAN_v2_freeSupportedTerminations (uint32_t *terminations)
 Free the memory allocated with AGHAF_CAN_Bus_supportedTerminations or AGHAF_CAN_Bus_supportedTerminationsLs. More...
 
uint8_t AGHAF_CAN_v2_Periodic_getCount (AGHAF_CAN can)
 Return the number of periodic message available on a CAN bus. More...
 
AGHAF_Status AGHAF_CAN_v2_Periodic_send (AGHAF_CAN can, uint8_t frameDatalen, uint8_t const *const frameData, uint8_t frameFlags, uint32_t frameIdent, uint8_t index, uint8_t flags, uint32_t period)
 Add a periodic message to send. More...
 
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 More...
 
AGHAF_Status AGHAF_CAN_v2_clearFilters (AGHAF_CAN can)
 clear the filters from a bus More...
 
AGHAF_Status AGHAF_CAN_v2_filtersCount (AGHAF_CAN can, AGHAF_CAN_FilterId idType, uint16_t *count)
 Provide the current number of filters. More...
 
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. More...
 
void AGHAF_CAN_v2_freeSupportedFilters (AGHAF_CAN_FilterDesc *values)
 Free the memory allocated with AGHAF_CAN_Bus_supportedFilters. More...
 
AGHAF_Status AGHAF_CAN_v2_reject (AGHAF_CAN can, AGHAF_CAN_RejectType rejectType, AGHAF_BOOL rtr)
 Set a global filter. More...
 
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 More...
 

Detailed Description

API to use CAN on exxotest devices.

Usage Example

Call order and priority

Device is in "init" state at startup.

The following section describes state management:


Symbol Description
Forbidden
Authorized
Followed status


Function Config Active
AGHAF_CAN_v2_get
AGHAF_CAN_v2_getCount
AGHAF_CAN_v2_setOnMessageTxCallback
AGHAF_CAN_v2_setOnMessageRxCallback
AGHAF_CAN_v2_setOnErrorCallback
AGHAF_CAN_v2_setOnBusChangeCallback
AGHAF_CAN_v2_setOnBusLoadCallback
AGHAF_CAN_v2_getParam
AGHAF_CAN_v2_setParam
AGHAF_CAN_v2_supportedModes
AGHAF_CAN_v2_addFilter
AGHAF_CAN_v2_clearFilters
AGHAF_CAN_v2_filtersCount
AGHAF_CAN_v2_reject
AGHAF_CAN_v2_supportedFilters
AGHAF_CAN_v2_activate
AGHAF_CAN_v2_deactivate
AGHAF_CAN_v2_isActivated
AGHAF_CAN_v2_supportedTerminations
AGHAF_CAN_v2_supportedTerminationsLs
AGHAF_CAN_v2_getChipSstate
AGHAF_CAN_v2_BusOn
AGHAF_CAN_v2_Periodic_send
AGHAF_CAN_v2_Periodic_getCount
AGHAF_CAN_v2_sendMessage

Typedef Documentation

◆ AGHAF_CAN_onBusChange

typedef void(* AGHAF_CAN_onBusChange) (uint64_t timestamp, uint8_t chipState, void *userContext)

callback function called when a bus change happens on a CAN

Parameters
timestamptimestamp of the event
chipStatecorresponding to AGHAF_CAN_ChipState
userContextcontext given when setting the callabck in the system

◆ AGHAF_CAN_onBusLoad

typedef 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

Parameters
timestamptimestamp of the event
chipStatecorresponding to AGHAF_CAN_ChipState
busLoadcurrent bus load
errorvalue of the error
userContextcontext given when setting the callabck in the system

◆ AGHAF_CAN_onError

typedef void(* AGHAF_CAN_onError) (uint64_t timestamp, AGHAF_CAN_Error error, void *userContext)

callback function called when an error happens on a CAN

Parameters
timestamptimestamp of the event
errorvalue of the error
userContextcontext given when setting the callabck in the system

◆ AGHAF_CAN_onMessageRx

typedef void(* AGHAF_CAN_onMessageRx) (uint64_t timestamp, uint32_t ident, uint8_t flags, uint16_t dataLen, uint8_t const *data, void *userContext)

callback function called when a message is received on a CAN

Parameters
timestamptimestamp of the event
identcan identifier
flagscorresponding to AGHAF_CAN_MSG_FLAGS
dataLenlength of the datas received
datadatas received
userContextcontext given when setting the callabck in the system

◆ AGHAF_CAN_onMessageTx

typedef void(* AGHAF_CAN_onMessageTx) (uint64_t timestamp, uint32_t ident, uint8_t flags, uint16_t dataLen, uint8_t const *data, void *userContext)

callback function called when a message is transmitted on a CAN

Parameters
timestamptimestamp of the event
identcan identifier
flagscorresponding to AGHAF_CAN_MSG_FLAGS
dataLenlength of the datas transmitted
datadatas transmitted
userContextcontext given when setting the callabck in the system

Function Documentation

◆ AGHAF_CAN_v2_activate()

AGHAF_Status AGHAF_CAN_v2_activate ( AGHAF_CAN  can)

activate a CAN bus

Parameters
canhandle on the bus
Returns
status request information
Examples
Can_v2_FD/main.cpp, Can_v2_LS/main.cpp, and DoCan_v2_FD/main.cpp.

◆ AGHAF_CAN_v2_addFilter()

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

Parameters
canhandle on the bus
idTypestandard or extended CAN
typetype from the filter
modemode from the filter
id1
id2
Returns
status request information

◆ AGHAF_CAN_v2_BusOn()

AGHAF_Status AGHAF_CAN_v2_BusOn ( AGHAF_CAN  can)

reactivate the bus after an error

Parameters
canhandle on the bus
Returns
status request information

◆ AGHAF_CAN_v2_clearFilters()

AGHAF_Status AGHAF_CAN_v2_clearFilters ( AGHAF_CAN  can)

clear the filters from a bus

Parameters
canhandle on the bus
Returns
status request information

◆ AGHAF_CAN_v2_deactivate()

AGHAF_Status AGHAF_CAN_v2_deactivate ( AGHAF_CAN  can)

deactivate a CAN bus

Parameters
canhandle on the bus
Returns
status request information
Examples
Can_v2_FD/main.cpp, Can_v2_LS/main.cpp, and DoCan_v2_FD/main.cpp.

◆ AGHAF_CAN_v2_filtersCount()

AGHAF_Status AGHAF_CAN_v2_filtersCount ( AGHAF_CAN  can,
AGHAF_CAN_FilterId  idType,
uint16_t *  count 
)

Provide the current number of filters.

Parameters
canhandle on the bus
idTypestandard or extended CAN
countpointer to fill with the data
Returns
status request information

◆ AGHAF_CAN_v2_freeSupportedFilters()

void AGHAF_CAN_v2_freeSupportedFilters ( AGHAF_CAN_FilterDesc *  values)

Free the memory allocated with AGHAF_CAN_Bus_supportedFilters.

Parameters
valuesarray to free

◆ AGHAF_CAN_v2_freeSupportedModes()

void AGHAF_CAN_v2_freeSupportedModes ( AGHAF_CAN_Mode modes)

Free the memory allocated with AGHAF_CAN_Bus_supportedModes.

Parameters
modesarray to free

◆ AGHAF_CAN_v2_freeSupportedTerminations()

void AGHAF_CAN_v2_freeSupportedTerminations ( uint32_t *  terminations)

Free the memory allocated with AGHAF_CAN_Bus_supportedTerminations or AGHAF_CAN_Bus_supportedTerminationsLs.

Parameters
terminationsarray to free

◆ AGHAF_CAN_v2_get()

AGHAF_CAN AGHAF_CAN_v2_get ( AGHAF_Device  device,
uint8_t  index 
)

return the CAN bus at index in parameter

Parameters
devicedevice handle from the desired CAN bus
indexindex from the bus
Returns
Handle on a CAN bus
Examples
Can_v2_FD/main.cpp, Can_v2_LS/main.cpp, and DoCan_v2_FD/main.cpp.

◆ AGHAF_CAN_v2_getChipSstate()

AGHAF_Status AGHAF_CAN_v2_getChipSstate ( AGHAF_CAN  can,
AGHAF_CAN_ChipState chipState 
)

Return the chip state from the bus.

Parameters
canhandle on the bus
chipStatepointer to fill
Returns
status request information

◆ AGHAF_CAN_v2_getCount()

uint8_t AGHAF_CAN_v2_getCount ( AGHAF_Device  device)

return the number of CAN bus from a device

Parameters
devicehandle from the device
Returns
Number of CAN bus on the device
Examples
Can_v2_FD/main.cpp, Can_v2_LS/main.cpp, and DoCan_v2_FD/main.cpp.

◆ AGHAF_CAN_v2_getIndex()

uint8_t AGHAF_CAN_v2_getIndex ( AGHAF_CAN  can)

return the index from a CAN bus

Parameters
canhandle from the CAN bus
Returns
index from the bus

◆ AGHAF_CAN_v2_getParam()

AGHAF_Status AGHAF_CAN_v2_getParam ( AGHAF_CAN  can,
AGHAF_CAN_Param  param,
uint32_t *  value 
)

Provide the value from a CAN parameter.

Parameters
canhandle on the CAN bus
paramparameter to request
valuepointer to fill with the content
Returns
status request information

◆ AGHAF_CAN_v2_isActivated()

AGHAF_Status AGHAF_CAN_v2_isActivated ( AGHAF_CAN  can,
AGHAF_BOOL isActivated 
)

Request if a CAN bus is yet activated or not.

Parameters
canhandle on the bus
isActivatedpointer to fill with the information
Returns
status request information

◆ AGHAF_CAN_v2_Periodic_getCount()

uint8_t AGHAF_CAN_v2_Periodic_getCount ( AGHAF_CAN  can)

Return the number of periodic message available on a CAN bus.

Parameters
canhandle on the bus
Returns
the number of periodic message available

◆ AGHAF_CAN_v2_Periodic_send()

AGHAF_Status AGHAF_CAN_v2_Periodic_send ( AGHAF_CAN  can,
uint8_t  frameDatalen,
uint8_t const *const  frameData,
uint8_t  frameFlags,
uint32_t  frameIdent,
uint8_t  index,
uint8_t  flags,
uint32_t  period 
)

Add a periodic message to send.

Parameters
canhandle on the bus
frameDatalendata length from the frame
frameDatadata from the frame
frameFlagsCAN flags from the frame
frameIdentCAN identi from the frame
indexindex in which to save the frame
flagsAGHAF_CAN_PERIODIC_FLAGS
periodperiod at which sending the frame (ms)
Returns
status request information
Note
A period of zero stops the priodic frame.

◆ AGHAF_CAN_v2_reject()

AGHAF_Status AGHAF_CAN_v2_reject ( AGHAF_CAN  can,
AGHAF_CAN_RejectType  rejectType,
AGHAF_BOOL  rtr 
)

Set a global filter.

Parameters
canhandle on the bus
rejectTypetype of reject desired
rtr
Returns
status request information

◆ AGHAF_CAN_v2_sendMessage()

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

Parameters
canhandle on the CAN bus
identCAN identifier
flagsflags starting with AGHAF_CAN_MSG_
dataLenlength of data
datadata to send
Returns
status request information
Examples
Can_v2_FD/main.cpp, and Can_v2_LS/main.cpp.

◆ AGHAF_CAN_v2_setOnBusChangeCallback()

void AGHAF_CAN_v2_setOnBusChangeCallback ( AGHAF_CAN  can,
AGHAF_CAN_onBusChange  callback,
void *  userContext 
)

set the callback called on a bus change event

Parameters
canhandle on the bus
callbackcallback to be used for the event
userContextcontext provided by the user for custom datas
Examples
Can_v2_FD/main.cpp, and Can_v2_LS/main.cpp.

◆ AGHAF_CAN_v2_setOnBusLoadCallback()

void AGHAF_CAN_v2_setOnBusLoadCallback ( AGHAF_CAN  can,
AGHAF_CAN_onBusLoad  callback,
void *  userContext 
)

set the callback called on a bus noad event

Parameters
canhandle on the bus
callbackcallback to be used for the event
userContextcontext provided by the user for custom datas
Examples
Can_v2_FD/main.cpp, and Can_v2_LS/main.cpp.

◆ AGHAF_CAN_v2_setOnErrorCallback()

void AGHAF_CAN_v2_setOnErrorCallback ( AGHAF_CAN  can,
AGHAF_CAN_onError  callback,
void *  userContext 
)

set the callback called on error event

Parameters
canhandle on the bus
callbackcallback to be used for the event
userContextcontext provided by the user for custom datas
Examples
Can_v2_FD/main.cpp, and Can_v2_LS/main.cpp.

◆ AGHAF_CAN_v2_setOnMessageRxCallback()

void AGHAF_CAN_v2_setOnMessageRxCallback ( AGHAF_CAN  can,
AGHAF_CAN_onMessageRx  callback,
void *  userContext 
)

set the callback called on a rx event

Parameters
canhandle on the bus
callbackcallback to be used for the event
userContextcontext provided by the user for custom datas
Examples
Can_v2_FD/main.cpp, and Can_v2_LS/main.cpp.

◆ AGHAF_CAN_v2_setOnMessageTxCallback()

void AGHAF_CAN_v2_setOnMessageTxCallback ( AGHAF_CAN  can,
AGHAF_CAN_onMessageTx  callback,
void *  userContext 
)

set the callback called on a tx event

Parameters
canhandle on the bus
callbackcallback to be used for the event
userContextcontext provided by the user for custom datas
Examples
Can_v2_FD/main.cpp, and Can_v2_LS/main.cpp.

◆ AGHAF_CAN_v2_setParam()

AGHAF_Status AGHAF_CAN_v2_setParam ( AGHAF_CAN  can,
AGHAF_CAN_Param  param,
uint32_t  value 
)

Set the value from a CAN parameter.

Parameters
canhandle on the CAN bus
paramparameter to set
valuevalue to set
Returns
status request information
Examples
Can_v2_FD/main.cpp, Can_v2_LS/main.cpp, and DoCan_v2_FD/main.cpp.

◆ AGHAF_CAN_v2_supportedFilters()

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.

Parameters
canhandle on the bus
globalFilterCapspointer to fill with global cappabilites informations
valuespointer to fill with the datas
sizesize from values arrays
Returns
status request information
Warning
the memory allocated in values must freed with AGHAF_CAN_Bus_freeSupportedFilters

◆ AGHAF_CAN_v2_supportedModes()

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.

Parameters
canhandle on the bus
modespointer on the datas
nbModessize from the modes array
Returns
status request information
Warning
the memory allocated in modes must freed with AGHAF_CAN_Bus_freeSupportedModes

◆ AGHAF_CAN_v2_supportedTerminations()

AGHAF_Status AGHAF_CAN_v2_supportedTerminations ( AGHAF_CAN  can,
uint32_t **  terminations,
uint32_t *  nbTerminations 
)

Request the supported terminations from a CAN bus.

Parameters
canhandle on the bus
terminationspointer on the datas
nbTerminationssize from the modes array
Returns
status request information
Warning
the memory allocated in terminations must freed with AGHAF_CAN_Bus_freeSupportedTerminations

◆ AGHAF_CAN_v2_supportedTerminationsLs()

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.

Parameters
canhandle on the bus
terminationspointer on the datas
nbTerminationssize from the modes array
Returns
status request information
Warning
the memory allocated in terminations must freed with AGHAF_CAN_Bus_freeSupportedTerminations