Hilscher netX microcontroller driver  V0.0.5.0
Documentation of the netX driver package
netx_drv_canctrl.h File Reference

Header file of CAN controller module. More...

#include "netx_drv.h"
#include <stdint.h>
#include <stdbool.h>
Include dependency graph for netx_drv_canctrl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  DRV_CANCTRL_SINGLEFILTER_T
 
struct  DRV_CANCTRL_DUALFILTER_T
 
struct  DRV_CANCTRL_MESSAGE_T
 

Macros

#define DRV_CANCTRL_BAUDRATE_1000K   1000
 
#define DRV_CANCTRL_BAUDRATE_800K   800
 
#define DRV_CANCTRL_BAUDRATE_500K   500
 
#define DRV_CANCTRL_BAUDRATE_250K   250
 
#define DRV_CANCTRL_BAUDRATE_125K   125
 
#define DRV_CANCTRL_BAUDRATE_50K   50
 
#define DRV_CANCTRL_BAUDRATE_20K   20
 
#define DRV_CANCTRL_BAUDRATE_10K   10
 
#define DRV_CANCTRL_OVERSAMPLING_EN   1
 
#define DRV_CANCTRL_OVERSAMPLING_DIS   0
 
#define DRV_CANCTRL_MSK_IRQ_EN_RX_IRQ_EN   0x00000001U
 
#define DRV_CANCTRL_MSK_IRQ_EN_TX_IRQ_EN   0x00000002U
 
#define DRV_CANCTRL_MSK_IRQ_EN_WARNING_IRQ_EN   0x00000004U
 
#define DRV_CANCTRL_MSK_IRQ_EN_OVERRUN_IRQ_EN   0x00000008U
 
#define DRV_CANCTRL_MSK_IRQ_EN_ERR_PASSIVE_IRQ_EN   0x00000020U
 
#define DRV_CANCTRL_MSK_IRQ_EN_ARB_LOST_IRQ_EN   0x00000040U
 
#define DRV_CANCTRL_MSK_IRQ_EN_BUS_ERROR_IRQ_EN   0x00000080U
 
#define DRV_CANCTRL_MSK_IRQ_RX_IRQ   0x00000001U
 
#define DRV_CANCTRL_MSK_IRQ_TX_IRQ   0x00000002U
 
#define DRV_CANCTRL_MSK_IRQ_WARNING_IRQ   0x00000004U
 
#define DRV_CANCTRL_MSK_IRQ_OVERRUN_IRQ   0x00000008U
 
#define DRV_CANCTRL_MSK_IRQ_ERR_PASSIVE_IRQ   0x00000020U
 
#define DRV_CANCTRL_MSK_IRQ_ARB_LOST_IRQ   0x00000040U
 
#define DRV_CANCTRL_MSK_IRQ_BUS_ERROR_IRQ   0x00000080U
 
#define DRV_CANCTRL_MSK_MODE_RESET_MODE   0x00000001U
 
#define DRV_CANCTRL_MSK_MODE_LISTEN_MODE   0x00000002U
 
#define DRV_CANCTRL_MSK_MODE_SELFTEST   0x00000004U
 
#define DRV_CANCTRL_MSK_MODE_ACCEPTANCE_MODE   0x00000008U
 
#define DRV_CANCTRL_MSK_STATUS_RX_BUF_STATUS   0x00000001U
 
#define DRV_CANCTRL_MSK_STATUS_OVERRUN   0x00000002U
 
#define DRV_CANCTRL_MSK_STATUS_TX_BUF_STATUS   0x00000004U
 
#define DRV_CANCTRL_MSK_STATUS_TX_COMPLETE   0x00000008U
 
#define DRV_CANCTRL_MSK_STATUS_RX_STATUS   0x00000010U
 
#define DRV_CANCTRL_MSK_STATUS_TX_STATUS   0x00000020U
 
#define DRV_CANCTRL_MSK_STATUS_ERROR_STATUS   0x00000040U
 
#define DRV_CANCTRL_MSK_STATUS_BUS_STATUS   0x00000080U
 
#define HALDEC(name)   DRV_##name
 

Enumerations

enum  DRV_CANCTRL_RESULT {
  DRV_CANCTRL_RESULT_OKAY = 0,
  DRV_CANCTRL_RESULT_INVAL_PARAM,
  DRV_CANCTRL_RESULT_NO_MESSAGE_AVAILABLE,
  DRV_CANCTRL_RESULT_MESSAGE_DROPPED,
  DRV_CANCTRL_RESULT_TX_BUFFER_NOT_FREE,
  DRV_CANCTRL_RESULT_WRONG_MODE
}
 
enum  DRV_CANCTRL_PRM_E {
  DRV_CANCTRL_PRM_IRQEN = 0,
  DRV_CANCTRL_PRM_BT0,
  DRV_CANCTRL_PRM_BT1,
  DRV_CANCTRL_PRM_ERR_WARNING_LIMIT,
  DRV_CANCTRL_PRM_RXERR_CNT,
  DRV_CANCTRL_PRM_TXERR_CNT,
  DRV_CANCTRL_PRM_ACCEPTANCE_CODE0,
  DRV_CANCTRL_PRM_ACCEPTANCE_CODE1,
  DRV_CANCTRL_PRM_ACCEPTANCE_CODE2,
  DRV_CANCTRL_PRM_ACCEPTANCE_CODE3,
  DRV_CANCTRL_PRM_ACCEPTANCE_MASK0,
  DRV_CANCTRL_PRM_ACCEPTANCE_MASK1,
  DRV_CANCTRL_PRM_ACCEPTANCE_MASK2,
  DRV_CANCTRL_PRM_ACCEPTANCE_MASK3
}
 
enum  DRV_CANCTRL_DEVICE_ID_E {
  DRV_CANCTRL_DEVICE_ID_0 = 0u,
  DRV_CANCTRL_DEVICE_ID_1 = 0u
}
 

Functions

DRV_CANCTRL_RESULT HALDEC() CanCtrl_EnterResetMode (unsigned int uiInst)
 
DRV_CANCTRL_RESULT HALDEC() CanCtrl_LeaveResetMode (unsigned int uiInst)
 
DRV_CANCTRL_RESULT HALDEC() CanCtrl_EnterListenMode (unsigned int uiInst)
 
DRV_CANCTRL_RESULT HALDEC() CanCtrl_LeaveListenMode (unsigned int uiInst)
 
DRV_CANCTRL_RESULT HALDEC() CanCtrl_EnterSelftestMode (unsigned int uiInst)
 
DRV_CANCTRL_RESULT HALDEC() CanCtrl_LeaveSelftestMode (unsigned int uiInst)
 
DRV_CANCTRL_RESULT HALDEC() CanCtrl_SetBaudrate (unsigned int uiInst, uint32_t ulBaudrate, unsigned int uOversampling)
 
DRV_CANCTRL_RESULT HALDEC() CanCtrl_SetSingleAcceptanceFilter (unsigned int uiInst, DRV_CANCTRL_SINGLEFILTER_T *ptFilter)
 
DRV_CANCTRL_RESULT HALDEC() CanCtrl_GetSingleAcceptanceFilter (unsigned int uiInst, DRV_CANCTRL_SINGLEFILTER_T *ptFilter)
 
DRV_CANCTRL_RESULT HALDEC() CanCtrl_SetDualAcceptanceFilter (unsigned int uiInst, DRV_CANCTRL_DUALFILTER_T *ptFilter)
 
DRV_CANCTRL_RESULT HALDEC() CanCtrl_GetDualAcceptanceFilter (unsigned int uiInst, DRV_CANCTRL_DUALFILTER_T *ptFilter)
 
DRV_CANCTRL_RESULT HALDEC() CanCtrl_SendMessage (unsigned int uiInst, DRV_CANCTRL_MESSAGE_T *ptMessage, bool fSingleShot, bool fSelfRx)
 
DRV_CANCTRL_RESULT HALDEC() CanCtrl_AbortMessage (unsigned int uiInst)
 
DRV_CANCTRL_RESULT HALDEC() CanCtrl_ReceiveMessage (unsigned int uiInst, DRV_CANCTRL_MESSAGE_T *ptMessage)
 
uint32_t HALDEC() CanCtrl_GetRxMessageCnt (unsigned int uiInst)
 
uint32_t HALDEC() CanCtrl_GetMode (unsigned int uiInst)
 
uint32_t HALDEC() CanCtrl_GetStatus (unsigned int uiInst)
 
uint32_t HALDEC() CanCtrl_GetAndClearIrqStatus (unsigned int uiInst)
 
DRV_CANCTRL_RESULT HALDEC() CanCtrl_SetIrqMask (unsigned int uiInst, uint32_t ulIrqMask)
 
uint32_t HALDEC() CanCtrl_GetIrqMask (unsigned int uiInst)
 
uint32_t HALDEC() CanCtrl_GetAndClearArblostStatus (unsigned int uiInst)
 
uint32_t HALDEC() CanCtrl_GetAndClearErrorCode (unsigned int uiInst)
 
DRV_CANCTRL_RESULT HALDEC() CanCtrl_SetWarningLimit (unsigned int uiInst, uint32_t ulLimit)
 
uint32_t HALDEC() CanCtrl_GetWarningLimit (unsigned int uiInst)
 
DRV_CANCTRL_RESULT HALDEC() CanCtrl_SetRxErrorCnt (unsigned int uiInst, uint32_t ulCnt)
 
uint32_t HALDEC() CanCtrl_GetRxErrorCnt (unsigned int uiInst)
 
DRV_CANCTRL_RESULT HALDEC() CanCtrl_SetTxErrorCnt (unsigned int uiInst, uint32_t ulCnt)
 
uint32_t HALDEC() CanCtrl_GetTxErrorCnt (unsigned int uiInst)
 
DRV_CANCTRL_RESULT HALDEC() CanCtrl_SetPrm (unsigned int uiInst, DRV_CANCTRL_PRM_E ePrmID, uint32_t ulPrmVal)
 
DRV_CANCTRL_RESULT HALDEC() CanCtrl_GetPrm (unsigned int uiInst, DRV_CANCTRL_PRM_E ePrmID, uint32_t *pulPrmVal)
 

Detailed Description

Header file of CAN controller module.

Warning
WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! The pad_ctrl has to be modified to use the can! The following lines of code has to be added at best to the main. It is necessary to gain the modification rights for the proper registers by reading and writing the asic access key and directly after this the pad_ctrl value of the pin shall be modified to the value 0x00000041. The following both lines of code show this by reading and wirting the key, followed by setting the value
((volatile unsigned int *) 0xff4012c0)[0] = ((volatile unsigned int *) 0xff4012c0)[0];
((volatile unsigned int *) 0xff401000)[47] = 0x41ull;
Revision
4646
Date
2018-12-19 08:47:36 +0100 (Mi, 19 Dez 2018)
Note
Exclusion of Liability for this demo software: The following software is intended for and must only be used for reference and in an evaluation laboratory environment. It is provided without charge and is subject to alterations. There is no warranty for the software, to the extent permitted by applicable law. Except when otherwise stated in writing the copyright holders and/or other parties provide the software "as is" without warranty of any kind, either expressed or implied. Please refer to the Agreement in README_DISCLAIMER.txt, provided together with this file! By installing or otherwise using the software, you accept the terms of this Agreement. If you do not agree to the terms of this Agreement, then do not install or use the Software!

Definition in file netx_drv_canctrl.h.