aboutsummaryrefslogtreecommitdiff
path: root/linux-user/syscall_defs.h
diff options
context:
space:
mode:
authorFilip Bozuta <Filip.Bozuta@rt-rk.com>2020-01-15 20:36:43 +0100
committerLaurent Vivier <laurent@vivier.eu>2020-02-19 11:17:40 +0100
commitaca7708eab01475099e3737aff29e12639a22da1 (patch)
tree16066b898b9ea0854fa6170b10992ea8a9300b45 /linux-user/syscall_defs.h
parent1c4c6fcd1a2ae56e98be3a441e19a0933c508a51 (diff)
linux-user: Add support for getting/setting specified alsa timer parameters using ioctls
This patch implements functionalities of following ioctls: SNDRV_TIMER_IOCTL_GINFO - Getting information about specified timer Read information about the specified timer. The information about the timer is returned in the following structure: struct snd_timer_ginfo { struct snd_timer_id tid; /* requested timer ID */ unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ int card; /* card number */ unsigned char id[64]; /* timer identification */ unsigned char name[80]; /* timer name */ unsigned long reserved0; /* reserved for future use */ unsigned long resolution; /* average period resolution in ns */ unsigned long resolution_min; /* minimal period resolution in ns */ unsigned long resolution_max; /* maximal period resolution in ns */ unsigned int clients; /* active timer clients */ unsigned char reserved[32]; /* reserved */ }; A pointer to this structure should be passed as the third ioctl's argument. Before calling the ioctl, the field "tid" should be initialized with the id information for the timer which information is to be obtained. After the ioctl call, the rest of the structure fields are filled with values from the timer device with the specified id. If there is no device with the specified id, the error ENODEV ("No such device") is returned. SNDRV_TIMER_IOCTL_GPARAMS - Setting precise period duration Sets timer precise period duration numerator and denominator in seconds. The period duration is set in the following structure: struct snd_timer_gparams { struct snd_timer_id tid; /* requested timer ID */ unsigned long period_num; /* period duration - numerator */ unsigned long period_den; /* period duration - denominator */ unsigned char reserved[32]; /* reserved */ }; A pointer to this structure should be passed as the third ioctl's argument. Before calling the ioctl, the field "tid" should be initialized with the id information for the timer which period duration is to be set. Also, the fileds "period_num" and "period_den" should be filled with the period duration numerator and denominator values that are to be set respectively. If there is no device with the specified id, the error ENODEV ("No such device") is returned. SNDRV_TIMER_IOCTL_GSTATUS - Getting current period resolution Read timer current period resolution in nanoseconds and period resolution numerator and denominator in seconds. The period resolution information is returned in the following structure: struct snd_timer_gstatus { struct snd_timer_id tid; /* requested timer ID */ unsigned long resolution; /* current period resolution in ns */ unsigned long resolution_num; /* period resolution - numerator */ unsigned long resolution_den; /* period resolution - denominator */ unsigned char reserved[32]; /* reserved for future use */ }; A pointer to this structure should be passed as the third ioctl's argument. Before calling the ioctl, the field "tid" should be initialized with the id information for the timer which period resolution is to be obtained. After the ioctl call, the rest of the structure fields are filled with values from the timer device with the specified id. If there is no device with the specified id, the error ENODEV ("No such device") is returned. Implementation notes: All ioctls in this patch have pointer to some kind of a structure as their third argument. That is the reason why corresponding definitions were added in 'linux-user/syscall_types.h'. All of these strcutures have some fields that are of type 'unsigned long'. That is the reason why separate target structures were defined in 'linux-user/syscall_defs.h'. Also, all of the structures have a field with type 'struct snd_timer_id' which is the reason why a separate target structure 'struct target_snd_timer_id' was also defined. The rest of the implementation was straightforward. Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Filip Bozuta <Filip.Bozuta@rt-rk.com> Message-Id: <1579117007-7565-10-git-send-email-Filip.Bozuta@rt-rk.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'linux-user/syscall_defs.h')
-rw-r--r--linux-user/syscall_defs.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index eb00358b54..c714e8b67b 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2437,10 +2437,53 @@ struct target_statfs64 {
#define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC)
+struct target_snd_timer_id {
+ int dev_class;
+ int dev_sclass;
+ int card;
+ int device;
+ int subdevice;
+};
+
+struct target_snd_timer_ginfo {
+ struct target_snd_timer_id tid;
+ unsigned int flags;
+ int card;
+ unsigned char id[64];
+ unsigned char name[80];
+ abi_ulong reserved0;
+ abi_ulong resolution;
+ abi_ulong resolution_min;
+ abi_ulong resolution_max;
+ unsigned int clients;
+ unsigned char reserved[32];
+};
+
+struct target_snd_timer_gparams {
+ struct target_snd_timer_id tid;
+ abi_ulong period_num;
+ abi_ulong period_den;
+ unsigned char reserved[32];
+};
+
+struct target_snd_timer_gstatus {
+ struct target_snd_timer_id tid;
+ abi_ulong resolution;
+ abi_ulong resolution_num;
+ abi_ulong resolution_den;
+ unsigned char reserved[32];
+};
+
/* alsa timer ioctls */
#define TARGET_SNDRV_TIMER_IOCTL_PVERSION TARGET_IOR('T', 0x00, int)
#define TARGET_SNDRV_TIMER_IOCTL_NEXT_DEVICE TARGET_IOWR('T', 0x01, \
struct snd_timer_id)
+#define TARGET_SNDRV_TIMER_IOCTL_GINFO TARGET_IOWR('T', 0x03, \
+ struct target_snd_timer_ginfo)
+#define TARGET_SNDRV_TIMER_IOCTL_GPARAMS TARGET_IOW('T', 0x04, \
+ struct target_snd_timer_gparams)
+#define TARGET_SNDRV_TIMER_IOCTL_GSTATUS TARGET_IOWR('T', 0x05, \
+ struct target_snd_timer_gstatus)
/* vfat ioctls */
#define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1)