Update of /cvsroot/alsa/alsa-kernel/include
In directory sc8-pr-cvs1:/tmp/cvs-serv3838/include
Modified Files:
asound.h core.h pcm.h timer.h
Log Message:
Updated timestamps - use 'struct timespec' now.
Enhanced timer read API (events + timestamps).
Index: asound.h
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/include/asound.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- asound.h 28 Feb 2003 11:05:50 -0000 1.19
+++ asound.h 28 Feb 2003 16:59:55 -0000 1.20
@@ -150,7 +150,7 @@
* *
*****************************************************************************/
-#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 4)
+#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5)
typedef unsigned long sndrv_pcm_uframes_t;
typedef long sndrv_pcm_sframes_t;
@@ -398,8 +398,8 @@
struct sndrv_pcm_status {
enum sndrv_pcm_state state; /* stream state */
- struct timeval trigger_tstamp; /* time when stream was started/stopped/paused
*/
- struct timeval tstamp; /* reference timestamp */
+ struct timespec trigger_tstamp; /* time when stream was started/stopped/paused
*/
+ struct timespec tstamp; /* reference timestamp */
sndrv_pcm_uframes_t appl_ptr; /* appl ptr */
sndrv_pcm_uframes_t hw_ptr; /* hw ptr */
sndrv_pcm_sframes_t delay; /* current delay in frames */
@@ -414,7 +414,7 @@
enum sndrv_pcm_state state; /* RO: state - SNDRV_PCM_STATE_XXXX */
int pad1; /* Needed for 64 bit alignment */
sndrv_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */
- struct timeval tstamp; /* Timestamp */
+ struct timespec tstamp; /* Timestamp */
enum sndrv_pcm_state suspended_state; /* RO: suspended stream state */
};
@@ -438,6 +438,7 @@
enum {
SNDRV_PCM_IOCTL_PVERSION = _IOR('A', 0x00, int),
SNDRV_PCM_IOCTL_INFO = _IOR('A', 0x01, struct sndrv_pcm_info),
+ SNDRV_PCM_IOCTL_TSTAMP = _IOW('A', 0x02, int),
SNDRV_PCM_IOCTL_HW_REFINE = _IOWR('A', 0x10, struct sndrv_pcm_hw_params),
SNDRV_PCM_IOCTL_HW_PARAMS = _IOWR('A', 0x11, struct sndrv_pcm_hw_params),
SNDRV_PCM_IOCTL_HW_FREE = _IO('A', 0x12),
@@ -513,7 +514,7 @@
struct sndrv_rawmidi_status {
enum sndrv_rawmidi_stream stream;
- struct timeval tstamp; /* Timestamp */
+ struct timespec tstamp; /* Timestamp */
size_t avail; /* available bytes */
size_t xruns; /* count of overruns since last status (in
bytes) */
unsigned char reserved[16]; /* reserved for future use */
@@ -532,7 +533,7 @@
* Timer section - /dev/snd/timer
*/
-#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0)
+#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 1)
enum sndrv_timer_class {
SNDRV_TIMER_CLASS_NONE = -1,
@@ -592,8 +593,8 @@
};
struct sndrv_timer_status {
- struct timeval tstamp; /* Timestamp */
- unsigned int resolution; /* current resolution */
+ struct timespec tstamp; /* Timestamp - last update */
+ unsigned int resolution; /* current resolution in ns */
unsigned int lost; /* counter of master tick lost */
unsigned int overrun; /* count of read queue overruns */
unsigned int queue; /* used queue size */
@@ -603,6 +604,7 @@
enum {
SNDRV_TIMER_IOCTL_PVERSION = _IOR('T', 0x00, int),
SNDRV_TIMER_IOCTL_NEXT_DEVICE = _IOWR('T', 0x01, struct sndrv_timer_id),
+ SNDRV_TIMER_IOCTL_TREAD = _IOW('T', 0x02, int),
SNDRV_TIMER_IOCTL_SELECT = _IOW('T', 0x10, struct sndrv_timer_select),
SNDRV_TIMER_IOCTL_INFO = _IOR('T', 0x11, struct sndrv_timer_info),
SNDRV_TIMER_IOCTL_PARAMS = _IOW('T', 0x12, struct sndrv_timer_params),
@@ -617,13 +619,27 @@
unsigned int ticks;
};
+enum sndrv_timer_event {
+ SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */
+ SNDRV_TIMER_EVENT_TICK, /* val = ticks */
+ SNDRV_TIMER_EVENT_START, /* val = resolution in ns */
+ SNDRV_TIMER_EVENT_STOP, /* val = 0 */
+ SNDRV_TIMER_EVENT_CONTINUE /* val = resolution in ns */
+};
+
+struct sndrv_timer_tread {
+ enum sndrv_timer_event event;
+ struct timespec tstamp;
+ unsigned int val;
+};
+
/****************************************************************************
* *
* Section for driver control interface - /dev/snd/control? *
* *
****************************************************************************/
-#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0)
+#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 1)
struct sndrv_ctl_card_info {
int card; /* card number */
Index: core.h
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/include/core.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- core.h 28 Feb 2003 14:29:22 -0000 1.35
+++ core.h 28 Feb 2003 16:59:55 -0000 1.36
@@ -27,7 +27,7 @@
#include <linux/rwsem.h> /* struct rw_semaphore */
/* Typedef's */
-typedef struct timeval snd_timestamp_t;
+typedef struct timespec snd_timestamp_t;
typedef struct sndrv_interval snd_interval_t;
typedef enum sndrv_card_type snd_card_type;
typedef struct sndrv_xferi snd_xferi_t;
@@ -424,9 +424,27 @@
#define snd_BUG() snd_assert(0, )
-#define snd_timestamp_now(tstamp) do_gettimeofday(tstamp)
-#define snd_timestamp_zero(tstamp) do { (tstamp)->tv_sec = 0; (tstamp)->tv_usec = 0;
} while (0)
-#define snd_timestamp_null(tstamp) ((tstamp)->tv_sec == 0 && (tstamp)->tv_usec ==0)
+static inline void snd_timestamp_now(struct timespec *tstamp, int timespec)
+{
+ struct timeval val;
+ /* FIXME: use a linear time source */
+ do_gettimeofday(&val);
+ tstamp->tv_sec = val.tv_sec;
+ tstamp->tv_nsec = val.tv_usec;
+ if (timespec)
+ tstamp->tv_nsec *= 1000L;
+}
+
+static inline void snd_timestamp_zero(struct timespec *tstamp)
+{
+ tstamp->tv_sec = 0;
+ tstamp->tv_nsec = 0;
+}
+
+static inline int snd_timestamp_null(struct timespec *tstamp)
+{
+ return tstamp->tv_sec == 0 && tstamp->tv_nsec == 0;
+}
#define SNDRV_OSS_VERSION ((3<<16)|(8<<8)|(1<<4)|(0)) /* 3.8.1a */
Index: pcm.h
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/include/pcm.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- pcm.h 28 Feb 2003 14:29:24 -0000 1.26
+++ pcm.h 28 Feb 2003 16:59:56 -0000 1.27
@@ -305,6 +305,7 @@
unsigned int rate_den;
/* -- SW params -- */
+ int tstamp_timespec; /* use timeval (0) or timespec (1) */
snd_pcm_tstamp_t tstamp_mode; /* mmap timestamp is updated */
unsigned int period_step;
unsigned int sleep_min; /* min ticks to sleep */
Index: timer.h
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/include/timer.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- timer.h 9 Feb 2003 18:41:55 -0000 1.8
+++ timer.h 28 Feb 2003 16:59:56 -0000 1.9
@@ -34,6 +34,7 @@
typedef struct sndrv_timer_params snd_timer_params_t;
typedef struct sndrv_timer_status snd_timer_status_t;
typedef struct sndrv_timer_read snd_timer_read_t;
+typedef struct sndrv_timer_tread snd_timer_tread_t;
#define _snd_timer_chip(timer) ((timer)->private_data)
#define snd_timer_chip(timer) snd_magic_cast1(chip_t, _snd_timer_chip(timer), return
-ENXIO)
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog