1
0
Fork 0
Commit graph

461 commits

Author SHA1 Message Date
Freddie Chopin
495f827d37 Fix minor typo/edit mistakes in CHANGELOG.md and CO_config.h 2020-05-06 18:00:28 +02:00
Freddie Chopin
e88ecb894e Fix "unused parameter" warnings
Some functions have a signature required by API, thus they have
arguments which will be unused. Fix by casting to void.
2020-05-06 16:31:36 +02:00
Freddie Chopin
466bf0ffb7 Fix "comparison of integer expressions of different signedness" warning
With -Wextra GCC gives:

socketCAN/CO_driver.c: In function ‘setRxFilters’:
socketCAN/CO_driver.c:159:19: warning: comparison of integer expressions
of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’}
[-Wsign-compare]
  159 |     for (i = 0; i < CANmodule->CANinterfaceCount; i ++) {
      |                   ^
2020-05-06 16:31:36 +02:00
Freddie Chopin
aa6075b3c8
Add CO_..._initCallbackPre() for RPDO and SYNC (#178)
* Merge two parts of CO_PDO_receive() into single common code

* Add CO_RPDO_initCallbackPre() for received RPDO messages

This optional mechanism allows to immediatelly wake the thread that
processes RPDO, without waiting for its next tick.

* Add CO_SYNC_initCallbackPre() for received SYNC messages

This optional mechanism allows to immediatelly wake the thread that
processes SYNC, without waiting for its next tick.
2020-05-05 13:23:26 +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
5a2a1e85cf Update configuration macros. SDO state machine preview. 2020-04-29 13:12:07 +02:00
Janez
6c24ecfcec Globals alternative to heap now possible from CANopen.c 2020-04-29 13:08:40 +02:00
Janez
06e6f343c9 Update changelog 2020-04-27 12:18:47 +02:00
Janez
417fe97510 Merge branch 'master' into split-driver 2020-04-27 11:50:16 +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
43f86073ee Minor corrections in documentation. 2020-04-03 11:43:14 +02:00
Janez
ffd5027cb2 Make SYNC optional in TPDO and RPDO. 2020-03-20 18:47:16 +01:00
Janez
6e28914ca9 Make calculation of timerNext_us optional. 2020-03-20 16:44:37 +01:00
Janez
3fd799f919 Heartbeat is send immediately after NMT state changes. 2020-03-19 18:59:58 +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
b8e821d0dd Add CO_NMT_UNKNOWN state for Heartbeat consumer. 2020-03-18 21:46:34 +01:00
Janez
794c0f903a Added file CO_config.h for stack configuration. Added CO_HBconsumer_initCallback() 2020-03-18 21:06:15 +01:00
Janez
0b2476ec95 Fix timeout and "timerNext_us" in SDO server and client. 2020-03-18 10:12:53 +01:00
Janez
9f8e726e7e SocketCAN, CO_driver.c: replace CO_notifyPype with simpler eventfd(). 2020-03-17 17:39:22 +01:00
Janez
0ee8acaa67 Unify indentation in three files. 2020-03-16 15:30:19 +01:00
Janez
41c075a182 SocketCAN main.c: Add NMT changes of current and remote nodes into log. 2020-03-13 16:14:50 +01:00
Janez
18bc8d4313 HBconsumer: add CO_HBconsumer_initCallbackNmtChanged(), callbaks optional
- Make HBconsumer callbacks optional via CO_CONFIG_HB_CONS_CALLBACKS
  definition.
- Add additional callback CO_HBconsumer_initCallbackNmtChanged()
2020-03-13 16:05:27 +01:00
Oleg
b92b4bb5b1
fix SDO block download process continuity after sequence breaks (#171)
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-03-13 09:29:25 +01:00
Janez
1ce3732e60 SocketCAN: change CO_DRIVER_MULTI_INTERFACE and CO_DRIVER_ERROR_REPORTING
- Replace macro USE_EMERGENCY_OBJECT with CO_DRIVER_USE_EMERGENCY 1
- Now define sets macro to 0 or 1. It is easier to set custom value.
2020-03-12 16:20:40 +01:00
Janez
2f204a0c71 Verify return value from CO_CANrxBufferInit() and CO_CANtxBufferInit(). 2020-03-12 12:18:05 +01:00
Janez
1624b7443d Ignore sync message in Emergency receive function CO_EM_receive(). 2020-03-12 10:42:19 +01:00
Janez
e6b4c1f5b1 socketCAN now compiles and runs. 2020-03-12 08:38:58 +01:00
Janez
fb2274fc9f socketCAN driver, CO_CANrxBufferInit(): remove check COB ID already used.
If two or more CANrx buffers have the same _ident_, then buffer with
lowest _index_ has precedence and other CANrx buffers will be ignored.
2020-03-11 17:48:48 +01:00
Janez
42f2554f2f Add emergency receive callback also for own emergency messages. 2020-03-11 17:44:33 +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
b49907f133 Update docs 2020-03-06 11:34:30 +01:00
Janez
a98492ecaf Add heapMemoryUsed info from CO_new() 2020-03-06 11:33:25 +01:00
Janez
02a734a832 Move socketCAN/Makefile into base directory
Partially update sockeCAN/main.c and rename to sockeCAN/CO_main_basic.c.
Fix some warnings in socketCAN.
2020-03-02 09:17:52 +01:00
Janez
9d17b0d671 socketCAN driver:
- Always enable CANptr and timestamp info in CO_CANrx_t.
- Update documentation
2020-02-29 22:34:48 +01:00
Janez
f21cde9ab0 doxygen socketCAN + some simplifications. 2020-02-28 16:37:41 +01:00
Janez
d52229917b Merge branch 'master' into split-driver 2020-02-28 16:02:55 +01:00
Janez
d40c1e1c96 Manual merge from updates in master branch - socketCAN 2020-02-28 10:08:11 +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
Martin Wagner
03613cc8a1 neuberger-socketcan: fix invalid memory access
store name string by copy, not by reference as source can be moved
2020-02-27 16:06:11 +01:00
Martin Wagner
85a31861c5 neuberger-socketcan: add comment to init function
the init function needs the interface index, not a pointer.
Alternative: use proper init struct.
2020-02-27 16:06:06 +01:00
Martin Wagner
dc02ad8310 neuberger-socketcan: fix error from c36d73b5
that's why I don't like to change this stuff.
2020-02-27 16:06:00 +01:00
Janez
3fc564b72f Remove CO_CANopenInitCallback() from CANopen.h/.c (revert) 2020-02-27 15:25:59 +01:00
Janez
22e66b7bb4 socketCAN/CO_Linux_threads
- CANrx_threadTmr_init(uint16_t interval_in_milliseconds
          (changed to) uint32_t interval_in_microseconds)
- other timing updated
2020-02-27 13:28:23 +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
Martin Wagner
bf91f41f38 neuberger-socketcan: add logging stuff 2020-02-27 12:50:51 +01:00
Martin Wagner
8d5ecac9d4 neuberger-socketcan: Fix sync compilation 2020-02-27 12:50:47 +01:00
Martin Wagner
1052aac684 neuberger-socketcan: fix driver
fix errors introduced within the last few commits:
    - data type mismatch
    - wrong return value
    - change handle to void pointer - added "const"
2020-02-27 12:50:42 +01:00
Janez
c40130b70e socketCAN: add Makefile and do basic changes 2020-02-26 13:04:25 +01:00