socan 1.2.1
Linux SocketCAN higher level library
Loading...
Searching...
No Matches
socan.h
Go to the documentation of this file.
1
95#ifndef _SOCAN_H
96#define _SOCAN_H
97
98/* ----------------------------------------------
99 * includes
100 * ---------------------------------------------- */
101
102#include <stdbool.h>
103
104/* ----------------------------------------------
105 * constants
106 * ---------------------------------------------- */
107
109#define SOCAN_VERSION_STR "1.2.1"
110
112#define SOCAN_VERSION_MAJOR 1
113
115#define SOCAN_VERSION_MINOR 2
116
130#define SOCAN_MAX_PORTS 8
131
137#define SOCAN_FRAME_LENGTH 8
138
146#define COB_NO 2048
147
148/* ----------------------------------------------
149 * types
150 * ---------------------------------------------- */
151
168
200
201
203typedef struct socan_obj_s *socan_obj_h;
204
211typedef struct socan_hdl_s *socan_hdl;
212
213/* ----------------------------------------------
214 * functions
215 * ---------------------------------------------- */
216
222extern char *socan_str_rc(socan_rc rc);
223
229extern bool socan_rc_is_error(socan_rc rc);
230
247extern int socan_errprintlevel(int level);
248
263extern int socan_tracelevel(int level);
264
276extern int socan_add_port(const char *devicename);
277
311extern bool socan_realtime_setup(bool use_rt_priority,
312 bool require_rt_priority,
313 int reader_priority,
314 int writer_priority);
315
323extern bool socan_init(void);
324
332extern socan_rc socan_port_bitrate(unsigned char port, unsigned int *bitrate);
333
341extern socan_hdl socan_open(void);
342
350extern bool socan_close(socan_hdl h);
351
365extern socan_rc socan_port_device(unsigned char port, char **dev);
366
391extern socan_rc socan_add_obj(socan_hdl hdl, unsigned char port,
392 unsigned short cob, unsigned char length,
393 unsigned int tmo_ms, socan_obj_type type);
394
409extern socan_rc socan_del_obj(unsigned char port, unsigned short cob);
410
430 unsigned char port, unsigned short cob,
431 unsigned char *length,
432 unsigned int *tmo_ms,
433 socan_obj_type *type);
434
463extern socan_rc socan_obj_ts(unsigned char port, unsigned short cob,
464 unsigned long *ts);
465
479extern socan_rc socan_ts_to_str(unsigned long ts, char *buf, int buflen);
480
501extern socan_rc socan_set_inhibit(unsigned char port, unsigned short cob, unsigned long inhibit_time);
502
525extern socan_rc socan_use_queue(unsigned char port, unsigned short cob);
526
548extern socan_rc socan_new_user_area(unsigned char port, unsigned short cob,
549 unsigned int size,
550 void **area);
551
570extern socan_rc socan_user_area(unsigned char port, unsigned short cob,
571 void **area);
572
595extern socan_rc socan_set_user_area(unsigned char port, unsigned short cob,
596 void *ptr);
597
615extern socan_rc socan_free_user_area(unsigned char port, unsigned short cob);
616
643 unsigned char port, unsigned short cob,
644 const void *data);
645
675 unsigned char port, unsigned short cob,
676 const void *data);
677
713 unsigned char port, unsigned short cob,
714 const void *data,
715 unsigned long *inhibit_time);
716
745extern socan_rc socan_readnow(socan_hdl hdl, unsigned char port, unsigned short cob, void *data);
746
776extern socan_rc socan_read(socan_hdl hdl, unsigned char port, unsigned short cob, void *data);
777
801extern socan_rc socan_queue_read(socan_hdl hdl, unsigned char *port,
802 unsigned short *cob, void *data);
803
804#endif
socan_rc socan_user_area(unsigned char port, unsigned short cob, void **area)
Definition socan.c:1642
struct socan_obj_s * socan_obj_h
Definition socan.h:203
bool socan_close(socan_hdl h)
Definition socan.c:1196
socan_rc socan_write_inhibit(socan_hdl hdl, unsigned char port, unsigned short cob, const void *data, unsigned long *inhibit_time)
Definition socan.c:2072
socan_rc socan_set_user_area(unsigned char port, unsigned short cob, void *ptr)
Definition socan.c:1658
char * socan_str_rc(socan_rc rc)
Definition socan.c:372
socan_rc
Definition socan.h:176
@ SOCAN_NOT_OWNED_ERR
Definition socan.h:194
@ SOCAN_ERROR
Definition socan.h:198
@ SOCAN_LOST
Definition socan.h:181
@ SOCAN_LENGTH_ERR
Definition socan.h:186
@ SOCAN_EXISTS
Definition socan.h:185
@ SOCAN_TYPE_ERR
Definition socan.h:191
@ SOCAN_TIMEOUT
Definition socan.h:178
@ SOCAN_COB_ERR
Definition socan.h:188
@ SOCAN_EXISTS_ERR
Definition socan.h:196
@ SOCAN_OLD
Definition socan.h:179
@ SOCAN_NOT_WO_ERR
Definition socan.h:190
@ SOCAN_WAIT
Definition socan.h:183
@ SOCAN_OK
Definition socan.h:177
@ SOCAN_PORT_ERR
Definition socan.h:187
@ SOCAN_NOT_RO_ERR
Definition socan.h:189
@ SOCAN_NOT_EXISTS_ERR
Definition socan.h:192
bool socan_realtime_setup(bool use_rt_priority, bool require_rt_priority, int reader_priority, int writer_priority)
Definition socan.c:2472
socan_rc socan_port_bitrate(unsigned char port, unsigned int *bitrate)
Definition socan.c:1089
socan_obj_type
Definition socan.h:162
@ SOCAN_WRITE
Definition socan.h:164
@ SOCAN_WRITE_RTR
Definition socan.h:166
@ SOCAN_READ
Definition socan.h:163
@ SOCAN_READ_RTR
Definition socan.h:165
socan_rc socan_del_obj(unsigned char port, unsigned short cob)
Definition socan.c:1502
socan_rc socan_read(socan_hdl hdl, unsigned char port, unsigned short cob, void *data)
Definition socan.c:1758
int socan_errprintlevel(int level)
Definition socan.c:288
socan_rc socan_obj_ts(unsigned char port, unsigned short cob, unsigned long *ts)
Definition socan.c:1549
socan_rc socan_use_queue(unsigned char port, unsigned short cob)
Definition socan.c:1600
socan_rc socan_readnow(socan_hdl hdl, unsigned char port, unsigned short cob, void *data)
Definition socan.c:1698
socan_rc socan_set_inhibit(unsigned char port, unsigned short cob, unsigned long inhibit_time)
Definition socan.c:1580
socan_rc socan_write(socan_hdl hdl, unsigned char port, unsigned short cob, const void *data)
Definition socan.c:1927
socan_rc socan_free_user_area(unsigned char port, unsigned short cob)
Definition socan.c:1674
struct socan_hdl_s * socan_hdl
Definition socan.h:211
int socan_add_port(const char *devicename)
Definition socan.c:1395
bool socan_rc_is_error(socan_rc rc)
Definition socan.c:395
int socan_tracelevel(int level)
Definition socan.c:354
bool socan_init(void)
Definition socan.c:2538
socan_hdl socan_open(void)
Definition socan.c:1151
socan_rc socan_port_device(unsigned char port, char **dev)
Definition socan.c:1233
socan_rc socan_queue_read(socan_hdl hdl, unsigned char *port, unsigned short *cob, void *data)
Definition socan.c:1867
socan_rc socan_ts_to_str(unsigned long ts, char *buf, int buflen)
Definition socan.c:1572
socan_rc socan_add_obj(socan_hdl hdl, unsigned char port, unsigned short cob, unsigned char length, unsigned int tmo_ms, socan_obj_type type)
Definition socan.c:1459
socan_rc socan_writelater(socan_hdl hdl, unsigned char port, unsigned short cob, const void *data)
Definition socan.c:2000
socan_rc socan_obj_info(socan_hdl hdl, unsigned char port, unsigned short cob, unsigned char *length, unsigned int *tmo_ms, socan_obj_type *type)
Definition socan.c:1523
socan_rc socan_new_user_area(unsigned char port, unsigned short cob, unsigned int size, void **area)
Definition socan.c:1621