diff options
Diffstat (limited to 'include/sound/timer.h')
| -rw-r--r-- | include/sound/timer.h | 94 |
1 files changed, 41 insertions, 53 deletions
diff --git a/include/sound/timer.h b/include/sound/timer.h index b55f38ae56e1..5ece2bf541dc 100644 --- a/include/sound/timer.h +++ b/include/sound/timer.h | |||
| @@ -26,20 +26,6 @@ | |||
| 26 | #include <sound/asound.h> | 26 | #include <sound/asound.h> |
| 27 | #include <linux/interrupt.h> | 27 | #include <linux/interrupt.h> |
| 28 | 28 | ||
| 29 | typedef enum sndrv_timer_class snd_timer_class_t; | ||
| 30 | typedef enum sndrv_timer_slave_class snd_timer_slave_class_t; | ||
| 31 | typedef enum sndrv_timer_global snd_timer_global_t; | ||
| 32 | typedef struct sndrv_timer_id snd_timer_id_t; | ||
| 33 | typedef struct sndrv_timer_ginfo snd_timer_ginfo_t; | ||
| 34 | typedef struct sndrv_timer_gparams snd_timer_gparams_t; | ||
| 35 | typedef struct sndrv_timer_gstatus snd_timer_gstatus_t; | ||
| 36 | typedef struct sndrv_timer_select snd_timer_select_t; | ||
| 37 | typedef struct sndrv_timer_info snd_timer_info_t; | ||
| 38 | typedef struct sndrv_timer_params snd_timer_params_t; | ||
| 39 | typedef struct sndrv_timer_status snd_timer_status_t; | ||
| 40 | typedef struct sndrv_timer_read snd_timer_read_t; | ||
| 41 | typedef struct sndrv_timer_tread snd_timer_tread_t; | ||
| 42 | |||
| 43 | #define snd_timer_chip(timer) ((timer)->private_data) | 29 | #define snd_timer_chip(timer) ((timer)->private_data) |
| 44 | 30 | ||
| 45 | #define SNDRV_TIMER_DEVICES 16 | 31 | #define SNDRV_TIMER_DEVICES 16 |
| @@ -64,11 +50,9 @@ typedef struct sndrv_timer_tread snd_timer_tread_t; | |||
| 64 | #define SNDRV_TIMER_FLG_CHANGE 0x00000001 | 50 | #define SNDRV_TIMER_FLG_CHANGE 0x00000001 |
| 65 | #define SNDRV_TIMER_FLG_RESCHED 0x00000002 /* need reschedule */ | 51 | #define SNDRV_TIMER_FLG_RESCHED 0x00000002 /* need reschedule */ |
| 66 | 52 | ||
| 67 | typedef void (*snd_timer_callback_t) (snd_timer_instance_t * timeri, unsigned long ticks, unsigned long resolution); | 53 | struct snd_timer; |
| 68 | typedef void (*snd_timer_ccallback_t) (snd_timer_instance_t * timeri, enum sndrv_timer_event event, | ||
| 69 | struct timespec * tstamp, unsigned long resolution); | ||
| 70 | 54 | ||
| 71 | struct _snd_timer_hardware { | 55 | struct snd_timer_hardware { |
| 72 | /* -- must be filled with low-level driver */ | 56 | /* -- must be filled with low-level driver */ |
| 73 | unsigned int flags; /* various flags */ | 57 | unsigned int flags; /* various flags */ |
| 74 | unsigned long resolution; /* average timer resolution for one tick in nsec */ | 58 | unsigned long resolution; /* average timer resolution for one tick in nsec */ |
| @@ -76,18 +60,18 @@ struct _snd_timer_hardware { | |||
| 76 | unsigned long resolution_max; /* maximal resolution */ | 60 | unsigned long resolution_max; /* maximal resolution */ |
| 77 | unsigned long ticks; /* max timer ticks per interrupt */ | 61 | unsigned long ticks; /* max timer ticks per interrupt */ |
| 78 | /* -- low-level functions -- */ | 62 | /* -- low-level functions -- */ |
| 79 | int (*open) (snd_timer_t * timer); | 63 | int (*open) (struct snd_timer * timer); |
| 80 | int (*close) (snd_timer_t * timer); | 64 | int (*close) (struct snd_timer * timer); |
| 81 | unsigned long (*c_resolution) (snd_timer_t * timer); | 65 | unsigned long (*c_resolution) (struct snd_timer * timer); |
| 82 | int (*start) (snd_timer_t * timer); | 66 | int (*start) (struct snd_timer * timer); |
| 83 | int (*stop) (snd_timer_t * timer); | 67 | int (*stop) (struct snd_timer * timer); |
| 84 | int (*set_period) (snd_timer_t * timer, unsigned long period_num, unsigned long period_den); | 68 | int (*set_period) (struct snd_timer * timer, unsigned long period_num, unsigned long period_den); |
| 85 | int (*precise_resolution) (snd_timer_t * timer, unsigned long *num, unsigned long *den); | 69 | int (*precise_resolution) (struct snd_timer * timer, unsigned long *num, unsigned long *den); |
| 86 | }; | 70 | }; |
| 87 | 71 | ||
| 88 | struct _snd_timer { | 72 | struct snd_timer { |
| 89 | snd_timer_class_t tmr_class; | 73 | int tmr_class; |
| 90 | snd_card_t *card; | 74 | struct snd_card *card; |
| 91 | struct module *module; | 75 | struct module *module; |
| 92 | int tmr_device; | 76 | int tmr_device; |
| 93 | int tmr_subdevice; | 77 | int tmr_subdevice; |
| @@ -97,8 +81,8 @@ struct _snd_timer { | |||
| 97 | int running; /* running instances */ | 81 | int running; /* running instances */ |
| 98 | unsigned long sticks; /* schedule ticks */ | 82 | unsigned long sticks; /* schedule ticks */ |
| 99 | void *private_data; | 83 | void *private_data; |
| 100 | void (*private_free) (snd_timer_t *timer); | 84 | void (*private_free) (struct snd_timer *timer); |
| 101 | struct _snd_timer_hardware hw; | 85 | struct snd_timer_hardware hw; |
| 102 | spinlock_t lock; | 86 | spinlock_t lock; |
| 103 | struct list_head device_list; | 87 | struct list_head device_list; |
| 104 | struct list_head open_list_head; | 88 | struct list_head open_list_head; |
| @@ -108,49 +92,53 @@ struct _snd_timer { | |||
| 108 | struct tasklet_struct task_queue; | 92 | struct tasklet_struct task_queue; |
| 109 | }; | 93 | }; |
| 110 | 94 | ||
| 111 | struct _snd_timer_instance { | 95 | struct snd_timer_instance { |
| 112 | snd_timer_t * timer; | 96 | struct snd_timer *timer; |
| 113 | char *owner; | 97 | char *owner; |
| 114 | unsigned int flags; | 98 | unsigned int flags; |
| 115 | void *private_data; | 99 | void *private_data; |
| 116 | void (*private_free) (snd_timer_instance_t *ti); | 100 | void (*private_free) (struct snd_timer_instance *ti); |
| 117 | snd_timer_callback_t callback; | 101 | void (*callback) (struct snd_timer_instance *timeri, |
| 118 | snd_timer_ccallback_t ccallback; | 102 | unsigned long ticks, unsigned long resolution); |
| 103 | void (*ccallback) (struct snd_timer_instance * timeri, | ||
| 104 | int event, | ||
| 105 | struct timespec * tstamp, | ||
| 106 | unsigned long resolution); | ||
| 119 | void *callback_data; | 107 | void *callback_data; |
| 120 | unsigned long ticks; /* auto-load ticks when expired */ | 108 | unsigned long ticks; /* auto-load ticks when expired */ |
| 121 | unsigned long cticks; /* current ticks */ | 109 | unsigned long cticks; /* current ticks */ |
| 122 | unsigned long pticks; /* accumulated ticks for callback */ | 110 | unsigned long pticks; /* accumulated ticks for callback */ |
| 123 | unsigned long resolution; /* current resolution for tasklet */ | 111 | unsigned long resolution; /* current resolution for tasklet */ |
| 124 | unsigned long lost; /* lost ticks */ | 112 | unsigned long lost; /* lost ticks */ |
| 125 | snd_timer_slave_class_t slave_class; | 113 | int slave_class; |
| 126 | unsigned int slave_id; | 114 | unsigned int slave_id; |
| 127 | struct list_head open_list; | 115 | struct list_head open_list; |
| 128 | struct list_head active_list; | 116 | struct list_head active_list; |
| 129 | struct list_head ack_list; | 117 | struct list_head ack_list; |
| 130 | struct list_head slave_list_head; | 118 | struct list_head slave_list_head; |
| 131 | struct list_head slave_active_head; | 119 | struct list_head slave_active_head; |
| 132 | snd_timer_instance_t *master; | 120 | struct snd_timer_instance *master; |
| 133 | }; | 121 | }; |
| 134 | 122 | ||
| 135 | /* | 123 | /* |
| 136 | * Registering | 124 | * Registering |
| 137 | */ | 125 | */ |
| 138 | 126 | ||
| 139 | extern int snd_timer_new(snd_card_t *card, char *id, snd_timer_id_t *tid, snd_timer_t ** rtimer); | 127 | int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid, struct snd_timer **rtimer); |
| 140 | extern void snd_timer_notify(snd_timer_t *timer, enum sndrv_timer_event event, struct timespec *tstamp); | 128 | void snd_timer_notify(struct snd_timer *timer, int event, struct timespec *tstamp); |
| 141 | extern int snd_timer_global_new(char *id, int device, snd_timer_t **rtimer); | 129 | int snd_timer_global_new(char *id, int device, struct snd_timer **rtimer); |
| 142 | extern int snd_timer_global_free(snd_timer_t *timer); | 130 | int snd_timer_global_free(struct snd_timer *timer); |
| 143 | extern int snd_timer_global_register(snd_timer_t *timer); | 131 | int snd_timer_global_register(struct snd_timer *timer); |
| 144 | extern int snd_timer_global_unregister(snd_timer_t *timer); | 132 | int snd_timer_global_unregister(struct snd_timer *timer); |
| 145 | 133 | ||
| 146 | extern int snd_timer_open(snd_timer_instance_t ** ti, char *owner, snd_timer_id_t *tid, unsigned int slave_id); | 134 | int snd_timer_open(struct snd_timer_instance **ti, char *owner, struct snd_timer_id *tid, unsigned int slave_id); |
| 147 | extern int snd_timer_close(snd_timer_instance_t * timeri); | 135 | int snd_timer_close(struct snd_timer_instance *timeri); |
| 148 | extern unsigned long snd_timer_resolution(snd_timer_instance_t * timeri); | 136 | unsigned long snd_timer_resolution(struct snd_timer_instance *timeri); |
| 149 | extern int snd_timer_start(snd_timer_instance_t * timeri, unsigned int ticks); | 137 | int snd_timer_start(struct snd_timer_instance *timeri, unsigned int ticks); |
| 150 | extern int snd_timer_stop(snd_timer_instance_t * timeri); | 138 | int snd_timer_stop(struct snd_timer_instance *timeri); |
| 151 | extern int snd_timer_continue(snd_timer_instance_t * timeri); | 139 | int snd_timer_continue(struct snd_timer_instance *timeri); |
| 152 | extern int snd_timer_pause(snd_timer_instance_t * timeri); | 140 | int snd_timer_pause(struct snd_timer_instance *timeri); |
| 153 | 141 | ||
| 154 | extern void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left); | 142 | void snd_timer_interrupt(struct snd_timer *timer, unsigned long ticks_left); |
| 155 | 143 | ||
| 156 | #endif /* __SOUND_TIMER_H */ | 144 | #endif /* __SOUND_TIMER_H */ |
