CO_LSSmaster and CO_LSSslave: static analysis: cannot assign 'enum' to different essential type [MISRA 2012 Rule 10.3, required]
refactoring convert enum to macro
This commit is contained in:
parent
47461cf08a
commit
d4b4d29f0b
6 changed files with 100 additions and 100 deletions
140
305/CO_LSS.h
140
305/CO_LSS.h
|
|
@ -75,7 +75,8 @@ extern "C" {
|
|||
*/
|
||||
|
||||
/**
|
||||
* LSS protocol command specifiers
|
||||
* @defgroup CO_LSS_cs_t LSS protocol command specifiers
|
||||
* @{
|
||||
*
|
||||
* The LSS protocols are executed between the LSS master device and the LSS
|
||||
* slave device(s) to implement the LSS services. Some LSS protocols require
|
||||
|
|
@ -83,73 +84,72 @@ extern "C" {
|
|||
*
|
||||
* As identifying method only "LSS fastscan" is supported.
|
||||
*/
|
||||
typedef enum {
|
||||
CO_LSS_SWITCH_STATE_GLOBAL = 0x04U, /**< Switch state global protocol */
|
||||
CO_LSS_SWITCH_STATE_SEL_VENDOR = 0x40U, /**< Switch state selective protocol - Vendor ID */
|
||||
CO_LSS_SWITCH_STATE_SEL_PRODUCT = 0x41U, /**< Switch state selective protocol - Product code */
|
||||
CO_LSS_SWITCH_STATE_SEL_REV = 0x42U, /**< Switch state selective protocol - Revision number */
|
||||
CO_LSS_SWITCH_STATE_SEL_SERIAL = 0x43U, /**< Switch state selective protocol - Serial number */
|
||||
CO_LSS_SWITCH_STATE_SEL = 0x44U, /**< Switch state selective protocol - Slave response */
|
||||
CO_LSS_CFG_NODE_ID = 0x11U, /**< Configure node ID protocol */
|
||||
CO_LSS_CFG_BIT_TIMING = 0x13U, /**< Configure bit timing parameter protocol */
|
||||
CO_LSS_CFG_ACTIVATE_BIT_TIMING = 0x15U, /**< Activate bit timing parameter protocol */
|
||||
CO_LSS_CFG_STORE = 0x17U, /**< Store configuration protocol */
|
||||
CO_LSS_IDENT_SLAVE = 0x4FU, /**< LSS Fastscan response */
|
||||
CO_LSS_IDENT_FASTSCAN = 0x51U, /**< LSS Fastscan protocol */
|
||||
CO_LSS_INQUIRE_VENDOR = 0x5AU, /**< Inquire identity vendor-ID protocol */
|
||||
CO_LSS_INQUIRE_PRODUCT = 0x5BU, /**< Inquire identity product-code protocol */
|
||||
CO_LSS_INQUIRE_REV = 0x5CU, /**< Inquire identity revision-number protocol */
|
||||
CO_LSS_INQUIRE_SERIAL = 0x5DU, /**< Inquire identity serial-number protocol */
|
||||
CO_LSS_INQUIRE_NODE_ID = 0x5EU, /**< Inquire node-ID protocol */
|
||||
} CO_LSS_cs_t;
|
||||
#define CO_LSS_SWITCH_STATE_GLOBAL 0x04U /**< Switch state global protocol */
|
||||
#define CO_LSS_SWITCH_STATE_SEL_VENDOR 0x40U /**< Switch state selective protocol - Vendor ID */
|
||||
#define CO_LSS_SWITCH_STATE_SEL_PRODUCT 0x41U /**< Switch state selective protocol - Product code */
|
||||
#define CO_LSS_SWITCH_STATE_SEL_REV 0x42U /**< Switch state selective protocol - Revision number */
|
||||
#define CO_LSS_SWITCH_STATE_SEL_SERIAL 0x43U /**< Switch state selective protocol - Serial number */
|
||||
#define CO_LSS_SWITCH_STATE_SEL 0x44U /**< Switch state selective protocol - Slave response */
|
||||
#define CO_LSS_CFG_NODE_ID 0x11U /**< Configure node ID protocol */
|
||||
#define CO_LSS_CFG_BIT_TIMING 0x13U /**< Configure bit timing parameter protocol */
|
||||
#define CO_LSS_CFG_ACTIVATE_BIT_TIMING 0x15U /**< Activate bit timing parameter protocol */
|
||||
#define CO_LSS_CFG_STORE 0x17U /**< Store configuration protocol */
|
||||
#define CO_LSS_IDENT_SLAVE 0x4FU /**< LSS Fastscan response */
|
||||
#define CO_LSS_IDENT_FASTSCAN 0x51U /**< LSS Fastscan protocol */
|
||||
#define CO_LSS_INQUIRE_VENDOR 0x5AU /**< Inquire identity vendor-ID protocol */
|
||||
#define CO_LSS_INQUIRE_PRODUCT 0x5BU /**< Inquire identity product-code protocol */
|
||||
#define CO_LSS_INQUIRE_REV 0x5CU /**< Inquire identity revision-number protocol */
|
||||
#define CO_LSS_INQUIRE_SERIAL 0x5DU /**< Inquire identity serial-number protocol */
|
||||
#define CO_LSS_INQUIRE_NODE_ID 0x5EU /**< Inquire node-ID protocol */
|
||||
/** @} */ /* CO_LSS_cs_t */
|
||||
|
||||
/**
|
||||
* Error codes for Configure node ID protocol
|
||||
* @defgroup CO_LSS_cfgNodeId_t Error codes for Configure node ID protocol
|
||||
* @{
|
||||
*/
|
||||
typedef enum {
|
||||
CO_LSS_CFG_NODE_ID_OK = 0x00U,/**< Protocol successfully completed */
|
||||
CO_LSS_CFG_NODE_ID_OUT_OF_RANGE = 0x01U,/**< NID out of range */
|
||||
CO_LSS_CFG_NODE_ID_MANUFACTURER = 0xFFU /**< Manufacturer specific error. No further support */
|
||||
} CO_LSS_cfgNodeId_t;
|
||||
#define CO_LSS_CFG_NODE_ID_OK 0x00U /**< Protocol successfully completed */
|
||||
#define CO_LSS_CFG_NODE_ID_OUT_OF_RANGE 0x01U /**< NID out of range */
|
||||
#define CO_LSS_CFG_NODE_ID_MANUFACTURER 0xFFU /**< Manufacturer specific error. No further support */
|
||||
/** @} */ /* CO_LSS_cfgNodeId_t */
|
||||
|
||||
/**
|
||||
* Error codes for Configure bit timing parameters protocol
|
||||
* @defgroup CO_LSS_cfgBitTiming_t Error codes for Configure bit timing parameters protocol
|
||||
* @{
|
||||
*/
|
||||
typedef enum {
|
||||
CO_LSS_CFG_BIT_TIMING_OK = 0x00U,/**< Protocol successfully completed */
|
||||
CO_LSS_CFG_BIT_TIMING_OUT_OF_RANGE = 0x01U,/**< Bit timing / Bit rate not supported */
|
||||
CO_LSS_CFG_BIT_TIMING_MANUFACTURER = 0xFFU /**< Manufacturer specific error. No further support */
|
||||
} CO_LSS_cfgBitTiming_t;
|
||||
#define CO_LSS_CFG_BIT_TIMING_OK 0x00U /**< Protocol successfully completed */
|
||||
#define CO_LSS_CFG_BIT_TIMING_OUT_OF_RANGE 0x01U /**< Bit timing / Bit rate not supported */
|
||||
#define CO_LSS_CFG_BIT_TIMING_MANUFACTURER 0xFFU /**< Manufacturer specific error. No further support */
|
||||
/** @} */ /* CO_LSS_cfgBitTiming_t */
|
||||
|
||||
/**
|
||||
* Error codes for Store configuration protocol
|
||||
* @defgroup CO_LSS_cfgStore_t Error codes for Store configuration protocol
|
||||
* @{
|
||||
*/
|
||||
typedef enum {
|
||||
CO_LSS_CFG_STORE_OK = 0x00U, /**< Protocol successfully completed */
|
||||
CO_LSS_CFG_STORE_NOT_SUPPORTED = 0x01U, /**< Store configuration not supported */
|
||||
CO_LSS_CFG_STORE_FAILED = 0x02U, /**< Storage media access error */
|
||||
CO_LSS_CFG_STORE_MANUFACTURER = 0xFFU /**< Manufacturer specific error. No further support */
|
||||
} CO_LSS_cfgStore_t;
|
||||
#define CO_LSS_CFG_STORE_OK 0x00U /**< Protocol successfully completed */
|
||||
#define CO_LSS_CFG_STORE_NOT_SUPPORTED 0x01U /**< Store configuration not supported */
|
||||
#define CO_LSS_CFG_STORE_FAILED 0x02U /**< Storage media access error */
|
||||
#define CO_LSS_CFG_STORE_MANUFACTURER 0xFFU /**< Manufacturer specific error. No further support */
|
||||
/** @} */ /* CO_LSS_cfgStore_t */
|
||||
|
||||
/**
|
||||
* Fastscan BitCheck. BIT0 means all bits are checked for equality by slave.
|
||||
* @defgroup CO_LSS_fastscan_bitcheck Fastscan BitCheck. BIT0 means all bits are checked for equality by slave
|
||||
* @{
|
||||
*/
|
||||
typedef enum {
|
||||
CO_LSS_FASTSCAN_BIT0 = 0x00U, /**< Least significant bit of IDnumbners bit area to be checked */
|
||||
#define CO_LSS_FASTSCAN_BIT0 0x00U /**< Least significant bit of IDnumbners bit area to be checked */
|
||||
/* ... */
|
||||
CO_LSS_FASTSCAN_BIT31 = 0x1FU, /**< dito */
|
||||
CO_LSS_FASTSCAN_CONFIRM = 0x80U /**< All LSS slaves waiting for scan respond and previous scan is reset */
|
||||
} CO_LSS_fastscan_bitcheck;
|
||||
#define CO_LSS_FASTSCAN_BIT31 0x1FU /**< dito */
|
||||
#define CO_LSS_FASTSCAN_CONFIRM 0x80U /**< All LSS slaves waiting for scan respond and previous scan is reset */
|
||||
/** @} */ /* CO_LSS_fastscan_bitcheck */
|
||||
|
||||
/**
|
||||
* Fastscan LSSsub, LSSnext
|
||||
* @defgroup CO_LSS_fastscan_lss_sub_next Fastscan LSSsub, LSSnext
|
||||
* @{
|
||||
*/
|
||||
typedef enum {
|
||||
CO_LSS_FASTSCAN_VENDOR_ID = 0, /**< Vendor ID */
|
||||
CO_LSS_FASTSCAN_PRODUCT = 1, /**< Product code */
|
||||
CO_LSS_FASTSCAN_REV = 2, /**< Revision number */
|
||||
CO_LSS_FASTSCAN_SERIAL = 3 /**< Serial number */
|
||||
} CO_LSS_fastscan_lss_sub_next;
|
||||
#define CO_LSS_FASTSCAN_VENDOR_ID 0x00U /**< Vendor ID */
|
||||
#define CO_LSS_FASTSCAN_PRODUCT 0x01U /**< Product code */
|
||||
#define CO_LSS_FASTSCAN_REV 0x02U /**< Revision number */
|
||||
#define CO_LSS_FASTSCAN_SERIAL 0x03U /**< Serial number */
|
||||
/** @} */ /* CO_LSS_fastscan_lss_sub_next */
|
||||
|
||||
/**
|
||||
* The LSS address is a 128 bit number, uniquely identifying each node. It
|
||||
|
|
@ -166,7 +166,8 @@ typedef union {
|
|||
} CO_LSS_address_t;
|
||||
|
||||
/**
|
||||
* LSS finite state automaton
|
||||
* @defgroup CO_LSS_state_t LSS finite state automaton
|
||||
* @{
|
||||
*
|
||||
* The LSS FSA shall provide the following states:
|
||||
* - Initial: Pseudo state, indicating the activation of the FSA.
|
||||
|
|
@ -174,26 +175,25 @@ typedef union {
|
|||
* - LSS configuration: In this state variables may be configured in the LSS slave.
|
||||
* - Final: Pseudo state, indicating the deactivation of the FSA.
|
||||
*/
|
||||
typedef enum {
|
||||
CO_LSS_STATE_WAITING = 0, /**< LSS FSA waiting for requests*/
|
||||
CO_LSS_STATE_CONFIGURATION = 1, /**< LSS FSA waiting for configuration*/
|
||||
} CO_LSS_state_t;
|
||||
#define CO_LSS_STATE_WAITING 0x00U /**< LSS FSA waiting for requests*/
|
||||
#define CO_LSS_STATE_CONFIGURATION 0x01U /**< LSS FSA waiting for configuration*/
|
||||
/** @} */ /* CO_LSS_state_t */
|
||||
|
||||
/**
|
||||
* Definition of table_index for /CiA301/ bit timing table
|
||||
* @defgroup CO_LSS_bitTimingTable_t Definition of table_index for /CiA301/ bit timing table
|
||||
* @{
|
||||
*/
|
||||
typedef enum {
|
||||
CO_LSS_BIT_TIMING_1000 = 0U, /**< 1000kbit/s */
|
||||
CO_LSS_BIT_TIMING_800 = 1U, /**< 800kbit/s */
|
||||
CO_LSS_BIT_TIMING_500 = 2U, /**< 500kbit/s */
|
||||
CO_LSS_BIT_TIMING_250 = 3U, /**< 250kbit/s */
|
||||
CO_LSS_BIT_TIMING_125 = 4U, /**< 125kbit/s */
|
||||
/* reserved = 5U */
|
||||
CO_LSS_BIT_TIMING_50 = 6U, /**< 50kbit/s */
|
||||
CO_LSS_BIT_TIMING_20 = 7U, /**< 20kbit/s */
|
||||
CO_LSS_BIT_TIMING_10 = 8U, /**< 10kbit/s */
|
||||
CO_LSS_BIT_TIMING_AUTO = 9U, /**< Automatic bit rate detection */
|
||||
} CO_LSS_bitTimingTable_t;
|
||||
#define CO_LSS_BIT_TIMING_1000 0U /**< 1000kbit/s */
|
||||
#define CO_LSS_BIT_TIMING_800 1U /**< 800kbit/s */
|
||||
#define CO_LSS_BIT_TIMING_500 2U /**< 500kbit/s */
|
||||
#define CO_LSS_BIT_TIMING_250 3U /**< 250kbit/s */
|
||||
#define CO_LSS_BIT_TIMING_125 4U /**< 125kbit/s */
|
||||
/* reserved 5U */
|
||||
#define CO_LSS_BIT_TIMING_50 6U /**< 50kbit/s */
|
||||
#define CO_LSS_BIT_TIMING_20 7U /**< 20kbit/s */
|
||||
#define CO_LSS_BIT_TIMING_10 8U /**< 10kbit/s */
|
||||
#define CO_LSS_BIT_TIMING_AUTO 9U /**< Automatic bit rate detection */
|
||||
/** @} */ /* CO_LSS_bitTimingTable_t */
|
||||
|
||||
/**
|
||||
* Lookup table for conversion between bit timing table and numerical
|
||||
|
|
|
|||
|
|
@ -721,7 +721,7 @@ CO_LSSmaster_return_t CO_LSSmaster_InquireLssAddress(
|
|||
CO_LSSmaster_return_t CO_LSSmaster_Inquire(
|
||||
CO_LSSmaster_t *LSSmaster,
|
||||
uint32_t timeDifference_us,
|
||||
CO_LSS_cs_t lssInquireCs,
|
||||
uint8_t lssInquireCs,
|
||||
uint32_t *value)
|
||||
{
|
||||
CO_LSSmaster_return_t ret = CO_LSSmaster_INVALID_STATE;
|
||||
|
|
@ -809,7 +809,7 @@ static CO_LSSmaster_return_t CO_LSSmaster_FsScanInitiate(
|
|||
CO_LSSmaster_t *LSSmaster,
|
||||
uint32_t timeDifference_us,
|
||||
CO_LSSmaster_scantype_t scan,
|
||||
CO_LSS_fastscan_lss_sub_next lssSub)
|
||||
uint8_t lssSub)
|
||||
{
|
||||
(void)timeDifference_us; /* unused */
|
||||
|
||||
|
|
@ -904,7 +904,7 @@ static CO_LSSmaster_return_t CO_LSSmaster_FsVerifyInitiate(
|
|||
uint32_t timeDifference_us,
|
||||
CO_LSSmaster_scantype_t scan,
|
||||
uint32_t idNumberCheck,
|
||||
CO_LSS_fastscan_lss_sub_next lssNext)
|
||||
uint8_t lssNext)
|
||||
{
|
||||
(void)timeDifference_us; /* unused */
|
||||
|
||||
|
|
@ -972,7 +972,7 @@ static CO_LSSmaster_return_t CO_LSSmaster_FsVerifyWait(
|
|||
/*
|
||||
* Helper function - check which 32 bit to scan for next, if any
|
||||
*/
|
||||
static CO_LSS_fastscan_lss_sub_next CO_LSSmaster_FsSearchNext(
|
||||
static uint8_t CO_LSSmaster_FsSearchNext(
|
||||
CO_LSSmaster_t *LSSmaster,
|
||||
const CO_LSSmaster_fastscan_t *fastscan)
|
||||
{
|
||||
|
|
@ -983,7 +983,7 @@ static CO_LSS_fastscan_lss_sub_next CO_LSSmaster_FsSearchNext(
|
|||
* finished */
|
||||
for (i = LSSmaster->fsLssSub + 1U; i <= CO_LSS_FASTSCAN_SERIAL; i++) {
|
||||
if (fastscan->scan[i] != CO_LSSmaster_FS_SKIP) {
|
||||
return (CO_LSS_fastscan_lss_sub_next)i;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
/* node selection is triggered by switching node state machine back
|
||||
|
|
@ -1000,7 +1000,7 @@ CO_LSSmaster_return_t CO_LSSmaster_IdentifyFastscan(
|
|||
uint8_t i;
|
||||
uint8_t count;
|
||||
CO_LSSmaster_return_t ret = CO_LSSmaster_INVALID_STATE;
|
||||
CO_LSS_fastscan_lss_sub_next next;
|
||||
uint8_t next;
|
||||
|
||||
/* parameter validation */
|
||||
if ((LSSmaster == NULL) || (fastscan == NULL)){
|
||||
|
|
|
|||
|
|
@ -386,7 +386,7 @@ CO_LSSmaster_return_t CO_LSSmaster_InquireLssAddress(
|
|||
CO_LSSmaster_return_t CO_LSSmaster_Inquire(
|
||||
CO_LSSmaster_t *LSSmaster,
|
||||
uint32_t timeDifference_us,
|
||||
CO_LSS_cs_t lssInquireCs,
|
||||
uint8_t lssInquireCs,
|
||||
uint32_t *value);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -32,11 +32,11 @@
|
|||
#include <string.h>
|
||||
|
||||
/* 'bit' must be unsigned or additional range check must be added: bit>=CO_LSS_FASTSCAN_BIT0 */
|
||||
#define CO_LSS_FASTSCAN_BITCHECK_VALID(bit) ((bit<=(uint8_t)CO_LSS_FASTSCAN_BIT31) || (bit==(uint8_t)CO_LSS_FASTSCAN_CONFIRM))
|
||||
#define CO_LSS_FASTSCAN_BITCHECK_VALID(bit) ((bit<=CO_LSS_FASTSCAN_BIT31) || (bit==CO_LSS_FASTSCAN_CONFIRM))
|
||||
/* 'index' must be unsigned or additional range check must be added: index>=CO_LSS_FASTSCAN_VENDOR_ID */
|
||||
#define CO_LSS_FASTSCAN_LSS_SUB_NEXT_VALID(index) (index<=(uint8_t)CO_LSS_FASTSCAN_SERIAL)
|
||||
#define CO_LSS_FASTSCAN_LSS_SUB_NEXT_VALID(index) (index<=CO_LSS_FASTSCAN_SERIAL)
|
||||
/* 'index' must be unsigned or additional range check must be added: index>=CO_LSS_BIT_TIMING_1000 */
|
||||
#define CO_LSS_BIT_TIMING_VALID(index) ((index != 5U) && (index <= (uint8_t)CO_LSS_BIT_TIMING_AUTO))
|
||||
#define CO_LSS_BIT_TIMING_VALID(index) ((index != 5U) && (index <= CO_LSS_BIT_TIMING_AUTO))
|
||||
|
||||
/*
|
||||
* Read received message from CAN module.
|
||||
|
|
@ -53,7 +53,7 @@ static void CO_LSSslave_receive(void *object, void *msg)
|
|||
if((DLC == 8U) && !CO_FLAG_READ(LSSslave->sendResponse)) {
|
||||
bool_t request_LSSslave_process = false;
|
||||
uint8_t *data = CO_CANrxMsg_readData(msg);
|
||||
CO_LSS_cs_t cs = (CO_LSS_cs_t) data[0];
|
||||
uint8_t cs = data[0];
|
||||
|
||||
if (cs == CO_LSS_SWITCH_STATE_GLOBAL) {
|
||||
uint8_t mode = data[1];
|
||||
|
|
@ -137,10 +137,10 @@ static void CO_LSSslave_receive(void *object, void *msg)
|
|||
idNumber = CO_SWAP_32(valSw);
|
||||
ack = false;
|
||||
|
||||
if (bitCheck == (uint8_t)CO_LSS_FASTSCAN_CONFIRM) {
|
||||
if (bitCheck == CO_LSS_FASTSCAN_CONFIRM) {
|
||||
/* Confirm, Reset */
|
||||
ack = true;
|
||||
LSSslave->fastscanPos = (uint8_t)(CO_LSS_FASTSCAN_VENDOR_ID);
|
||||
LSSslave->fastscanPos = CO_LSS_FASTSCAN_VENDOR_ID;
|
||||
(void)memset(&LSSslave->lssFastscan, 0,
|
||||
sizeof(LSSslave->lssFastscan));
|
||||
}
|
||||
|
|
@ -232,7 +232,7 @@ CO_ReturnError_t CO_LSSslave_init(
|
|||
/* Configure object variables */
|
||||
(void)memcpy(&LSSslave->lssAddress, lssAddress, sizeof(LSSslave->lssAddress));
|
||||
LSSslave->lssState = CO_LSS_STATE_WAITING;
|
||||
LSSslave->fastscanPos = (uint8_t)(CO_LSS_FASTSCAN_VENDOR_ID);
|
||||
LSSslave->fastscanPos = CO_LSS_FASTSCAN_VENDOR_ID;
|
||||
|
||||
LSSslave->pendingBitRate = pendingBitRate;
|
||||
LSSslave->pendingNodeID = pendingNodeID;
|
||||
|
|
@ -344,19 +344,19 @@ bool_t CO_LSSslave_process(CO_LSSslave_t *LSSslave) {
|
|||
break;
|
||||
}
|
||||
case CO_LSS_SWITCH_STATE_SEL_SERIAL: {
|
||||
LSSslave->TXbuff->data[0] = (uint8_t)(CO_LSS_SWITCH_STATE_SEL);
|
||||
LSSslave->TXbuff->data[0] = CO_LSS_SWITCH_STATE_SEL;
|
||||
CANsend = true;
|
||||
break;
|
||||
}
|
||||
case CO_LSS_CFG_NODE_ID: {
|
||||
nid = LSSslave->CANdata[1];
|
||||
errorCode = (uint8_t)(CO_LSS_CFG_NODE_ID_OK);
|
||||
errorCode = CO_LSS_CFG_NODE_ID_OK;
|
||||
|
||||
if (CO_LSS_NODE_ID_VALID(nid)) {
|
||||
*LSSslave->pendingNodeID = nid;
|
||||
}
|
||||
else {
|
||||
errorCode = (uint8_t)(CO_LSS_CFG_NODE_ID_OUT_OF_RANGE);
|
||||
errorCode = CO_LSS_CFG_NODE_ID_OUT_OF_RANGE;
|
||||
}
|
||||
|
||||
/* send confirmation */
|
||||
|
|
@ -374,8 +374,8 @@ bool_t CO_LSSslave_process(CO_LSSslave_t *LSSslave) {
|
|||
|
||||
tableSelector = LSSslave->CANdata[1];
|
||||
tableIndex = LSSslave->CANdata[2];
|
||||
errorCode = (uint8_t)(CO_LSS_CFG_BIT_TIMING_OK);
|
||||
errorCodeManuf = (uint8_t)(CO_LSS_CFG_BIT_TIMING_OK);
|
||||
errorCode = CO_LSS_CFG_BIT_TIMING_OK;
|
||||
errorCodeManuf = CO_LSS_CFG_BIT_TIMING_OK;
|
||||
|
||||
if ((tableSelector == 0U) && CO_LSS_BIT_TIMING_VALID(tableIndex)) {
|
||||
uint16_t bit = CO_LSS_bitTimingTableLookup[tableIndex];
|
||||
|
|
@ -386,13 +386,13 @@ bool_t CO_LSSslave_process(CO_LSSslave_t *LSSslave) {
|
|||
*LSSslave->pendingBitRate = bit;
|
||||
}
|
||||
else {
|
||||
errorCode = (uint8_t)(CO_LSS_CFG_BIT_TIMING_MANUFACTURER);
|
||||
errorCodeManuf = (uint8_t)(CO_LSS_CFG_BIT_TIMING_OUT_OF_RANGE);
|
||||
errorCode = CO_LSS_CFG_BIT_TIMING_MANUFACTURER;
|
||||
errorCodeManuf = CO_LSS_CFG_BIT_TIMING_OUT_OF_RANGE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* we currently only support CiA301 bit timing table */
|
||||
errorCode = (uint8_t)(CO_LSS_CFG_BIT_TIMING_OUT_OF_RANGE);
|
||||
errorCode = CO_LSS_CFG_BIT_TIMING_OUT_OF_RANGE;
|
||||
}
|
||||
|
||||
/* send confirmation */
|
||||
|
|
@ -418,11 +418,11 @@ bool_t CO_LSSslave_process(CO_LSSslave_t *LSSslave) {
|
|||
break;
|
||||
}
|
||||
case CO_LSS_CFG_STORE: {
|
||||
errorCode = (uint8_t)(CO_LSS_CFG_STORE_OK);
|
||||
errorCode = CO_LSS_CFG_STORE_OK;
|
||||
|
||||
if (LSSslave->pFunctLSScfgStore == NULL) {
|
||||
/* storing is not supported. Reply error */
|
||||
errorCode = (uint8_t)(CO_LSS_CFG_STORE_NOT_SUPPORTED);
|
||||
errorCode = CO_LSS_CFG_STORE_NOT_SUPPORTED;
|
||||
}
|
||||
else {
|
||||
bool_t result;
|
||||
|
|
@ -432,7 +432,7 @@ bool_t CO_LSSslave_process(CO_LSSslave_t *LSSslave) {
|
|||
*LSSslave->pendingNodeID,
|
||||
*LSSslave->pendingBitRate);
|
||||
if (!result) {
|
||||
errorCode = (uint8_t)(CO_LSS_CFG_STORE_FAILED);
|
||||
errorCode = CO_LSS_CFG_STORE_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -478,7 +478,7 @@ bool_t CO_LSSslave_process(CO_LSSslave_t *LSSslave) {
|
|||
break;
|
||||
}
|
||||
case CO_LSS_IDENT_FASTSCAN: {
|
||||
LSSslave->TXbuff->data[0] = (uint8_t)(CO_LSS_IDENT_SLAVE);
|
||||
LSSslave->TXbuff->data[0] = CO_LSS_IDENT_SLAVE;
|
||||
CANsend = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ extern "C" {
|
|||
*/
|
||||
typedef struct{
|
||||
CO_LSS_address_t lssAddress; /**< From #CO_LSSslave_init */
|
||||
CO_LSS_state_t lssState; /**< #CO_LSS_state_t */
|
||||
uint8_t lssState; /**< #CO_LSS_state_t */
|
||||
CO_LSS_address_t lssSelect; /**< Received LSS Address by select */
|
||||
|
||||
CO_LSS_address_t lssFastscan; /**< Received LSS Address by fastscan */
|
||||
|
|
@ -99,7 +99,7 @@ typedef struct{
|
|||
uint8_t activeNodeID; /**< Node ID used at the CAN interface */
|
||||
|
||||
volatile void *sendResponse; /**< Variable indicates, if LSS response has to be sent by mainline processing function */
|
||||
CO_LSS_cs_t service; /**< Service, which will have to be processed by mainline processing function */
|
||||
uint8_t service; /**< Service, which will have to be processed by mainline processing function */
|
||||
uint8_t CANdata[8]; /**< Received CAN data, which will be processed by mainline processing function */
|
||||
|
||||
#if (((CO_CONFIG_LSS) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
|
||||
|
|
@ -189,7 +189,7 @@ bool_t CO_LSSslave_process(CO_LSSslave_t *LSSslave);
|
|||
* @param LSSslave This object.
|
||||
* @return #CO_LSS_state_t
|
||||
*/
|
||||
static inline CO_LSS_state_t CO_LSSslave_getState(CO_LSSslave_t *LSSslave) {
|
||||
static inline uint8_t CO_LSSslave_getState(CO_LSSslave_t *LSSslave) {
|
||||
return (LSSslave == NULL) ? CO_LSS_STATE_WAITING : LSSslave->lssState;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -371,7 +371,7 @@ typedef struct {
|
|||
/** LSS bitrate parameter */
|
||||
uint16_t lssBitrate;
|
||||
/** LSS inquire parameter */
|
||||
CO_LSS_cs_t lssInquireCs;
|
||||
uint8_t lssInquireCs;
|
||||
/** LSS fastscan parameter */
|
||||
CO_LSSmaster_fastscan_t lssFastscan;
|
||||
/** LSS allnodes sub state parameter */
|
||||
|
|
|
|||
Loading…
Reference in a new issue