/*
- * Copyright (C) 2012-2013 Czech Technical University in Prague
+ * Copyright (C) 2012-2014, 2016 Czech Technical University in Prague
*
* Created on: 28.2.2013
*
* Authors:
* - Michal Horn
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * This document contains proprietary information belonging to Czech
+ * Technical University in Prague. Passing on and copying of this
+ * document, and communication of its contents is not permitted
+ * without prior written authorization.
*
* File : cmd_can.c
*
* Abstract:
- * This file contains commands for CAN test
+ * This file contains commands for CAN test
*
*/
/*
* Error codes definitions for RPP CAN functions tests.
*/
-#define ERR_CCT_HW_OBJ 0x0001 /**< Wrong HW object passed to the RPP CAN function. */
-#define ERR_CCT_MSG_MISMATCH 0x0010 /**< Received message does not match to the sent message. */
-#define ERR_CCT_RX_IND_NOT_CLEARED 0x0020 /**< Message received indicator was not cleared by the rpp_can_read function. */
-#define ERR_CCT_RX_IND_SET_NO_MSG_REC 0x0040 /**< Message received indicator is set, but no message could be retrieved by the rpp_can_read function. */
-#define ERR_CCT_RECV_TIMEOUT 0x0100 /**< Message receive timeout reached. */
-#define ERR_CCT_CLEAR_TX_PEND_TO 0x0200 /**< Timeout reached for waiting for the clearance of the transmission request flag. */
-#define ERR_CCT_SET_TX_PEND_TO 0x0400 /**< Timeout reached for waiting until the transmission request flag is set after the request is posted. */
-#define ERR_CCT_INIT 0x1000 /**< Error while initializing the CAN bus. */
-#define ERR_CCT_SEND 0x2000 /**< Error while sending a CAN message. */
-#define ERR_CCT_RCV 0x4000 /**< Error while receiving a CAN message */
-#define ERR_CCT_UNEXPECTED_RETVAL 0x0008 /**< Unexpected return value has been returned from some RPP CAN function. */
-
-#define CCT_TIMEOUT 100000 /**< Timeout for RPP CAN test steps. */
+#define ERR_CCT_HW_OBJ 0x0001 /**< Wrong HW object passed to the RPP CAN function. */
+#define ERR_CCT_MSG_MISMATCH 0x0010 /**< Received message does not match to the sent message. */
+#define ERR_CCT_RX_IND_NOT_CLEARED 0x0020 /**< Message received indicator was not cleared by the rpp_can_read function. */
+#define ERR_CCT_RX_IND_SET_NO_MSG_REC 0x0040 /**< Message received indicator is set, but no message could be retrieved by the rpp_can_read function. */
+#define ERR_CCT_RECV_TIMEOUT 0x0100 /**< Message receive timeout reached. */
+#define ERR_CCT_CLEAR_TX_PEND_TO 0x0200 /**< Timeout reached for waiting for the clearance of the transmission request flag. */
+#define ERR_CCT_SET_TX_PEND_TO 0x0400 /**< Timeout reached for waiting until the transmission request flag is set after the request is posted. */
+#define ERR_CCT_INIT 0x1000 /**< Error while initializing the CAN bus. */
+#define ERR_CCT_SEND 0x2000 /**< Error while sending a CAN message. */
+#define ERR_CCT_RCV 0x4000 /**< Error while receiving a CAN message */
+#define ERR_CCT_UNEXPECTED_RETVAL 0x0008 /**< Unexpected return value has been returned from some RPP CAN function. */
+
+#define CCT_TIMEOUT 100000 /**< Timeout for RPP CAN test steps. */
static int can_inited = 0;
.type = RPP_CAN_MIXED,
.controller = 1,
.msg_obj = 1,
- .id = 1,
- .mask = 0x7fffff,
+ .id = 0,
+ .mask = 0,
},
{
.type = RPP_CAN_MIXED,
.controller = 2,
.msg_obj = 1,
- .id = 1,
- .mask = 0x7fffff,
+ .id = 0,
+ .mask = 0,
},
{
.type = RPP_CAN_MIXED,
.controller = 3,
.msg_obj = 1,
- .id = 1,
- .mask = 0x7fffff,
+ .id = 0,
+ .mask = 0,
}
};
* CAN test bit timings configurations.
*/
struct rpp_can_timing_cfg can_test_timing[] = {
- {
- .brp = 10,
- .prop_seg = 8,
- .phase_seg1 = 5,
- .phase_seg2 = 2,
- .sjw = 1
- },
- {
- .brp = 10,
- .prop_seg = 8,
- .phase_seg1 = 5,
- .phase_seg2 = 2,
- .sjw = 1
- },
- {
- .brp = 10,
- .prop_seg = 8,
- .phase_seg1 = 5,
- .phase_seg2 = 2,
- .sjw = 1
- },
+ {
+ .brp = 10,
+ .prop_seg = 8,
+ .phase_seg1 = 5,
+ .phase_seg2 = 2,
+ .sjw = 1
+ },
+ {
+ .brp = 10,
+ .prop_seg = 8,
+ .phase_seg1 = 5,
+ .phase_seg2 = 2,
+ .sjw = 1
+ },
+ {
+ .brp = 10,
+ .prop_seg = 8,
+ .phase_seg1 = 5,
+ .phase_seg2 = 2,
+ .sjw = 1
+ },
};
/**
* CAN test controllers configurations.
*/
struct rpp_can_ctrl_config can_test_ctrl_cfg[] = {
- {
- .baudrate = 500000,
- .clk = 80000000,
- .timing_calc_method = RPP_CAN_TIMING_CALC_MANUAL,
- .timing_config = &can_test_timing[0]
- },
- {
- .baudrate = 500000,
- .clk = 80000000,
- .timing_calc_method = RPP_CAN_TIMING_CALC_MANUAL,
- .timing_config = &can_test_timing[1]
- },
- {
- .baudrate = 500000,
- .clk = 80000000,
- .timing_calc_method = RPP_CAN_TIMING_CALC_MANUAL,
- .timing_config = &can_test_timing[2]
- },
+ {
+ .baudrate = 500000,
+ .clk = 80000000,
+ .timing_calc_method = RPP_CAN_TIMING_CALC_MANUAL,
+ .timing_config = &can_test_timing[0]
+ },
+ {
+ .baudrate = 500000,
+ .clk = 80000000,
+ .timing_calc_method = RPP_CAN_TIMING_CALC_MANUAL,
+ .timing_config = &can_test_timing[1]
+ },
+ {
+ .baudrate = 500000,
+ .clk = 80000000,
+ .timing_calc_method = RPP_CAN_TIMING_CALC_MANUAL,
+ .timing_config = &can_test_timing[2]
+ },
};
/**
* CAN test TX configuration.
*/
struct rpp_can_tx_config can_test_tx_cfg[] = {
- {
- .type = RPP_CAN_STANDARD,
- .controller = 1,
- .msg_obj = 1
- }
+ {
+ .type = RPP_CAN_STANDARD,
+ .controller = 1,
+ .msg_obj = 1
+ }
};
/**
* CAN test RX configuration.
*/
struct rpp_can_rx_config can_test_rx_cfg[] = {
- {
- .type = RPP_CAN_STANDARD,
- .controller = 2,
- .id = 0x1,
- .mask = 1,
- .msg_obj = 1
- }
+ {
+ .type = RPP_CAN_STANDARD,
+ .controller = 2,
+ .id = 0x1,
+ .mask = 1,
+ .msg_obj = 1
+ }
};
/**
* Root CAN test configuration structure
*/
struct rpp_can_config can_test_cfg = {
- .num_tx_obj = 1,
- .num_rx_obj = 1,
- .tx_config = can_test_tx_cfg,
- .rx_config = can_test_rx_cfg,
- .ctrl = can_test_ctrl_cfg
+ .num_tx_obj = 1,
+ .num_rx_obj = 1,
+ .tx_config = can_test_tx_cfg,
+ .rx_config = can_test_rx_cfg,
+ .ctrl = can_test_ctrl_cfg
};
/**
boolean_t cmd_can_messages_equal(const struct rpp_can_pdu *pdu1, const struct rpp_can_pdu *pdu2)
{
boolean_t pdus_equal = TRUE;
+
if (pdu1->id != pdu2->id ||
- pdu1->dlc != pdu2->dlc) {
+ pdu1->dlc != pdu2->dlc)
pdus_equal = FALSE;
- }
else {
uint8_t i = 0;
for (i = 0; i < pdu1->dlc; i++) {
can_test_cfg.ctrl[2].baudrate = desired_baudrate;
can_test_cfg.ctrl[2].timing_calc_method = timing_calc;
- if (rpp_can_init(&can_test_cfg) == SUCCESS) {
+ if (rpp_can_init(&can_test_cfg) == SUCCESS)
return SUCCESS;
- }
- else {
+ else
return FAILURE;
- }
}
/**
* @param[in] timeout How long should the test wait for the message.
* @return SUCCESS if the test passed, error code otherwise.
*/
-int cmd_can_test_recv(const struct rpp_can_pdu* can_tx_pdu, uint32_t timeout)
+int cmd_can_test_recv(const struct rpp_can_pdu *can_tx_pdu, uint32_t timeout)
{
boolean_t msg_received = FALSE;
volatile uint32_t rec_time = 0;
case -RPP_EINVAL:
return ERR_CCT_HW_OBJ;
case -RPP_ENODATA:
- if (++rec_time >= CCT_TIMEOUT) {
+ if (++rec_time >= CCT_TIMEOUT)
return ERR_CCT_RECV_TIMEOUT;
- }
break;
case SUCCESS:
- if (!cmd_can_messages_equal(&can_rx_pdu, can_tx_pdu)) {
+ if (!cmd_can_messages_equal(&can_rx_pdu, can_tx_pdu))
return ERR_CCT_MSG_MISMATCH;
- }
- else {
+ else
msg_received = TRUE;
- }
break;
default:
return ERR_CCT_UNEXPECTED_RETVAL;
* @param[in] can_tx_msg A message for transmission.
* @return SUCCESS if the test passed, error code otherwise.
*/
-int cmd_can_test_send(const struct rpp_can_pdu* can_tx_msg)
+int cmd_can_test_send(const struct rpp_can_pdu *can_tx_msg)
{
- if (rpp_can_write(0, can_tx_msg) != SUCCESS) {
+ if (rpp_can_write(0, can_tx_msg) != SUCCESS)
return ERR_CCT_HW_OBJ;
- }
return SUCCESS;
}
* @param[in] can_tx_msg A message used to testing
* @return SUCCESS if the test passed, error code otherwise.
*/
-int cmd_can_test_simple_send_recv(const struct rpp_can_pdu* can_tx_msg)
+int cmd_can_test_simple_send_recv(const struct rpp_can_pdu *can_tx_msg)
{
int ret_val = 0;
- if ((ret_val = cmd_can_test_send(can_tx_msg)) != SUCCESS) {
+
+ if ((ret_val = cmd_can_test_send(can_tx_msg)) != SUCCESS)
return ERR_CCT_SEND|ret_val;
- }
- else {
- if ((ret_val = cmd_can_test_recv(can_tx_msg, CCT_TIMEOUT)) != SUCCESS) {
- return ERR_CCT_RCV|ret_val;
- }
- }
+ else if ((ret_val = cmd_can_test_recv(can_tx_msg, CCT_TIMEOUT)) != SUCCESS)
+ return ERR_CCT_RCV|ret_val;
+
return SUCCESS;
}
* @return SUCCESS if the test passed, error code otherwise.
*
*/
-int cmd_can_test_baudrate_calc(uint32_t tested_baudrate,const struct rpp_can_pdu* can_tx_msg)
+int cmd_can_test_baudrate_calc(uint32_t tested_baudrate,const struct rpp_can_pdu *can_tx_msg)
{
int ret_val = 0;
- if ((ret_val = cmd_can_test_init(RPP_CAN_TIMING_CALC_AUTO, 125000)) != SUCCESS) {
+
+ if ((ret_val = cmd_can_test_init(RPP_CAN_TIMING_CALC_AUTO, 125000)) != SUCCESS)
return ERR_CCT_INIT|ret_val;
- }
- else {
- if ((ret_val = cmd_can_test_simple_send_recv(can_tx_msg)) != SUCCESS) {
- return ret_val;
- }
- }
+ else if ((ret_val = cmd_can_test_simple_send_recv(can_tx_msg)) != SUCCESS)
+ return ret_val;
+
return SUCCESS;
}
* @param[in] can_tx_msg2 A message, which transmission is requested right after the can_tx_msg1
* @return SUCCESS if the test passed, error code otherwise.
*/
-int cmd_can_test_tx_request_replace(const struct rpp_can_pdu* can_tx_msg1, const struct rpp_can_pdu* can_tx_msg2)
+int cmd_can_test_tx_request_replace(const struct rpp_can_pdu *can_tx_msg1, const struct rpp_can_pdu *can_tx_msg2)
{
int ret_val = 0;
- if ((ret_val = cmd_can_test_send(can_tx_msg1)) != SUCCESS) {
+
+ if ((ret_val = cmd_can_test_send(can_tx_msg1)) != SUCCESS)
return ret_val;
- }
- else {
- if ((ret_val = cmd_can_test_simple_send_recv(can_tx_msg2)) != SUCCESS) {
- return ret_val;
- }
- }
+ else if ((ret_val = cmd_can_test_simple_send_recv(can_tx_msg2)) != SUCCESS)
+ return ret_val;
+
return SUCCESS;
}
* @param[out] time Measured time between posting the transmission request and setting the TX request flag.
* @return SUCCESS if the test passed, error code otherwise.
*/
-int cmd_can_test_tx_request_flag(const struct rpp_can_pdu* can_tx_msg, uint32_t* time)
+int cmd_can_test_tx_request_flag(const struct rpp_can_pdu *can_tx_msg, uint32_t *time)
{
*time = 0;
uint32_t timeout = 0;
boolean_t tx_pend = FALSE;
int ret_val = 0;
- if ((ret_val = cmd_can_test_send(can_tx_msg)) != SUCCESS) {
+ if ((ret_val = cmd_can_test_send(can_tx_msg)) != SUCCESS)
return ret_val;
- }
else {
/* Wait for the flag to be set */
while (!tx_pend) {
- if (++timeout > CCT_TIMEOUT) {
+ if (++timeout > CCT_TIMEOUT)
return ERR_CCT_SET_TX_PEND_TO;
- }
- if (rpp_can_check_tx_pend(0, &tx_pend) == FAILURE) {
+ if (rpp_can_check_tx_pend(0, &tx_pend) == FAILURE)
return ERR_CCT_HW_OBJ;
- }
}
timeout = 0;
while (tx_pend) {
- if (rpp_can_check_tx_pend(0, &tx_pend) == FAILURE) {
+ if (rpp_can_check_tx_pend(0, &tx_pend) == FAILURE)
return ERR_CCT_HW_OBJ;
- }
(*time)++;
- if (++timeout > CCT_TIMEOUT) {
+ if (++timeout > CCT_TIMEOUT)
return ERR_CCT_CLEAR_TX_PEND_TO;
- }
}
- if ((ret_val = cmd_can_test_recv(can_tx_msg, CCT_TIMEOUT)) != SUCCESS) {
+ if ((ret_val = cmd_can_test_recv(can_tx_msg, CCT_TIMEOUT)) != SUCCESS)
return ERR_CCT_RCV|ret_val;
- }
}
return SUCCESS;
* @param[out] time Measured time between posting the transmission request and setting the RX flag.
* @return SUCCESS if the test passed, error code otherwise.
*/
-int cmd_can_test_rx_indicator(const struct rpp_can_pdu* can_tx_msg, uint32_t* time)
+int cmd_can_test_rx_indicator(const struct rpp_can_pdu *can_tx_msg, uint32_t *time)
{
*time = 0;
volatile uint32_t timeout = 0;
int ret_val = 0;
struct rpp_can_pdu can_rx_pdu;
- if ((ret_val = cmd_can_test_send(can_tx_msg)) != SUCCESS) {
+ if ((ret_val = cmd_can_test_send(can_tx_msg)) != SUCCESS)
return ret_val;
- }
else {
/* Wait for the flag to be set */
while (!rx_ind) {
- if (rpp_can_check_rx_ind(0, &rx_ind) == FAILURE) {
+ if (rpp_can_check_rx_ind(0, &rx_ind) == FAILURE)
return ERR_CCT_HW_OBJ;
- }
(*time)++;
- if (++timeout > CCT_TIMEOUT) {
+ if (++timeout > CCT_TIMEOUT)
return ERR_CCT_SET_TX_PEND_TO;
- }
}
if ((ret_val = rpp_can_read(0, &can_rx_pdu)) != SUCCESS) {
- switch(ret_val) {
+ switch (ret_val) {
case -RPP_ENODATA:
return ERR_CCT_RX_IND_SET_NO_MSG_REC;
case -RPP_EINVAL:
}
}
else {
- if (!cmd_can_messages_equal(&can_rx_pdu, can_tx_msg)) {
+ if (!cmd_can_messages_equal(&can_rx_pdu, can_tx_msg))
return ERR_CCT_MSG_MISMATCH;
- }
else {
- if (rpp_can_check_rx_ind(0, &rx_ind) == FAILURE) {
+ if (rpp_can_check_rx_ind(0, &rx_ind) == FAILURE)
return ERR_CCT_HW_OBJ;
- }
- if (rx_ind == TRUE) {
+ if (rx_ind == TRUE)
return ERR_CCT_RX_IND_NOT_CLEARED;
- }
}
}
}
int cmd_do_can_test_functions(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
{
struct rpp_can_pdu can_tx_msg1 = {
- .id = 0x1,
- .dlc = 8,
- .data = {'H', 'E', 'L', 'L', 'O', '0', '0', '1'}
+ .id = 0x1,
+ .dlc = 8,
+ .data = {'H', 'E', 'L', 'L', 'O', '0', '0', '1'}
};
struct rpp_can_pdu can_tx_msg2 = {
- .id = 0x1,
- .dlc = 8,
- .data = {'H', 'E', 'L', 'L', 'O', '0', '0', '2'}
+ .id = 0x1,
+ .dlc = 8,
+ .data = {'H', 'E', 'L', 'L', 'O', '0', '0', '2'}
};
rpp_sci_printf("This is a test for RPP CAN library functions:\n");
rpp_sci_printf("Test of simple message transmission and reception.\n");
int ret_val = 0;
rpp_sci_printf("\tCAN bus Initialization: ");
- if ((ret_val = cmd_can_test_init(RPP_CAN_TIMING_CALC_MANUAL, 500000)) != SUCCESS) {
+ if ((ret_val = cmd_can_test_init(RPP_CAN_TIMING_CALC_MANUAL, 500000)) != SUCCESS)
rpp_sci_printf("failed: error: 0x%X.\n", ret_val);
- }
else {
rpp_sci_printf("OK\n");
rpp_sci_printf("\tTransmission and reception...");
- if ((ret_val = cmd_can_test_simple_send_recv(&can_tx_msg1)) != SUCCESS) {
+ if ((ret_val = cmd_can_test_simple_send_recv(&can_tx_msg1)) != SUCCESS)
rpp_sci_printf("failed: error: 0x%X.\n", ret_val);
- }
- else {
+ else
rpp_sci_printf("OK\n");
- }
}
rpp_sci_printf("---\n");
/* Baudrate calculation testing
for (i = 0; i < num_baudrates; i++) {
rpp_sci_printf("\tBaudrate: %d: ", baudrates[i]);
- if ((ret_val = cmd_can_test_baudrate_calc(baudrates[i], &can_tx_msg1)) != SUCCESS) {
+ if ((ret_val = cmd_can_test_baudrate_calc(baudrates[i], &can_tx_msg1)) != SUCCESS)
rpp_sci_printf("failed: error: 0x%X.\n", ret_val);
- }
- else {
+ else
rpp_sci_printf("OK\n");
- }
}
rpp_sci_printf("---\n");
*/
rpp_sci_printf("Test of transmission request rewritting.\n");
rpp_sci_printf("\tCAN bus Initialization: ");
- if ((ret_val = cmd_can_test_init(RPP_CAN_TIMING_CALC_MANUAL, 500000)) != SUCCESS) {
+ if ((ret_val = cmd_can_test_init(RPP_CAN_TIMING_CALC_MANUAL, 500000)) != SUCCESS)
rpp_sci_printf("failed: error: 0x%X.\n", ret_val);
- }
else {
rpp_sci_printf("OK\n");
rpp_sci_printf("\tTX request rewritting...");
- if ((ret_val = cmd_can_test_tx_request_replace(&can_tx_msg1, &can_tx_msg2)) != SUCCESS) {
+ if ((ret_val = cmd_can_test_tx_request_replace(&can_tx_msg1, &can_tx_msg2)) != SUCCESS)
rpp_sci_printf("failed: error: 0x%X.\n", ret_val);
- }
- else {
+ else
rpp_sci_printf("OK\n");
- }
}
rpp_sci_printf("---\n");
*/
rpp_sci_printf("Test of TX request pending flag detection.\n");
rpp_sci_printf("\tCAN bus Initialization: ");
- if ((ret_val = cmd_can_test_init(RPP_CAN_TIMING_CALC_MANUAL, 500000)) != SUCCESS) {
+ if ((ret_val = cmd_can_test_init(RPP_CAN_TIMING_CALC_MANUAL, 500000)) != SUCCESS)
rpp_sci_printf("failed: error: 0x%X.\n", ret_val);
- }
else {
rpp_sci_printf("OK\n");
uint32_t time = 0;
rpp_sci_printf("\tTX request pending flag behavioral: ");
- if ((ret_val = cmd_can_test_tx_request_flag(&can_tx_msg1, &time)) != SUCCESS) {
+ if ((ret_val = cmd_can_test_tx_request_flag(&can_tx_msg1, &time)) != SUCCESS)
rpp_sci_printf("failed: error: 0x%X.\n", ret_val);
- }
- else {
+ else
rpp_sci_printf("OK, time: %d cycles.\n", time);
- }
}
rpp_sci_printf("---\n");
*/
rpp_sci_printf("Test of RX indicator.\n");
rpp_sci_printf("\tCAN bus Initialization: ");
- if ((ret_val = cmd_can_test_init(RPP_CAN_TIMING_CALC_MANUAL, 500000)) != SUCCESS) {
+ if ((ret_val = cmd_can_test_init(RPP_CAN_TIMING_CALC_MANUAL, 500000)) != SUCCESS)
rpp_sci_printf("failed: error: 0x%X.\n", ret_val);
- }
else {
rpp_sci_printf("OK\n");
uint32_t time = 0;
rpp_sci_printf("\tRX indicator behavioral: ");
- if ((ret_val = cmd_can_test_rx_indicator(&can_tx_msg1, &time)) != SUCCESS) {
+ if ((ret_val = cmd_can_test_rx_indicator(&can_tx_msg1, &time)) != SUCCESS)
rpp_sci_printf("failed: error: 0x%X.\n", ret_val);
- }
- else {
+ else
rpp_sci_printf("OK, time: %d cycles.\n", time);
- }
}
rpp_sci_printf("---\n");
*/
rpp_sci_printf("Reset the CAN bus.\n");
rpp_sci_printf("\tCAN bus Initialization: ");
- if ((ret_val = cmd_can_test_init(RPP_CAN_TIMING_CALC_MANUAL, 500000)) != SUCCESS) {
+ if ((ret_val = cmd_can_test_init(RPP_CAN_TIMING_CALC_MANUAL, 500000)) != SUCCESS)
rpp_sci_printf("failed: error: 0x%X.\n", ret_val);
- }
- else {
+ else
rpp_sci_printf("OK\n");
- }
return SUCCESS;
}
int cmd_do_can_init(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
{
- can_inited = (rpp_can_init(&can_config) == SUCCESS ? 1 : 0);
- return (can_inited ? 0 : 1);
+ can_inited = (rpp_can_init(&can_config) == SUCCESS ? 1 : 0);
+ return (can_inited ? 0 : 1);
}
struct rpp_can_pdu pdu;
char *p;
- if (!can_inited)
- {
+ if (!can_inited) {
rpp_sci_printf("CAN is not initialized\n");
return -CMDERR_NODEV;
}
p = param[1];
ret = sscanf(p, "%i %i%n", &controller_id, &pdu.id, &l);
- if (ret < 2)
- {
+ if (ret < 2) {
rpp_sci_printf("Cannot parse parameter %d\n", ret+1);
return -CMDERR_BADPAR;
}
pdu.dlc = i;
- if (rpp_can_write(controller_id-1, &pdu) == SUCCESS)
- {
+ if (rpp_can_write(controller_id-1, &pdu) == SUCCESS) {
rpp_sci_printf("Sent: can%u\t%X\t[%u]\t", controller_id, pdu.id, pdu.dlc);
- for (i=0; i<pdu.dlc; i++)
- {
+ for (i = 0; i < pdu.dlc; i++) {
rpp_sci_printf("%X ", pdu.data[i]);
}
}
else
- {
rpp_sci_printf("Error: rpp_can_write");
- }
rpp_sci_printf("\n");
uint32_t i;
- if (!can_inited)
- {
+ if (!can_inited) {
rpp_sci_printf("CAN is not initialized\n");
return -CMDERR_NODEV;
}
- if (!(sscanf(param[1], "%u", &controller_id) == 1))
- {
+ if (!(sscanf(param[1], "%u", &controller_id) == 1)) {
rpp_sci_printf("Unable to parse controller ID\n");
return 1;
}
+ if (controller_id < 1 || controller_id > 3) {
+ rpp_sci_printf("Invalid controller ID\n");
+ return -CMDERR_NODEV;
+ }
+
rpp_can_init(&can_config);
- while(cmd_io->getc(cmd_io) < 0)
- {
+ while (cmd_io->getc(cmd_io) < 0) {
rpp_can_check_rx_ind(controller_id-1, &rx_ind);
- if (rx_ind)
- {
- if (rpp_can_read(controller_id-1, &pdu) == SUCCESS)
- {
+ if (rx_ind) {
+ if (rpp_can_read(controller_id-1, &pdu) == SUCCESS) {
if (pdu.id & CAN_EFF_FLAG)
- {
rpp_sci_printf("can%u %08X [%u] ", controller_id & (~CAN_EFF_FLAG), pdu.id, pdu.dlc);
- }
else
- {
rpp_sci_printf("can%u %03X [%u] ", controller_id, pdu.id, pdu.dlc);
- }
- for (i=0; i<pdu.dlc; i++)
- {
- rpp_sci_printf("%X ", pdu.data[i]);
+ for (i = 0; i < pdu.dlc; i++) {
+ rpp_sci_printf("%X ", pdu.data[i]);
}
rpp_sci_printf("\n");
}
else
- {
rpp_sci_printf("Error rpp_can_read\n");
- }
}
}
if ((opchar = cmd_opchar_check(cmd_io, des, param)) < 0)
return opchar;
- if (opchar == ':')
- {
- if (!(sscanf(param[1], "%u:%u", &controller_id, &baudrate) == 2))
- {
+ if (opchar == ':') {
+ if (!(sscanf(param[1], "%u:%u", &controller_id, &baudrate) == 2)) {
rpp_sci_printf("Unable to parse arguments\n");
return 1;
}
{
if (!(sscanf(param[1], "%u", &controller_id) == 1))
- if (controller_id < 1 || controller_id > 3)
- return -CMDERR_BADPAR;
+ if (controller_id < 1 || controller_id > 3)
+ return -CMDERR_BADPAR;
cmd_opchar_replong(cmd_io, param, can_config.ctrl[controller_id-1].baudrate, 0, 10);
}
if ((opchar = cmd_opchar_check(cmd_io, des, param)) < 0)
return opchar;
- if (opchar == ':')
- {
- if (!(sscanf(param[1], "%u:%u %u %u %u %u", &controller_id, &brp, &prop_seg, &phase_seg1, &phase_seg2, &sjw) == 6))
- {
+ if (opchar == ':') {
+ if (!(sscanf(param[1], "%u:%u %u %u %u %u", &controller_id, &brp, &prop_seg, &phase_seg1, &phase_seg2, &sjw) == 6)) {
rpp_sci_printf("Unable to parse arguments\n");
return 1;
}
{
if (!(sscanf(param[1], "%u", &controller_id) == 1))
- if (controller_id < 1 || controller_id > 3)
- return -CMDERR_BADPAR;
+ if (controller_id < 1 || controller_id > 3)
+ return -CMDERR_BADPAR;
- if (can_config.ctrl[controller_id-1].timing_config != NULL) {
+ if (can_config.ctrl[controller_id-1].timing_config != NULL)
rpp_sci_printf("brp: %u\r\nprop_seg: %u tQ\r\nphase_seg1: %u tQ\r\nphase_seg2: %u tQ\r\nsjw: %u tQ\r\n",
- can_config.ctrl[controller_id-1].timing_config->brp,
- can_config.ctrl[controller_id-1].timing_config->prop_seg,
- can_config.ctrl[controller_id-1].timing_config->phase_seg1,
- can_config.ctrl[controller_id-1].timing_config->phase_seg2,
- can_config.ctrl[controller_id-1].timing_config->sjw
- );
-
- }
- else {
+ can_config.ctrl[controller_id-1].timing_config->brp,
+ can_config.ctrl[controller_id-1].timing_config->prop_seg,
+ can_config.ctrl[controller_id-1].timing_config->phase_seg1,
+ can_config.ctrl[controller_id-1].timing_config->phase_seg2,
+ can_config.ctrl[controller_id-1].timing_config->sjw
+ );
+
+ else
rpp_sci_printf("CAN timing has not yet been manually specified.\r\n");
- }
}
return 0;
-#endif /* DOCGEN */
+#endif /* DOCGEN */
+
+cmd_des_t const cmd_des_can_init = {
+ 0, 0,
+ "caninit", "Initialize CAN controllers",
+ "### Command syntax ###\n"
+ "\n"
+ " caninit\n"
+ "\n"
+ "### Description ###\n"
+ "\n"
+ "This command (re-)initializes all CAN controllers using current\n"
+ "CAN configuration. This configuration can be changed using\n"
+ "canbaudrate command.\n"
+ "\n"
+ "In the default configuration the baudrate of all CAN controllers i set\n"
+ "to 500 kbit/s.\n"
+ "\n"
+ "### Example ###\n"
+ " --> caninit\n",
+ CMD_HANDLER(cmd_do_can_init), (void *)&cmd_list_can
+};
-cmd_des_t const cmd_des_can_init={
- 0, 0,
- "caninit", "Initialize CAN controllers",
- "### Command syntax ###\n"
- "\n"
- " caninit\n"
- "\n"
- "### Description ###\n"
- "\n"
- "This command (re-)initializes all CAN controllers using current\n"
- "CAN configuration. This configuration can be changed using\n"
- "canbaudrate command.\n"
- "\n"
- "In the default configuration the baudrate of all CAN controllers i set\n"
- "to 500 kbit/s.\n"
- "\n"
- "### Example ###\n"
- " --> caninit\n",
- CMD_HANDLER(cmd_do_can_init), (void *)&cmd_list_can
+cmd_des_t const cmd_des_can_baudrate = {
+ 0, CDESM_OPCHR|CDESM_RW,
+ "canbaudrate#", "Change baudrate of CAN controller",
+ "### Command syntax ###\n"
+ "\n"
+ " canbaudrate<CONTROLLER>?\n"
+ " canbaudrate<CONTROLLER>:<BAUDRATE>\n"
+ "\n"
+ "where `<CONTROLLER>` is number in range 1-3 and BAUDRATE is number in\n"
+ "range 1000-10000000 specifying the baudrate in bits per second.\n"
+ "\n"
+ "### Description ###\n"
+ "\n"
+ "This command is used to set or show the baudrate of a CAN controller.\n"
+ "The baudrate shown is the one which will be used by next invocation of\n"
+ "the caninit command.\n"
+ "The baudrate specified by the command is used to automatic calculation of\n"
+ "the CAN controller timing. If you want to specify the timing manually,\n"
+ "please use the command cantiming.\n"
+ "The automatic calculation might not work properly for some baudrates. In\n"
+ "this case you should calculate the timing manually and specify it by the\n"
+ "command cantiming."
+ "\n"
+ "### Examples ###\n"
+ "\n"
+ " --> canbaudrate2?\n"
+ " canbaudrate2=500000\n"
+ "\n"
+ " --> canbaudrate2:100000\n",
+ CMD_HANDLER(cmd_do_can_change_baudrate), (void *)&cmd_list_can
};
-cmd_des_t const cmd_des_can_baudrate={
- 0, CDESM_OPCHR|CDESM_RW,
- "canbaudrate#", "Change baudrate of CAN controller",
- "### Command syntax ###\n"
- "\n"
- " canbaudrate<CONTROLLER>?\n"
- " canbaudrate<CONTROLLER>:<BAUDRATE>\n"
- "\n"
- "where `<CONTROLLER>` is number in range 1-3 and BAUDRATE is number in\n"
- "range 1000-10000000 specifying the baudrate in bits per second.\n"
- "\n"
- "### Description ###\n"
- "\n"
- "This command is used to set or show the baudrate of a CAN controller.\n"
- "The baudrate shown is the one which will be used by next invocation of\n"
- "the caninit command.\n"
- "The baudrate specified by the command is used to automatic calculation of\n"
- "the CAN controller timing. If you want to specify the timing manually,\n"
- "please use the command cantiming.\n"
- "The automatic calculation might not work properly for some baudrates. In\n"
- "this case you should calculate the timing manually and specify it by the\n"
- "command cantiming."
- "\n"
- "### Examples ###\n"
- "\n"
- " --> canbaudrate2?\n"
- " canbaudrate2=500000\n"
- "\n"
- " --> canbaudrate2:100000\n",
- CMD_HANDLER(cmd_do_can_change_baudrate), (void *)&cmd_list_can
+cmd_des_t const cmd_des_can_timing = {
+ 0, CDESM_OPCHR|CDESM_RW,
+ "cantiming#", "Change timing of CAN controller manually",
+ "### Command syntax ###\n"
+ "\n"
+ " cantiming<CONTROLLER>?\n"
+ " cantiming<CONTROLLER>:<BRP> <PROP_SEG> <PHASE_SEG1> <PHASE_SEG2> <SJW>\n"
+ "\n"
+ "where:"
+ " - `<CONTROLLER>` is number in range 1-3\n"
+ " - `<BRP>` (baudrate prescaler) is number in range 1-65\n"
+ " - `<PROP_SEG>` (length of propagation segment in tQ) is a number in range 1-8\n"
+ " - `<PHASE_SEG1>` (phase buffer segment 1 in tQ) is a number in range 1-8\n"
+ " - `<PHASE_SEG2>` (phase buffer segment 2 in tQ) is a number in range 1-8\n"
+ " - `<SJW>` (synchronization jump width in tQ) is a number in range 1-4\n"
+ "\n"
+ "### Description ###\n"
+ "\n"
+ "This command is used to set or show the timing of a CAN controller.\n"
+ "The timing shown is the one which will be used by next invocation of\n"
+ "the caninit command.\n"
+ "The timing configured by this command defines manually the baudrate of\n"
+ "the CAN controller. If you want to calculate the timing automaticaly from\n"
+ "a baudrate, please use the command canbaudrate.\n"
+ "\n"
+ "### Examples ###\n"
+ "\n"
+ " --> cantiming2?\n"
+ " brp: 17\n"
+ " prop_seg: 4 tQ\n"
+ " phase_seg1: 5 tQ\n"
+ " phase_seg2: 5 tQ\n"
+ " sjw: 4 tQ\n"
+ " sample_pt: 875 ns\n"
+ " error: 0\n"
+ " tQ: 125 ns\n"
+ "\n"
+ " --> cantiming2:5 8 7 4 1\n",
+ CMD_HANDLER(cmd_do_can_change_timing), (void *)&cmd_list_can
};
-cmd_des_t const cmd_des_can_timing={
- 0, CDESM_OPCHR|CDESM_RW,
- "cantiming#", "Change timing of CAN controller manually",
- "### Command syntax ###\n"
- "\n"
- " cantiming<CONTROLLER>?\n"
- " cantiming<CONTROLLER>:<BRP> <PROP_SEG> <PHASE_SEG1> <PHASE_SEG2> <SJW>\n"
- "\n"
- "where:"
- " - `<CONTROLLER>` is number in range 1-3\n"
- " - `<BRP>` (baudrate prescaler) is number in range 1-65\n"
- " - `<PROP_SEG>` (length of propagation segment in tQ) is a number in range 1-8\n"
- " - `<PHASE_SEG1>` (phase buffer segment 1 in tQ) is a number in range 1-8\n"
- " - `<PHASE_SEG2>` (phase buffer segment 2 in tQ) is a number in range 1-8\n"
- " - `<SJW>` (synchronization jump width in tQ) is a number in range 1-4\n"
- "\n"
- "### Description ###\n"
- "\n"
- "This command is used to set or show the timing of a CAN controller.\n"
- "The timing shown is the one which will be used by next invocation of\n"
- "the caninit command.\n"
- "The timing configured by this command defines manually the baudrate of\n"
- "the CAN controller. If you want to calculate the timing automaticaly from\n"
- "a baudrate, please use the command canbaudrate.\n"
- "\n"
- "### Examples ###\n"
- "\n"
- " --> cantiming2?\n"
- " brp: 17\n"
- " prop_seg: 4 tQ\n"
- " phase_seg1: 5 tQ\n"
- " phase_seg2: 5 tQ\n"
- " sjw: 4 tQ\n"
- " sample_pt: 875 ns\n"
- " error: 0\n"
- " tQ: 125 ns\n"
- "\n"
- " --> cantiming2:5 8 7 4 1\n",
- CMD_HANDLER(cmd_do_can_change_timing), (void *)&cmd_list_can
+
+cmd_des_t const cmd_des_can_send = {
+ 0, 0,
+ "cansend", "Test sending message over CAN",
+ "### Command syntax ###\n"
+ "\n"
+ " cansend <CONTROLLER> <ID> <DATA>\n"
+ "\n"
+ "where `<CONTROLLER>` is number in range 1-3, `<ID>` is a valid CAN ID\n"
+ "and `<DATA>` is 0-8 bytes of data in hexadecimal representation.\n"
+ "There may be any number of spaces between the data bytes.\n"
+ "`<ID>` may be given in octal, decimal or hexadecimal base.\n"
+ "\n"
+ "### Description ###\n"
+ "\n"
+ "This command sends a CAN frame using specified CAN controller.\n"
+ "\n"
+ "The caninit command must be called before using this command.\n"
+ "\n"
+ "### Example ###\n"
+ " --> cansend 2 0x123 DEAD BEEF\n"
+ " Sent: can2 123 [4] DE AD BE EF\n",
+ CMD_HANDLER(cmd_do_can_send), (void *)&cmd_list_can
};
-cmd_des_t const cmd_des_can_send={
+cmd_des_t const cmd_des_can_dump = {
+ 0, 0,
+ "candump", "Dump all messages received over CAN",
+ "### Command syntax ###\n"
+ "\n"
+ " candump <CONTROLLER>\n"
+ "\n"
+ "where `<CONTROLLER>` is a number in range 1-3.\n"
+ "\n"
+ "### Description ###\n"
+ "\n"
+ "This command prints out all CAN messages received via the specified\n"
+ "controller.\n"
+ "\n"
+ "IDs are zero-filled to length 3 if a message in the standard frame\n"
+ "format is received and to 8 for extended frame format messages.\n"
+ "\n"
+ "`caninit` must be called before using this command.\n"
+ "\n"
+ "### Example ###\n"
+ "\n"
+ " --> candump 2\n"
+ " can2 0000FADE [2] 12 34\n",
+ CMD_HANDLER(cmd_do_can_dump), (void *)&cmd_list_can
+};
+
+cmd_des_t const cmd_des_can_test={
0, 0,
- "cansend", "Test sending message over CAN",
+ "canrpptest", "Test the CAN functions from the RPP library",
"### Command syntax ###\n"
"\n"
- " cansend <CONTROLLER> <ID> <DATA>\n"
- "\n"
- "where `<CONTROLLER>` is number in range 1-3, `<ID>` is a valid CAN ID\n"
- "and `<DATA>` is 0-8 bytes of data in hexadecimal representation.\n"
- "There may be any number of spaces between the data bytes.\n"
- "`<ID>` may be given in octal, decimal or hexadecimal base.\n"
+ " canrpptest\n"
"\n"
"### Description ###\n"
"\n"
- "This command sends a CAN frame using specified CAN controller.\n"
+ "This command tests all CAN functions in the RPP library. It requires\n"
+ "the CAN1 and CAN2 connectors to be connected with HW loopback. The\n"
+ "following tests are performed:\n"
"\n"
- "The caninit command must be called before using this command.\n"
+ "1. Test of `rpp_can_init()`, `rpp_can_write()` and `rpp_can_read()` functions.\n"
"\n"
- "### Example ###\n"
- " --> cansend 2 0x123 DEAD BEEF\n"
- " Sent: can2 123 [4] DE AD BE EF\n",
- CMD_HANDLER(cmd_do_can_send), (void *)&cmd_list_can
-};
-
-
-cmd_des_t const cmd_des_can_dump={
- 0, 0,
- "candump", "Dump all messages received over CAN",
- "### Command syntax ###\n"
+ " At the beginning, the CAN bus is initialized with hardcoded (and\n"
+ " verified) verified CAN bit timing parameters. Then a message is\n"
+ " sent to the CAN1 interface and received from CAN2. The received\n"
+ " message is compared with the sent one. If the transmissions fails,\n"
+ " reception exceeds a timeout or the sent and received messages\n"
+ " differ, the command prints an appropriate error code.\n"
"\n"
- " candump <CONTROLLER>\n"
+ "2. Test of CAN bit timing parameters calculation.\n"
"\n"
- "where `<CONTROLLER>` is a number in range 1-3.\n"
+ " This test subsequently initializes the CAN controller to baudrates\n"
+ " 125k, 250k and 500k. For each one of them a message is sent to\n"
+ " CAN1 and received from CAN2. The received message is compared with\n"
+ " the sent one like in test 1. If the initialization, transmission,\n"
+ " reception or comparison fails or if the reception timeout is\n"
+ " reached, an appropriate error code is printed.\n"
"\n"
- "### Description ###\n"
+ "3. Test of the behavior of transmission request overwriting.\n"
"\n"
- "This command prints out all CAN messages received via the specified\n"
- "controller.\n"
+ " The CAN controller is initialized as in test 1. A transmission\n"
+ " request for message A is made on CAN1 by calling `rpp_can_write()`.\n"
+ " Right after that another transmission request for message B is\n"
+ " made on CAN1 by another call to `rpp_can_write()`. A message B is\n"
+ " received on CAN2, because the second request came so quickly, that\n"
+ " it overwrote message A in the TX buffer. The sent and received\n"
+ " messages are compared to verify that the behavior was correct.\n"
"\n"
- "IDs are zero-filled to length 3 if a message in the standard frame\n"
- "format is received and to 8 for extended frame format messages.\n"
+ " If the initialization, transmission, reception or comparison fails\n"
+ " or if the reception timeout is reached, an appropriate error code\n"
+ " is printed.\n"
"\n"
- "caninit must be called before using this command.\n"
+ "4. Test of the TX request pending flag detection.\n"
"\n"
- "### Example ###\n"
+ " The CAN bus is initialized like in test 1. A message is\n"
+ " transmitted on CAN1 and the test waits for the TX pending flag to\n"
+ " be set, which signalizes that there is a message transmission\n"
+ " request pending. After the flag has been set, the test waits for\n"
+ " its clearance, which means that the message has been sent. The\n"
+ " test measures, how many flag test cycles passed, until the flag\n"
+ " has been cleared. This value is then presented as time. At the\n"
+ " end, the message is received from CAN2 and it is compared with the\n"
+ " sent message for verification.\n"
"\n"
- " --> candump 2\n"
- "can2 0000FADE [2] 12 34\n",
- CMD_HANDLER(cmd_do_can_dump), (void *)&cmd_list_can
-};
-
-cmd_des_t const cmd_des_can_test={
- 0, 0,
- "canrpptest", "Test the CAN functions from the RPP library",
- "### Command syntax ###\n"
+ " If the initialization, transmission, reception or comparison fails or if\n"
+ " timeout is reached while waiting for the flag set/clear or receive timeout\n"
+ " is reached, an appropriate error code is printed.\n"
"\n"
- " canrpptest\n"
+ "5. Test of the message received (RX) indication.\n"
"\n"
- "### Description ###\n"
+ " The CAN bus is initialized like in test 1. A message is\n"
+ " transmitted on CAN1. The test then waits for the RX indication to\n"
+ " be set, which indicates that a message has been received. The\n"
+ " message is picked up by calling `rpp_can_read()`. This should\n"
+ " clear the indicator, which is tested. Finally the received\n"
+ " messages is compared with the sent one.\n"
"\n"
- "This command tests all CAN functions in the RPP library. It does those\n"
- "particular tests:\n"
+ " If the initialization, transmission, reception, message comparison or indicator\n"
+ " test fails or if timeout is reached while waiting for the flag set, the\n"
+ " appropriate error code is printed.\n"
"\n"
- "1) Test of the rpp_can_init(), rpp_can_write() and rpp_can_read() functions.\n"
- " At the beginning, the CAN bus is initialized with manually specified and\n"
- " verified CAN bit timing parameters. Then a message is sent on the CAN1 and is\n"
- " received on the CAN2. Finally the received message is compared with the sent one.\n"
- " If the transmissions fails, reception exceeds a timeout or the sent and\n"
- " received messages do not match, the command prints the appropriate error\n"
- " code."
- "2) Test of the CAN bit timing parameters calculation.\n"
- " This test subsequently initializes the CAN bus to a baudrates 125k, 250k\n"
- " and 500k. For each one of them a message is sent on CAN1 and received on CAN2.\n"
- " Finally the received message is compared with the sent one like in a test (1).\n"
- " If the initialization, transmission, reception or comparison fails or\n"
- " if the reception timeout is reached, an appropriate error code is printed.\n"
- "3) Test of the behavior of transmission request overwriting.\n"
- " The CAN bus is initialized like in the test (1). A message A transmission\n"
- " request is posted on CAN1 by calling rpp_can_write() and right after that\n"
- " another message B transmission request is posted on CAN1 by another call of\n"
- " the rpp_can_write(). A message B is received on CAN2, because the second request\n"
- " came so quickly, that it overwrote the first one. The sent and received messages\n"
- " are compared to verify that the transmission was correct.\n"
- " If the initialization, transmission, reception or comparison fails or\n"
- " if the reception timeout is reached, an appropriate error code is printed.\n"
- "4) Test of the TX request pending flag detection.\n"
- " The CAN bus is initialized like in the test (1). A message is transmitted\n"
- " on the CAN1 and the test waits for the TX pending flag to be set, which\n"
- " signalizes that there is a message transmission request pending. After the\n"
- " flag has been set, the test waits for its clearance, which means that the\n"
- " message has been sent. The test measures, how many flag test cycles passed,\n"
- " until the flag has been cleared. This value is then presented as a time.\n"
- " At the end, the message is received on the CAN2 and is compared with the\n"
- " sent message for verification.\n"
- " If the initialization, transmission, reception or comparison fails or if\n"
- " timeout is reached while waiting for the flag set/clear or receive timeout\n"
- " is reached, an appropriate error code is printed.\n"
- "5) Test of the message received (RX) indicator.\n"
- " The CAN bus is initialized like in the test (1). A message is transmitted\n"
- " on the CAN1. The test then waits for the RX indicator to be set, which\n"
- " indicates that a message has been received. The message is picked up by\n"
- " the rpp_can_read(). This should clear the indicator, which is tested. Finally\n"
- " the received messages is compared with the sent one.\n"
- " If the initialization, transmission, reception, message comparison or indicator\n"
- " test fails or if timeout is reached while waiting for the flag set, the\n"
- " appropriate error code is printed.\n"
+ "At the end the CAN bus is reset and left with the configuration from\n"
+ "test 1.\n"
"\n"
- "At the end the CAN bus is reset and left with the configuration from test (1).\n"
- "Those tests assumes the CAN1 and CAN2 to be connected in HW loopback.\n"
- "Any previous configuration is canceled, but is not deleted, so any following\n"
- "call of caninit command will restore the CAN bus to previous configuration.\n"
+ "The command can be called even after the CAN bus has been already\n"
+ "configured by previous invocation of the `caninit` command. The\n"
+ "previous timing configuration set by `cantiming#` command not\n"
+ "modified. Therefore, calling `caninit` after this command finishes\n"
+ "restores the previous timing settings.\n"
"\n"
- "For error codes description refer please the API documentation for the rpp-test-sw.\n"
+ "For error codes description please refer to the API documentation for\n"
+ "the rpp-test-sw.\n"
"\n"
"### Example ###\n"
"\n"
" --> canrpptest\n"
- "This is a test for RPP CAN library functions:"
- "Test of simple message transmission and reception."
- " CAN bus Initialization...OK"
- " Transmission and reception...OK"
- "---"
- "Test od automatic CAN bit timing calculation."
- " Baudrate: 125000: OK"
- " Baudrate: 250000: OK"
- " Baudrate: 500000: OK"
- "---"
- "Test of transmission request rewritting."
- " CAN bus Initialization...OK"
- " TX request rewritting...OK"
- "---"
- "Test of TX request pending flag detection."
- " CAN bus Initialization...OK"
- " TX request pending flag behavioral: OK, time: 256 cycles."
- "---"
- "Test of RX indicator."
- " CAN bus Initialization...OK"
- " RX indicator behavioral:"
- "OK, time: 0 cycles."
- "---"
- "Reset the CAN bus."
- " CAN bus Initialization...OK",
+ " This is a test for RPP CAN library functions:\n"
+ " Test of simple message transmission and reception.\n"
+ " CAN bus Initialization...OK\n"
+ " Transmission and reception...OK\n"
+ " ---\n"
+ " Test of automatic CAN bit timing calculation.\n"
+ " Baudrate: 125000: OK\n"
+ " Baudrate: 250000: OK\n"
+ " Baudrate: 500000: OK\n"
+ " ---\n"
+ " Test of transmission request rewritting.\n"
+ " CAN bus Initialization...OK\n"
+ " TX request rewritting...OK\n"
+ " ---\n"
+ " Test of TX request pending flag detection.\n"
+ " CAN bus Initialization...OK\n"
+ " TX request pending flag behavioral: OK, time: 256 cycles.\n"
+ " ---\n"
+ " Test of RX indicator.\n"
+ " CAN bus Initialization...OK\n"
+ " RX indicator behavioral:\n"
+ " OK, time: 0 cycles.\n"
+ " ---\n"
+ " Reset the CAN bus.\n"
+ " CAN bus Initialization...OK\n",
CMD_HANDLER(cmd_do_can_test_functions), (void *)&cmd_list_can
};
-cmd_des_t const *cmd_list_can[]={
- &cmd_des_can_init,
- &cmd_des_can_baudrate,
- &cmd_des_can_timing,
- &cmd_des_can_send,
- &cmd_des_can_dump,
- &cmd_des_can_test,
- NULL
+cmd_des_t const *cmd_list_can[] = {
+ &cmd_des_can_init,
+ &cmd_des_can_baudrate,
+ &cmd_des_can_timing,
+ &cmd_des_can_send,
+ &cmd_des_can_dump,
+ &cmd_des_can_test,
+ NULL
};