FDCAN changes, not finished.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@13692 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
3d63ab70e1
commit
0850d9a7a2
|
@ -279,11 +279,12 @@ bool can_lld_start(CANDriver *canp) {
|
|||
canp->fdcan->CCCR |= FDCAN_CCCR_CCE;
|
||||
|
||||
/* Setting up operation mode except driver-controlled bits.*/
|
||||
canp->fdcan->NBTP = canp->config->NBTP;
|
||||
canp->fdcan->DBTP = canp->config->DBTP;
|
||||
canp->fdcan->CCCR = canp->config->CCCR & ~(FDCAN_CCCR_CSR | FDCAN_CCCR_CSA |
|
||||
FDCAN_CCCR_CCE | FDCAN_CCCR_INIT);
|
||||
canp->fdcan->TEST = canp->config->TEST;
|
||||
canp->fdcan->NBTP = canp->config->NBTP;
|
||||
canp->fdcan->DBTP = canp->config->DBTP;
|
||||
canp->fdcan->CCCR = canp->config->CCCR & ~(FDCAN_CCCR_CSR | FDCAN_CCCR_CSA |
|
||||
FDCAN_CCCR_CCE | FDCAN_CCCR_INIT);
|
||||
canp->fdcan->TEST = canp->config->TEST;
|
||||
canp->fdcan->RXGFC = canp->config->RXGFC;
|
||||
|
||||
/* Enabling interrupts, only using interrupt zero.*/
|
||||
canp->fdcan->IR = (uint32_t)-1;
|
||||
|
@ -390,7 +391,7 @@ void can_lld_transmit(CANDriver *canp,
|
|||
}
|
||||
|
||||
/* Starting transmission.*/
|
||||
canp->fdcan->TXBAR = (uint32_t)1 << (uint32_t)mailbox;
|
||||
canp->fdcan->TXBAR = (uint32_t)1 << ((uint32_t)mailbox - 1U);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -181,14 +181,19 @@ typedef struct {
|
|||
union {
|
||||
struct {
|
||||
union {
|
||||
uint32_t EID:29; /**< @brief Extended identifier. */
|
||||
struct {
|
||||
uint32_t EID:29; /**< @brief Extended identifier. */
|
||||
} ext;
|
||||
struct {
|
||||
uint32_t _R1:18; /**< @brief Reserved for offset. */
|
||||
uint32_t SID:11; /**< @brief Standard identifier. */
|
||||
} std;
|
||||
struct {
|
||||
uint32_t _R1:29; /**< @brief Reserved for offset. */
|
||||
uint32_t RTR:1; /**< @brief Remote transmit request.*/
|
||||
uint32_t XTD:1; /**< @brief Extended identifier. */
|
||||
uint32_t ESI:1; /**< @brief Error state indicator. */
|
||||
};
|
||||
} common;
|
||||
};
|
||||
uint32_t _R2:16;
|
||||
uint32_t DLC:4; /**< @brief Data length code. */
|
||||
|
@ -221,27 +226,34 @@ typedef struct {
|
|||
/**
|
||||
* @brief Frame header.
|
||||
*/
|
||||
struct {
|
||||
union {
|
||||
uint32_t EID:29; /**< @brief Extended Identifier. */
|
||||
struct {
|
||||
uint32_t _R1:18;
|
||||
uint32_t SID:11; /**< @brief Standard identifier. */
|
||||
uint32_t RTR:1; /**< @brief Remote transmit request.*/
|
||||
uint32_t XTD:1; /**< @brief Extended identifier. */
|
||||
uint32_t ESI:1; /**< @brief Error state indicator. */
|
||||
union {
|
||||
struct {
|
||||
union {
|
||||
struct {
|
||||
uint32_t EID:29; /**< @brief Extended identifier. */
|
||||
} ext;
|
||||
struct {
|
||||
uint32_t _R1:18;
|
||||
uint32_t SID:11; /**< @brief Standard identifier. */
|
||||
} std;
|
||||
struct {
|
||||
uint32_t _R1:29; /**< @brief Reserved for offset. */
|
||||
uint32_t RTR:1; /**< @brief Remote transmit request.*/
|
||||
uint32_t XTD:1; /**< @brief Extended identifier. */
|
||||
uint32_t ESI:1; /**< @brief Error state indicator. */
|
||||
} common;
|
||||
};
|
||||
};
|
||||
uint16_t RXTS:16; /**< @brief TX time stamp. */
|
||||
uint8_t DLC:4; /**< @brief Data length code. */
|
||||
uint8_t BRS:1; /**< @brief Bit rate switch. */
|
||||
uint8_t FDF:1; /**< @brief FDCAN frame format. */
|
||||
uint8_t _R2:2;
|
||||
uint8_t FIDX:7; /**< @brief Filter index. */
|
||||
uint8_t ANMF:1; /**< @brief Accepted non-matching
|
||||
uint32_t RXTS:16; /**< @brief TX time stamp. */
|
||||
uint32_t DLC:4; /**< @brief Data length code. */
|
||||
uint32_t BRS:1; /**< @brief Bit rate switch. */
|
||||
uint32_t FDF:1; /**< @brief FDCAN frame format. */
|
||||
uint32_t _R2:2;
|
||||
uint32_t FIDX:7; /**< @brief Filter index. */
|
||||
uint32_t ANMF:1; /**< @brief Accepted non-matching
|
||||
frame. */
|
||||
};
|
||||
uint32_t header32[2];
|
||||
};
|
||||
uint32_t header32[2];
|
||||
/**
|
||||
* @brief Frame data.
|
||||
*/
|
||||
|
@ -320,6 +332,10 @@ typedef struct {
|
|||
* @brief Test configuration register.
|
||||
*/
|
||||
uint32_t TEST;
|
||||
/**
|
||||
* @brief Global filter configuration register.
|
||||
*/
|
||||
uint32_t RXGFC;
|
||||
} CANConfig;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue