Lines Matching +full:device +full:- +full:id
5 * SPDX-License-Identifier: Apache-2.0
26 #include <zephyr/device.h>
53 * @brief Structure for storing date and time values with sub-second precision.
55 * @details The structure is 1-1 mapped to the struct tm for the members
67 int tm_year; /**< Year - 1900 */
68 int tm_wday; /**< Day of the week [0, 6] (Sunday = 0) (Unknown = -1) */
69 int tm_yday; /**< Day of the year [0, 365] (Unknown = -1) */
70 int tm_isdst; /**< Daylight saving time flag [-1] (Unknown = -1) */
78 * @param dev Device instance invoking the handler
81 typedef void (*rtc_update_callback)(const struct device *dev, void *user_data);
87 * @param dev Device instance invoking the handler
88 * @param id Alarm id
91 typedef void (*rtc_alarm_callback)(const struct device *dev, uint16_t id, void *user_data);
103 typedef int (*rtc_api_set_time)(const struct device *dev, const struct rtc_time *timeptr);
109 typedef int (*rtc_api_get_time)(const struct device *dev, struct rtc_time *timeptr);
115 typedef int (*rtc_api_alarm_get_supported_fields)(const struct device *dev, uint16_t id,
122 typedef int (*rtc_api_alarm_set_time)(const struct device *dev, uint16_t id, uint16_t mask,
129 typedef int (*rtc_api_alarm_get_time)(const struct device *dev, uint16_t id, uint16_t *mask,
136 typedef int (*rtc_api_alarm_is_pending)(const struct device *dev, uint16_t id);
142 typedef int (*rtc_api_alarm_set_callback)(const struct device *dev, uint16_t id,
149 typedef int (*rtc_api_update_set_callback)(const struct device *dev,
156 typedef int (*rtc_api_set_calibration)(const struct device *dev, int32_t calibration);
162 typedef int (*rtc_api_get_calibration)(const struct device *dev, int32_t *calibration);
191 * @param dev Device instance
195 * @return -EINVAL if RTC time is invalid or exceeds hardware capabilities
196 * @return -errno code if failure
198 __syscall int rtc_set_time(const struct device *dev, const struct rtc_time *timeptr);
200 static inline int z_impl_rtc_set_time(const struct device *dev, const struct rtc_time *timeptr) in z_impl_rtc_set_time()
202 return DEVICE_API_GET(rtc, dev)->set_time(dev, timeptr); in z_impl_rtc_set_time()
208 * @param dev Device instance
212 * @return -ENODATA if RTC time has not been set
213 * @return -errno code if failure
215 __syscall int rtc_get_time(const struct device *dev, struct rtc_time *timeptr);
217 static inline int z_impl_rtc_get_time(const struct device *dev, struct rtc_time *timeptr) in z_impl_rtc_get_time()
219 return DEVICE_API_GET(rtc, dev)->get_time(dev, timeptr); in z_impl_rtc_get_time()
231 * @param dev Device instance
232 * @param id Id of the alarm
238 * @return -EINVAL if id is out of range or time is invalid
239 * @return -ENOTSUP if API is not supported by hardware
240 * @return -errno code if failure
242 __syscall int rtc_alarm_get_supported_fields(const struct device *dev, uint16_t id,
245 static inline int z_impl_rtc_alarm_get_supported_fields(const struct device *dev, uint16_t id, in z_impl_rtc_alarm_get_supported_fields() argument
248 if (DEVICE_API_GET(rtc, dev)->alarm_get_supported_fields == NULL) { in z_impl_rtc_alarm_get_supported_fields()
249 return -ENOSYS; in z_impl_rtc_alarm_get_supported_fields()
252 return DEVICE_API_GET(rtc, dev)->alarm_get_supported_fields(dev, id, mask); in z_impl_rtc_alarm_get_supported_fields()
264 * @param dev Device instance
265 * @param id Id of the alarm
274 * @return -EINVAL if id is out of range or time is invalid
275 * @return -ENOTSUP if API is not supported by hardware
276 * @return -errno code if failure
278 __syscall int rtc_alarm_set_time(const struct device *dev, uint16_t id, uint16_t mask,
281 static inline int z_impl_rtc_alarm_set_time(const struct device *dev, uint16_t id, uint16_t mask, in z_impl_rtc_alarm_set_time() argument
284 if (DEVICE_API_GET(rtc, dev)->alarm_set_time == NULL) { in z_impl_rtc_alarm_set_time()
285 return -ENOSYS; in z_impl_rtc_alarm_set_time()
288 return DEVICE_API_GET(rtc, dev)->alarm_set_time(dev, id, mask, timeptr); in z_impl_rtc_alarm_set_time()
294 * @param dev Device instance
295 * @param id Id of the alarm
302 * @return -EINVAL if id is out of range
303 * @return -ENOTSUP if API is not supported by hardware
304 * @return -errno code if failure
306 __syscall int rtc_alarm_get_time(const struct device *dev, uint16_t id, uint16_t *mask,
309 static inline int z_impl_rtc_alarm_get_time(const struct device *dev, uint16_t id, uint16_t *mask, in z_impl_rtc_alarm_get_time() argument
312 if (DEVICE_API_GET(rtc, dev)->alarm_get_time == NULL) { in z_impl_rtc_alarm_get_time()
313 return -ENOSYS; in z_impl_rtc_alarm_get_time()
316 return DEVICE_API_GET(rtc, dev)->alarm_get_time(dev, id, mask, timeptr); in z_impl_rtc_alarm_get_time()
322 * @details Test whether or not the alarm with id is pending. If the alarm
325 * @param dev Device instance
326 * @param id Id of the alarm to test
330 * @return -EINVAL if id is out of range
331 * @return -ENOTSUP if API is not supported by hardware
332 * @return -errno code if failure
334 __syscall int rtc_alarm_is_pending(const struct device *dev, uint16_t id);
336 static inline int z_impl_rtc_alarm_is_pending(const struct device *dev, uint16_t id) in z_impl_rtc_alarm_is_pending() argument
338 if (DEVICE_API_GET(rtc, dev)->alarm_is_pending == NULL) { in z_impl_rtc_alarm_is_pending()
339 return -ENOSYS; in z_impl_rtc_alarm_is_pending()
342 return DEVICE_API_GET(rtc, dev)->alarm_is_pending(dev, id); in z_impl_rtc_alarm_is_pending()
361 * @param dev Device instance
362 * @param id Id of the alarm for which the callback shall be set
367 * @return -EINVAL if id is out of range
368 * @return -ENOTSUP if API is not supported by hardware
369 * @return -errno code if failure
371 __syscall int rtc_alarm_set_callback(const struct device *dev, uint16_t id,
374 static inline int z_impl_rtc_alarm_set_callback(const struct device *dev, uint16_t id, in z_impl_rtc_alarm_set_callback() argument
377 if (DEVICE_API_GET(rtc, dev)->alarm_set_callback == NULL) { in z_impl_rtc_alarm_set_callback()
378 return -ENOSYS; in z_impl_rtc_alarm_set_callback()
381 return DEVICE_API_GET(rtc, dev)->alarm_set_callback(dev, id, callback, user_data); in z_impl_rtc_alarm_set_callback()
406 * @param dev Device instance
411 * @return -ENOTSUP if API is not supported by hardware
412 * @return -errno code if failure
414 __syscall int rtc_update_set_callback(const struct device *dev, rtc_update_callback callback,
417 static inline int z_impl_rtc_update_set_callback(const struct device *dev, in z_impl_rtc_update_set_callback()
420 if (DEVICE_API_GET(rtc, dev)->update_set_callback == NULL) { in z_impl_rtc_update_set_callback()
421 return -ENOSYS; in z_impl_rtc_update_set_callback()
424 return DEVICE_API_GET(rtc, dev)->update_set_callback(dev, callback, user_data); in z_impl_rtc_update_set_callback()
448 * @param dev Device instance
452 * @return -EINVAL if calibration is out of range
453 * @return -ENOTSUP if API is not supported by hardware
454 * @return -errno code if failure
456 __syscall int rtc_set_calibration(const struct device *dev, int32_t calibration);
458 static inline int z_impl_rtc_set_calibration(const struct device *dev, int32_t calibration) in z_impl_rtc_set_calibration()
460 if (DEVICE_API_GET(rtc, dev)->set_calibration == NULL) { in z_impl_rtc_set_calibration()
461 return -ENOSYS; in z_impl_rtc_set_calibration()
464 return DEVICE_API_GET(rtc, dev)->set_calibration(dev, calibration); in z_impl_rtc_set_calibration()
470 * @param dev Device instance
474 * @return -ENOTSUP if API is not supported by hardware
475 * @return -errno code if failure
477 __syscall int rtc_get_calibration(const struct device *dev, int32_t *calibration);
479 static inline int z_impl_rtc_get_calibration(const struct device *dev, int32_t *calibration) in z_impl_rtc_get_calibration()
481 if (DEVICE_API_GET(rtc, dev)->get_calibration == NULL) { in z_impl_rtc_get_calibration()
482 return -ENOSYS; in z_impl_rtc_get_calibration()
485 return DEVICE_API_GET(rtc, dev)->get_calibration(dev, calibration); in z_impl_rtc_get_calibration()
523 return (int32_t)((1000000000000000000LL / frequency) - 1000000000); in rtc_calibration_from_frequency()