Add more data types which may have flexible length

Change-Id: Ia78d89adfb4017e970ace7fdf0b1bccffc8ac357
pull/89/head
Lars Danielsson 2020-09-23 13:24:11 +02:00
parent a6f45c308f
commit 74d710b8b7
2 changed files with 11 additions and 2 deletions

View File

@ -776,7 +776,8 @@ static void SDO_download (void)
if (actsize != size)
{
/* entries with data types VISIBLE_STRING, OCTET_STRING,
* and UNICODE_STRING may have flexible length
* UNICODE_STRING, ARRAY_OF_INT, ARRAY_OF_SINT,
* ARRAY_OF_DINT, and ARRAY_OF_UDINT may have flexible length
*/
uint16_t type = (objd + nsub)->datatype;
if (type == DTYPE_VISIBLE_STRING)
@ -785,7 +786,11 @@ static void SDO_download (void)
memset((objd + nsub)->data + size, 0, actsize - size);
}
else if ((type != DTYPE_OCTET_STRING) &&
(type != DTYPE_UNICODE_STRING))
(type != DTYPE_UNICODE_STRING) &&
(type != DTYPE_ARRAY_OF_INT) &&
(type != DTYPE_ARRAY_OF_SINT) &&
(type != DTYPE_ARRAY_OF_DINT) &&
(type != DTYPE_ARRAY_OF_UDINT))
{
set_state_idle (index, subindex, ABORT_TYPEMISMATCH);
return;

View File

@ -83,6 +83,10 @@ typedef struct
#define DTYPE_BIT6 0x0035
#define DTYPE_BIT7 0x0036
#define DTYPE_BIT8 0x0037
#define DTYPE_ARRAY_OF_INT 0x0260
#define DTYPE_ARRAY_OF_SINT 0x0261
#define DTYPE_ARRAY_OF_DINT 0x0262
#define DTYPE_ARRAY_OF_UDINT 0x0263
#define ATYPE_Rpre 0x01
#define ATYPE_Rsafe 0x02