AGHAF  4.5.4
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 <ghap/aghaf_docan_enums.h>
11 
12 #include "aghaf_can.h"
13 #include "aghaf_global.h"
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
21 
23 typedef enum {
30 
32 typedef void *AGHAF_DoCAN_Bus;
33 
35 typedef void *AGHAF_DoCAN_Event;
36 
38 typedef void *AGHAF_DoCAN_Channel;
39 
50  void *userContext);
51 
52 /* Accessing bus */
53 AGHAF_PUBLIC_FUNCTION(AGHAF_DoCAN_Bus, AGHAF_DoCAN_getBus,
54  (AGHAF_Device device, uint8_t index));
55 AGHAF_PUBLIC_FUNCTION(uint32_t, AGHAF_DoCAN_getBusCount, (AGHAF_Device device));
56 
57 AGHAF_PUBLIC_FUNCTION(void, AGHAF_DoCAN_registerCallback,
59  void *userContext));
60 AGHAF_PUBLIC_FUNCTION(void, AGHAF_DoCAN_deregisterCallback,
61  (AGHAF_DoCAN_Bus bus, AGHAF_DoCAN_Callback callback));
62 AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_DoCAN_getChannelCount,
63  (AGHAF_DoCAN_Bus bus, uint8_t *count));
64 AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_DoCAN_getFreeChannelCount,
65  (AGHAF_DoCAN_Bus bus, uint8_t *count));
66 AGHAF_PUBLIC_FUNCTION(AGHAF_DoCAN_Channel, AGHAF_DoCAN_createChannel,
67  (AGHAF_DoCAN_Bus bus));
68 AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_DoCAN_releaseChannel,
69  (AGHAF_DoCAN_Channel channel));
70 
71 AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_DoCAN_Channel_setParam,
72  (AGHAF_DoCAN_Channel channel,
73  AGHAF_DoCAN_ChannelParam param, uint32_t value));
74 AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_DoCAN_Channel_getParam,
75  (AGHAF_DoCAN_Channel channel,
76  AGHAF_DoCAN_ChannelParam param, uint32_t *value));
77 AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_DoCAN_Channel_start,
78  (AGHAF_DoCAN_Channel channel));
79 AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_DoCAN_Channel_stop,
80  (AGHAF_DoCAN_Channel channel));
81 AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_DoCAN_Channel_send,
82  (AGHAF_DoCAN_Channel channel, uint32_t dataLen,
83  uint8_t const *data));
84 AGHAF_PUBLIC_FUNCTION(void, AGHAF_DoCAN_Channel_activateTrace,
85  (AGHAF_DoCAN_Channel channel, AGHAF_BOOL value));
86 
87 /* Event functions */
88 AGHAF_PUBLIC_FUNCTION(AGHAF_DoCAN_EventType, AGHAF_DoCAN_Event_type,
89  (AGHAF_EventInfo event));
90 AGHAF_PUBLIC_FUNCTION(uint8_t, AGHAF_DoCAN_Event_getBusIndex,
91  (AGHAF_DoCAN_Event event));
92 AGHAF_PUBLIC_FUNCTION(uint32_t, AGHAF_DoCAN_Event_getDataSize,
93  (AGHAF_DoCAN_Event event));
94 AGHAF_PUBLIC_FUNCTION(AGHAF_Status, AGHAF_DoCAN_Event_getData,
95  (AGHAF_DoCAN_Event event, uint8_t *data, uint32_t *size));
96 AGHAF_PUBLIC_FUNCTION(AGHAF_CAN_Identifier, AGHAF_DoCAN_Event_getId,
97  (AGHAF_DoCAN_Event event));
98 AGHAF_PUBLIC_FUNCTION(uint8_t, AGHAF_DoCAN_Event_getError,
99  (AGHAF_DoCAN_Event event));
101  (AGHAF_DoCAN_Event event));
102 
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif // EXXOTEST_AGHAF_DOCAN_H
void * AGHAF_DoCAN_Bus
Handle to a DoCAN bus.
Definition: aghaf_docan.h:32
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:130
AGHAF_DoCAN_EventType
enumerator to tell the type of the event
Definition: aghaf_docan.h:23
AGHAF_DoCAN_Bus AGHAF_DoCAN_getBus(AGHAF_Device device, uint8_t index)
return the DoCAN bus at index in parameter
Definition: aghaf_docan.cpp:14
AGHAF_Status AGHAF_DoCAN_releaseChannel(AGHAF_DoCAN_Channel channel)
Release the channel.
Definition: aghaf_docan.cpp:91
void * AGHAF_DoCAN_Channel
Handle to a DoCAN channel.
Definition: aghaf_docan.h:38
uint32_t AGHAF_DoCAN_Event_getDataSize(AGHAF_DoCAN_Event event)
return the size from the datas in the event
Definition: aghaf_docan.cpp:225
AGHAF_Status AGHAF_DoCAN_Channel_stop(AGHAF_DoCAN_Channel channel)
Stop a channel.
Definition: aghaf_docan.cpp:169
AGHAF_DoCAN_EventType AGHAF_DoCAN_Event_type(AGHAF_EventInfo event)
return the type from the event
Definition: aghaf_docan.cpp:206
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:59
void AGHAF_DoCAN_Channel_activateTrace(AGHAF_DoCAN_Channel channel, AGHAF_BOOL value)
Activate the CAN trace.
Definition: aghaf_docan.cpp:194
void(* AGHAF_DoCAN_Callback)(AGHAF_DoCAN_Event event, void *userContext)
Definition: aghaf_docan.h:49
void AGHAF_DoCAN_deregisterCallback(AGHAF_DoCAN_Bus bus, AGHAF_DoCAN_Callback callback)
deregister a callback
Definition: aghaf_docan.cpp:47
AGHAF_DoCAN_Channel AGHAF_DoCAN_Event_getChannel(AGHAF_DoCAN_Event event)
Return the channel on which occured the event.
Definition: aghaf_docan.cpp:268
uint32_t AGHAF_DoCAN_getBusCount(AGHAF_Device device)
return the number of DoCAN bus from a device
Definition: aghaf_docan.cpp:24
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:182
AGHAF_DoCAN_ChannelParam
List of parameters used to configure a DoCAN channel.
Definition: aghaf_docan_enums.h:86
void * AGHAF_DoCAN_Event
Handle to a DoCAN event.
Definition: aghaf_docan.h:35
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:145
AGHAF_DoCAN_Channel AGHAF_DoCAN_createChannel(AGHAF_DoCAN_Bus bus)
Create a channel.
Definition: aghaf_docan.cpp:81
uint8_t AGHAF_DoCAN_Event_getError(AGHAF_DoCAN_Event event)
Return the error value from the event.
Definition: aghaf_docan.cpp:258
AGHAF_Status AGHAF_DoCAN_Channel_start(AGHAF_DoCAN_Channel channel)
Start a channel.
Definition: aghaf_docan.cpp:158
AGHAF_Status AGHAF_DoCAN_getFreeChannelCount(AGHAF_DoCAN_Bus bus, uint8_t *count)
Return the number of free channels still available.
Definition: aghaf_docan.cpp:70
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:215
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:35
@ AGHAF_DoCAN_EVENT_MSGRXFF
First Frame has been received.
Definition: aghaf_docan.h:27
@ AGHAF_DoCAN_EVENT_MSGRXERR
Reception error.
Definition: aghaf_docan.h:28
@ AGHAF_DoCAN_EVENT_MSGTX
End of transmission.
Definition: aghaf_docan.h:24
@ AGHAF_DoCAN_EVENT_MSGTXERR
Transmission Error.
Definition: aghaf_docan.h:25
@ AGHAF_DoCAN_EVENT_MSGRX
Message has been received.
Definition: aghaf_docan.h:26
AGHAF_Status
enumerator to define the error type in aghaf functions
Definition: aghaf_global.h:120
AGHAF_BOOL
enumerator to get a bool definition
Definition: aghaf_global.h:114
void * AGHAF_Device
handle on an exxotest device
Definition: aghaf_global.h:175
structure to represent an indentifier CAN in the AGHAF library
Definition: aghaf_can.h:115
generic stucture to read an event in a callback
Definition: aghaf_global.h:229