drivers: can: rename API functions from timing_*_data to timing_data_*

Rename the CAN data phase API functions to timing_data_* for consistency:
- can_get_timing_min_data() -> can_get_timing_data_min()
- can_get_timing_max_data() -> can_get_timing_data_max()
- .timing_min_data -> timing_data_min
- .timing_max_data -> timing_data_max

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
Henrik Brix Andersen 2022-05-03 22:13:13 +02:00 committed by Carles Cufí
parent 18890828b8
commit 2f7c01ba21
8 changed files with 28 additions and 28 deletions

View file

@ -151,8 +151,8 @@ int z_impl_can_calc_timing(const struct device *dev, struct can_timing *res,
int z_impl_can_calc_timing_data(const struct device *dev, struct can_timing *res,
uint32_t bitrate, uint16_t sample_pnt)
{
const struct can_timing *min = can_get_timing_min_data(dev);
const struct can_timing *max = can_get_timing_max_data(dev);
const struct can_timing *min = can_get_timing_data_min(dev);
const struct can_timing *max = can_get_timing_data_max(dev);
uint32_t core_clock;
int ret;

View file

@ -90,21 +90,21 @@ static int z_vrfy_can_calc_timing_data(const struct device *dev, struct can_timi
}
#include <syscalls/can_calc_timing_data_mrsh.c>
static inline const struct can_timing *z_vrfy_can_get_timing_min_data(const struct device *dev)
static inline const struct can_timing *z_vrfy_can_get_timing_data_min(const struct device *dev)
{
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_CAN));
return z_impl_can_get_timing_min_data(dev);
return z_impl_can_get_timing_data_min(dev);
}
#include <syscalls/can_get_timing_min_data_mrsh.c>
#include <syscalls/can_get_timing_data_min_mrsh.c>
static inline const struct can_timing *z_vrfy_can_get_timing_max_data(const struct device *dev)
static inline const struct can_timing *z_vrfy_can_get_timing_data_max(const struct device *dev)
{
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_CAN));
return z_impl_can_get_timing_max_data(dev);
return z_impl_can_get_timing_data_max(dev);
}
#include <syscalls/can_get_timing_max_data_mrsh.c>
#include <syscalls/can_get_timing_data_max_mrsh.c>
static inline int z_vrfy_can_set_timing_data(const struct device *dev,
const struct can_timing *timing_data)

View file

@ -103,14 +103,14 @@ static const struct can_driver_api mcux_mcan_driver_api = {
* the register field limits are physical values minus 1 (which is
* handled by the register assignments in the common MCAN driver code).
*/
.timing_min_data = {
.timing_data_min = {
.sjw = 1,
.prop_seg = 0,
.phase_seg1 = 1,
.phase_seg2 = 1,
.prescaler = 1,
},
.timing_max_data = {
.timing_data_max = {
.sjw = 16,
.prop_seg = 0,
.phase_seg1 = 16,

View file

@ -99,14 +99,14 @@ static const struct can_driver_api can_sam_driver_api = {
},
#ifdef CONFIG_CAN_FD_MODE
.set_timing_data = can_mcan_set_timing_data,
.timing_min_data = {
.timing_data_min = {
.sjw = 0x01,
.prop_seg = 0x00,
.phase_seg1 = 0x01,
.phase_seg2 = 0x01,
.prescaler = 0x01
},
.timing_max_data = {
.timing_data_max = {
.sjw = 0x10,
.prop_seg = 0x00,
.phase_seg1 = 0x20,

View file

@ -138,14 +138,14 @@ static const struct can_driver_api can_stm32fd_driver_api = {
},
#ifdef CONFIG_CAN_FD_MODE
.set_timing_data = can_mcan_set_timing_data,
.timing_min_data = {
.timing_data_min = {
.sjw = 0x01,
.prop_seg = 0x00,
.phase_seg1 = 0x01,
.phase_seg2 = 0x01,
.prescaler = 0x01
},
.timing_max_data = {
.timing_data_max = {
.sjw = 0x10,
.prop_seg = 0x00,
.phase_seg1 = 0x20,

View file

@ -132,14 +132,14 @@ static const struct can_driver_api can_stm32h7_driver_api = {
* (RM0433 Rev 7), section 56.5.3, FDCAN data bit timing and prescaler
* register (FDCAN_DBTP).
*/
.timing_min_data = {
.timing_data_min = {
.sjw = 0x00,
.prop_seg = 0x00,
.phase_seg1 = 0x00,
.phase_seg2 = 0x00,
.prescaler = 0x00
},
.timing_max_data = {
.timing_data_max = {
.sjw = 0x10,
.prop_seg = 0x00,
.phase_seg1 = 0x20,

View file

@ -396,9 +396,9 @@ __subsystem struct can_driver_api {
#if defined(CONFIG_CAN_FD_MODE) || defined(__DOXYGEN__)
can_set_timing_data_t set_timing_data;
/* Min values for the timing registers during the data phase */
struct can_timing timing_min_data;
struct can_timing timing_data_min;
/* Max values for the timing registers during the data phase */
struct can_timing timing_max_data;
struct can_timing timing_data_max;
#endif /* CONFIG_CAN_FD_MODE */
};
@ -724,13 +724,13 @@ __syscall int can_calc_timing(const struct device *dev, struct can_timing *res,
* @return Pointer to the minimum supported timing parameter values, or NULL if
* CAN-FD is not supported.
*/
__syscall const struct can_timing *can_get_timing_min_data(const struct device *dev);
__syscall const struct can_timing *can_get_timing_data_min(const struct device *dev);
static inline const struct can_timing *z_impl_can_get_timing_min_data(const struct device *dev)
static inline const struct can_timing *z_impl_can_get_timing_data_min(const struct device *dev)
{
const struct can_driver_api *api = (const struct can_driver_api *)dev->api;
return &api->timing_min_data;
return &api->timing_data_min;
}
/**
@ -746,13 +746,13 @@ static inline const struct can_timing *z_impl_can_get_timing_min_data(const stru
* @return Pointer to the maximum supported timing parameter values, or NULL if
* CAN-FD is not supported.
*/
__syscall const struct can_timing *can_get_timing_max_data(const struct device *dev);
__syscall const struct can_timing *can_get_timing_data_max(const struct device *dev);
static inline const struct can_timing *z_impl_can_get_timing_max_data(const struct device *dev)
static inline const struct can_timing *z_impl_can_get_timing_data_max(const struct device *dev)
{
const struct can_driver_api *api = (const struct can_driver_api *)dev->api;
return &api->timing_max_data;
return &api->timing_data_max;
}
/**

View file

@ -175,8 +175,8 @@ static void test_timing_values(const struct device *dev, const struct can_timing
if (data_phase) {
if (IS_ENABLED(CONFIG_CAN_FD_MODE)) {
min = can_get_timing_min_data(dev);
max = can_get_timing_max_data(dev);
min = can_get_timing_data_min(dev);
max = can_get_timing_data_max(dev);
sp_err = can_calc_timing_data(dev, &timing, test->bitrate, test->sp);
} else {
zassert_unreachable("data phase timing test without CAN-FD support");
@ -258,7 +258,7 @@ void test_set_timing_min(void)
zassert_equal(err, 0, "failed to set minimum timing parameters (err %d)", err);
if (IS_ENABLED(CONFIG_CAN_FD_MODE)) {
err = can_set_timing_data(dev, can_get_timing_min_data(dev));
err = can_set_timing_data(dev, can_get_timing_data_min(dev));
zassert_equal(err, 0, "failed to set minimum timing data parameters (err %d)", err);
}
}
@ -275,7 +275,7 @@ void test_set_timing_max(void)
zassert_equal(err, 0, "failed to set maximum timing parameters (err %d)", err);
if (IS_ENABLED(CONFIG_CAN_FD_MODE)) {
err = can_set_timing_data(dev, can_get_timing_max_data(dev));
err = can_set_timing_data(dev, can_get_timing_data_max(dev));
zassert_equal(err, 0, "failed to set maximum timing data parameters (err %d)", err);
}
}