source: trunk/MagicSoft/Cosy/incl/can_lib.h@ 7041

Last change on this file since 7041 was 731, checked in by tbretz, 24 years ago
*** empty log message ***
File size: 5.1 KB
Line 
1/*-----------------------------------------------------------------------------
2can_lib.h -- Interface to CAN library
3
4Copyright (c) 1994 JANZ Computer AG
5All Rights Reserved
6
7
8Created 96/01/23 by Stefan Althoefer
9Version 1.8 of 96/10/31
10-----------------------------------------------------------------------------*/
11
12
13#ifndef can_lib_DEFINED
14#define can_lib_DEFINED
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20#ifdef VXWORKS
21#include "semLib.h"
22#endif
23
24#include "defs.h"
25#include "mican.h"
26#include "dpm.h"
27#include "vmod.h"
28
29/*------- Function Declarations ---------------------------------------------*/
30
31/* Open the device and return a descriptor. Only one process may
32 hold the the device open at a time. */
33extern int can_open _PARAMS((char *));
34extern int can_alt_open _PARAMS((char *));
35
36/* Close a device */
37extern void can_close _PARAMS((int fd));
38
39/* Reset a device */
40extern void can_reset _PARAMS((int fd));
41
42/* Declare a signal (for OS-9 systems only) */
43extern int can_sigdcl _PARAMS((int fd, int pid, int sig));
44
45/* Undeclare a signal (for OS-9 systems only) */
46extern void can_sigdel _PARAMS((int fd));
47
48#ifdef VXWORKS
49/* Declare a semaphore (for VxWorks systems only) */
50extern SEM_ID can_semdcl _PARAMS((int fd));
51
52/* Delete a semaphore (for VxWorks systems only) */
53extern void can_semdel _PARAMS((int fd));
54#endif
55
56/* Receive a message from a module */
57extern int can_recv _PARAMS((int fd, Message *pm));
58
59/* Receive a fast message from a module */
60extern int can_recv_fast _PARAMS((int fd, FastMessage *pm));
61
62/* Send a middle prior message to a module */
63extern int can_send _PARAMS((int fd, Message *pm));
64
65/* Send a high prior message to a module */
66extern int can_send_hi _PARAMS((int fd, Message *pm));
67
68/* Send a low_prior message to a module */
69extern int can_send_low _PARAMS((int fd, Message *pm));
70
71/* Send a fast message to a module */
72extern int can_fast_send _PARAMS((int fd, FastMessage *pm));
73
74/* Send a fast message to a module */
75extern int can_fast_send_prio _PARAMS((int fd, int prioQueue, FastMessage *pm));
76
77/* One communication step (MS-DOS systems only) */
78extern void can_comm _PARAMS((int fd));
79
80/* Switch to new stylish hostinterface */
81extern void ican2_select_hostif _PARAMS((int fd, int rbuffers, int wbuffers));
82
83/* Switch to new stylish hostinterface with dedicated priorized-messsage- */
84/* buffer-size */
85extern void ican2_select_hostif_prio _PARAMS((int fd, int rbuffers,
86 int wbuffers, int wbuffers_hi, int wbuffers_low));
87
88/* Init fast CANbus access */
89extern int ican2_init_fast_can _PARAMS((int fd, int rbuffers, int wbuffers));
90
91/* Init fast CANbus access */
92extern int ican2_init_fast_can_prio _PARAMS((int fd, int rbuffers, int wbuffers,
93 int numOfPrioQueues));
94
95/* Copy a block of data to the DPM */
96extern void ican2_todpmcpy _PARAMS((int fd, unsigned int d,
97 unsigned char *s, int n));
98
99/* Copy a block of data from the DPM */
100extern void ican2_fromdpmcpy _PARAMS((int fd, unsigned char *d,
101 unsigned int s, int n));
102
103/* Initialize table; holds Id-specific message-queue-ids, where */
104/* fast messages with the corresponding ID should be routed to are stored */
105extern int init_id_msg_q_table(int fd);
106
107/* Deinitialize above described table */
108extern int deinit_id_msg_q_table(int fd);
109
110/* Enter one message-queue-id into the above described table. */
111/* this entry causes a message-sending not to the default, common queue */
112/* but to a user defined queue */
113int add_msg_q_to_id_table(
114#ifdef VXWORKS
115 int fd,
116 unsigned short id,
117 MSG_Q_ID target_queue
118#endif
119#ifdef LINUX
120 int fd,
121 unsigned short id
122#endif
123);
124
125/* removes one entry like above described */
126int rem_msg_q_from_id_table(
127 int fd,
128 unsigned short id
129);
130
131/* Initialize table; holds device and ID where messages from this device */
132/* and with a certain CAN-ID should be routed to. */
133extern int can_init_layer_2_routing _PARAMS((int fd));
134
135/* Deinitialize above described table */
136extern int can_deinit_layer_2_routing _PARAMS((int fd));
137
138/* */
139extern int can_init_route_id _PARAMS((
140 int fd,
141 int Id,
142 int max_routes
143));
144
145/* */
146extern int can_add_route_to_id _PARAMS((
147 int fd,
148 int source_Id,
149 int dest_fd,
150 int dest_Id
151));
152
153/* */
154extern unsigned int can_drv_idvers _PARAMS((
155 int fd
156));
157
158/* initiate a tpu request */
159extern void ican2_tpurequest _PARAMS((int fd));
160
161extern void ican_objdic _PARAMS((
162 int fd,
163 int objdic_index,
164 int objdic_subindex,
165 int access_type,
166 void *entry_structure
167));
168
169extern int ican_read_pp _PARAMS((
170 int fd,
171 int dataSize,
172 int offset,
173 char *buffer
174));
175
176extern void ican_write_pp _PARAMS((
177 int fd,
178 int dataSize,
179 int offset,
180 char *buffer
181));
182
183#ifdef __cplusplus
184}
185#endif
186
187#endif /* !can_lib_DEFINED */
Note: See TracBrowser for help on using the repository browser.