AGHAF  4.5.1
Annecy electronique Generic Hardware Access Framework
aghaf_docan.h
Go to the documentation of this file.
1 // Copyright (c) 2019 by ANNECY ELECTRONIQUE, Chavanod, France
2 
6 
7 #ifndef EXXOTEST_AGHAF_DOCAN_H
8 #define EXXOTEST_AGHAF_DOCAN_H
9 
10 #include "aghaf_global.h"
11 #include "aghaf_can.h"
12 #include <ghap/aghaf_docan_enums.h>
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
20 
22 typedef enum {
29 
31 typedef void * AGHAF_DoCAN_Bus;
32 
34 typedef void * AGHAF_DoCAN_Event;
35 
37 typedef void * AGHAF_DoCAN_Channel;
38 
47 typedef void (*AGHAF_DoCAN_Callback)(AGHAF_DoCAN_Event event, void *userContext);
48 
49 /* Accessing bus */
50 AGHAF_PUBLIC_FUNCTION(AGHAF_DoCAN_Bus, AGHAF_DoCAN_getBus, (AGHAF_Device device, uint8_t index));
51 AGHAF_PUBLIC_FUNCTION(uint32_t, AGHAF_DoCAN_getBusCount, (AGHAF_Device device));
52 
53 AGHAF_PUBLIC_FUNCTION(void, AGHAF_DoCAN_registerCallback, (AGHAF_DoCAN_Bus bus, AGHAF_DoCAN_Callback callback, void *userContext));
54 AGHAF_PUBLIC_FUNCTION(void, AGHAF_DoCAN_deregisterCallback, (AGHAF_DoCAN_Bus bus, AGHAF_DoCAN_Callback callback));
55 AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_DoCAN_getChannelCount, (AGHAF_DoCAN_Bus bus, uint8_t *count));
56 AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_DoCAN_getFreeChannelCount, (AGHAF_DoCAN_Bus bus, uint8_t *count));
58 AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_DoCAN_releaseChannel, (AGHAF_DoCAN_Channel channel));
59 
60 AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_DoCAN_Channel_setParam, (AGHAF_DoCAN_Channel channel, AGHAF_DoCAN_ChannelParam param, uint32_t value));
61 AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_DoCAN_Channel_getParam, (AGHAF_DoCAN_Channel channel, AGHAF_DoCAN_ChannelParam param, uint32_t *value));
62 AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_DoCAN_Channel_start, (AGHAF_DoCAN_Channel channel));
63 AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_DoCAN_Channel_stop, (AGHAF_DoCAN_Channel channel));
64 AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_DoCAN_Channel_send, (AGHAF_DoCAN_Channel channel, uint32_t dataLen, uint8_t const* data));
65 AGHAF_PUBLIC_FUNCTION(void, AGHAF_DoCAN_Channel_activateTrace, (AGHAF_DoCAN_Channel channel, AGHAF_BOOL value));
66 
67 /* Event functions */
68 AGHAF_PUBLIC_FUNCTION(AGHAF_DoCAN_EventType, AGHAF_DoCAN_Event_type, (AGHAF_EventInfo event));
69 AGHAF_PUBLIC_FUNCTION(uint8_t, AGHAF_DoCAN_Event_getBusIndex, (AGHAF_DoCAN_Event event));
70 AGHAF_PUBLIC_FUNCTION(uint32_t, AGHAF_DoCAN_Event_getDataSize, (AGHAF_DoCAN_Event event));
71 AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_DoCAN_Event_getData, (AGHAF_DoCAN_Event event, uint8_t *data, uint32_t *size));
72 AGHAF_PUBLIC_FUNCTION(AGHAF_CAN_Identifier, AGHAF_DoCAN_Event_getId, (AGHAF_DoCAN_Event event));
73 AGHAF_PUBLIC_FUNCTION(uint8_t, AGHAF_DoCAN_Event_getError, (AGHAF_DoCAN_Event event));
75 
77 
78 #ifdef __cplusplus
79 }
80 #endif
81 
82 #endif // EXXOTEST_AGHAF_DOCAN_H
void * AGHAF_DoCAN_Bus
Handle to a DoCAN bus.
Definition: aghaf_docan.h:31
AGHAF_Status AGHAF_DoCAN_Channel_setParam(AGHAF_DoCAN_Channel channel, AGHAF_DoCAN_ChannelParam param, uint32_t value)
Set the parameter from a channel.
Definition: aghaf_docan.cpp:133
AGHAF_DoCAN_EventType
enumerator to tell the type of the event
Definition: aghaf_docan.h:22
AGHAF_DoCAN_Bus AGHAF_DoCAN_getBus(AGHAF_Device device, uint8_t index)
return the DoCAN bus at index in parameter
Definition: aghaf_docan.cpp:15
AGHAF_Status AGHAF_DoCAN_releaseChannel(AGHAF_DoCAN_Channel channel)
Release the channel.
Definition: aghaf_docan.cpp:95
void * AGHAF_DoCAN_Channel
Handle to a DoCAN channel.
Definition: aghaf_docan.h:37
uint32_t AGHAF_DoCAN_Event_getDataSize(AGHAF_DoCAN_Event event)
return the size from the datas in the event
Definition: aghaf_docan.cpp:224
AGHAF_Status AGHAF_DoCAN_Channel_stop(AGHAF_DoCAN_Channel channel)
Stop a channel.
Definition: aghaf_docan.cpp:168
AGHAF_DoCAN_EventType AGHAF_DoCAN_Event_type(AGHAF_EventInfo event)
return the type from the event
Definition: aghaf_docan.cpp:203
AGHAF_Status AGHAF_DoCAN_getChannelCount(AGHAF_DoCAN_Bus bus, uint8_t *count)
Provide the number of channels available on the bus.
Definition: aghaf_docan.cpp:61
void AGHAF_DoCAN_Channel_activateTrace(AGHAF_DoCAN_Channel channel, AGHAF_BOOL value)
Activate the CAN trace.
Definition: aghaf_docan.cpp:192
void(* AGHAF_DoCAN_Callback)(AGHAF_DoCAN_Event event, void *userContext)
Definition: aghaf_docan.h:47
void AGHAF_DoCAN_deregisterCallback(AGHAF_DoCAN_Bus bus, AGHAF_DoCAN_Callback callback)
deregister a callback
Definition: aghaf_docan.cpp:49
AGHAF_DoCAN_Channel AGHAF_DoCAN_Event_getChannel(AGHAF_DoCAN_Event event)
Return the channel on which occured the event.
Definition: aghaf_docan.cpp:270
uint32_t AGHAF_DoCAN_getBusCount(AGHAF_Device device)
return the number of DoCAN bus from a device
Definition: aghaf_docan.cpp:26
AGHAF_Status AGHAF_DoCAN_Channel_send(AGHAF_DoCAN_Channel channel, uint32_t dataLen, uint8_t const *data)
Send on the DoCAN channel in parameter.
Definition: aghaf_docan.cpp:181
AGHAF_DoCAN_ChannelParam
List of parameters used to configure a DoCAN channel.
Definition: aghaf_docan_enums.h:78
void * AGHAF_DoCAN_Event
Handle to a DoCAN event.
Definition: aghaf_docan.h:34
AGHAF_CAN_Identifier AGHAF_DoCAN_Event_getId(AGHAF_DoCAN_Event event)
Return the CAN identifier from the event.
Definition: aghaf_docan.cpp:248
AGHAF_Status AGHAF_DoCAN_Event_getData(AGHAF_DoCAN_Event event, uint8_t *data, uint32_t *size)
Provide the datas received in the event.
Definition: aghaf_docan.cpp:237
AGHAF_Status AGHAF_DoCAN_Channel_getParam(AGHAF_DoCAN_Channel channel, AGHAF_DoCAN_ChannelParam param, uint32_t *value)
Provide the value from a channel parameter.
Definition: aghaf_docan.cpp:146
AGHAF_DoCAN_Channel AGHAF_DoCAN_createChannel(AGHAF_DoCAN_Bus bus)
Create a channel.
Definition: aghaf_docan.cpp:84
uint8_t AGHAF_DoCAN_Event_getError(AGHAF_DoCAN_Event event)
Return the error value from the event.
Definition: aghaf_docan.cpp:259
AGHAF_Status AGHAF_DoCAN_Channel_start(AGHAF_DoCAN_Channel channel)
Start a channel.
Definition: aghaf_docan.cpp:157
AGHAF_Status AGHAF_DoCAN_getFreeChannelCount(AGHAF_DoCAN_Bus bus, uint8_t *count)
Return the number of free channels still available.
Definition: aghaf_docan.cpp:73
uint8_t AGHAF_DoCAN_Event_getBusIndex(AGHAF_DoCAN_Event event)
return the index from the bus on which occured the event
Definition: aghaf_docan.cpp:213
void AGHAF_DoCAN_registerCallback(AGHAF_DoCAN_Bus bus, AGHAF_DoCAN_Callback callback, void *userContext)
Register a callback for the DoCAN events from a bus.
Definition: aghaf_docan.cpp:38
@ AGHAF_DoCAN_EVENT_MSGRXFF
First Frame has been received.
Definition: aghaf_docan.h:26
@ AGHAF_DoCAN_EVENT_MSGRXERR
Reception error.
Definition: aghaf_docan.h:27
@ AGHAF_DoCAN_EVENT_MSGTX
End of transmission.
Definition: aghaf_docan.h:23
@ AGHAF_DoCAN_EVENT_MSGTXERR
Transmission Error.
Definition: aghaf_docan.h:24
@ AGHAF_DoCAN_EVENT_MSGRX
Message has been received.
Definition: aghaf_docan.h:25
AGHAF_Status
enumerator to define the error type in aghaf functions
Definition: aghaf_global.h:109
AGHAF_BOOL
enumerator to get a bool definition
Definition: aghaf_global.h:102
void * AGHAF_Device
handle on an exxotest device
Definition: aghaf_global.h:145
structure to represent an indentifier CAN in the AGHAF library
Definition: aghaf_can.h:108
generic stucture to read an event in a callback
Definition: aghaf_global.h:201