@@ -81,19 +81,37 @@ AM_ASSERT_STATIC(AM_TICK_DOMAIN_MAX < (1U << AM_EVENT_TICK_DOMAIN_BITS));
8181
8282/**
8383 * Timer constructor.
84+ *
8485 * @param cfg timer module configuration
8586 * The timer module makes an internal copy of the configuration.
8687 */
8788void am_timer_ctor (const struct am_timer_cfg * cfg );
8889
8990/**
9091 * Timer event constructor.
92+ *
9193 * @param event the timer event to construct
9294 * @param id the timer event identifier
9395 * @param domain tick domain the event belongs to
9496 */
9597void am_timer_event_ctor (struct am_event_timer * event , int id , int domain );
9698
99+ /**
100+ * Allocate and construct timer event.
101+ * Cannot fail. Cannot be freed. Never garbage collected.
102+ * The returned timer event is fully constructed.
103+ * No need to call am_timer_event_ctor() for it.
104+ * Provides an alternative way to reserve memory for timer events in
105+ * addition to the static allocation in user code.
106+ * Allocation of timer event using this API is preferred as it
107+ * improves cache locality of timer event structures.
108+ *
109+ * @param id the timer event id
110+ * @param size the timer event size [bytes]
111+ * @param domain the clock domain [0-AM_TICK_DOMAIN_MAX[
112+ */
113+ struct am_event_timer * am_timer_event_allocate (int id , int size , int domain );
114+
97115/**
98116 * Tick timer.
99117 *
@@ -120,6 +138,7 @@ void am_timer_arm(
120138
121139/**
122140 * Disarm timer.
141+ *
123142 * @param event the timer to disarm
124143 * @retval true the timer was armed
125144 * @retval false the timer was not armed
@@ -128,6 +147,7 @@ bool am_timer_disarm(struct am_event_timer *event);
128147
129148/**
130149 * Check if timer is armed.
150+ *
131151 * @param event the timer to check
132152 * @retval true the timer is armed
133153 * @retval false the timer is not armed
0 commit comments