1
0
Fork 0
Commit graph

47 commits

Author SHA1 Message Date
Janez
d4b78771b3 socketCAN: Add CO_CANptrSocketCan_t object for "CANptr" argument for CO_CANmodule_init() function 2020-09-23 08:32:30 +02:00
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
3fb0a3ee09 Fix compile error with older kernels #211 2020-08-03 07:48:40 +02:00
Janez
ca452c47cc CO_driver interface: remove Emergency object dependency for reporting CAN
errors, use CANerrorStatus own variable instead. Emergency object updated.
2020-06-13 14:06:35 +02:00
Janez
dd1677b5bc Integrate LSS slave into CANopenNode more directly.
- CO_LSSslave: move expensive code from CAN receive (interrupt) to mainline
  CO_LSSslave_process() function.
- LSS slave now runs in parallel to other CANopen objects.
- LSS slave and master can run both on same device.
- LSS slave, LSS master and gateway-ascii(CiA309) LSS functions tested.
- LSSusage.md updated.
2020-06-09 14:55:07 +02:00
Janez
bd3326fed9 Make own file for CANopen status LED diodesLED indicator indication
(CiA303-3) moved from NMT into own files. Now fully comply to standard.
2020-06-05 18:02:26 +02:00
Janez
ae220f9115 Configuration for LSS updated. 2020-05-29 09:56:05 +02:00
Janez
cb9b2cce42 Add printout of message log from CANopen gateway-ascii (non-standard). 2020-05-29 07:36:23 +02:00
Janez
f41069561a Make SDO client and NMT master optional in gateway_ascii 2020-05-28 16:40:21 +02:00
Janez
c1a30b8a03 Some style corrections
- add CO_fifo_st enumerator for use in CO_fifo_cpyTok2xx functions.
- 309/CO_gateway_ascii: add x8 to x64 nonstandard data types
- example compiles now
- Fix "unused argument" warnings in socketCAN
2020-05-15 15:52:22 +02:00
Janez
b5bfeec42a Added CANopen gateway-ascii command interface according to CiA309-3 as a
microcontroller independent module.
It includes NMT master, LSS master and SDO client interface.
Interface is non-blocking, it is added to mainline.
Example for Linux stdio and socket is included.

Added CO_fifo.h/c for fifo data buffer, used with rewritten SDO client, etc

SDO client is rewritten. Now includes r/w fifo interface to transfer data.

doc/gettingStarted.md is updated.
2020-05-12 18:11:43 +02:00
Janez
d9c16ae763
Merge pull request #183 from DISTORTEC/even-moar-callbacks
Add CO_TIME_initCallbackPre(), convert {T,R}PDO_CALLS_EXTENSION to config options
2020-05-12 17:30:59 +02:00
Freddie Chopin
b4b0fe069f Convert {T,R}PDO_CALLS_EXTENSION to CO_CONFIG_{T,R}PDO_CALLS_EXTENSION
User can now enable extension callbacks in RPDO/TPDO handling paths
simply by configuration flags instead of modifying sources or by passing
the defines directly to the compiler.
2020-05-06 18:22:50 +02:00
Freddie Chopin
9b8a296fb7 Add CO_TIME_initCallbackPre() for received TIME messages
This optional mechanism allows to immediatelly wake the thread that
processes TIME, without waiting for its next tick.
2020-05-06 18:08:45 +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
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
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
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
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
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
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
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
d40c1e1c96 Manual merge from updates in master branch - socketCAN 2020-02-28 10:08:11 +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
Janez
c40130b70e socketCAN: add Makefile and do basic changes 2020-02-26 13:04:25 +01:00
Janez
a513d84e45 Move Makefile into example/
Renamed to example/CO_driver_blank.c and example/main_blank.c
Copied socketCAN/main.c from CANopenSocket project.
2020-02-26 13:01:53 +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
Janez
4495e32fe8 Rename macros CO_CANrxNew_* into CO_FLAG_* 2020-02-04 20:39:10 +01:00
Janez
c19879b659 Time base CHANGED TO MICROSECONDS in all objects. FIX OS!
- Necessary to update Time base in OS too - call to CO_process() function.
- timerNext_us info to OS implemented in in all objects.
- CO_NMT_blinkingProcess50ms() moved inside CO_NMT_process().
- CO_HBconsumer_process() function optimized and revised.
- Bugfix "timeDifference_us = 0;" inside the for loop.
2020-02-04 20:28:33 +01:00
Janez
d50e50e2c6 socketCAN related updates
- move stack/socketCAN/CO_OD_storage.* in socketCAN/CO_OD_storage.*
- CO_CANrxNew_ macros updated
- some corrections
2020-01-25 12:57:17 +01:00
Janez
23a37f0d92 New socketCAN/CO_driver_target.h
- Reduce CO_driver.h and CO_driver_base.h into CO_driver_target.h
- New functions: CO_CANrxMsg_readIdent, _DLC, _data
- rxArray[i].pFunct  changed to   -> rxArray[i].CANrx_callback
- (*pFunct)(void *object, const CO_CANrxMsg_t *message))  changed to
  (*CANrx_callback)(void *object, void *message))
- change to '#define CO_CANrxNew_READ(rxNew) ((bool_t)rxNew)'
2020-01-24 14:59:45 +01:00
Janez
fdda4c8340 move stack/neuberger-socketCAN/ socketCAN
Compare with initial commit of neuberger-socketCAN.
Try to use original code.
2020-01-24 12:22:54 +01:00