summaryrefslogtreecommitdiffstats
path: root/bsps/shared/grlib/can/grcan.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2022-11-14bsps/shared/grlib: Change license to BSD-2 for files with Gaisler copyrightDaniel Cederman1-3/+22
This patch changes the license to BSD-2 for all source files where the copyright is held by Aeroflex Gaisler, Cobham Gaisler, or Gaisler Research. Some files also includes copyright right statements from OAR and/or embedded Brains in addition to Gaisler. Updates #3053.
2021-03-11leon,grcan: split out GRCAN non-FD specific support in separate fileDaniel Hellstrom1-405/+0
Close #4324.
2021-03-11leon,grcanfd: split out GRCANFD specific support in separate fileDaniel Hellstrom1-627/+11
Update #4324.
2021-03-11leon,grcan: added support for GRCANFDDaniel Hellstrom1-16/+568
The new GRCAN_FD IP supports CAN FD standard and is mostly backwards compatible with GRCAN SW interface. The GRCAN driver have been extended to support the GRCANFD IP using the same driver. Additional functions have been added that uses a new CAN FD frame format and read/write/baud-rate functions that supports both GRCANFD and GRCAN. To keep the SW API fully backwards compatible with GRCAN, the old functions remain. Update #4324.
2021-03-11leon,grcan: use common CAN baud-rate calculation routineDaniel Hellstrom1-114/+20
Update #4323.
2021-03-05grcan.c: Fix Unused value (CID #1437613)Ryan Long1-1/+1
CID 1437613: Unused value in grcan_set_filter(). This fix was recommended by Daniel Hellstrom (daniel@gaisler.com). Closes #4301
2019-01-22grlib: use cpu-independent routines for uncached accessJiri Gaisler1-24/+3
Update #3678.
2019-01-22grlib: Move source filesSebastian Huber1-0/+0
Update #3678.
2019-01-22grlib: Move header filesSebastian Huber1-5/+5
Update #3678.
2018-12-21bsps/sparc: Add grlib_malloc(), grlib_calloc()Sebastian Huber1-4/+3
This avoids a dependency to errno in device driver code.
2018-11-27bsps/sparc: Add and use <grlib_impl.h>Sebastian Huber1-25/+1
Reduce copy and paste.
2018-04-20bsps/sparc: Move shared files to bspsSebastian Huber1-0/+0
This patch is a part of the BSP source reorganization. Update #3285.
2017-05-14leon, grcan: removed unused txerror, rxerrorMartin Aberg1-13/+0
2017-05-14leon, grcan: fixed historical commentMartin Aberg1-4/+3
2017-05-14leon, grcan: semaphore reset count required after flushingDaniel Hellstrom1-30/+32
It is also required to use semaphore release instead of flush when stopping or on BUSOFF/AHBERR condition. Otherwise a task just about to wait (taking the semaphore) could end up locked because the semaphore count is still the same. There was previously a scenario where the semaphore flush would not always make semaphore obtain to return in case of BUSOFF, AHBERROR or grcan_stop. It has to do with the rtems_semaphore_flush() not releasing the semaphore but just aborts any _current_ waiter.
2017-05-14leon, grcan: split hw_stop() into hw and sw stopDaniel Hellstrom1-0/+13
this is to avoid owning the spin-lock during semaphore operations.
2017-05-14leon, grcan: RTEMS_NO_TIMEOUT on tx_semMartin Aberg1-1/+1
2017-05-14leon, grcan: redesigned bus-off and AHB error handlingMartin Aberg1-139/+269
When bus-off condition is detected by the ISR, it sets the started flag to STATE_BUSOFF. This is monitored by the user functions grcan_read() and grcan_write() each time they want to enable DMA or update interrupt mask. If they detect that ISR has detected bus-off then they will return either with an error or with the number of CAN messages processed. Future calls to functions which require STARTED mode will be rejected and grcan_isstarted() will return 0. The next call to grcan_stop() will do the transition from BUSOFF->STOPPED and the device can then be started again with grcan_start(). Similar to a bus-off condition, the AHB error condition detected by the ISR will trigger the same shut-down logic of the driver. The difference is that the state entered is STATE_AHBERR and the routines will return a different value to indicate AHB error state. This commit also fixes an issue where ISR was not always unregistered on close. User functions can cause these transitions: STATE_STOPPED -> STATE_STARTED (grcan_start) STATE_STARTED -> STATE_STOPPED (grcan_stop) STATE_BUSOFF -> STATE_STOPPED (grcan_stop, grcan_close) STATE_AHBERR -> STATE_STOPPED (grcan_stop, grcan_close) ISR can cause these transition STATE_STARTED -> STATE_BUSOFF (grcan_interrupt) STATE_STARTED -> STATE_AHBERR (grcan_interrupt) STATE_BUSOFF/AHBERR is entered from ISR on bus-off condition. At transition the ISR disables DMA, masks all interrupts and flushes semaphores. Other related updates: * Statistics are updated from the ISR. Update is now spin-locked to ensure a consistent user view. * The debug output has been updated to include state changes. * For read/write/flush, return error (-4) if driver aborted the operation due to bus-off. Likewise if abourted due to AHB error -5 is returned. * Collect bus-off statistics Related to the new BUSOFF and AHBERR states the API has been updated to reflect the current SW driver state. The isstarted() function has been replaced with get_state().
2017-05-14leon, grcan: updated device name and use it for ISRDaniel Hellstrom1-3/+25
2017-05-14leon, grcan: fixed race on interrupt mask registerMartin Aberg1-0/+14
There was a potential read-modify-write race on the interrupt mask (imr) register between the ISR and user functions.
2017-05-14leon, grcan: unregister interrupt handler at closeMartin Aberg1-1/+5
2017-05-14leon, grcan: protect statistics on copy to userMartin Aberg1-0/+3
Locking the stats structure when copying to user buffer ensures a consistent view to the user.
2017-05-14leon, grcan: use RTEMS 4.12 SMP interrupt lockMartin Aberg1-27/+44
2017-05-14leon, grcan: consistent indentationMartin Aberg1-582/+580
This commit does not contain any change of functionality.
2017-05-14leon, grcan: function based user interfaceMartin Aberg1-334/+327
This commit preserves all driver services, using a function based user interface instead of the I/O interface. The messages count parameter is now number of CAN messages instead of number of bytes.
2015-10-26basdefs.h: Add and use RTEMS_UNUSEDSebastian Huber1-1/+1
2015-04-17DRVMGR: KEY_TYPE now a enum drvmgr_ktDaniel Hellstrom1-4/+4
2015-04-17LEON: move driver headers to bsp/ directoryDaniel Hellstrom1-2/+2
2015-04-17LEON: updated shared drivers to Driver Manger frameworkDaniel Hellstrom1-875/+872
Some bugfixes at the same time. After this patch the drivers may be used on RASTA systems having a big-endian PCI layout. Removed not up to date changelogs, rely on git log instead.
2014-10-19sparc/shared: Fix warningsJoel Sherrill1-2/+5
2014-03-21Change all references of rtems.com to rtems.org.Chris Johns1-1/+1
2013-09-22sparc/.../grcan.c: Switch to using RTEMS_COMPILER_UNUSED_ATTRIBUTEJoel Sherrill1-8/+6
2013-09-21sparc/.../grcan.c: Fix multiple warningsJoel Sherrill1-2/+8
2012-05-16LEON: moved register definitions into grlib header fileDaniel Hellstrom1-2/+3
Some register layout definitions for LEON3 reside in ambapp.h which does not really has anything to do with device registers. The register structures has been incorrectly named LEON3_*, the cores are not only used on LEON3 but on LEON4 and perhaps on LEON5 when that day comes. Some structures has been renamed according to the GRLIB core name instead, which CPU that actually use it is not relevant. Drivers has been updated with the new names. Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
2012-04-17LEON: updated drivers to use new AMBAPP LayerDaniel Hellstrom1-8/+10
The drivers are updated to use the new AMBA layer, however the backwards-compatibility interface (ambapp_old) is used. Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
2011-02-112011-02-11 Ralf Corsépius <ralf.corsepius@rtems.org>Ralf Corsepius1-2/+2
* shared/1553/b1553brm.c, shared/can/grcan.c, shared/can/occan.c, shared/spw/grspw.c, shared/uart/apbuart.c: Use "__asm__" instead of "asm" for improved c99-compliance.
2009-11-29Whitespace removal.Ralf Corsepius1-246/+246
2007-11-302007-11-30 Daniel Hellstrom <daniel@gaisler.com>Joel Sherrill1-37/+166
* shared/can/grcan.c, shared/can/grcan_rasta.c, shared/include/ambapp.h: GRCAN CAN driver. Fixes Interrupt enabling/disabling in the driver, interrupt may not be restored correctly. Implements the baud rate calculation routine. Removed unnecessary printk. Fixed scanning to support GRCAN and GRHCAN hardware. Added GRCAN device number to ambapp.h.
2007-09-182007-09-18 Joel Sherrill <joel.sherrill@OARcorp.com>Joel Sherrill1-1/+0
* shared/1553/b1553brm.c, shared/can/grcan.c: Remove include of sched.h
2007-09-122007-09-12 Daniel Hellstrom <daniel@gaisler.com>Joel Sherrill1-23/+0
* shared/can/grcan.c, shared/include/debug_defs.h, shared/spw/grspw.c: Remove use of DEBUG_printf.
2007-09-072007-09-07 Daniel Hellstrom <daniel@gaisler.com>Joel Sherrill1-1/+2
* shared/1553/b1553brm.c, shared/can/grcan.c, shared/can/grcan_rasta.c, shared/can/occan.c, shared/spw/grspw.c, shared/spw/grspw_pci.c, shared/uart/apbuart.c: Remove warnings.
2007-09-062007-09-06 Daniel Hellstrom <daniel@gaisler.com>Joel Sherrill1-0/+1706
New drivers: PCI, b1553BRM, SpaceWire(GRSPW), CAN (GRCAN,OC_CAN), Raw UART. * shared/1553/b1553brm.c, shared/1553/b1553brm_pci.c, shared/1553/b1553brm_rasta.c, shared/can/grcan.c, shared/can/grcan_rasta.c, shared/can/occan.c, shared/can/occan_pci.c, shared/spw/grspw.c, shared/spw/grspw_pci.c, shared/spw/grspw_rasta.c, shared/uart/apbuart.c, shared/uart/apbuart_pci.c, shared/uart/apbuart_rasta.c: New files missed in previous commit.