AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
Loading...
Searching...
No Matches
UsbCanLs.h
1/****************************************************************************
2
3 (c) SYS TEC electronic AG, D-08468 Heinsdorfergrund, Am Windrad 2
4 www.systec-electronic.com
5
6 Project: USB-CANmodule
7
8 Description: Additional header file for the USBCAN32.DLL
9 Functions for Low Speed CAN transceiver
10
11 -------------------------------------------------------------------------
12
13 $RCSfile:$
14
15 $Author: R.Dietzsch $
16
17 $Revision: 1.1 $ $Date: 2003/03/18 $
18 Version: 2.18 Date: 27.04.2004
19
20 $State: $
21
22 Build Environment:
23 MSVC 5.0 and MSVC 6.0
24
25 -------------------------------------------------------------------------
26
27 Revision History:
28
29 2002/0?/0? r.d.: First implementation
30
31****************************************************************************/
32
33// clang-format off
35
36// Protection against mutliple including
37#ifndef __USBCANLS_H__
38#define __USBCANLS_H__
39
40
41#ifndef __USBCAN32_H__
42
43 #error 'ERROR: file "usbcan32.h" not included!'
44
45#endif
46
47
48// allow access to functions for C++ applications as well
49#ifdef __cplusplus
50extern "C"
51{
52#endif
53
54
55//---------------------------------------------------------------------------
56// const defines
57//---------------------------------------------------------------------------
58
59#define UCAN_CANPORT_TRM 0x10 // termination resistor (not available for GW-001/002)
60#define UCAN_CANPORT_ERR 0x20 // error signal of low speed CAN driver
61#define UCAN_CANPORT_STB 0x40 // standby of low speed CAN driver
62#define UCAN_CANPORT_EN 0x80 // enable signal of low speed CAN driver
63
64#define UCAN_CANPORT_OUTPUT (UCAN_CANPORT_STB | UCAN_CANPORT_EN )
65#define UCAN_CANPORT_INPUT (UCAN_CANPORT_TRM | UCAN_CANPORT_ERR)
66
67
68//---------------------------------------------------------------------------
69// function prototypes
70//---------------------------------------------------------------------------
71
72//---------------------------------------------------------------------------
73//
74// Function: UcanWriteCanPort(), UcanWriteCanPortEx()
75//
76// Description: Writes a value to special CAN port of USB-CANmodule which is connected to a low
77// speed CAN transceiver. Only values STB and EN can be written (see defines below). Call
78// to this function has no effect when USB-CANmodule contains high speed CAN driver.
79//
80// Parameters: UcanHandle_p = USB-CAN-Handle
81// Handle, which is returned by the function UcanInitHardware()
82// bOutValue_p = value to write to special CAN port
83//
84// bChannel_p = CAN channel (0 or 1)
85//
86// Returns: result of the function
87// USBCAN_SUCCESSFUL
88// USBCAN_ERR_ILLHANDLE
89// USBCAN_ERR_MAXINSTANCES
90// USBCAN_ERR_ILLHW
91// USBCAN_ERR_IOFAILED
92// USBCAN_ERR_DATA
93// USBCAN_ERR_ABORT
94// USBCAN_ERR_DISCONNECT
95// USBCAN_ERR_BUSY
96// USBCAN_ERR_TIMEOUT
97// USBCAN_ERRCMD_...
98
99//---------------------------------------------------------------------------
100
101UCANRET PUBLIC UcanWriteCanPort (tUcanHandle UcanHandle_p, BYTE bOutValue_p);
102UCANRET PUBLIC UcanWriteCanPortEx (tUcanHandle UcanHandle_p, BYTE bChannel_p, BYTE bOutValue_p);
103
104
105//---------------------------------------------------------------------------
106//
107// Function: UcanReadCanPort(), UcanReadCanPortEx()
108//
109// Description: Reads a value from special CAN port of USB-CANmodule which is connected to a low
110// speed CAN transceiver. Only values ERR can be read (see defines below). Call
111// to this function has no effect when USB-CANmodule contains high speed CAN driver.
112//
113// Parameters: UcanHandle_p = [in] USB-CAN-Handle
114// Handle, which is returned by the function UcanInitHardware()
115// pbInValue_p = [out] pointer variable which receives the input value (see UCAN_CANPORT_...)
116// This parameter can not be NULL.
117//
118// bChannel_p = [in] CAN channel (0 or 1)
119// pbLastOutVal_p = [out] pointer to receive output data configuratiuon (see UCAN_CANPORT_...)
120// This parameter can be NULL.
121//
122// Returns: result of the function
123// USBCAN_SUCCESSFUL
124// USBCAN_ERR_ILLHANDLE
125// USBCAN_ERR_MAXINSTANCES
126// USBCAN_ERR_ILLHW
127// USBCAN_ERR_ILLPARAM
128// USBCAN_ERR_IOFAILED
129// USBCAN_ERR_DATA
130// USBCAN_ERR_ABORT
131// USBCAN_ERR_DISCONNECT
132// USBCAN_ERR_BUSY
133// USBCAN_ERR_TIMEOUT
134// USBCAN_ERRCMD_...
135//
136//---------------------------------------------------------------------------
137
138UCANRET PUBLIC UcanReadCanPort (tUcanHandle UcanHandle_p, BYTE* pbInValue_p);
139UCANRET PUBLIC UcanReadCanPortEx (tUcanHandle UcanHandle_p, BYTE bChannel_p, BYTE* pbInValue_p, BYTE* pbLastOutVal_p);
140
141
142#ifdef __cplusplus
143} // von extern "C"
144#endif
145
146
147#endif // __USBCANLS_H__
148
150// clang-format on