Skip to content

Commit a619fe7

Browse files
henrikbrixandersenkartben
authored andcommitted
drivers: can: remove the deprecated can_calc_prescaler() API function
Remove the deprecated can_calc_prescaler() CAN API function. Signed-off-by: Henrik Brix Andersen <[email protected]>
1 parent 424988b commit a619fe7

File tree

2 files changed

+0
-41
lines changed

2 files changed

+0
-41
lines changed

drivers/can/can_common.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -343,24 +343,6 @@ int z_impl_can_calc_timing_data(const struct device *dev, struct can_timing *res
343343
}
344344
#endif /* CONFIG_CAN_FD_MODE */
345345

346-
int can_calc_prescaler(const struct device *dev, struct can_timing *timing,
347-
uint32_t bitrate)
348-
{
349-
uint32_t ts = timing->prop_seg + timing->phase_seg1 + timing->phase_seg2 +
350-
CAN_SYNC_SEG;
351-
uint32_t core_clock;
352-
int ret;
353-
354-
ret = can_get_core_clock(dev, &core_clock);
355-
if (ret != 0) {
356-
return ret;
357-
}
358-
359-
timing->prescaler = core_clock / (bitrate * ts);
360-
361-
return core_clock % (ts * timing->prescaler);
362-
}
363-
364346
static int check_timing_in_range(const struct can_timing *timing,
365347
const struct can_timing *min,
366348
const struct can_timing *max)

include/zephyr/drivers/can.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,29 +1053,6 @@ __syscall int can_set_timing_data(const struct device *dev,
10531053
*/
10541054
__syscall int can_set_bitrate_data(const struct device *dev, uint32_t bitrate_data);
10551055

1056-
/**
1057-
* @brief Fill in the prescaler value for a given bitrate and timing
1058-
*
1059-
* Fill the prescaler value in the timing struct. The sjw, prop_seg, phase_seg1
1060-
* and phase_seg2 must be given.
1061-
*
1062-
* The returned bitrate error is remainder of the division of the clock rate by
1063-
* the bitrate times the timing segments.
1064-
*
1065-
* @deprecated This function allows for bitrate errors, but bitrate errors between nodes on the same
1066-
* network leads to them drifting apart after the start-of-frame (SOF) synchronization
1067-
* has taken place.
1068-
*
1069-
* @param dev Pointer to the device structure for the driver instance.
1070-
* @param timing Result is written into the can_timing struct provided.
1071-
* @param bitrate Target bitrate.
1072-
*
1073-
* @retval 0 or positive bitrate error.
1074-
* @retval Negative error code on error.
1075-
*/
1076-
__deprecated int can_calc_prescaler(const struct device *dev, struct can_timing *timing,
1077-
uint32_t bitrate);
1078-
10791056
/**
10801057
* @brief Configure the bus timing of a CAN controller.
10811058
*

0 commit comments

Comments
 (0)