1
0
Fork 0

Replace type char with uint8_t or int8_t, where appropriate

305/CO_LSS.h now passing -Wextra warnings
This commit is contained in:
Janez 2021-01-05 09:22:19 +01:00
parent d62de8dc64
commit 267a2dafb2
8 changed files with 152 additions and 142 deletions

View file

@ -115,7 +115,7 @@ static void CO_SDOclient_receive(void *object, void *msg) {
/* Copy data. There is always enough space in fifo buffer,
* because block_blksize was calculated before */
CO_fifo_write(&SDO_C->bufFifo,
(const char *)&data[1],
&data[1],
7, &SDO_C->block_crc);
SDO_C->sizeTran += 7;
/* all segments in sub-block has been transferred */
@ -497,7 +497,7 @@ void CO_SDOclientDownloadInitiateSize(CO_SDOclient_t *SDO_C,
/******************************************************************************/
size_t CO_SDOclientDownloadBufWrite(CO_SDOclient_t *SDO_C,
const char *buf,
const uint8_t *buf,
size_t count)
{
size_t ret = 0;
@ -907,7 +907,7 @@ CO_SDO_return_t CO_SDOclientDownload(CO_SDOclient_t *SDO_C,
/* copy data */
CO_fifo_read(&SDO_C->bufFifo,
(char *)&SDO_C->CANtxBuff->data[4], count, NULL);
&SDO_C->CANtxBuff->data[4], count, NULL);
SDO_C->sizeTran = count;
SDO_C->finished = true;
}
@ -938,7 +938,7 @@ CO_SDO_return_t CO_SDOclientDownload(CO_SDOclient_t *SDO_C,
case CO_SDO_ST_DOWNLOAD_SEGMENT_REQ: {
/* fill data bytes */
count = CO_fifo_read(&SDO_C->bufFifo,
(char *)&SDO_C->CANtxBuff->data[1],
&SDO_C->CANtxBuff->data[1],
7, NULL);
/* verify if sizeTran is too large */
@ -1002,7 +1002,7 @@ CO_SDO_return_t CO_SDOclientDownload(CO_SDOclient_t *SDO_C,
/* get up to 7 data bytes */
count = CO_fifo_altRead(&SDO_C->bufFifo,
(char *)&SDO_C->CANtxBuff->data[1], 7);
&SDO_C->CANtxBuff->data[1], 7);
SDO_C->block_noData = 7 - count;
/* verify if sizeTran is too large */
@ -1318,7 +1318,7 @@ CO_SDO_return_t CO_SDOclientUpload(CO_SDOclient_t *SDO_C,
}
/* copy data, indicate size and finish */
CO_fifo_write(&SDO_C->bufFifo,
(const char *)&SDO_C->CANrxData[4],
&SDO_C->CANrxData[4],
count, NULL);
SDO_C->sizeTran = count;
SDO_C->state = CO_SDO_ST_IDLE;
@ -1364,7 +1364,7 @@ CO_SDO_return_t CO_SDOclientUpload(CO_SDOclient_t *SDO_C,
/* get data size and write data to the buffer */
count = 7 - ((SDO_C->CANrxData[0] >> 1) & 0x07);
countWr = CO_fifo_write(&SDO_C->bufFifo,
(const char *)&SDO_C->CANrxData[1],
&SDO_C->CANrxData[1],
count, NULL);
SDO_C->sizeTran += countWr;
@ -1462,7 +1462,7 @@ CO_SDO_return_t CO_SDOclientUpload(CO_SDOclient_t *SDO_C,
}
/* copy data, indicate size and finish */
CO_fifo_write(&SDO_C->bufFifo,
(const char *)&SDO_C->CANrxData[4],
&SDO_C->CANrxData[4],
count, NULL);
SDO_C->sizeTran = count;
SDO_C->state = CO_SDO_ST_IDLE;
@ -1497,7 +1497,7 @@ CO_SDO_return_t CO_SDOclientUpload(CO_SDOclient_t *SDO_C,
* contain data. Then copy remaining data into fifo */
uint8_t noData = ((SDO_C->CANrxData[0] >> 2) & 0x07);
CO_fifo_write(&SDO_C->bufFifo,
(const char *)&SDO_C->block_dataUploadLast[0],
&SDO_C->block_dataUploadLast[0],
7 - noData,
&SDO_C->block_crc);
SDO_C->sizeTran += 7 - noData;
@ -1810,7 +1810,7 @@ CO_SDO_return_t CO_SDOclientUpload(CO_SDOclient_t *SDO_C,
/******************************************************************************/
size_t CO_SDOclientUploadBufRead(CO_SDOclient_t *SDO_C,
char *buf,
uint8_t *buf,
size_t count)
{
size_t ret = 0;

View file

@ -119,7 +119,7 @@ typedef struct {
CO_fifo_t bufFifo;
/** Data buffer of usable size @ref CO_CONFIG_SDO_CLI_BUFFER_SIZE, used
* inside bufFifo. Must be one byte larger for fifo usage. */
char buf[CO_CONFIG_SDO_CLI_BUFFER_SIZE + 1];
uint8_t buf[CO_CONFIG_SDO_CLI_BUFFER_SIZE + 1];
/** Indicates, if new SDO message received from CAN bus. It is not cleared,
* until received message is completely processed. */
volatile void *CANrxNew;
@ -298,7 +298,7 @@ void CO_SDOclientDownloadInitiateSize(CO_SDOclient_t *SDO_C,
* @return number of bytes actually written.
*/
size_t CO_SDOclientDownloadBufWrite(CO_SDOclient_t *SDO_C,
const char *buf,
const uint8_t *buf,
size_t count);
@ -421,7 +421,7 @@ CO_SDO_return_t CO_SDOclientUpload(CO_SDOclient_t *SDO_C,
* @return number of bytes actually read.
*/
size_t CO_SDOclientUploadBufRead(CO_SDOclient_t *SDO_C,
char *buf,
uint8_t *buf,
size_t count);

View file

@ -37,9 +37,11 @@
#include <inttypes.h>
/* Non-graphical character for command delimiter */
#define DELIM_COMMAND '\n'
#define DELIM_COMMAND ((uint8_t)'\n')
/* Graphical character for comment delimiter */
#define DELIM_COMMENT '#'
#define DELIM_COMMENT ((uint8_t)'#')
/* Graphical character for double quotes */
#define DELIM_DQUOTE ((uint8_t)'"')
#endif /* (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_COMMANDS */
/* verify configuration */
@ -50,7 +52,7 @@
#endif
/******************************************************************************/
void CO_fifo_init(CO_fifo_t *fifo, char *buf, size_t bufSize) {
void CO_fifo_init(CO_fifo_t *fifo, uint8_t *buf, size_t bufSize) {
if (fifo == NULL || buf == NULL || bufSize < 2) {
return;
@ -79,12 +81,12 @@ void CO_fifo_init(CO_fifo_t *fifo, char *buf, size_t bufSize) {
* buffer in buff in buff full *
******************************************************************************/
size_t CO_fifo_write(CO_fifo_t *fifo,
const char *buf,
const uint8_t *buf,
size_t count,
uint16_t *crc)
{
size_t i;
char *bufDest;
uint8_t *bufDest;
if (fifo == NULL || fifo->buf == NULL || buf == NULL) {
return 0;
@ -104,7 +106,7 @@ size_t CO_fifo_write(CO_fifo_t *fifo,
#if (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_CRC16_CCITT
if (crc != NULL) {
crc16_ccitt_single(crc, (unsigned char)*buf);
crc16_ccitt_single(crc, *buf);
}
#endif
@ -125,9 +127,9 @@ size_t CO_fifo_write(CO_fifo_t *fifo,
/******************************************************************************/
size_t CO_fifo_read(CO_fifo_t *fifo, char *buf, size_t count, bool_t *eof) {
size_t CO_fifo_read(CO_fifo_t *fifo, uint8_t *buf, size_t count, bool_t *eof) {
size_t i;
const char *bufSrc;
const uint8_t *bufSrc;
if (eof != NULL) {
*eof = false;
@ -138,7 +140,7 @@ size_t CO_fifo_read(CO_fifo_t *fifo, char *buf, size_t count, bool_t *eof) {
bufSrc = &fifo->buf[fifo->readPtr];
for (i = count; i > 0; ) {
const char c = *bufSrc;
const uint8_t c = *bufSrc;
/* is circular buffer empty */
if (fifo->readPtr == fifo->writePtr) {
@ -205,10 +207,10 @@ void CO_fifo_altFinish(CO_fifo_t *fifo, uint16_t *crc) {
fifo->readPtr = fifo->altReadPtr;
}
else {
const char *bufSrc = &fifo->buf[fifo->readPtr];
const uint8_t *bufSrc = &fifo->buf[fifo->readPtr];
while (fifo->readPtr != fifo->altReadPtr) {
#if (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_CRC16_CCITT
crc16_ccitt_single(crc, (unsigned char)*bufSrc);
crc16_ccitt_single(crc, *bufSrc);
#endif
/* increment variable */
if (++fifo->readPtr == fifo->bufSize) {
@ -222,13 +224,13 @@ void CO_fifo_altFinish(CO_fifo_t *fifo, uint16_t *crc) {
}
}
size_t CO_fifo_altRead(CO_fifo_t *fifo, char *buf, size_t count) {
size_t CO_fifo_altRead(CO_fifo_t *fifo, uint8_t *buf, size_t count) {
size_t i;
const char *bufSrc;
const uint8_t *bufSrc;
bufSrc = &fifo->buf[fifo->altReadPtr];
for (i = count; i > 0; i--) {
const char c = *bufSrc;
const uint8_t c = *bufSrc;
/* is there no more data */
if (fifo->altReadPtr == fifo->writePtr) {
@ -257,7 +259,7 @@ size_t CO_fifo_altRead(CO_fifo_t *fifo, char *buf, size_t count) {
bool_t CO_fifo_CommSearch(CO_fifo_t *fifo, bool_t clear) {
bool_t newCommand = false;
size_t count;
char *commandEnd;
uint8_t *commandEnd;
if (fifo == NULL || fifo->readPtr == fifo->writePtr) {
return 0;
@ -269,17 +271,17 @@ bool_t CO_fifo_CommSearch(CO_fifo_t *fifo, bool_t clear) {
} else {
count = fifo->bufSize - fifo->readPtr;
}
commandEnd = (char *)memchr((const void *)&fifo->buf[fifo->readPtr],
DELIM_COMMAND,
count);
commandEnd = (uint8_t *)memchr((const void *)&fifo->buf[fifo->readPtr],
(int)DELIM_COMMAND,
count);
if (commandEnd != NULL) {
newCommand = true;
}
else if (fifo->readPtr > fifo->writePtr) {
/* not found, search in the beginning of the circular buffer */
commandEnd = (char *)memchr((const void *)&fifo->buf[0],
DELIM_COMMAND,
fifo->writePtr);
commandEnd = (uint8_t *)memchr((const void *)&fifo->buf[0],
(int)DELIM_COMMAND,
fifo->writePtr);
if (commandEnd != NULL || fifo->readPtr == (fifo->writePtr + 1)) {
/* command delimiter found or buffer full */
newCommand = true;
@ -293,7 +295,7 @@ bool_t CO_fifo_CommSearch(CO_fifo_t *fifo, bool_t clear) {
/* Clear buffer if set so */
if (clear) {
if (commandEnd != NULL) {
fifo->readPtr = (int)(commandEnd - fifo->buf) + 1;
fifo->readPtr = (size_t)(commandEnd - fifo->buf) + 1;
if (fifo->readPtr == fifo->bufSize) {
fifo->readPtr = 0;
}
@ -313,7 +315,7 @@ bool_t CO_fifo_trimSpaces(CO_fifo_t *fifo, bool_t *insideComment) {
if (fifo != NULL && insideComment != NULL) {
while (fifo->readPtr != fifo->writePtr) {
char c = fifo->buf[fifo->readPtr];
uint8_t c = fifo->buf[fifo->readPtr];
if (c == DELIM_COMMENT) {
*insideComment = true;
@ -339,7 +341,7 @@ bool_t CO_fifo_trimSpaces(CO_fifo_t *fifo, bool_t *insideComment) {
size_t CO_fifo_readToken(CO_fifo_t *fifo,
char *buf,
size_t count,
char *closed,
int8_t *closed,
bool_t *err)
{
bool_t delimCommandFound = false;
@ -350,9 +352,9 @@ size_t CO_fifo_readToken(CO_fifo_t *fifo,
&& fifo->readPtr != fifo->writePtr
) {
bool_t finished = false;
char step = 0;
uint8_t step = 0;
size_t ptr = fifo->readPtr; /* current pointer (integer, 0 based) */
char *c = &fifo->buf[ptr]; /* current char */
uint8_t *c = &fifo->buf[ptr]; /* current character */
do {
switch (step) {
case 0: /* skip leading empty characters, stop on delimiter */
@ -360,7 +362,7 @@ size_t CO_fifo_readToken(CO_fifo_t *fifo,
if (*c == DELIM_COMMENT) {
delimCommentFound = true;
} else {
buf[tokenSize++] = *c;
buf[tokenSize++] = (char)*c;
step++;
}
}
@ -373,7 +375,7 @@ size_t CO_fifo_readToken(CO_fifo_t *fifo,
if (*c == DELIM_COMMENT) {
delimCommentFound = true;
} else if (tokenSize < count) {
buf[tokenSize++] = *c;
buf[tokenSize++] = (char)*c;
}
}
else {
@ -446,7 +448,7 @@ size_t CO_fifo_readToken(CO_fifo_t *fifo,
*closed = delimCommandFound ? 1 : 0;
}
/* token was larger then size of the buffer, all was cleaned, return '' */
/* token was larger then size of the buffer, all was cleaned, return empty*/
if (tokenSize == count) {
tokenSize = 0;
}
@ -470,21 +472,21 @@ size_t CO_fifo_readToken(CO_fifo_t *fifo,
static const char base64EncTable[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static const char base64DecTable[] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1,103,101, -1, -1,102, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
103, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1,100, -1, -1,
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1};
static const uint8_t base64DecTable[] = {
255,255,255,255,255,255,255,255,255,103,101,255,255,102,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
103,255,255,255,255,255,255,255,255,255,255, 62,255,255,255, 63,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61,255,255,255,100,255,255,
255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,255,255,255,255,255,
255, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,255,255,255,255,255};
size_t CO_fifo_readU82a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end) {
uint8_t n=0;
if (fifo != NULL && count >= 6 && CO_fifo_getOccupied(fifo) == sizeof(n)) {
CO_fifo_read(fifo, (char *)&n, sizeof(n), NULL);
CO_fifo_read(fifo, &n, sizeof(n), NULL);
return sprintf(buf, "%"PRIu8, n);
}
else {
@ -496,7 +498,7 @@ size_t CO_fifo_readU162a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end) {
uint16_t n=0;
if (fifo != NULL && count >= 8 && CO_fifo_getOccupied(fifo) == sizeof(n)) {
CO_fifo_read(fifo, (char *)&n, sizeof(n), NULL);
CO_fifo_read(fifo, (uint8_t *)&n, sizeof(n), NULL);
return sprintf(buf, "%"PRIu16, CO_SWAP_16(n));
}
else {
@ -508,7 +510,7 @@ size_t CO_fifo_readU322a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end) {
uint32_t n=0;
if (fifo != NULL && count >= 12 && CO_fifo_getOccupied(fifo) == sizeof(n)) {
CO_fifo_read(fifo, (char *)&n, sizeof(n), NULL);
CO_fifo_read(fifo, (uint8_t *)&n, sizeof(n), NULL);
return sprintf(buf, "%"PRIu32, CO_SWAP_32(n));
}
else {
@ -520,7 +522,7 @@ size_t CO_fifo_readU642a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end) {
uint64_t n=0;
if (fifo != NULL && count >= 20 && CO_fifo_getOccupied(fifo) == sizeof(n)) {
CO_fifo_read(fifo, (char *)&n, sizeof(n), NULL);
CO_fifo_read(fifo, (uint8_t *)&n, sizeof(n), NULL);
return sprintf(buf, "%"PRIu64, CO_SWAP_64(n));
}
else {
@ -532,7 +534,7 @@ size_t CO_fifo_readX82a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end) {
uint8_t n=0;
if (fifo != NULL && count >= 6 && CO_fifo_getOccupied(fifo) == sizeof(n)) {
CO_fifo_read(fifo, (char *)&n, sizeof(n), NULL);
CO_fifo_read(fifo, (uint8_t *)&n, sizeof(n), NULL);
return sprintf(buf, "0x%02"PRIX8, n);
}
else {
@ -544,7 +546,7 @@ size_t CO_fifo_readX162a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end) {
uint16_t n=0;
if (fifo != NULL && count >= 8 && CO_fifo_getOccupied(fifo) == sizeof(n)) {
CO_fifo_read(fifo, (char *)&n, sizeof(n), NULL);
CO_fifo_read(fifo, (uint8_t *)&n, sizeof(n), NULL);
return sprintf(buf, "0x%04"PRIX16, CO_SWAP_16(n));
}
else {
@ -556,7 +558,7 @@ size_t CO_fifo_readX322a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end) {
uint32_t n=0;
if (fifo != NULL && count >= 12 && CO_fifo_getOccupied(fifo) == sizeof(n)) {
CO_fifo_read(fifo, (char *)&n, sizeof(n), NULL);
CO_fifo_read(fifo, (uint8_t *)&n, sizeof(n), NULL);
return sprintf(buf, "0x%08"PRIX32, CO_SWAP_32(n));
}
else {
@ -568,7 +570,7 @@ size_t CO_fifo_readX642a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end) {
uint64_t n=0;
if (fifo != NULL && count >= 20 && CO_fifo_getOccupied(fifo) == sizeof(n)) {
CO_fifo_read(fifo, (char *)&n, sizeof(n), NULL);
CO_fifo_read(fifo, (uint8_t *)&n, sizeof(n), NULL);
return sprintf(buf, "0x%016"PRIX64, CO_SWAP_64(n));
}
else {
@ -580,7 +582,7 @@ size_t CO_fifo_readI82a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end) {
int8_t n=0;
if (fifo != NULL && count >= 6 && CO_fifo_getOccupied(fifo) == sizeof(n)) {
CO_fifo_read(fifo, (char *)&n, sizeof(n), NULL);
CO_fifo_read(fifo, (uint8_t *)&n, sizeof(n), NULL);
return sprintf(buf, "%"PRId8, n);
}
else {
@ -592,7 +594,7 @@ size_t CO_fifo_readI162a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end) {
int16_t n=0;
if (fifo != NULL && count >= 8 && CO_fifo_getOccupied(fifo) == sizeof(n)) {
CO_fifo_read(fifo, (char *)&n, sizeof(n), NULL);
CO_fifo_read(fifo, (uint8_t *)&n, sizeof(n), NULL);
return sprintf(buf, "%"PRId16, CO_SWAP_16(n));
}
else {
@ -604,7 +606,7 @@ size_t CO_fifo_readI322a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end) {
int32_t n=0;
if (fifo != NULL && count >= 13 && CO_fifo_getOccupied(fifo) == sizeof(n)) {
CO_fifo_read(fifo, (char *)&n, sizeof(n), NULL);
CO_fifo_read(fifo, (uint8_t *)&n, sizeof(n), NULL);
return sprintf(buf, "%"PRId32, CO_SWAP_32(n));
}
else {
@ -616,7 +618,7 @@ size_t CO_fifo_readI642a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end) {
int64_t n=0;
if (fifo != NULL && count >= 23 && CO_fifo_getOccupied(fifo) == sizeof(n)) {
CO_fifo_read(fifo, (char *)&n, sizeof(n), NULL);
CO_fifo_read(fifo, (uint8_t *)&n, sizeof(n), NULL);
return sprintf(buf, "%"PRId64, CO_SWAP_64(n));
}
else {
@ -628,7 +630,7 @@ size_t CO_fifo_readR322a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end) {
float32_t n=0;
if (fifo != NULL && count >= 20 && CO_fifo_getOccupied(fifo) == sizeof(n)) {
CO_fifo_read(fifo, (char *)&n, sizeof(n), NULL);
CO_fifo_read(fifo, (uint8_t *)&n, sizeof(n), NULL);
return sprintf(buf, "%g", CO_SWAP_32(n));
}
else {
@ -640,7 +642,7 @@ size_t CO_fifo_readR642a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end) {
float64_t n=0;
if (fifo != NULL && count >= 30 && CO_fifo_getOccupied(fifo) == sizeof(n)) {
CO_fifo_read(fifo, (char *)&n, sizeof(n), NULL);
CO_fifo_read(fifo, (uint8_t *)&n, sizeof(n), NULL);
return sprintf(buf, "%g", CO_SWAP_64(n));
}
else {
@ -656,19 +658,19 @@ size_t CO_fifo_readHex2a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end) {
if (fifo != NULL && count > 3) {
/* Very first write is without leading space */
if (!fifo->started) {
char c;
uint8_t c;
if(CO_fifo_getc(fifo, &c)) {
len = sprintf(&buf[0], "%02"PRIX8, (uint8_t)c);
len = sprintf(&buf[0], "%02"PRIX8, c);
fifo->started = true;
}
}
while ((len + 3) < count) {
char c;
uint8_t c;
if(!CO_fifo_getc(fifo, &c)) {
break;
}
len += sprintf(&buf[len], " %02"PRIX8, (uint8_t)c);
len += sprintf(&buf[len], " %02"PRIX8, c);
}
}
@ -686,17 +688,18 @@ size_t CO_fifo_readVs2a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end) {
}
while ((len + 2) < count) {
char c;
uint8_t c;
if(!CO_fifo_getc(fifo, &c)) {
if (end) {
buf[len++] = '"';
}
break;
}
else if (c != 0 && c != '\r') { /* skip null and CR inside string */
buf[len++] = c;
if (c == '"') {
buf[len++] = c;
else if (c != 0 && c != (uint8_t)'\r') {
/* skip null and CR inside string */
buf[len++] = (char)c;
if (c == DELIM_DQUOTE) {
buf[len++] = '"';
}
}
}
@ -726,7 +729,7 @@ size_t CO_fifo_readB642a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end) {
}
while ((len + 3) <= count) {
char c;
uint8_t c;
if(!CO_fifo_getc(fifo, &c)) {
/* buffer is empty, is also SDO communication finished? */
@ -747,7 +750,7 @@ size_t CO_fifo_readB642a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end) {
break;
}
word |= (uint8_t)c;
word |= c;
switch (step++) {
case 0:
@ -776,7 +779,7 @@ size_t CO_fifo_readB642a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end) {
/******************************************************************************/
size_t CO_fifo_cpyTok2U8(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
char buf[15];
char closed = -1;
int8_t closed = -1;
bool_t err = 0;
size_t nWr = 0;
size_t nRd = CO_fifo_readToken(src, buf, sizeof(buf), &closed, &err);
@ -788,7 +791,7 @@ size_t CO_fifo_cpyTok2U8(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
if (sRet != strchr(buf, '\0') || u32 > UINT8_MAX) st |= CO_fifo_st_errVal;
else {
uint8_t num = (uint8_t) u32;
nWr = CO_fifo_write(dest, (const char *)&num, sizeof(num), NULL);
nWr = CO_fifo_write(dest, &num, sizeof(num), NULL);
if (nWr != sizeof(num)) st |= CO_fifo_st_errBuf;
}
}
@ -798,7 +801,7 @@ size_t CO_fifo_cpyTok2U8(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
size_t CO_fifo_cpyTok2U16(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
char buf[15];
char closed = -1;
int8_t closed = -1;
bool_t err = 0;
size_t nWr = 0;
size_t nRd = CO_fifo_readToken(src, buf, sizeof(buf), &closed, &err);
@ -810,7 +813,7 @@ size_t CO_fifo_cpyTok2U16(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
if (sRet != strchr(buf, '\0') || u32 > UINT16_MAX) st |= CO_fifo_st_errVal;
else {
uint16_t num = CO_SWAP_16((uint16_t) u32);
nWr = CO_fifo_write(dest, (const char *)&num, sizeof(num), NULL);
nWr = CO_fifo_write(dest, (uint8_t *)&num, sizeof(num), NULL);
if (nWr != sizeof(num)) st |= CO_fifo_st_errBuf;
}
}
@ -820,7 +823,7 @@ size_t CO_fifo_cpyTok2U16(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
size_t CO_fifo_cpyTok2U32(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
char buf[15];
char closed = -1;
int8_t closed = -1;
bool_t err = 0;
size_t nWr = 0;
size_t nRd = CO_fifo_readToken(src, buf, sizeof(buf), &closed, &err);
@ -832,7 +835,7 @@ size_t CO_fifo_cpyTok2U32(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
if (sRet != strchr(buf, '\0')) st |= CO_fifo_st_errVal;
else {
uint32_t num = CO_SWAP_32(u32);
nWr = CO_fifo_write(dest, (const char *)&num, sizeof(num), NULL);
nWr = CO_fifo_write(dest, (uint8_t *)&num, sizeof(num), NULL);
if (nWr != sizeof(num)) st |= CO_fifo_st_errBuf;
}
}
@ -842,7 +845,7 @@ size_t CO_fifo_cpyTok2U32(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
size_t CO_fifo_cpyTok2U64(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
char buf[25];
char closed = -1;
int8_t closed = -1;
bool_t err = 0;
size_t nWr = 0;
size_t nRd = CO_fifo_readToken(src, buf, sizeof(buf), &closed, &err);
@ -854,7 +857,7 @@ size_t CO_fifo_cpyTok2U64(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
if (sRet != strchr(buf, '\0')) st |= CO_fifo_st_errVal;
else {
uint64_t num = CO_SWAP_64(u64);
nWr = CO_fifo_write(dest, (const char *)&num, sizeof(num), NULL);
nWr = CO_fifo_write(dest, (uint8_t *)&num, sizeof(num), NULL);
if (nWr != sizeof(num)) st |= CO_fifo_st_errBuf;
}
}
@ -864,7 +867,7 @@ size_t CO_fifo_cpyTok2U64(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
size_t CO_fifo_cpyTok2I8(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
char buf[15];
char closed = -1;
int8_t closed = -1;
bool_t err = 0;
size_t nWr = 0;
size_t nRd = CO_fifo_readToken(src, buf, sizeof(buf), &closed, &err);
@ -877,7 +880,7 @@ size_t CO_fifo_cpyTok2I8(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
st |= CO_fifo_st_errVal;
} else {
int8_t num = (int8_t) i32;
nWr = CO_fifo_write(dest, (const char *)&num, sizeof(num), NULL);
nWr = CO_fifo_write(dest, (uint8_t *)&num, sizeof(num), NULL);
if (nWr != sizeof(num)) st |= CO_fifo_st_errBuf;
}
}
@ -887,7 +890,7 @@ size_t CO_fifo_cpyTok2I8(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
size_t CO_fifo_cpyTok2I16(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
char buf[15];
char closed = -1;
int8_t closed = -1;
bool_t err = 0;
size_t nWr = 0;
size_t nRd = CO_fifo_readToken(src, buf, sizeof(buf), &closed, &err);
@ -900,7 +903,7 @@ size_t CO_fifo_cpyTok2I16(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
st |= CO_fifo_st_errVal;
} else {
int16_t num = CO_SWAP_16((int16_t) i32);
nWr = CO_fifo_write(dest, (const char *)&num, sizeof(num), NULL);
nWr = CO_fifo_write(dest, (uint8_t *)&num, sizeof(num), NULL);
if (nWr != sizeof(num)) st |= CO_fifo_st_errBuf;
}
}
@ -910,7 +913,7 @@ size_t CO_fifo_cpyTok2I16(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
size_t CO_fifo_cpyTok2I32(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
char buf[15];
char closed = -1;
int8_t closed = -1;
bool_t err = 0;
size_t nWr = 0;
size_t nRd = CO_fifo_readToken(src, buf, sizeof(buf), &closed, &err);
@ -922,7 +925,7 @@ size_t CO_fifo_cpyTok2I32(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
if (sRet != strchr(buf, '\0')) st |= CO_fifo_st_errVal;
else {
int32_t num = CO_SWAP_32(i32);
nWr = CO_fifo_write(dest, (const char *)&num, sizeof(num), NULL);
nWr = CO_fifo_write(dest, (uint8_t *)&num, sizeof(num), NULL);
if (nWr != sizeof(num)) st |= CO_fifo_st_errBuf;
}
}
@ -932,7 +935,7 @@ size_t CO_fifo_cpyTok2I32(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
size_t CO_fifo_cpyTok2I64(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
char buf[25];
char closed = -1;
int8_t closed = -1;
bool_t err = 0;
size_t nWr = 0;
size_t nRd = CO_fifo_readToken(src, buf, sizeof(buf), &closed, &err);
@ -944,7 +947,7 @@ size_t CO_fifo_cpyTok2I64(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
if (sRet != strchr(buf, '\0')) st |= CO_fifo_st_errVal;
else {
int64_t num = CO_SWAP_64(i64);
nWr = CO_fifo_write(dest, (const char *)&num, sizeof(num), NULL);
nWr = CO_fifo_write(dest, (uint8_t *)&num, sizeof(num), NULL);
if (nWr != sizeof(num)) st |= CO_fifo_st_errBuf;
}
}
@ -954,7 +957,7 @@ size_t CO_fifo_cpyTok2I64(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
size_t CO_fifo_cpyTok2R32(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
char buf[30];
char closed = -1;
int8_t closed = -1;
bool_t err = 0;
size_t nWr = 0;
size_t nRd = CO_fifo_readToken(src, buf, sizeof(buf), &closed, &err);
@ -966,7 +969,7 @@ size_t CO_fifo_cpyTok2R32(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
if (sRet != strchr(buf, '\0')) st |= CO_fifo_st_errVal;
else {
float32_t num = CO_SWAP_32(f32);
nWr = CO_fifo_write(dest, (const char *)&num, sizeof(num), NULL);
nWr = CO_fifo_write(dest, (uint8_t *)&num, sizeof(num), NULL);
if (nWr != sizeof(num)) st |= CO_fifo_st_errBuf;
}
}
@ -976,7 +979,7 @@ size_t CO_fifo_cpyTok2R32(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
size_t CO_fifo_cpyTok2R64(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
char buf[40];
char closed = -1;
int8_t closed = -1;
bool_t err = 0;
size_t nWr = 0;
size_t nRd = CO_fifo_readToken(src, buf, sizeof(buf), &closed, &err);
@ -988,7 +991,7 @@ size_t CO_fifo_cpyTok2R64(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
if (sRet != strchr(buf, '\0')) st |= CO_fifo_st_errVal;
else {
float64_t num = CO_SWAP_64(f64);
nWr = CO_fifo_write(dest, (const char *)&num, sizeof(num), NULL);
nWr = CO_fifo_write(dest, (uint8_t *)&num, sizeof(num), NULL);
if (nWr != sizeof(num)) st |= CO_fifo_st_errBuf;
}
}
@ -1000,7 +1003,7 @@ size_t CO_fifo_cpyTok2Hex(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
size_t destSpace, destSpaceStart;
bool_t finished = false;
uint8_t step;
char firstChar;
uint8_t firstChar;
CO_fifo_st st = 0;
if (dest == NULL || src == NULL) {
@ -1024,13 +1027,13 @@ size_t CO_fifo_cpyTok2Hex(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
else {
/* get memorized variables from previous function calls */
step = (uint8_t)(dest->aux >> 8);
firstChar = (char)(dest->aux & 0xFF);
firstChar = (uint8_t)(dest->aux & 0xFF);
}
/* repeat until destination space available and no error and not finished
* and source characters available */
while (destSpace > 0 && (st & CO_fifo_st_errMask) == 0 && !finished) {
char c;
uint8_t c;
if (!CO_fifo_getc(src, &c)) {
break;
}
@ -1053,18 +1056,18 @@ size_t CO_fifo_cpyTok2Hex(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
}
else {
/* write the byte */
char s[3];
uint8_t s[3];
int32_t num;
s[0] = firstChar; s[1] = c; s[2] = 0;
num = strtol(s, NULL, 16);
CO_fifo_putc(dest, (char) num);
num = strtol((char *)&s[0], NULL, 16);
CO_fifo_putc(dest, (uint8_t) num);
destSpace--;
step = 0;
}
}
else if (isgraph((int)c) != 0) {
/* printable character, not hex digit */
if (c == '#') /* comment start */
if (c == DELIM_COMMENT) /* comment start */
step = 6;
else /* syntax error */
st |= CO_fifo_st_errTok;
@ -1073,11 +1076,11 @@ size_t CO_fifo_cpyTok2Hex(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
/* this is space or delimiter */
if (step == 1) {
/* write the byte */
char s[2];
uint8_t s[2];
int32_t num;
s[0] = firstChar; s[1] = 0;
num = strtol(s, NULL, 16);
CO_fifo_putc(dest, (char) num);
num = strtol((char *)&s[0], NULL, 16);
CO_fifo_putc(dest, (uint8_t) num);
destSpace--;
step = 0;
}
@ -1096,7 +1099,7 @@ size_t CO_fifo_cpyTok2Hex(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
if (!finished) {
st |= CO_fifo_st_partial;
/* memorize variables for next iteration */
dest->aux = (uint32_t)step << 8 | (uint8_t)firstChar;
dest->aux = (uint32_t)step << 8 | firstChar;
}
if (status != NULL) *status = st;
@ -1135,14 +1138,14 @@ size_t CO_fifo_cpyTok2Vs(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
/* repeat until destination space available and no error and not finished
* and source characters available */
while (destSpace > 0 && (st & CO_fifo_st_errMask) == 0 && !finished) {
char c;
uint8_t c;
if (!CO_fifo_getc(src, &c)) {
break;
}
switch (step) {
case 0: /* beginning of the string, first write into dest */
if (c == '"') {
if (c == DELIM_DQUOTE) {
/* Indicated beginning of the string, skip this character. */
step = 1;
}
@ -1157,7 +1160,7 @@ size_t CO_fifo_cpyTok2Vs(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
case 1: /* inside string, quoted string */
case 2: /* inside string, single word, no quotes */
if (c == '"') {
if (c == DELIM_DQUOTE) {
/* double quote found, this may be end of the string or escaped
* double quote (with two double quotes) */
step += 2;
@ -1188,7 +1191,7 @@ size_t CO_fifo_cpyTok2Vs(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
case 3: /* previous was double quote, parsing quoted string */
case 4: /* previous was double quote, parsing no quoted word */
if (c == '"') {
if (c == DELIM_DQUOTE) {
/* escaped double quote, copy the character and continue */
CO_fifo_putc(dest, c);
destSpace--;
@ -1232,7 +1235,7 @@ size_t CO_fifo_cpyTok2Vs(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
step = 6;
}
else if (isgraph((int)c) != 0) {
if (c == '#') /* comment start */
if (c == DELIM_COMMENT) /* comment start */
step = 6;
else /* syntax error */
st |= CO_fifo_st_errTok;
@ -1300,7 +1303,7 @@ size_t CO_fifo_cpyTok2B64(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
/* repeat until destination space available and no error and not finished
* and source characters available */
while (destSpace >= 3 && (st & CO_fifo_st_errMask) == 0 && !finished) {
char c;
uint8_t c;
if (!CO_fifo_getc(src, &c)) {
break;
}
@ -1315,8 +1318,8 @@ size_t CO_fifo_cpyTok2B64(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
else if (insideComment) {
step = 6;
}
else if (isgraph((int)c) != 0 && c != '=') {
if (c == '#') /* comment start */
else if (isgraph((int)c) != 0 && c != (uint8_t)'=') {
if (c == DELIM_COMMENT) /* comment start */
step = 6;
else /* syntax error */
st |= CO_fifo_st_errTok;
@ -1324,21 +1327,21 @@ size_t CO_fifo_cpyTok2B64(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
continue;
}
char code = base64DecTable[c & 0x7F];
uint8_t code = base64DecTable[c & 0x7F];
if (c < 0 || code < 0) {
if ((c & 0x80) != 0 || (code & 0x80) != 0) {
st |= CO_fifo_st_errTok;
}
else if (code >= 64 /* '=' (pad) or DELIM_COMMAND or space */) {
/* base64 string finished, write remaining bytes */
switch (step) {
case 2:
CO_fifo_putc(dest, (char)(dword >> 4));
CO_fifo_putc(dest, (uint8_t)(dword >> 4));
destSpace --;
break;
case 3:
CO_fifo_putc(dest, (char)(dword >> 10));
CO_fifo_putc(dest, (char)(dword >> 2));
CO_fifo_putc(dest, (uint8_t)(dword >> 10));
CO_fifo_putc(dest, (uint8_t)(dword >> 2));
destSpace -= 2;
break;
}
@ -1355,9 +1358,9 @@ size_t CO_fifo_cpyTok2B64(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status) {
else {
dword = (dword << 6) | code;
if (step++ == 3) {
CO_fifo_putc(dest, (char)((dword >> 16) & 0xFF));
CO_fifo_putc(dest, (char)((dword >> 8) & 0xFF));
CO_fifo_putc(dest, (char)(dword & 0xFF));
CO_fifo_putc(dest, (uint8_t)((dword >> 16) & 0xFF));
CO_fifo_putc(dest, (uint8_t)((dword >> 8) & 0xFF));
CO_fifo_putc(dest, (uint8_t)(dword & 0xFF));
destSpace -= 3;
dword = 0;
step = 0;

View file

@ -59,7 +59,7 @@ extern "C" {
*/
typedef struct {
/** Buffer of size bufSize. Initialized by CO_fifo_init() */
char *buf;
uint8_t *buf;
/** Initialized by CO_fifo_init() */
size_t bufSize;
/** Location in the buffer, which will be next written. */
@ -89,7 +89,7 @@ typedef struct {
* @param bufSize Size of the above buffer. Usable size of the buffer will be
* one byte less than bufSize, it is used for operation of the circular buffer.
*/
void CO_fifo_init(CO_fifo_t *fifo, char *buf, size_t bufSize);
void CO_fifo_init(CO_fifo_t *fifo, uint8_t *buf, size_t bufSize);
/**
@ -170,7 +170,7 @@ static inline size_t CO_fifo_getOccupied(CO_fifo_t *fifo) {
*
* @return true, if write was successful (enough space in fifo buffer)
*/
static inline bool_t CO_fifo_putc(CO_fifo_t *fifo, const char c) {
static inline bool_t CO_fifo_putc(CO_fifo_t *fifo, const uint8_t c) {
if (fifo != NULL && fifo->buf != NULL) {
size_t writePtrNext = fifo->writePtr + 1;
if (writePtrNext != fifo->readPtr &&
@ -193,7 +193,7 @@ static inline bool_t CO_fifo_putc(CO_fifo_t *fifo, const char c) {
* @param fifo This object
* @param c Character to put
*/
static inline void CO_fifo_putc_ov(CO_fifo_t *fifo, const char c) {
static inline void CO_fifo_putc_ov(CO_fifo_t *fifo, const uint8_t c) {
if (fifo != NULL && fifo->buf != NULL) {
fifo->buf[fifo->writePtr] = c;
@ -213,7 +213,7 @@ static inline void CO_fifo_putc_ov(CO_fifo_t *fifo, const char c) {
*
* @return true, if read was successful (non-empty fifo buffer)
*/
static inline bool_t CO_fifo_getc(CO_fifo_t *fifo, char *buf) {
static inline bool_t CO_fifo_getc(CO_fifo_t *fifo, uint8_t *buf) {
if (fifo != NULL && buf != NULL && fifo->readPtr != fifo->writePtr) {
*buf = fifo->buf[fifo->readPtr];
if (++fifo->readPtr == fifo->bufSize) {
@ -241,7 +241,7 @@ static inline bool_t CO_fifo_getc(CO_fifo_t *fifo, char *buf) {
* @return number of bytes actually written.
*/
size_t CO_fifo_write(CO_fifo_t *fifo,
const char *buf,
const uint8_t *buf,
size_t count,
uint16_t *crc);
@ -262,7 +262,7 @@ size_t CO_fifo_write(CO_fifo_t *fifo,
*
* @return number of bytes actually read.
*/
size_t CO_fifo_read(CO_fifo_t *fifo, char *buf, size_t count, bool_t *eof);
size_t CO_fifo_read(CO_fifo_t *fifo, uint8_t *buf, size_t count, bool_t *eof);
#if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ALT_READ) || defined CO_DOXYGEN
@ -320,7 +320,7 @@ static inline size_t CO_fifo_altGetOccupied(CO_fifo_t *fifo) {
*
* @return number of bytes actually read.
*/
size_t CO_fifo_altRead(CO_fifo_t *fifo, char *buf, size_t count);
size_t CO_fifo_altRead(CO_fifo_t *fifo, uint8_t *buf, size_t count);
#endif /* #if (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ALT_READ */
@ -409,7 +409,7 @@ bool_t CO_fifo_trimSpaces(CO_fifo_t *fifo, bool_t *insideComment);
size_t CO_fifo_readToken(CO_fifo_t *fifo,
char *buf,
size_t count,
char *closed,
int8_t *closed,
bool_t *err);
#endif /* (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_COMMANDS */

View file

@ -141,7 +141,8 @@ typedef enum {
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_BITCHECK_VALID(bit) ((bit>=CO_LSS_FASTSCAN_BIT0 && bit<=CO_LSS_FASTSCAN_BIT31) || bit==CO_LSS_FASTSCAN_CONFIRM)
/* comparision is always true: bit>=CO_LSS_FASTSCAN_BIT0 */
#define CO_LSS_FASTSCAN_BITCHECK_VALID(bit) (bit<=CO_LSS_FASTSCAN_BIT31 || bit==CO_LSS_FASTSCAN_CONFIRM)
/**
* Fastscan LSSsub, LSSnext
@ -153,7 +154,8 @@ typedef enum {
CO_LSS_FASTSCAN_SERIAL = 3 /**< Serial number */
} CO_LSS_fastscan_lss_sub_next;
#define CO_LSS_FASTSCAN_LSS_SUB_NEXT_VALID(index) (index>=CO_LSS_FASTSCAN_VENDOR_ID && index<=CO_LSS_FASTSCAN_SERIAL)
/* comparision is always true: index>=CO_LSS_FASTSCAN_VENDOR_ID */
#define CO_LSS_FASTSCAN_LSS_SUB_NEXT_VALID(index) (index<=CO_LSS_FASTSCAN_SERIAL)
/**
* The LSS address is a 128 bit number, uniquely identifying each node. It
@ -219,7 +221,11 @@ static const uint16_t CO_LSS_bitTimingTableLookup[] = {
/**
* Macro to check if index contains valid bit timing
*/
#define CO_LSS_BIT_TIMING_VALID(index) (index != 5 && (index >= CO_LSS_BIT_TIMING_1000 && index <= CO_LSS_BIT_TIMING_AUTO))
#if CO_LSS_BIT_TIMING_1000 != 0
#error missing comprision index >= CO_LSS_BIT_TIMING_1000
#endif
/* comparision is always true: index >= CO_LSS_BIT_TIMING_1000 */
#define CO_LSS_BIT_TIMING_VALID(index) (index != 5 && index <= CO_LSS_BIT_TIMING_AUTO)
/**
* Invalid node ID triggers node ID assignment

View file

@ -143,7 +143,7 @@ void CO_GTWA_log_print(CO_GTWA_t* gtwa, const char *message) {
const char *c;
for (c = &message[0]; *c != 0; c++) {
CO_fifo_putc_ov(&gtwa->logFifo, *c);
CO_fifo_putc_ov(&gtwa->logFifo, (const uint8_t)*c);
}
}
}
@ -623,7 +623,7 @@ void CO_GTWA_process(CO_GTWA_t *gtwa,
(void)timerNext_us; /* may be unused */
bool_t err = false; /* syntax or other error, true or false, I/O variable */
char closed; /* indication of command delimiter, I/O variable */
int8_t closed; /* indication of command delimiter, I/O variable */
CO_GTWA_respErrorCode_t respErrorCode = CO_GTWA_respErrorNone;
if (gtwa == NULL) {
@ -1986,7 +1986,8 @@ void CO_GTWA_process(CO_GTWA_t *gtwa,
/* print message log */
case CO_GTWA_ST_LOG: {
do {
gtwa->respBufCount = CO_fifo_read(&gtwa->logFifo, gtwa->respBuf,
gtwa->respBufCount = CO_fifo_read(&gtwa->logFifo,
(uint8_t *)gtwa->respBuf,
CO_GTWA_RESP_BUF_SIZE, NULL);
respBufTransfer(gtwa);

View file

@ -324,7 +324,7 @@ typedef struct {
/** CO_fifo_t object for command (not pointer) */
CO_fifo_t commFifo;
/** Command buffer of usable size @ref CO_CONFIG_GTWA_COMM_BUF_SIZE */
char commBuf[CO_CONFIG_GTWA_COMM_BUF_SIZE + 1];
uint8_t commBuf[CO_CONFIG_GTWA_COMM_BUF_SIZE + 1];
/** Response buffer of usable size @ref CO_GTWA_RESP_BUF_SIZE */
char respBuf[CO_GTWA_RESP_BUF_SIZE];
/** Actual size of data in respBuf */
@ -384,7 +384,7 @@ typedef struct {
#endif
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LOG) || defined CO_DOXYGEN
/** Message log buffer of usable size @ref CO_CONFIG_GTWA_LOG_BUF_SIZE */
char logBuf[CO_CONFIG_GTWA_LOG_BUF_SIZE + 1];
uint8_t logBuf[CO_CONFIG_GTWA_LOG_BUF_SIZE + 1];
/** CO_fifo_t object for message log (not pointer) */
CO_fifo_t logFifo;
#endif
@ -486,7 +486,7 @@ static inline size_t CO_GTWA_write(CO_GTWA_t* gtwa,
const char *buf,
size_t count)
{
return CO_fifo_write(&gtwa->commFifo, buf, count, NULL);
return CO_fifo_write(&gtwa->commFifo, (const uint8_t *)buf, count, NULL);
}

View file

@ -40,7 +40,7 @@
*/
static CO_CANinterfaceState_t CO_CANerrorSetListenOnly(
CO_CANinterfaceErrorhandler_t *CANerrorhandler,
unsigned char resetIf)
bool_t resetIf)
{
char command[100];