ccand_11xx.h
Go to the documentation of this file.
1 /*
2  * @brief LPC11xx CCAN ROM API declarations and functions
3  *
4  * @note
5  * Copyright(C) NXP Semiconductors, 2012
6  * All rights reserved.
7  *
8  * @par
9  * Software that is described herein is for illustrative purposes only
10  * which provides customers with programming information regarding the
11  * LPC products. This software is supplied "AS IS" without any warranties of
12  * any kind, and NXP Semiconductors and its licensor disclaim any and
13  * all warranties, express or implied, including all implied warranties of
14  * merchantability, fitness for a particular purpose and non-infringement of
15  * intellectual property rights. NXP Semiconductors assumes no responsibility
16  * or liability for the use of the software, conveys no license or rights under any
17  * patent, copyright, mask work right, or any other intellectual property rights in
18  * or to any products. NXP Semiconductors reserves the right to make changes
19  * in the software without notification. NXP Semiconductors also makes no
20  * representation or warranty that such application will be suitable for the
21  * specified use without further testing or modification.
22  *
23  * @par
24  * Permission to use, copy, modify, and distribute this software and its
25  * documentation is hereby granted, under NXP Semiconductors' and its
26  * licensor's relevant copyrights in the software, without fee, provided that it
27  * is used in conjunction with NXP Semiconductors microcontrollers. This
28  * copyright, permission, and disclaimer notice must appear in all copies of
29  * this code.
30  */
31 
32 #ifndef __CCAND_11XX_H_
33 #define __CCAND_11XX_H_
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
47 #define CAN_ERROR_NONE 0x00000000UL
48 #define CAN_ERROR_PASS 0x00000001UL
49 #define CAN_ERROR_WARN 0x00000002UL
50 #define CAN_ERROR_BOFF 0x00000004UL
51 #define CAN_ERROR_STUF 0x00000008UL
52 #define CAN_ERROR_FORM 0x00000010UL
53 #define CAN_ERROR_ACK 0x00000020UL
54 #define CAN_ERROR_BIT1 0x00000040UL
55 #define CAN_ERROR_BIT0 0x00000080UL
56 #define CAN_ERROR_CRC 0x00000100UL
57 
61 #define CAN_MSGOBJ_STD 0x00000000UL /* CAN 2.0a 11-bit ID */
62 #define CAN_MSGOBJ_EXT 0x20000000UL /* CAN 2.0b 29-bit ID */
63 #define CAN_MSGOBJ_DAT 0x00000000UL /* data frame */
64 #define CAN_MSGOBJ_RTR 0x40000000UL /* rtr frame */
65 
66 typedef struct CCAN_MSG_OBJ {
73 
74 /**************************************************************************
75  SDO Abort Codes
76 **************************************************************************/
77 #define SDO_ABORT_TOGGLE 0x05030000UL // Toggle bit not alternated
78 #define SDO_ABORT_SDOTIMEOUT 0x05040000UL // SDO protocol timed out
79 #define SDO_ABORT_UNKNOWN_COMMAND 0x05040001UL // Client/server command specifier not valid or unknown
80 #define SDO_ABORT_UNSUPPORTED 0x06010000UL // Unsupported access to an object
81 #define SDO_ABORT_WRITEONLY 0x06010001UL // Attempt to read a write only object
82 #define SDO_ABORT_READONLY 0x06010002UL // Attempt to write a read only object
83 #define SDO_ABORT_NOT_EXISTS 0x06020000UL // Object does not exist in the object dictionary
84 #define SDO_ABORT_PARAINCOMP 0x06040043UL // General parameter incompatibility reason
85 #define SDO_ABORT_ACCINCOMP 0x06040047UL // General internal incompatibility in the device
86 #define SDO_ABORT_TYPEMISMATCH 0x06070010UL // Data type does not match, length of service parameter does not match
87 #define SDO_ABORT_UNKNOWNSUB 0x06090011UL // Sub-index does not exist
88 #define SDO_ABORT_VALUE_RANGE 0x06090030UL // Value range of parameter exceeded (only for write access)
89 #define SDO_ABORT_TRANSFER 0x08000020UL // Data cannot be transferred or stored to the application
90 #define SDO_ABORT_LOCAL 0x08000021UL // Data cannot be transferred or stored to the application because of local control
91 #define SDO_ABORT_DEVSTAT 0x08000022UL // Data cannot be transferred or stored to the application because of the present device state
92 
93 typedef struct CCAN_ODCONSTENTRY {
99 
100 // upper-nibble values for CAN_ODENTRY.entrytype_len
101 #define OD_NONE 0x00 // Object Dictionary entry doesn't exist
102 #define OD_EXP_RO 0x10 // Object Dictionary entry expedited, read-only
103 #define OD_EXP_WO 0x20 // Object Dictionary entry expedited, write-only
104 #define OD_EXP_RW 0x30 // Object Dictionary entry expedited, read-write
105 #define OD_SEG_RO 0x40 // Object Dictionary entry segmented, read-only
106 #define OD_SEG_WO 0x50 // Object Dictionary entry segmented, write-only
107 #define OD_SEG_RW 0x60 // Object Dictionary entry segmented, read-write
108 
109 typedef struct CCAN_ODENTRY {
115 
116 typedef struct CCAN_CANOPENCFG {
126 
127 // Return values for CANOPEN_sdo_req() callback
128 #define CAN_SDOREQ_NOTHANDLED 0 // process regularly, no impact
129 #define CAN_SDOREQ_HANDLED_SEND 1 // processed in callback, auto-send returned msg
130 #define CAN_SDOREQ_HANDLED_NOSEND 2 // processed in callback, don't send response
131 
132 // Values for CANOPEN_sdo_seg_read/write() callback 'openclose' parameter
133 #define CAN_SDOSEG_SEGMENT 0 // segment read/write
134 #define CAN_SDOSEG_OPEN 1 // channel is opened
135 #define CAN_SDOSEG_CLOSE 2 // channel is closed
136 
137 typedef struct CCAN_CALLBACKS {
138  void (*CAN_rx)(uint8_t msg_obj_num);
139  void (*CAN_tx)(uint8_t msg_obj_num);
140  void (*CAN_error)(uint32_t error_info);
142  uint32_t (*CANOPEN_sdo_write)(uint16_t index, uint8_t subindex, uint8_t *dat_ptr);
143  uint32_t (*CANOPEN_sdo_seg_read)(uint16_t index, uint8_t subindex, uint8_t openclose, uint8_t *length,
144  uint8_t *data, uint8_t *last);
145  uint32_t (*CANOPEN_sdo_seg_write)(uint16_t index, uint8_t subindex, uint8_t openclose, uint8_t length,
146  uint8_t *data, uint8_t *fast_resp);
147  uint8_t (*CANOPEN_sdo_req)(uint8_t length_req, uint8_t *req_ptr, uint8_t *length_resp, uint8_t *resp_ptr);
149 
150 typedef struct CCAN_API {
151  void (*init_can)(uint32_t *can_cfg, uint8_t isr_ena);
152  void (*isr)(void);
153  void (*config_rxmsgobj)(CCAN_MSG_OBJ_T *msg_obj);
155  void (*can_transmit)(CCAN_MSG_OBJ_T *msg_obj);
156  void (*config_canopen)(CCAN_CANOPENCFG_T *canopen_cfg);
157  void (*canopen_handler)(void);
158  void (*config_calb)(CCAN_CALLBACKS_T *callback_cfg);
159 } CCAN_API_T;
160 
161 #define LPC_CCAN_API ((CCAN_API_T *) (LPC_ROM_API->candApiBase))
162 
166 #ifdef __cplusplus
167 }
168 #endif
169 
170 #endif /* __CCAND_11XX_H_ */
CCAN_CALLBACKS::CANOPEN_sdo_write
uint32_t(* CANOPEN_sdo_write)(uint16_t index, uint8_t subindex, uint8_t *dat_ptr)
Definition: ccand_11xx.h:142
CCAN_API::can_receive
uint8_t(* can_receive)(CCAN_MSG_OBJ_T *msg_obj)
Definition: ccand_11xx.h:154
CCAN_ODENTRY
Definition: ccand_11xx.h:109
CCAN_ODCONSTENTRY::len
uint8_t len
Definition: ccand_11xx.h:96
CCAN_MSG_OBJ::data
uint8_t data[8]
Definition: ccand_11xx.h:69
CCAN_API::canopen_handler
void(* canopen_handler)(void)
Definition: ccand_11xx.h:157
uavcan::uint32_t
std::uint32_t uint32_t
Definition: std.hpp:26
CCAN_CALLBACKS::CAN_rx
void(* CAN_rx)(uint8_t msg_obj_num)
Definition: ccand_11xx.h:138
CCAN_MSG_OBJ::mode_id
uint32_t mode_id
Definition: ccand_11xx.h:67
CCAN_MSG_OBJ
Definition: ccand_11xx.h:66
CCAN_CANOPENCFG
Definition: ccand_11xx.h:116
CCAN_API_T
struct CCAN_API CCAN_API_T
CCAN_ODENTRY::val
uint8_t * val
Definition: ccand_11xx.h:113
CCAN_API::config_canopen
void(* config_canopen)(CCAN_CANOPENCFG_T *canopen_cfg)
Definition: ccand_11xx.h:156
CCAN_CALLBACKS::CANOPEN_sdo_seg_read
uint32_t(* CANOPEN_sdo_seg_read)(uint16_t index, uint8_t subindex, uint8_t openclose, uint8_t *length, uint8_t *data, uint8_t *last)
Definition: ccand_11xx.h:143
CCAN_CALLBACKS::CANOPEN_sdo_read
uint32_t(* CANOPEN_sdo_read)(uint16_t index, uint8_t subindex)
Definition: ccand_11xx.h:141
uavcan::uint16_t
std::uint16_t uint16_t
Definition: std.hpp:25
CCAN_MSG_OBJ_T
struct CCAN_MSG_OBJ CCAN_MSG_OBJ_T
CCAN_MSG_OBJ::mask
uint32_t mask
Definition: ccand_11xx.h:68
CCAN_MSG_OBJ::msgobj
uint8_t msgobj
Definition: ccand_11xx.h:71
uavcan::uint8_t
std::uint8_t uint8_t
Definition: std.hpp:24
CCAN_CANOPENCFG::msgobj_tx
uint8_t msgobj_tx
Definition: ccand_11xx.h:119
CCAN_CALLBACKS::CAN_tx
void(* CAN_tx)(uint8_t msg_obj_num)
Definition: ccand_11xx.h:139
CCAN_MSG_OBJ::dlc
uint8_t dlc
Definition: ccand_11xx.h:70
CCAN_ODCONSTENTRY::index
uint16_t index
Definition: ccand_11xx.h:94
CCAN_CANOPENCFG::od_const_num
uint32_t od_const_num
Definition: ccand_11xx.h:121
CCAN_API::init_can
void(* init_can)(uint32_t *can_cfg, uint8_t isr_ena)
Definition: ccand_11xx.h:151
CCAN_CANOPENCFG::od_const_table
CCAN_ODCONSTENTRY_T * od_const_table
Definition: ccand_11xx.h:122
CCAN_CALLBACKS_T
struct CCAN_CALLBACKS CCAN_CALLBACKS_T
CCAN_ODCONSTENTRY
Definition: ccand_11xx.h:93
CCAN_ODENTRY::index
uint16_t index
Definition: ccand_11xx.h:110
CCAN_CANOPENCFG::isr_handled
uint8_t isr_handled
Definition: ccand_11xx.h:120
CCAN_API::can_transmit
void(* can_transmit)(CCAN_MSG_OBJ_T *msg_obj)
Definition: ccand_11xx.h:155
CCAN_ODENTRY::entrytype_len
uint8_t entrytype_len
Definition: ccand_11xx.h:112
CCAN_CALLBACKS::CANOPEN_sdo_seg_write
uint32_t(* CANOPEN_sdo_seg_write)(uint16_t index, uint8_t subindex, uint8_t openclose, uint8_t length, uint8_t *data, uint8_t *fast_resp)
Definition: ccand_11xx.h:145
CCAN_CANOPENCFG::od_num
uint32_t od_num
Definition: ccand_11xx.h:123
CCAN_ODCONSTENTRY::subindex
uint8_t subindex
Definition: ccand_11xx.h:95
CCAN_API::isr
void(* isr)(void)
Definition: ccand_11xx.h:152
CCAN_ODENTRY::subindex
uint8_t subindex
Definition: ccand_11xx.h:111
CCAN_CALLBACKS::CANOPEN_sdo_req
uint8_t(* CANOPEN_sdo_req)(uint8_t length_req, uint8_t *req_ptr, uint8_t *length_resp, uint8_t *resp_ptr)
Definition: ccand_11xx.h:147
CCAN_API
Definition: ccand_11xx.h:150
CCAN_ODCONSTENTRY::val
uint32_t val
Definition: ccand_11xx.h:97
CCAN_CANOPENCFG::node_id
uint8_t node_id
Definition: ccand_11xx.h:117
CCAN_API::config_calb
void(* config_calb)(CCAN_CALLBACKS_T *callback_cfg)
Definition: ccand_11xx.h:158
CCAN_ODCONSTENTRY_T
struct CCAN_ODCONSTENTRY CCAN_ODCONSTENTRY_T
CCAN_CALLBACKS
Definition: ccand_11xx.h:137
CCAN_API::config_rxmsgobj
void(* config_rxmsgobj)(CCAN_MSG_OBJ_T *msg_obj)
Definition: ccand_11xx.h:153
CCAN_CANOPENCFG_T
struct CCAN_CANOPENCFG CCAN_CANOPENCFG_T
CCAN_CANOPENCFG::od_table
CCAN_ODENTRY_T * od_table
Definition: ccand_11xx.h:124
CCAN_CALLBACKS::CAN_error
void(* CAN_error)(uint32_t error_info)
Definition: ccand_11xx.h:140
CCAN_CANOPENCFG::msgobj_rx
uint8_t msgobj_rx
Definition: ccand_11xx.h:118
CCAN_ODENTRY_T
struct CCAN_ODENTRY CCAN_ODENTRY_T


uavcan_communicator
Author(s):
autogenerated on Fri Dec 13 2024 03:10:02