Skip to content

Commit 1004901

Browse files
henrikbrixandersennashif
authored andcommitted
drivers: can: exclude deprecated APIs from the documentation
Move the deprecated CAN APIs to the bottom of the include file and exclude them from the documentation. Signed-off-by: Henrik Brix Andersen <[email protected]>
1 parent f499559 commit 1004901

File tree

1 file changed

+69
-62
lines changed

1 file changed

+69
-62
lines changed

include/drivers/can.h

Lines changed: 69 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -84,40 +84,6 @@ extern "C" {
8484

8585
/** @} */
8686

87-
/**
88-
* @name CAN specific error codes
89-
*
90-
* The `CAN_TX_*` error codes are used for CAN specific error return codes from
91-
* @a can_send() and for `error_flags` values in @a can_tx_callback_t().
92-
*
93-
* `CAN_NO_FREE_FILTER` is returned by `can_attach_*()` if no free filters are
94-
* available. `CAN_TIMEOUT` indicates that @a can_recover() timed out.
95-
*
96-
* @warning These definitions are deprecated. Use the corresponding errno
97-
* definitions instead.
98-
*
99-
* @{
100-
*/
101-
102-
/** Transmitted successfully. */
103-
#define CAN_TX_OK (0) __DEPRECATED_MACRO
104-
/** General transmit error. */
105-
#define CAN_TX_ERR (-EIO) __DEPRECATED_MACRO
106-
/** Bus arbitration lost during transmission. */
107-
#define CAN_TX_ARB_LOST (-EBUSY) __DEPRECATED_MACRO
108-
/** CAN controller is in bus off state. */
109-
#define CAN_TX_BUS_OFF (-ENETDOWN) __DEPRECATED_MACRO
110-
/** Unknown error. */
111-
#define CAN_TX_UNKNOWN (CAN_TX_ERR) __DEPRECATED_MACRO
112-
/** Invalid parameter. */
113-
#define CAN_TX_EINVAL (-EINVAL) __DEPRECATED_MACRO
114-
/** No free filters available. */
115-
#define CAN_NO_FREE_FILTER (-ENOSPC) __DEPRECATED_MACRO
116-
/** Operation timed out. */
117-
#define CAN_TIMEOUT (-EAGAIN) __DEPRECATED_MACRO
118-
119-
/** @} */
120-
12187
/**
12288
* @brief Defines the mode of the CAN controller
12389
*/
@@ -648,34 +614,6 @@ static inline int can_set_bitrate(const struct device *dev,
648614
#endif /* !CONFIG_CAN_FD_MODE */
649615
}
650616

651-
/**
652-
* @brief Configure operation of a host controller.
653-
*
654-
* @warning This function is deprecated. Use @a can_set_bitrate() and @a
655-
* can_set_mode() instead.
656-
*
657-
* @param dev Pointer to the device structure for the driver instance.
658-
* @param mode Operation mode.
659-
* @param bitrate bus-speed in Baud/s.
660-
*
661-
* @retval 0 If successful.
662-
* @retval -EIO General input/output error, failed to configure device.
663-
*/
664-
__deprecated static inline int can_configure(const struct device *dev, enum can_mode mode,
665-
uint32_t bitrate)
666-
{
667-
int err;
668-
669-
if (bitrate > 0) {
670-
err = can_set_bitrate(dev, bitrate, bitrate);
671-
if (err != 0) {
672-
return err;
673-
}
674-
}
675-
676-
return can_set_mode(dev, mode);
677-
}
678-
679617
/** @} */
680618

681619
/**
@@ -1162,6 +1100,75 @@ static inline void can_copy_zfilter_to_filter(const struct zcan_filter *zfilter,
11621100

11631101
/** @} */
11641102

1103+
/**
1104+
* @cond INTERNAL_HIDDEN
1105+
* Deprecated APIs
1106+
*/
1107+
1108+
/**
1109+
* @name CAN specific error codes
1110+
*
1111+
* The `CAN_TX_*` error codes are used for CAN specific error return codes from
1112+
* @a can_send() and for `error_flags` values in @a can_tx_callback_t().
1113+
*
1114+
* `CAN_NO_FREE_FILTER` is returned by `can_attach_*()` if no free filters are
1115+
* available. `CAN_TIMEOUT` indicates that @a can_recover() timed out.
1116+
*
1117+
* @warning These definitions are deprecated. Use the corresponding errno
1118+
* definitions instead.
1119+
*
1120+
* @{
1121+
*/
1122+
1123+
/** Transmitted successfully. */
1124+
#define CAN_TX_OK (0) __DEPRECATED_MACRO
1125+
/** General transmit error. */
1126+
#define CAN_TX_ERR (-EIO) __DEPRECATED_MACRO
1127+
/** Bus arbitration lost during transmission. */
1128+
#define CAN_TX_ARB_LOST (-EBUSY) __DEPRECATED_MACRO
1129+
/** CAN controller is in bus off state. */
1130+
#define CAN_TX_BUS_OFF (-ENETDOWN) __DEPRECATED_MACRO
1131+
/** Unknown error. */
1132+
#define CAN_TX_UNKNOWN (CAN_TX_ERR) __DEPRECATED_MACRO
1133+
/** Invalid parameter. */
1134+
#define CAN_TX_EINVAL (-EINVAL) __DEPRECATED_MACRO
1135+
/** No free filters available. */
1136+
#define CAN_NO_FREE_FILTER (-ENOSPC) __DEPRECATED_MACRO
1137+
/** Operation timed out. */
1138+
#define CAN_TIMEOUT (-EAGAIN) __DEPRECATED_MACRO
1139+
1140+
/** @} */
1141+
1142+
/**
1143+
* @brief Configure operation of a host controller.
1144+
*
1145+
* @warning This function is deprecated. Use @a can_set_bitrate() and @a
1146+
* can_set_mode() instead.
1147+
*
1148+
* @param dev Pointer to the device structure for the driver instance.
1149+
* @param mode Operation mode.
1150+
* @param bitrate bus-speed in Baud/s.
1151+
*
1152+
* @retval 0 If successful.
1153+
* @retval -EIO General input/output error, failed to configure device.
1154+
*/
1155+
__deprecated static inline int can_configure(const struct device *dev, enum can_mode mode,
1156+
uint32_t bitrate)
1157+
{
1158+
int err;
1159+
1160+
if (bitrate > 0) {
1161+
err = can_set_bitrate(dev, bitrate, bitrate);
1162+
if (err != 0) {
1163+
return err;
1164+
}
1165+
}
1166+
1167+
return can_set_mode(dev, mode);
1168+
}
1169+
1170+
/** @endcond */
1171+
11651172
/**
11661173
* @}
11671174
*/

0 commit comments

Comments
 (0)