-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathoccan_lib.h
71 lines (46 loc) · 1.68 KB
/
occan_lib.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef __OCCANLIB_H__
#define __OCCANLIB_H__
/* include driver definitions for CANMsg
* struct.
*
*/
#include <occan.h>
typedef struct {
int fd;
int txblk;
int rxblk;
} occan_s;
typedef occan_s *occan_t;
/* Open device driver named 'name'.
* - /dev/occan0 (ON-CHIP BUS)
* - /dev/occan1 (ON-CHIP BUS)
* ...
* - /dev/gr701_0/occan0 (GR-701 PCI TARGET's AMBA BUS)
*
* Returns a dynamically allocated (malloced)
* pointer to a occan_s structure used in following
* calls to occan_lib*()
*/
occan_t occanlib_open(char *name);
/* Closes /dev/occanX and frees chan */
void occanlib_close(occan_t chan);
int occanlib_send_multiple(occan_t chan, CANMsg *msgs, int msgcnt);
int occanlib_send(occan_t chan, CANMsg *msg);
int occanlib_recv_multiple(occan_t chan, CANMsg *msgs, int msgcnt);
int occanlib_recv(occan_t chan, CANMsg *msg);
int occanlib_set_speed(occan_t chan, unsigned int speed);
int occanlib_set_speed_auto(occan_t chan);
int occanlib_set_btrs(occan_t chan, unsigned char btr0, unsigned char btr1);
int occanlib_set_buf_length(occan_t chan, unsigned short txlen, unsigned short rxlen);
int occanlib_get_stats(occan_t chan, occan_stats *stats);
int occanlib_set_filter(occan_t chan, struct occan_afilter *new_filter);
int occanlib_set_blocking_mode(occan_t chan, int txblocking, int rxblocking);
int occanlib_start(occan_t chan);
int occanlib_stop(occan_t chan);
void occanlib_stats_summary_print(occan_stats *stats);
void occanlib_stats_arblost_print(occan_stats *stats);
void occanlib_stats_buserr_print(occan_stats *stats);
void occanlib_stats_print(occan_stats *stats);
/* CAN HELP DEBUG FUNCTIONS */
void print_msg(int i, CANMsg *msg);
#endif