1
0
Fork 0
Commit graph

21 commits

Author SHA1 Message Date
Janez
a528eb1669 Better organised configuration macros (CO_config.h):
- rearranged and better documented
 - default values moved from CO_driver.h into appropriate files
 - rearranged also in CO_driver_target.h files
 - parts of the stack or whole objects can be disabled.
 - configuration is verified for depencies

Additional:
 - renamed some members of CO_Default_CAN_ID_t
 - moved helpers CO_setUint32() etc from CO_SDOserver.h into CO_driver.h.
 - change wrong CO_ERROR_PARAMETERS to CO_ERROR_ILLEGAL_ARGUMENT.
 - renamed CO_ERROR_PARAMETERS to CO_ERROR_OD_PARAMETERS
2020-09-14 15:50:21 +02:00
Janez
f68e9dade7 Fix previous commit 2020-07-14 16:28:32 +02:00
Janez
1f92aee85a SDO: fix broken block download #210
by lukegluke, same as commit in v1.3-master
2020-07-13 15:12:40 +02:00
Janez
035da160b5 SDO: fix to always check if buffer is empty before freeing it #204
Before this patch SDO queue process pointer could overrun receive pointer on receiving NMT stop command during active SDO communication.
This fix is applied to 'master' and 'v1.3-master' branches.
2020-07-01 09:44:18 +02:00
Freddie Chopin
7c13199a1a Fix all possible warnings about unused timerNext_us argument 2020-06-26 11:56:46 +02:00
Janez
e1c7e2dbfa Add fifo queue for SDO received messages to fix possible drops
Same as pr #174 in v1.3-master
2020-06-11 10:33:03 +02:00
Paolo Teti
6551233406
GCC 10: Fix dereference of NULL warning (#191)
GCC 10 static analyzer (-fanalyzer) warn about possible dereference
of NULL ‘ext’ on 'ext->pODFunc'.

This patch adds a guard on 'ext' to fix the issue.
2020-06-09 17:11:09 +02:00
Paolo Teti
6c16680d02
Use memcpy() and memset() where possible (#188)
* LLSMaster: replace explicit array element copy with memcpy()

Replace explicit array element copy with memcpy()

Signed-off-by: Paolo Teti <paolo.teti@gmail.com>

* SDO server: copy and zeroize arrays using memcpy() and memset()

* Replace array elements copy with memcpy().
* Clear response buffer using memset()

Signed-off-by: Paolo Teti <paolo.teti@gmail.com>
2020-05-27 13:42:50 +02:00
Freddie Chopin
0048cb52c7
Fix pointer bug in CO_OD_getFlagsPointer() (#181)
Function did not check whether the object had any flags assigned. It
makes no difference for objects with no subindexes, because then the
function will return NULL anyway. But is subIndex argument is not zero,
then the function calculates addresses of flags as offsets from NULL.
For example, for an object with no flags assigned, when subIndex == 5,
the function would return 5 as the address instead of the expected NULL.
2020-05-12 17:24:06 +02:00
Freddie Chopin
4c3011d34a
Replace all memcpy/memset-like functions with standard <string.h> functions (#175)
* Use standard memcpy() instead of CO_memcpy()

* Remove CO_memcpy()

* Use standard memset() instead of CO_memset()

* Remove CO_memset()

* Move helper functions from CO_SDOserver.c to header and make them inline

* Implement CO_getUint16() with memcpy()

* Implement CO_getUint32() with memcpy()

* Implement CO_setUint16() with memcpy()

* Implement CO_setUint32() with memcpy()

* Define memcpy() as CO_memcpySwapX() for little-endian systems

* Fix several writes past the buffer due to hardcoded sizes

Use more "generic" sizes (via sizeof()) instead of hardcoded number in
all calls to memset() to avoid 1-byte errors which result in writes past
the buffer, for example:

memset(&LSSslave->TXbuff->data[5], 0, 4);
in CO_LSSslave_serviceInquire()

memset(&LSSmaster->TXbuff->data[6], 0, 3);
in CO_LSSmaster_switchStateSelectInitiate()

* Use "generic" size in calls to memcpy() where possible

* Remove CO_bytes_t

This type was used only for CO_{get,set}Uint{16,32}().
2020-05-04 11:22:32 +02:00
Janez
5bb2d16323 fix SDO block download process continuity after sequence breaks
This is the same as pull request #171, but applied to split-driver branch.
Original author: Oleg <ev.mipt@gmail.com>

Now additional state CO_SDO_ST_DOWNLOAD_BL_SUB_RESP_2 is used to send response without resetting SDO sequence.
Refactoring timeout halding logic in sub-block transfer.
Also add missed unsigned indicators for several constants.

issue #170
2020-04-07 09:41:00 +02:00
Janez
6e28914ca9 Make calculation of timerNext_us optional. 2020-03-20 16:44:37 +01:00
Janez
c88194e813 Add Stack configuration macros to most of CANopenNode objects.
Add CO_NMT_initCallbackPre()
2020-03-19 18:07:23 +01:00
Janez
d9c44c69d1 Change non-descriptive CO_***_initCallback() into CO_***_initCallbackPre().
Change CO_NMT_initCallback() into CO_NMT_initCallbackChange().
Change type of NMT->operatingState from uint8_t into enum CO_NMT_internalState_t.
2020-03-18 23:19:29 +01:00
Janez
0b2476ec95 Fix timeout and "timerNext_us" in SDO server and client. 2020-03-18 10:12:53 +01:00
Janez
2f204a0c71 Verify return value from CO_CANrxBufferInit() and CO_CANtxBufferInit(). 2020-03-12 12:18:05 +01:00
Janez
02e2cc5860 Stack configuration added do CO_driver.h
Change macro CO_USE_LEDS -> CO_CONFIG_NMT_LEDS 1
Change macro CO_SDO_BUFFER_SIZE -> CO_CONFIG_SDO_BUFFER_SIZE
2020-03-07 16:26:52 +01:00
Janez
3fc79b807e Remove pFunctSignal from mainline processing functions. Use timerNext_us.
Interface to CO_SDOclientDownloadInitiate and CO_SDOclientUploadInitiate
changed (added optional *timerNext_us argument). Little corrections in
documentation for CO_SDOclient.h
2020-03-07 13:32:14 +01:00
Janez
78487ba89f Clarify EM, SDOserver, SDOclient and LSSmaster callback functions.
callback functions called also from SDO_blockTransferInProgress.
Clarify timerNext_us parameter to CO_process() function.
2020-02-27 16:43:27 +01:00
Janez
8fb48173c6 Add CO_CANopenInitCallback() into CANopen.h/.c.
Change CO_*_initCallback() functions - add 'void *object' argument.
2020-02-27 13:09:48 +01:00
Janez
62ffc7c9f5 Drivers removed from stack, directory structure rearranged.
- Change log added to README.
- Doxygen documentation updated.
2020-02-05 10:52:56 +01:00
Renamed from stack/CO_SDO.c (Browse further)