1
0
Fork 0
Commit graph

792 commits

Author SHA1 Message Date
Olivier Desenfans
07c61316b3 Single project-wide header for driver functions
Created a single header file (`CO_driver.h`) to declare the functions
of the drivers API. This forces drivers to use a common API.

Previously, each driver declared these functions in its specific
`CO_driver.h` file. This causes two issues:
1. while these functions are used in target-independent code,
   the declarations could be target specific, leading to API/ABI
   compatibility issues.
2. the declarations were duplicated for each driver.

The `CO_driver.h` files for each driver were renamed to
`CO_driver_target.h`. This file is included from `CO_driver.h`.

Added a new header for types: `CO_types.h`. This file currently
holds the definition of `CO_ReturnError_t` that was previously
duplicated for all drivers. Added a few enum values to support
the `neuberger-socketCAN` code.
2019-11-13 13:28:21 +01:00
Martin Wagner
10cf9a30b0
Merge pull request #116 from odesenfans/can-base-address-void-ptr
Use a void pointer for the CAN device address
2019-11-13 08:54:34 +01:00
Olivier Desenfans
02fd8ee9da Renaming CANdevicePtr to CANdriverState 2019-11-13 08:34:42 +01:00
Julien PEYREGNE
bba140f943 feat: Add TIME producer and refactor TIME consumer 2019-11-12 12:28:33 +01:00
Olivier Desenfans
eb4293c4e5 Fix inverted 1003 condition 2019-11-12 08:41:08 +01:00
Martin Wagner
2e7e3a4c02
Merge pull request #119 from odesenfans/fix-sync-ptr-to-int-cast-warning
Sync: fix cast to integer of different size

Didn't even know this existed...
2019-11-12 07:56:12 +01:00
Olivier Desenfans
c36d73b590 Fix bool equality checks
Removed comparisons of boolean values to `false` and `true`. Evaluating
them is enough.
2019-11-11 16:36:55 +01:00
Olivier Desenfans
c7349b9dde Sync: fix cast to integer of different size
Cast the pointer to `uintptr_t` instead of `int` in the implementations
of `IS_CANrxNew`.
2019-11-11 16:34:09 +01:00
Olivier Desenfans
e7d9652658 Use a void pointer for the CAN device address
Previously, the address of the CAN device (`CANbaseAddress`)
was specified as a signed or unsigned integer of variable size.
This made the ABI specific for each driver and is not generic
enough for some use cases.

Replaced all usages by using a void pointer instead.
Renamed `CANbaseAddress` to `CANdevicePtr`.
Refactored the code where it needed to be (some comparisons to -1).

Use a pointer to a user-defined variable/structure instead of
a 32-bit integer for CANbaseAddress. Renamed CANbaseAddress
to CANbaseStruct to reflect that change in behavior.

This is more modular and avoids casts.
2019-11-10 13:14:53 +01:00
Martin Wagner
3f1a636453
Merge pull request #112 from trojanobelix/patch-1
Correct handling if there is more than one SDO client configured
2019-10-14 07:34:22 +02:00
trojanobelix
46a78ff308
Update CANopen.c
- correct handling if there is more than one SDO client configured.
2019-10-11 14:34:49 +02:00
Martin Wagner
6ac1c62c34
Merge pull request #106 from vestas-wind-systems/co_trace_format_specifiers
Use inttypes.h for 32 bit signed/unsigned format specifiers.
2019-10-09 17:11:12 +02:00
Martin Wagner
15328bf734
Merge pull request #109 from JuPrgn/FixTypoEMCY
fix: Typo CO_ERR_ERG_TEMPERATUR
2019-10-09 17:08:49 +02:00
JuPrgn
8bd037bb1b
Added TIME protocol (Time stamp) 2019-10-09 17:00:45 +02:00
JuPrgn
afa3a29f13
Fix mistake removed semicolon for dynamic aloc
Fix removed semicolon in CO_memoryUsed initialisation
2019-10-09 15:25:56 +02:00
JuPrgn
84577b72a4
Fix tabs and spaces 2019-10-09 14:56:14 +02:00
Julien PEYREGNE
b411ebb48c fix: Typo CO_ERR_ERG_TEMPERATUR 2019-10-09 14:32:54 +02:00
Julien PEYREGNE
e8262dc88f feat: Add TimeStamp feature 2019-10-09 14:31:26 +02:00
Martin Wagner
e336b3ad26 Changed for two callbacks, as one is called inside ISR context. This also keeps backward compatibility for current useres that don't need RX EMCY events 2019-10-08 10:17:03 +02:00
Martin Wagner
fa5f81e0a9 Merge branch 'master' of https://github.com/wilkinsw/CANopenNode 2019-10-08 10:01:50 +02:00
Martin Wagner
8b01062eb6 Merge branch 'martinwag-neuberger-master' 2019-10-08 08:28:29 +02:00
Martin Wagner
0bd08bef1a
Merge branch 'master' into neuberger-master 2019-10-08 08:25:37 +02:00
Martin Wagner
d200264301 Merge branch 'martinwag-fix-emcy-overflow-clear' 2019-10-08 08:07:33 +02:00
Martin Wagner
8d565f7fbc Merge branch 'fix-emcy-overflow-clear' of https://github.com/martinwag/CANopenNode into martinwag-fix-emcy-overflow-clear 2019-10-08 08:07:26 +02:00
Martin Wagner
8a766530d2 Merge branch 'martinwag-add-errorregister-mnf-bit' 2019-10-08 08:06:47 +02:00
Martin Wagner
8d1955ab6d Merge branch 'add-errorregister-mnf-bit' of https://github.com/martinwag/CANopenNode into martinwag-add-errorregister-mnf-bit 2019-10-08 08:06:21 +02:00
Martin Wagner
6ef8ffcf0f Merge branch 'martinwag-fix-sdo-race-condition' 2019-10-08 08:01:58 +02:00
Martin Wagner
14c2abd582 Merge branch 'fix-sdo-race-condition' of https://github.com/martinwag/CANopenNode into martinwag-fix-sdo-race-condition 2019-10-08 08:01:40 +02:00
Martin Wagner
b06254257e Merge branch 'martinwag-fix-RPDO_CALLS_EXTENSION' 2019-10-08 08:00:01 +02:00
Henrik Brix Andersen
806fa6ead5 Use inttypes.h for 32 bit signed/unsigned format specifiers.
This fixes commit 5338015740.
2019-09-23 10:20:55 +02:00
Martin Wagner
c46a2edd57 Add Linux socketCAN driver for CANopen manager application
This driver is more sophisticated than the normal socketCAN driver. Compared
to the normal socketCAN driver, this one contains the linking exception license.

Changes compared to normal socketCAN driver:
- Re-implementation based on driver template
- Error detection works
- Setting up filters works properly
- Optional Support for socketCAN error frames. This currently handles bus-off
  and no-ack condition by setting driver into listen-only mode. If you decide
  to use this feature have a close look at your own requirements and fit
  error handling functions to that.
- Optional support for CAN interface combining (not redundancy!). With this
  feature enabled you can have multiple CAN interface represented as one within
  CANopenNode stack. By default, all TX messages are sent on all used CAN
  interfaces, but the user can change this behaviour inside own app (e.g. check
  on wich bus rx-sdo is received and set-up tx-sdo accordingly).
  Be aware that no bridging between the interfaces is done!
2019-05-10 09:52:11 +02:00
Martin Wagner
cf02f924ff Fix: Use getter function instead of raw pointer...
see https://github.com/CANopenNode/CANopenNode/issues/100

Using this workaround, the struct passed to the callback still doesn't
match the description (only "data" is passed instead of "data" and
"ODdataStorage"), see CO_ODF_arg_t fields description for details.

However, data pointer is a least valid for all object types.
2019-05-10 09:35:37 +02:00
Martin Wagner
817ddcb786 Revert "nmt: delete double declaration"
This reverts commit 9c7faddd32.
2018-12-14 09:13:26 +01:00
Martin Wagner
691c8095b2 heartbeat consumer: added callback for first received heartbeat
This callback is called when the first heartbeat is received (after BOOTUP)
and when there was a pause between heartbeats (TIMEOUT). This allows
the user to get an event when a bus segment is disconnected and then
reconnected from the server (nodes just start sending heartbeats again
without BOOTUP first).
2018-12-14 09:06:39 +01:00
Martin Wagner
5743e1c998 hb consumer: added query function for current NMT state...
this only works on monitored nodes!
2018-12-14 09:06:16 +01:00
Martin Wagner
9c7faddd32 nmt: delete double declaration 2018-12-14 09:06:07 +01:00
Martin Wagner
54f80b119b LSS slave: LSS startup did not confirm to CiA DSP 305 Figure 47
Added function and changed example code so that NMT boot-up is only started
after receiving LSS switch state global waiting. This also fixes problems
where doing CANopenNode initialization (-> change can HW Filter settings)
lead to missing the LSS switch state global waiting message.

However, now we do not fully comply to the specified sequence in 8.3.1.2
as we do all the startup stuff after switching to LSS waiting. This can't
be split in CANopenNode.
2018-12-14 09:04:49 +01:00
Martin Wagner
8ba7084fb7 fixed null pointer dereference
timerNext_ms is given from user and can be null.
2018-10-09 07:49:03 +02:00
Martin Wagner
ac0b82be35 lss master: Deselect all work in all states and cleans up the master state machine 2018-10-09 07:48:41 +02:00
Martin Wagner
65161afb7f heartbeat consumer: initialization of single consumer is now possible from within code 2018-10-09 07:48:31 +02:00
Martin Wagner
1a85de0bec hearbeat consumer: bootup callback was only called when a heartbeat was received before 2018-10-01 15:13:41 +02:00
Martin Wagner
37c2c4230a sdo master: callback for local OD is not triggered by message rx, so trigger it manually 2018-10-01 15:13:33 +02:00
Martin Wagner
13068f6e44 fixed uninitialized variable 2018-10-01 15:13:15 +02:00
Martin Wagner
cf8d0978c9 sdo: added out-of-bound check to getDataPointer 2018-10-01 15:13:05 +02:00
Martin Wagner
11ef04f828 sdo master: fix missing break, fix typo...
no functional changes
2018-09-13 09:13:13 +02:00
Martin Wagner
94b3eac941 sdo client: use SDO client parameter default entries as start values
to keep current behaviour (auto configuration), just set the default values to "0"
2018-09-13 09:12:48 +02:00
Martin Wagner
5601770589 Changed sdo client to support multiple sdo servers.
for existing code, you need to add "[0]" to the sdo function parameter CO->SDOclient (so you get CO->SDOclient[0]).
2018-09-13 09:12:21 +02:00
Martin Wagner
0860923e9c Revert "Fix switch case fallthrough warnings"
this commit breaks TPDO generation

This reverts commit c236b455d1.
2018-09-10 14:30:00 +02:00
Martin Wagner
7b8756fcc5 heartbeat consumer: added callback functions for each consumer...
example usage: ASCII heartbeat consumer/event protocol
2018-09-10 14:29:52 +02:00
Martin Wagner
36ca8ae0a8 heartbeat consumer: added query functions, fixed emergencies...
HB emergency was only set but never cleared, so only the first error ever
was reported. We now get an emergency when the first node is missing and
a clear emergency when the last node turns up again.
The same applies for HB Remote Reset, however while clearing this emergency
is required by the CO_Emergency module, it's not required for the network.
2018-09-10 14:29:42 +02:00