File indexing completed on 2025-05-11 08:23:52
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 #ifndef __MSCAN_H__
0035 #define __MSCAN_H__
0036
0037 #ifdef __cplusplus
0038 extern "C" {
0039 #endif
0040
0041 #define MSCAN_A_DEV_NAME "/dev/mscana"
0042 #define MSCAN_B_DEV_NAME "/dev/mscanb"
0043 #define MSCAN_0_DEV_NAME "/dev/mscan0"
0044 #define MSCAN_1_DEV_NAME "/dev/mscan1"
0045 #define MSCAN_A 0
0046 #define MSCAN_B 1
0047
0048 #define MSCAN_MAX_DATA_BYTES 8
0049
0050 #define MSCAN_MESS_ID_RTR (1 << 15)
0051 #define MSCAN_MESS_ID_RTR_MASK (1 << 15)
0052 #define MSCAN_MESS_ID_ID_MASK ((1 << 11)-1)
0053 #define MSCAN_MESS_ID_HAS_RTR(id) (((id)&MSCAN_MESS_ID_RTR_MASK)==MSCAN_MESS_ID_RTR)
0054
0055 #define MSCAN_SET_RX_ID 1
0056 #define MSCAN_GET_RX_ID 2
0057 #define MSCAN_SET_RX_ID_MASK 3
0058 #define MSCAN_GET_RX_ID_MASK 4
0059 #define MSCAN_SET_TX_ID 5
0060 #define MSCAN_GET_TX_ID 6
0061 #define TOUCAN_MSCAN_INIT 7
0062 #define MSCAN_SET_BAUDRATE 8
0063 #define SET_TX_BUF_NO 9
0064
0065 struct can_message
0066 {
0067
0068 uint16_t mess_id;
0069 uint16_t mess_time_stamp;
0070 uint8_t mess_data[MSCAN_MAX_DATA_BYTES];
0071 uint8_t mess_len;
0072 uint8_t mess_rtr;
0073 uint32_t toucan_tx_idx;
0074 };
0075
0076 struct mscan_rx_parms
0077 {
0078 struct can_message *rx_mess;
0079 uint32_t rx_timeout;
0080 uint8_t rx_flags;
0081 };
0082
0083 struct mscan_tx_parms
0084 {
0085 struct can_message *tx_mess;
0086 uint32_t tx_idx;
0087 };
0088
0089 struct mscan_ctrl_parms
0090 {
0091 uint32_t ctrl_id;
0092 uint32_t ctrl_id_mask;
0093 uint8_t ctrl_reg_no;
0094 uint8_t ctrl_tx_buf_no;
0095 uint32_t ctrl_can_bitrate;
0096 void (*toucan_cb_fnc)(int16_t);
0097 };
0098
0099
0100 rtems_device_driver mscan_initialize( rtems_device_major_number,
0101 rtems_device_minor_number,
0102 void *
0103 );
0104
0105 rtems_device_driver mscan_open( rtems_device_major_number,
0106 rtems_device_minor_number,
0107 void *
0108 );
0109
0110 rtems_device_driver mscan_close( rtems_device_major_number,
0111 rtems_device_minor_number,
0112 void *
0113 );
0114
0115 rtems_device_driver mscan_read( rtems_device_major_number,
0116 rtems_device_minor_number,
0117 void *
0118 );
0119
0120 rtems_device_driver mscan_write( rtems_device_major_number,
0121 rtems_device_minor_number,
0122 void *
0123 );
0124
0125 rtems_device_driver mscan_control( rtems_device_major_number,
0126 rtems_device_minor_number,
0127 void *
0128 );
0129
0130
0131 #define MSCAN_DRIVER_TABLE_ENTRY \
0132 { mscan_initialize, mscan_open, mscan_close, \
0133 mscan_read, mscan_write, mscan_control }
0134
0135 #ifdef __cplusplus
0136 }
0137 #endif
0138
0139 #endif