RTEMS
6.3
Toggle main menu visibility
Loading...
Searching...
No Matches
bsps
powerpc
gen5200
include
bsp
mscan.h
1
/* SPDX-License-Identifier: BSD-2-Clause */
2
3
/*
4
* RTEMS generic MPC5200 BSP
5
*
6
* This file has to be included by application when using mscan.
7
*/
8
9
/*
10
* Copyright (c) 2005 embedded brains GmbH & Co. KG
11
*
12
* Redistribution and use in source and binary forms, with or without
13
* modification, are permitted provided that the following conditions
14
* are met:
15
* 1. Redistributions of source code must retain the above copyright
16
* notice, this list of conditions and the following disclaimer.
17
* 2. Redistributions in binary form must reproduce the above copyright
18
* notice, this list of conditions and the following disclaimer in the
19
* documentation and/or other materials provided with the distribution.
20
*
21
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
* POSSIBILITY OF SUCH DAMAGE.
32
*/
33
34
#ifndef __MSCAN_H__
35
#define __MSCAN_H__
36
37
#ifdef __cplusplus
38
extern
"C"
{
39
#endif
40
41
#define MSCAN_A_DEV_NAME "/dev/mscana"
42
#define MSCAN_B_DEV_NAME "/dev/mscanb"
43
#define MSCAN_0_DEV_NAME "/dev/mscan0"
44
#define MSCAN_1_DEV_NAME "/dev/mscan1"
45
#define MSCAN_A 0
46
#define MSCAN_B 1
47
48
#define MSCAN_MAX_DATA_BYTES 8
49
50
#define MSCAN_MESS_ID_RTR (1 << 15)
51
#define MSCAN_MESS_ID_RTR_MASK (1 << 15)
52
#define MSCAN_MESS_ID_ID_MASK ((1 << 11)-1)
53
#define MSCAN_MESS_ID_HAS_RTR(id) (((id)&MSCAN_MESS_ID_RTR_MASK)==MSCAN_MESS_ID_RTR)
54
55
#define MSCAN_SET_RX_ID 1
56
#define MSCAN_GET_RX_ID 2
57
#define MSCAN_SET_RX_ID_MASK 3
58
#define MSCAN_GET_RX_ID_MASK 4
59
#define MSCAN_SET_TX_ID 5
60
#define MSCAN_GET_TX_ID 6
61
#define TOUCAN_MSCAN_INIT 7
62
#define MSCAN_SET_BAUDRATE 8
63
#define SET_TX_BUF_NO 9
64
65
struct
can_message
66
{
67
/* uint16_t mess_len; */
68
uint16_t mess_id;
69
uint16_t mess_time_stamp;
70
uint8_t mess_data[MSCAN_MAX_DATA_BYTES];
71
uint8_t mess_len;
72
uint8_t mess_rtr;
73
uint32_t toucan_tx_idx;
74
};
75
76
struct
mscan_rx_parms
77
{
78
struct
can_message
*rx_mess;
79
uint32_t rx_timeout;
80
uint8_t rx_flags;
81
};
82
83
struct
mscan_tx_parms
84
{
85
struct
can_message
*tx_mess;
86
uint32_t tx_idx;
87
};
88
89
struct
mscan_ctrl_parms
90
{
91
uint32_t ctrl_id;
92
uint32_t ctrl_id_mask;
93
uint8_t ctrl_reg_no;
94
uint8_t ctrl_tx_buf_no;
95
uint32_t ctrl_can_bitrate;
96
void (*toucan_cb_fnc)(int16_t);
97
};
98
99
100
rtems_device_driver
mscan_initialize(
rtems_device_major_number
,
101
rtems_device_minor_number
,
102
void
*
103
);
104
105
rtems_device_driver
mscan_open(
rtems_device_major_number
,
106
rtems_device_minor_number
,
107
void
*
108
);
109
110
rtems_device_driver
mscan_close(
rtems_device_major_number
,
111
rtems_device_minor_number
,
112
void
*
113
);
114
115
rtems_device_driver
mscan_read(
rtems_device_major_number
,
116
rtems_device_minor_number
,
117
void
*
118
);
119
120
rtems_device_driver
mscan_write(
rtems_device_major_number
,
121
rtems_device_minor_number
,
122
void
*
123
);
124
125
rtems_device_driver
mscan_control(
rtems_device_major_number
,
126
rtems_device_minor_number
,
127
void
*
128
);
129
130
131
#define MSCAN_DRIVER_TABLE_ENTRY \
132
{ mscan_initialize, mscan_open, mscan_close, \
133
mscan_read, mscan_write, mscan_control }
134
135
#ifdef __cplusplus
136
}
137
#endif
138
139
#endif
/* __MSCAN_H__ */
rtems_device_driver
rtems_status_code rtems_device_driver
This type shall be used in device driver entry declarations and definitions.
Definition
io.h:90
rtems_device_major_number
uint32_t rtems_device_major_number
This integer type represents the major number of devices.
Definition
io.h:103
rtems_device_minor_number
uint32_t rtems_device_minor_number
This integer type represents the minor number of devices.
Definition
io.h:115
mscan_ctrl_parms
Definition
mscan.h:90
mscan_rx_parms
Definition
mscan.h:77
mscan_tx_parms
Definition
mscan.h:84
can_message
A CAN message represented of both forms.
Definition
can.h:66
Generated by
1.18.0