Skip to content

Commit e39bf29

Browse files
Andy Rossnashif
authored andcommitted
kernel/timeout: Doc cleanup
Add a doc string for k_timeout_t. Rephrase a few other items for clarity. Fix some syntax goofs. Signed-off-by: Andy Ross <[email protected]>
1 parent 914205c commit e39bf29

File tree

2 files changed

+29
-16
lines changed

2 files changed

+29
-16
lines changed

include/kernel.h

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ extern k_ticks_t z_timeout_remaining(struct _timeout *timeout);
10601060
#ifdef CONFIG_SYS_CLOCK_EXISTS
10611061

10621062
/**
1063-
* @brief Get time when a thread wakes up, in ticks
1063+
* @brief Get time when a thread wakes up, in system ticks
10641064
*
10651065
* This routine computes the system uptime when a waiting thread next
10661066
* executes, in units of system ticks. If the thread is not waiting,
@@ -1075,7 +1075,7 @@ static inline k_ticks_t z_impl_k_thread_timeout_expires_ticks(
10751075
}
10761076

10771077
/**
1078-
* @brief Get time remaining before a thread wakes up, in ticks
1078+
* @brief Get time remaining before a thread wakes up, in system ticks
10791079
*
10801080
* This routine computes the time remaining before a waiting thread
10811081
* next executes, in units of system ticks. If the thread is not
@@ -1593,7 +1593,7 @@ const char *k_thread_state_str(k_tid_t thread_id);
15931593
* Note that timer precision is limited to the tick rate, not the
15941594
* requested value.
15951595
*
1596-
* @paramt Duration in nanoseconds.
1596+
* @param t Duration in nanoseconds.
15971597
*
15981598
* @return Timeout delay value.
15991599
*/
@@ -1607,7 +1607,7 @@ const char *k_thread_state_str(k_tid_t thread_id);
16071607
* Note that timer precision is limited to the tick rate, not the
16081608
* requested value.
16091609
*
1610-
* @paramt Duration in microseconds.
1610+
* @param t Duration in microseconds.
16111611
*
16121612
* @return Timeout delay value.
16131613
*/
@@ -1619,7 +1619,7 @@ const char *k_thread_state_str(k_tid_t thread_id);
16191619
* This macro generates a timeout delay that instructs a kernel API
16201620
* to wait up to @a t cycles to perform the requested operation.
16211621
*
1622-
* @paramt Duration in cycles.
1622+
* @param t Duration in cycles.
16231623
*
16241624
* @return Timeout delay value.
16251625
*/
@@ -1631,7 +1631,7 @@ const char *k_thread_state_str(k_tid_t thread_id);
16311631
* This macro generates a timeout delay that instructs a kernel API
16321632
* to wait up to @a t ticks to perform the requested operation.
16331633
*
1634-
* @paramt Duration in system ticks.
1634+
* @param t Duration in system ticks.
16351635
*
16361636
* @return Timeout delay value.
16371637
*/
@@ -1698,10 +1698,10 @@ const char *k_thread_state_str(k_tid_t thread_id);
16981698
#ifdef CONFIG_TIMEOUT_64BIT
16991699

17001700
/**
1701-
* @brief Generates an absolute/uptime timeout value in ticks
1701+
* @brief Generates an absolute/uptime timeout value from system ticks
17021702
*
17031703
* This macro generates a timeout delay that represents an expiration
1704-
* at the absolute uptime value specified, in ticks. That is, the
1704+
* at the absolute uptime value specified, in system ticks. That is, the
17051705
* timeout will expire immediately after the system uptime reaches the
17061706
* specified tick count.
17071707
*
@@ -1711,7 +1711,7 @@ const char *k_thread_state_str(k_tid_t thread_id);
17111711
#define K_TIMEOUT_ABS_TICKS(t) Z_TIMEOUT_TICKS(Z_TICK_ABS(MAX(t, 0)))
17121712

17131713
/**
1714-
* @brief Generates an absolute/uptime timeout value in ms
1714+
* @brief Generates an absolute/uptime timeout value from milliseconds
17151715
*
17161716
* This macro generates a timeout delay that represents an expiration
17171717
* at the absolute uptime value specified, in milliseconds. That is,
@@ -1724,7 +1724,7 @@ const char *k_thread_state_str(k_tid_t thread_id);
17241724
#define K_TIMEOUT_ABS_MS(t) K_TIMEOUT_ABS_TICKS(k_ms_to_ticks_ceil64(t))
17251725

17261726
/**
1727-
* @brief Generates an absolute/uptime timeout value in us
1727+
* @brief Generates an absolute/uptime timeout value from microseconds
17281728
*
17291729
* This macro generates a timeout delay that represents an expiration
17301730
* at the absolute uptime value specified, in microseconds. That is,
@@ -1738,7 +1738,7 @@ const char *k_thread_state_str(k_tid_t thread_id);
17381738
#define K_TIMEOUT_ABS_US(t) K_TIMEOUT_ABS_TICKS(k_us_to_ticks_ceil64(t))
17391739

17401740
/**
1741-
* @brief Generates an absolute/uptime timeout value in ns
1741+
* @brief Generates an absolute/uptime timeout value from nanoseconds
17421742
*
17431743
* This macro generates a timeout delay that represents an expiration
17441744
* at the absolute uptime value specified, in nanoseconds. That is,
@@ -1752,7 +1752,7 @@ const char *k_thread_state_str(k_tid_t thread_id);
17521752
#define K_TIMEOUT_ABS_NS(t) K_TIMEOUT_ABS_TICKS(k_ns_to_ticks_ceil64(t))
17531753

17541754
/**
1755-
* @brief Generates an absolute/uptime timeout value in cycles
1755+
* @brief Generates an absolute/uptime timeout value from system cycles
17561756
*
17571757
* This macro generates a timeout delay that represents an expiration
17581758
* at the absolute uptime value specified, in cycles. That is, the
@@ -1964,7 +1964,7 @@ __syscall u32_t k_timer_status_sync(struct k_timer *timer);
19641964
#ifdef CONFIG_SYS_CLOCK_EXISTS
19651965

19661966
/**
1967-
* @brief Get next expiration time of a timer, in ticks
1967+
* @brief Get next expiration time of a timer, in system ticks
19681968
*
19691969
* This routine returns the future system uptime reached at the next
19701970
* time of expiration of the timer, in units of system ticks. If the
@@ -1981,7 +1981,7 @@ static inline k_ticks_t z_impl_k_timer_expires_ticks(struct k_timer *timer)
19811981
}
19821982

19831983
/**
1984-
* @brief Get time remaining before a timer next expires, in ticks
1984+
* @brief Get time remaining before a timer next expires, in system ticks
19851985
*
19861986
* This routine computes the time remaining before a running timer
19871987
* next expires, in units of system ticks. If the timer is not
@@ -2058,7 +2058,7 @@ static inline void *z_impl_k_timer_user_data_get(struct k_timer *timer)
20582058
*/
20592059

20602060
/**
2061-
* @brief Get system uptime, in ticks.
2061+
* @brief Get system uptime, in system ticks.
20622062
*
20632063
* This routine returns the elapsed time since the system booted, in
20642064
* ticks (c.f. :option:`CONFIG_SYS_CLOCK_TICKS_PER_SEC`), which is the
@@ -3479,7 +3479,8 @@ static inline k_ticks_t k_delayed_work_expires_ticks(
34793479
}
34803480

34813481
/**
3482-
* @brief Get time remaining before a delayed work gets scheduled, in ticks
3482+
* @brief Get time remaining before a delayed work gets scheduled, in
3483+
* system ticks
34833484
*
34843485
* This routine computes the time remaining before a delayed work gets
34853486
* executed. If the delayed work is not waiting to be scheduled, it

include/sys_clock.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@ typedef u32_t k_ticks_t;
5252

5353
#ifndef CONFIG_LEGACY_TIMEOUT_API
5454

55+
/**
56+
* @brief Kernel timeout type
57+
*
58+
* Timeout arguments presented to kernel APIs are stored in this
59+
* opaque type, which is capable of representing times in various
60+
* formats and units. It should be constructed from application data
61+
* using one of the macros defined for this purpose (e.g. `K_MSEC()`,
62+
* `K_TIMEOUT_ABS_TICKS()`, etc...), or be one of the two constants
63+
* K_NO_WAIT or K_FOREVER. Applications should not inspect the
64+
* internal data once constructed. Timeout values may be compared for
65+
* equality with the `K_TIMEOUT_EQ()` macro.
66+
*/
5567
typedef struct {
5668
k_ticks_t ticks;
5769
} k_timeout_t;

0 commit comments

Comments
 (0)