Commit 0dfbb14e authored by Bruno Gomes's avatar Bruno Gomes

LIBIOP: Simplify CAN message memory allocation

refs #192377
parent a7865996
......@@ -797,12 +797,13 @@ air_status_code_e iop_grcan_open_internal(iop_device_driver_t *iop_dev, void *ar
}
/* Convert the unaligned buffers into aligned buffers */
/* AIR message _rx and _tx initialy point to same memory address*/
pDev->tx = (grcan_msg *) (((unsigned int) pDev->_tx +
(BUFFER_ALIGNMENT_NEEDS-1)) &
~(BUFFER_ALIGNMENT_NEEDS-1));
pDev->rx = (grcan_msg *) (((unsigned int) pDev->_rx +
pDev->rx = (grcan_msg *) ((((unsigned int) pDev->_rx +
(BUFFER_ALIGNMENT_NEEDS-1)) &
~(BUFFER_ALIGNMENT_NEEDS-1));
~(BUFFER_ALIGNMENT_NEEDS-1)) + pDev->txbuf_size);
iop_grcan_set_afilter(iop_dev, &(pDev->afilter));
iop_grcan_set_sfilter(iop_dev, &(pDev->sfilter));
......
......@@ -16,8 +16,7 @@ typedef struct {
int can_core; // Identify which CAN core corresponds to (either CAN0 or CAN1)
int baud_rate;
uint16_t rx_count;
uint16_t tx_count;
} iop_can_device_t;
void can_copy_header(
......
......@@ -28,13 +28,9 @@
${iop_template.RemotePortList(iop_configuration)}\
/**
*@brief Allocation of the receiver memory
*@brief CAN data buffer allocation
*/
static uint8_t rx_msg_fifo[CAN_RX_SIZE*16*4+1024];
/**
*@brief Allocation of the transmiter memory
*/
static uint8_t tx_msg_fifo[CAN_TX_SIZE*16*4+1024];
static uint8_t can_msg_buffer[CAN_RX_SIZE*16*4+CAN_TX_SIZE*16*4+1024];
/** @brief GRCAN control structure*/
static grcan_priv grcan_driver = ${'\\'}
......@@ -70,8 +66,8 @@ static grcan_priv grcan_driver = ${'\\'}
},
},
._tx = tx_msg_fifo,
._rx = rx_msg_fifo,
._tx = can_msg_buffer,
._rx = can_msg_buffer,
};
/** @brief GRCAN control strucutre */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment