From bb6daf9fb72ae0235f6c4657c239f8d075512c24 Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Wed, 22 Jun 2022 12:05:26 +0900 Subject: [PATCH] timer: enums: rename to ALSATimer.RealTimeEventType The set of events is used only for ALSATimer.RealTimeEvent. Signed-off-by: Takashi Sakamoto --- samples/timer | 16 ++++---- src/timer/alsatimer-enum-types.h | 66 ++++++++++++++++---------------- src/timer/alsatimer.map | 2 +- src/timer/instance-params.c | 20 +++++----- src/timer/instance-params.h | 4 +- src/timer/real-time-event.c | 12 +++--- src/timer/real-time-event.h | 2 +- tests/alsatimer-enums | 4 +- 8 files changed, 63 insertions(+), 63 deletions(-) diff --git a/samples/timer b/samples/timer index 71af177..5fe472f 100755 --- a/samples/timer +++ b/samples/timer @@ -62,14 +62,14 @@ params.set_property('flags', flags) ticks = 500 * 1000 * 1000 // resolution # 500msec params.set_property('interval', ticks) params.set_property('queue-size', 64) -events = (ALSATimer.TstampEventType.RESOLUTION, - ALSATimer.TstampEventType.TICK, - ALSATimer.TstampEventType.START, - ALSATimer.TstampEventType.STOP, - ALSATimer.TstampEventType.CONTINUE, - ALSATimer.TstampEventType.PAUSE, - ALSATimer.TstampEventType.SUSPEND, - ALSATimer.TstampEventType.RESUME) +events = (ALSATimer.RealTimeEventType.RESOLUTION, + ALSATimer.RealTimeEventType.TICK, + ALSATimer.RealTimeEventType.START, + ALSATimer.RealTimeEventType.STOP, + ALSATimer.RealTimeEventType.CONTINUE, + ALSATimer.RealTimeEventType.PAUSE, + ALSATimer.RealTimeEventType.SUSPEND, + ALSATimer.RealTimeEventType.RESUME) params.set_event_filter(events) _, params = instance.set_params(params) diff --git a/src/timer/alsatimer-enum-types.h b/src/timer/alsatimer-enum-types.h index 80be895..83c6da2 100644 --- a/src/timer/alsatimer-enum-types.h +++ b/src/timer/alsatimer-enum-types.h @@ -73,43 +73,43 @@ typedef enum /*< flags >*/ } ALSATimerInstanceParamFlag; /** - * ALSATimerTstampEventType: - * @ALSATIMER_TSTAMP_EVENT_TYPE_RESOLUTION: The event for timer resolution. - * @ALSATIMER_TSTAMP_EVENT_TYPE_TICK: The event for timer tick. - * @ALSATIMER_TSTAMP_EVENT_TYPE_START: The event for timer start. - * @ALSATIMER_TSTAMP_EVENT_TYPE_STOP: The event for timer stop. - * @ALSATIMER_TSTAMP_EVENT_TYPE_CONTINUE: The event for timer continue. - * @ALSATIMER_TSTAMP_EVENT_TYPE_PAUSE: The event for timer pause. - * @ALSATIMER_TSTAMP_EVENT_TYPE_EARLY: The event before timer start. - * @ALSATIMER_TSTAMP_EVENT_TYPE_SUSPEND: The event for timer suspend. - * @ALSATIMER_TSTAMP_EVENT_TYPE_RESUME: The event for timer resume. - * @ALSATIMER_TSTAMP_EVENT_TYPE_MSTART: The event for master timer start. - * @ALSATIMER_TSTAMP_EVENT_TYPE_MSTOP: The event for master timer stop. - * @ALSATIMER_TSTAMP_EVENT_TYPE_MCONTINUE: The event for master timer continue. - * @ALSATIMER_TSTAMP_EVENT_TYPE_MPAUSE: The event for master timer pause. - * @ALSATIMER_TSTAMP_EVENT_TYPE_MSUSPEND: The event for master timer suspend. - * @ALSATIMER_TSTAMP_EVENT_TYPE_MRESUME: The event for master timer resume. + * ALSATimerRealTimeEventType: + * @ALSATIMER_REAL_TIME_EVENT_TYPE_RESOLUTION: The event for timer resolution. + * @ALSATIMER_REAL_TIME_EVENT_TYPE_TICK: The event for timer tick. + * @ALSATIMER_REAL_TIME_EVENT_TYPE_START: The event for timer start. + * @ALSATIMER_REAL_TIME_EVENT_TYPE_STOP: The event for timer stop. + * @ALSATIMER_REAL_TIME_EVENT_TYPE_CONTINUE: The event for timer continue. + * @ALSATIMER_REAL_TIME_EVENT_TYPE_PAUSE: The event for timer pause. + * @ALSATIMER_REAL_TIME_EVENT_TYPE_EARLY: The event before timer start. + * @ALSATIMER_REAL_TIME_EVENT_TYPE_SUSPEND: The event for timer suspend. + * @ALSATIMER_REAL_TIME_EVENT_TYPE_RESUME: The event for timer resume. + * @ALSATIMER_REAL_TIME_EVENT_TYPE_MSTART: The event for master timer start. + * @ALSATIMER_REAL_TIME_EVENT_TYPE_MSTOP: The event for master timer stop. + * @ALSATIMER_REAL_TIME_EVENT_TYPE_MCONTINUE: The event for master timer continue. + * @ALSATIMER_REAL_TIME_EVENT_TYPE_MPAUSE: The event for master timer pause. + * @ALSATIMER_REAL_TIME_EVENT_TYPE_MSUSPEND: The event for master timer suspend. + * @ALSATIMER_REAL_TIME_EVENT_TYPE_MRESUME: The event for master timer resume. * - * A set of enumerations for the type of timestamp event. + * A set of enumerations for the type of real time event. */ typedef enum { - ALSATIMER_TSTAMP_EVENT_TYPE_RESOLUTION = SNDRV_TIMER_EVENT_RESOLUTION, - ALSATIMER_TSTAMP_EVENT_TYPE_TICK = SNDRV_TIMER_EVENT_TICK, - ALSATIMER_TSTAMP_EVENT_TYPE_START = SNDRV_TIMER_EVENT_START, - ALSATIMER_TSTAMP_EVENT_TYPE_STOP = SNDRV_TIMER_EVENT_STOP, - ALSATIMER_TSTAMP_EVENT_TYPE_CONTINUE = SNDRV_TIMER_EVENT_CONTINUE, - ALSATIMER_TSTAMP_EVENT_TYPE_PAUSE = SNDRV_TIMER_EVENT_PAUSE, - ALSATIMER_TSTAMP_EVENT_TYPE_EARLY = SNDRV_TIMER_EVENT_EARLY, - ALSATIMER_TSTAMP_EVENT_TYPE_SUSPEND = SNDRV_TIMER_EVENT_SUSPEND, - ALSATIMER_TSTAMP_EVENT_TYPE_RESUME = SNDRV_TIMER_EVENT_RESUME, - ALSATIMER_TSTAMP_EVENT_TYPE_MSTART = SNDRV_TIMER_EVENT_MSTART, - ALSATIMER_TSTAMP_EVENT_TYPE_MSTOP = SNDRV_TIMER_EVENT_MSTOP, - ALSATIMER_TSTAMP_EVENT_TYPE_MCONTINUE = SNDRV_TIMER_EVENT_MCONTINUE, - ALSATIMER_TSTAMP_EVENT_TYPE_MPAUSE = SNDRV_TIMER_EVENT_MPAUSE, - ALSATIMER_TSTAMP_EVENT_TYPE_MSUSPEND = SNDRV_TIMER_EVENT_MSUSPEND, - ALSATIMER_TSTAMP_EVENT_TYPE_MRESUME = SNDRV_TIMER_EVENT_MRESUME, -} ALSATimerTstampEventType; + ALSATIMER_REAL_TIME_EVENT_TYPE_RESOLUTION = SNDRV_TIMER_EVENT_RESOLUTION, + ALSATIMER_REAL_TIME_EVENT_TYPE_TICK = SNDRV_TIMER_EVENT_TICK, + ALSATIMER_REAL_TIME_EVENT_TYPE_START = SNDRV_TIMER_EVENT_START, + ALSATIMER_REAL_TIME_EVENT_TYPE_STOP = SNDRV_TIMER_EVENT_STOP, + ALSATIMER_REAL_TIME_EVENT_TYPE_CONTINUE = SNDRV_TIMER_EVENT_CONTINUE, + ALSATIMER_REAL_TIME_EVENT_TYPE_PAUSE = SNDRV_TIMER_EVENT_PAUSE, + ALSATIMER_REAL_TIME_EVENT_TYPE_EARLY = SNDRV_TIMER_EVENT_EARLY, + ALSATIMER_REAL_TIME_EVENT_TYPE_SUSPEND = SNDRV_TIMER_EVENT_SUSPEND, + ALSATIMER_REAL_TIME_EVENT_TYPE_RESUME = SNDRV_TIMER_EVENT_RESUME, + ALSATIMER_REAL_TIME_EVENT_TYPE_MSTART = SNDRV_TIMER_EVENT_MSTART, + ALSATIMER_REAL_TIME_EVENT_TYPE_MSTOP = SNDRV_TIMER_EVENT_MSTOP, + ALSATIMER_REAL_TIME_EVENT_TYPE_MCONTINUE = SNDRV_TIMER_EVENT_MCONTINUE, + ALSATIMER_REAL_TIME_EVENT_TYPE_MPAUSE = SNDRV_TIMER_EVENT_MPAUSE, + ALSATIMER_REAL_TIME_EVENT_TYPE_MSUSPEND = SNDRV_TIMER_EVENT_MSUSPEND, + ALSATIMER_REAL_TIME_EVENT_TYPE_MRESUME = SNDRV_TIMER_EVENT_MRESUME, +} ALSATimerRealTimeEventType; /** * ALSATimerEventType diff --git a/src/timer/alsatimer.map b/src/timer/alsatimer.map index 39a46d8..ed5a1a6 100644 --- a/src/timer/alsatimer.map +++ b/src/timer/alsatimer.map @@ -66,7 +66,7 @@ ALSA_GOBJECT_0_3_0 { "alsatimer_user_instance_continue"; "alsatimer_user_instance_choose_event_type"; - "alsatimer_tstamp_event_type_get_type"; + "alsatimer_real_time_event_type_get_type"; "alsatimer_event_type_get_type"; "alsatimer_tick_time_event_get_type"; diff --git a/src/timer/instance-params.c b/src/timer/instance-params.c index c6fbe7c..22480b0 100644 --- a/src/timer/instance-params.c +++ b/src/timer/instance-params.c @@ -141,17 +141,17 @@ ALSATimerInstanceParams *alsatimer_instance_params_new() * alsatimer_instance_params_set_event_filter: * @self: A [class@InstanceParams]. * @entries: (array length=entry_count): The array with elements for entries of - * [enum@TstampEventType]. + * [enum@RealTimeEventType]. * @entry_count: The number of elements in the above array. * @error: A [struct@GLib.Error] at failure. * - * Set the list of [enum@TstampEventType] to filter events. This parameter is effective only for - * target instance with [enum@EventType:TIMESTAMP]. + * Set the list of [enum@RealTimeEventType] to filter events. This parameter is effective only for + * target instance with [enum@EventType].TIMESTAMP. * * Returns: %TRUE when the overall operation finishes successfully, else %FALSE. */ gboolean alsatimer_instance_params_set_event_filter(ALSATimerInstanceParams *self, - const ALSATimerTstampEventType *entries, + const ALSATimerRealTimeEventType *entries, gsize entry_count, GError **error) { ALSATimerInstanceParamsPrivate *priv; @@ -190,21 +190,21 @@ gboolean alsatimer_instance_params_set_event_filter(ALSATimerInstanceParams *sel * alsatimer_instance_params_get_event_filter: * @self: A [class@InstanceParams]. * @entries: (array length=entry_count)(out): The array with elements for entries of - * [enum@TstampEventType]. + * [enum@RealTimeEventType]. * @entry_count: The number of elements in the above array. * @error: A [struct@GLib.Error] at failure. * - * Get the list of [enum@TstampEventType] to filter events. This parameter is effective only for - * target instance with [enum@EventType:TIMESTAMP]. + * Get the list of [enum@RealTimeEventType] to filter events. This parameter is effective only for + * target instance with [enum@EventType].REAL_TIME. * * Returns: %TRUE when the overall operation finishes successfully, else %FALSE. */ gboolean alsatimer_instance_params_get_event_filter(ALSATimerInstanceParams *self, - ALSATimerTstampEventType **entries, + ALSATimerRealTimeEventType **entries, gsize *entry_count, GError **error) { ALSATimerInstanceParamsPrivate *priv; - ALSATimerTstampEventType *list; + ALSATimerRealTimeEventType *list; unsigned int filter; unsigned int count; unsigned int index; @@ -232,7 +232,7 @@ gboolean alsatimer_instance_params_get_event_filter(ALSATimerInstanceParams *sel index = 0; for (i = 0; i < sizeof(filter) * 8; ++i) { if ((1u << i) & filter) { - list[index] = (ALSATimerTstampEventType)i; + list[index] = (ALSATimerRealTimeEventType)i; if (++index >= count) break; } diff --git a/src/timer/instance-params.h b/src/timer/instance-params.h index 7ed5814..e913488 100644 --- a/src/timer/instance-params.h +++ b/src/timer/instance-params.h @@ -18,11 +18,11 @@ struct _ALSATimerInstanceParamsClass { ALSATimerInstanceParams *alsatimer_instance_params_new(); gboolean alsatimer_instance_params_set_event_filter(ALSATimerInstanceParams *self, - const ALSATimerTstampEventType *entries, + const ALSATimerRealTimeEventType *entries, gsize entry_count, GError **error); gboolean alsatimer_instance_params_get_event_filter(ALSATimerInstanceParams *self, - ALSATimerTstampEventType **entries, + ALSATimerRealTimeEventType **entries, gsize *entry_count, GError **error); G_END_DECLS diff --git a/src/timer/real-time-event.c b/src/timer/real-time-event.c index c66cf58..fecdea8 100644 --- a/src/timer/real-time-event.c +++ b/src/timer/real-time-event.c @@ -27,21 +27,21 @@ G_DEFINE_BOXED_TYPE(ALSATimerRealTimeEvent, alsatimer_real_time_event, timer_rea /** * alsatimer_real_time_event_get_event: * @self: A [struct@RealTimeEvent]. - * @event: (out): The type of tstamp event, one of [enum@TstampEventType]. + * @event: (out): The type of real time event, one of [enum@RealTimeEventType]. * - * Get the kind of event for the timestamp event. + * Get the kind of event for the real time event. */ void alsatimer_real_time_event_get_event(const ALSATimerRealTimeEvent *self, - ALSATimerTstampEventType *event) + ALSATimerRealTimeEventType *event) { - *event = (ALSATimerTstampEventType)self->event; + *event = (ALSATimerRealTimeEventType)self->event; } /** * alsatimer_real_time_event_get_time: * @self: A [struct@RealTimeEvent]. * @real_time: (array fixed-size=2) (inout): The array with two elements for the seconds and - * nanoseconds part of timestamp when the instance queues the timestamp event. + * nanoseconds part of timestamp when the real time event occurs. * * Get the seconds and nanoseconds part for the real time event. */ @@ -57,7 +57,7 @@ void alsatimer_real_time_event_get_time(const ALSATimerRealTimeEvent *self, * @self: A [struct@RealTimeEvent]. * @val: (out): The value depending on the type of timestamp event. * - * Get the value depending on the type of timestamp event. + * Get the value depending on the type of real time event. */ void alsatimer_real_time_event_get_val(const ALSATimerRealTimeEvent *self, guint *val) { diff --git a/src/timer/real-time-event.h b/src/timer/real-time-event.h index 9165dd6..7b8cc42 100644 --- a/src/timer/real-time-event.h +++ b/src/timer/real-time-event.h @@ -13,7 +13,7 @@ typedef struct snd_timer_tread ALSATimerRealTimeEvent; GType alsatimer_real_time_event_get_type() G_GNUC_CONST; void alsatimer_real_time_event_get_event(const ALSATimerRealTimeEvent *self, - ALSATimerTstampEventType *event); + ALSATimerRealTimeEventType *event); void alsatimer_real_time_event_get_time(const ALSATimerRealTimeEvent *self, gint64 *const real_time[2]); diff --git a/tests/alsatimer-enums b/tests/alsatimer-enums index 487ad87..e60532b 100644 --- a/tests/alsatimer-enums +++ b/tests/alsatimer-enums @@ -35,7 +35,7 @@ instance_param_flags = ( 'EARLY_EVENT', ) -tstamp_event_types = ( +real_time_event_types = ( 'RESOLUTION', 'TICK', 'START', @@ -71,7 +71,7 @@ types = { ALSATimer.SpecificGlobalDevice: specific_global_devices, ALSATimer.DeviceInfoFlag: device_info_flags, ALSATimer.InstanceParamFlag: instance_param_flags, - ALSATimer.TstampEventType: tstamp_event_types, + ALSATimer.RealTimeEventType: real_time_event_types, ALSATimer.EventType: event_types, ALSATimer.UserInstanceError: user_instance_error_types, } -- 2.47.3