Interface between CAN hardware and CANopenNode. More...
Go to the source code of this file.
Data Structures | |
struct | CO_CANrx_t |
Configuration object for CAN received message for specific CANopenNode Object. More... | |
struct | CO_CANtx_t |
Configuration object for CAN transmit message for specific CANopenNode Object. More... | |
struct | CO_CANmodule_t |
Complete CAN module object. More... | |
Macros | |
#define | CO_VERSION_MAJOR 4 |
Major version number of CANopenNode. | |
#define | CO_VERSION_MINOR 0 |
Minor version number of CANopenNode. | |
#define | CO_LITTLE_ENDIAN |
CO_LITTLE_ENDIAN or CO_BIG_ENDIAN must be defined. | |
#define | CO_SWAP_16(x) x |
Macro must swap bytes, if CO_BIG_ENDIAN is defined. | |
#define | CO_SWAP_32(x) x |
Macro must swap bytes, if CO_BIG_ENDIAN is defined. | |
#define | CO_SWAP_64(x) x |
Macro must swap bytes, if CO_BIG_ENDIAN is defined. | |
#define | NULL (0) |
NULL, for general usage. | |
#define | true 1 |
Logical true, for general use. | |
#define | false 0 |
Logical false, for general use. | |
#define | CO_LOCK_CAN_SEND() |
Lock critical section in CO_CANsend() | |
#define | CO_UNLOCK_CAN_SEND() |
Unlock critical section in CO_CANsend() | |
#define | CO_LOCK_EMCY() |
Lock critical section in CO_errorReport() or CO_errorReset() | |
#define | CO_UNLOCK_EMCY() |
Unlock critical section in CO_errorReport() or CO_errorReset() | |
#define | CO_LOCK_OD() |
Lock critical section when accessing Object Dictionary. | |
#define | CO_UNLOCK_OD() |
Unock critical section when accessing Object Dictionary. | |
#define | CO_FLAG_READ(rxNew) ((rxNew) != NULL) |
Check if new message has arrived. | |
#define | CO_FLAG_SET(rxNew) { __sync_synchronize(); rxNew = (void *)1L; } |
Set new message flag. | |
#define | CO_FLAG_CLEAR(rxNew) { __sync_synchronize(); rxNew = NULL; } |
Clear new message flag. | |
#define | CO_errinfo(CANmodule, err) |
Macro for passing additional information about error. More... | |
Typedefs | |
typedef unsigned char | bool_t |
Boolean data type for general use. | |
typedef signed char | int8_t |
INTEGER8 in CANopen (0002h), 8-bit signed integer. | |
typedef signed int | int16_t |
INTEGER16 in CANopen (0003h), 16-bit signed integer. | |
typedef signed long int | int32_t |
INTEGER32 in CANopen (0004h), 32-bit signed integer. | |
typedef signed long long int | int64_t |
INTEGER64 in CANopen (0015h), 64-bit signed integer. | |
typedef unsigned char | uint8_t |
UNSIGNED8 in CANopen (0005h), 8-bit unsigned integer. | |
typedef unsigned int | uint16_t |
UNSIGNED16 in CANopen (0006h), 16-bit unsigned integer. | |
typedef unsigned long int | uint32_t |
UNSIGNED32 in CANopen (0007h), 32-bit unsigned integer. | |
typedef unsigned long long int | uint64_t |
UNSIGNED64 in CANopen (001Bh), 64-bit unsigned integer. | |
typedef float | float32_t |
REAL32 in CANopen (0008h), single precision floating point value, 32-bit. | |
typedef double | float64_t |
REAL64 in CANopen (0011h), double precision floating point value, 64-bit. | |
typedef char | char_t |
VISIBLE_STRING in CANopen (0009h), string of signed 8-bit values. | |
typedef unsigned char | oChar_t |
OCTET_STRING in CANopen (000Ah), string of unsigned 8-bit values. | |
typedef unsigned char | domain_t |
DOMAIN in CANopen (000Fh), used to transfer a large block of data. | |
Functions | |
void | CANrx_callback (void *object, void *rxMsg) |
CAN receive callback function which pre-processes received CAN message. More... | |
static uint16_t | CO_CANrxMsg_readIdent (void *rxMsg) |
CANrx_callback() can read CAN identifier from received CAN message. More... | |
static uint8_t | CO_CANrxMsg_readDLC (void *rxMsg) |
CANrx_callback() can read Data Length Code from received CAN message. More... | |
static uint8_t * | CO_CANrxMsg_readData (void *rxMsg) |
CANrx_callback() can read pointer to data from received CAN message. More... | |
void | CO_CANsetConfigurationMode (void *CANptr) |
Request CAN configuration (stopped) mode and wait until it is set. More... | |
void | CO_CANsetNormalMode (CO_CANmodule_t *CANmodule) |
Request CAN normal (operational) mode and wait until it is set. More... | |
CO_ReturnError_t | CO_CANmodule_init (CO_CANmodule_t *CANmodule, void *CANptr, CO_CANrx_t rxArray[], uint16_t rxSize, CO_CANtx_t txArray[], uint16_t txSize, uint16_t CANbitRate) |
Initialize CAN module object. More... | |
void | CO_CANmodule_disable (CO_CANmodule_t *CANmodule) |
Switch off CANmodule. More... | |
CO_ReturnError_t | CO_CANrxBufferInit (CO_CANmodule_t *CANmodule, uint16_t index, uint16_t ident, uint16_t mask, bool_t rtr, void *object, void(*CANrx_callback)(void *object, void *message)) |
Configure CAN message receive buffer. More... | |
CO_CANtx_t * | CO_CANtxBufferInit (CO_CANmodule_t *CANmodule, uint16_t index, uint16_t ident, bool_t rtr, uint8_t noOfBytes, bool_t syncFlag) |
Configure CAN message transmit buffer. More... | |
CO_ReturnError_t | CO_CANsend (CO_CANmodule_t *CANmodule, CO_CANtx_t *buffer) |
Send CAN message. More... | |
void | CO_CANclearPendingSyncPDOs (CO_CANmodule_t *CANmodule) |
Clear all synchronous TPDOs from CAN module transmit buffers. More... | |
void | CO_CANmodule_process (CO_CANmodule_t *CANmodule) |
Process can module - verify CAN errors. More... | |
static uint8_t | CO_getUint8 (const void *buf) |
Get uint8_t value from memory buffer. More... | |
static uint16_t | CO_getUint16 (const void *buf) |
Get uint16_t value from memory buffer, see CO_getUint8. | |
static uint32_t | CO_getUint32 (const void *buf) |
Get uint32_t value from memory buffer, see CO_getUint8. | |
static uint8_t | CO_setUint8 (void *buf, uint8_t value) |
Write uint8_t value into memory buffer. More... | |
static uint8_t | CO_setUint16 (void *buf, uint16_t value) |
Write uint16_t value into memory buffer, see CO_setUint8. | |
static uint8_t | CO_setUint32 (void *buf, uint32_t value) |
Write uint32_t value into memory buffer, see CO_setUint8. | |
Interface between CAN hardware and CANopenNode.
This file is part of CANopenNode, an opensource CANopen Stack. Project home page is https://github.com/CANopenNode/CANopenNode. For more information on CANopen see http://www.can-cia.org/.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.