]> git.alsa-project.org Git - alsa-plugins.git/commitdiff
Alsa support for Maemo SDK (n770): Header files
authorEduardo Valentin <eduardo.valentin@indt.org.br>
Mon, 6 Nov 2006 13:29:42 +0000 (14:29 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 6 Nov 2006 13:29:42 +0000 (14:29 +0100)
This patch file adds header files needed by alsa-dsp plugin.

Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br>
maemo/constants.h [new file with mode: 0644]
maemo/debug.h [new file with mode: 0644]
maemo/list.h [new file with mode: 0644]
maemo/reporting.h [new file with mode: 0644]
maemo/types.h [new file with mode: 0644]

diff --git a/maemo/constants.h b/maemo/constants.h
new file mode 100644 (file)
index 0000000..d0ad27c
--- /dev/null
@@ -0,0 +1,199 @@
+/**
+ * @file constants.h 
+ * @brief PCM Task node protocol constants definition
+ * <p>
+ * Copyright (C) 2006 Nokia Corporation
+ * <p>
+ * Contact: Eduardo Bezerra Valentin <eduardo.valentin@indt.org.br>
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ * */
+#ifndef _CONSTANTS_H
+#define _CONSTANTS_H
+/**
+ * Commands
+ * */
+/** No command */
+#define DSP_CMD_NONE           0x00
+/** Informs the DSP that the following data is about initialisation. */
+#define DSP_CMD_INIT           0x01
+/** Informs the DSP that the following data is parameters */
+#define DSP_CMD_SET_PARAMS     0x02
+/** Informs the DSP that the following data is general data (compressed 
+ * or raw audio or video) 
+ * */
+#define DSP_CMD_DATA_WRITE     0x03
+/** Starts audio or video playback or recording */
+#define DSP_CMD_PLAY           0x04
+/** Pauses playback */
+#define DSP_CMD_PAUSE          0x05
+/** Stops playback */
+#define DSP_CMD_STOP           0x06
+/** Informs the DSP that the following data is volume */
+#define DSP_CMD_SET_VOLUME     0x07
+/** Requests from the DSP to send information about current task node 
+ * state 
+ * */
+#define DSP_CMD_STATE          0x08
+/** Informs the DSP that the following data is about setting the current
+ *  presentation time 
+ * */
+#define DSP_CMD_SET_TIME       0x09
+/** Informs the DSP that the ARM queries the current presentation time */
+#define DSP_CMD_GET_TIME       0x0A
+/** Informs the DSP that the following data is about setting video 
+ * post-processing parameters 
+ * */
+#define DSP_CMD_SET_POSTPROC   0x0B
+/** Informs the DSP that the following data is about setting the panning
+ * */
+#define DSP_CMD_SET_PANNING    0x0D
+/** Informs the DSP about discontinuity in the audio stream */
+#define DSP_CMD_DISCONT                0x0E
+/** Mutes the audio playback */
+#define DSP_CMD_MUTE           0x0F
+/** Unmutes the audio playback */
+#define DSP_CMD_UNMUTE         0x10
+/**Closes the task node*/
+#define DSP_CMD_CLOSE          0x14
+/** Command from DSP to start to read data*/
+#define DSP_CMD_DATA_READ      0x25
+/**Sets speech parameters*/
+#define DSP_CMD_SET_SPEECH_PARAMS 0x26
+
+/**
+ * Audio formats
+ * */
+/** Unsigned 8 bits per sample PCM */
+#define DSP_AFMT_U8            0x01
+/** Signed 16 bits per sample PCM, little endian */
+#define DSP_AFMT_S16_LE                0x02
+/** Signed 16 bits per sample PCM, big endian */
+#define DSP_AFMT_S16_BE                0x03
+/** Signed 8 bits per sample PCM */
+#define DSP_AFMT_S8            0x04
+/** Unsigned 16 bits per sample PCM, little endian */
+#define DSP_AFMT_U16_LE                0x05
+/** Unsigned 16 bits per sample PCM, big endian */
+#define DSP_AFMT_U16_BE                0x06
+/** A-law encoded PCM */
+#define DSP_AFMT_ALAW          0x07
+/** μ-Law encoded PCM */
+#define DSP_AFMT_ULAW          0x08
+/** MP3 stream */
+#define DSP_AFMT_MP3           0x09
+/** AAC stream */
+#define DSP_AFMT_AAC           0x0A
+/** AMR stream */
+#define DSP_AFMT_AMR           0x0B
+/** MP2 stream */
+#define DSP_AFMT_MP2           0x0C
+/** iLBC stream */
+#define DSP_AFMT_ILBC          0x0D
+/** G.729 stream */
+#define DSP_AFMT_G729          0x0E
+/**
+ * Supported Sample rates
+ * */
+/** 96KHz sampling rate */
+#define SAMPLE_RATE_96KHZ      0x00
+/** 88.2KHz sampling rate */
+#define SAMPLE_RATE_88_2KHZ    0x01
+/** 64KHz sampling rate */
+#define SAMPLE_RATE_64KHZ      0x02
+/** 48KHz sampling rate */
+#define SAMPLE_RATE_48KHZ      0x03
+/** 44.1KHz sampling rate */
+#define SAMPLE_RATE_44_1KHZ    0x04
+/** 32KHz sampling rate */
+#define SAMPLE_RATE_32KHZ      0x05
+/** 24KHz sampling rate */
+#define SAMPLE_RATE_24KHZ      0x06
+/** 22.05KHz sampling rate */
+#define SAMPLE_RATE_22_05KHZ   0x07
+/** 16KHz sampling rate */
+#define SAMPLE_RATE_16KHZ      0x08
+/** 12KHz sampling rate */
+#define SAMPLE_RATE_12KHZ      0x09
+/** 11.025KHz sampling rate */
+#define SAMPLE_RATE_11_025KHZ  0x0A
+/** 8KHz sampling rate */
+#define SAMPLE_RATE_8KHZ       0x0B
+/** 5.5125Khz sampling rate */
+#define SAMPLE_RATE_5_5125KHZ  0X0C
+/**
+ * DSP Return values
+ * */
+/** Operation successful */
+#define DSP_OK                         0x01
+/** Unrecognised or unsupported command value */
+#define DSP_ERROR_CMD          0x02
+/** Unrecognised or unsupported audio format value */
+#define DSP_ERROR_FMT          0x03
+/** Unrecognised or unsupported sampling rate value */
+#define DSP_ERROR_RATE         0x04
+/** Unrecognised or unsupported number of channels */
+#define DSP_ERROR_CHANNELS     0x05
+/** Destination/source stream ID out of range */
+#define DSP_ERROR_DS_ID                0x06
+/** Insufficient memory to perform requested action */
+#define DSP_ERROR_MEMORY       0x07
+/** Unspecified error */
+#define DSP_ERROR_GENERAL      0x08
+/** Error in stream (audio or video) */
+#define DSP_ERROR_STREAM       0x09
+/** Unexpected task node state */
+#define DSP_ERROR_STATE        0x0A
+/** Error in synchronisation: 
+   For MP3 – synchronisation marker not found */
+#define DSP_ERROR_SYNC         0x0B
+/** For MPEG4: non-compliant video stream */
+#define DSP_ERROR_VIDEO_NON_COMPLIANT 0x100
+/** For MPEG4: Error in VOS */
+#define DSP_ERROR_VIDEO_FAULT_IN_VOS  0x101
+/** For MPEG4: Image size not supported */
+#define DSP_ERROR_VIDEO_SIZE_NOT_SUPPORTED 0x102
+/** End of VOS code reached */
+#define DSP_ERROR_VIDEO_VOS_END_CODE 0x103
+/**
+ * Channels
+ * */
+/** One channel (mono) */
+#define CHANNELS_1             0x01
+/** Two channels (stereo) */
+#define CHANNELS_2             0x02
+/**
+ * Audio Task node states
+ * */
+/** Initialised */
+#define STATE_INITIALISED      0x00
+/** Playing/recording */
+#define STATE_PLAYING          0x01
+/** Stopped */
+#define STATE_STOPPED          0x02
+/** Paused */
+#define STATE_PAUSED           0x03
+/** Not initialised */
+#define STATE_UNINITIALISED    0x04
+/** Reseted */
+#define STATE_RESET            0x05
+/** Muted */
+#define STATE_MUTED            0x06
+
+/** Sending commands */
+#define REQUEST_CONFIRMATION   0x01
+#define WITHOU_CONFIRMATION    0x00
+#endif                         /* _CONSTANTS_H */
diff --git a/maemo/debug.h b/maemo/debug.h
new file mode 100644 (file)
index 0000000..a8a53fc
--- /dev/null
@@ -0,0 +1,52 @@
+/**
+ * @file debug.h 
+ * @brief Debugging Macros
+ * <p>
+ * Copyright (C) 2006 Nokia Corporation
+ * <p>
+ * Contact: Eduardo Bezerra Valentin <eduardo.valentin@indt.org.br>
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ * */
+#ifndef _DEBUG_H
+#define _DEBUG_H
+
+//#define DEBUG
+#undef DEBUG
+#ifdef DEBUG
+#define DEBUG_OUTPUT stderr
+#define DPRINT(fmt,arg...) fprintf(DEBUG_OUTPUT, "%s(): " fmt,\
+               __FUNCTION__, ##arg)
+#define DENTER()  fprintf(DEBUG_OUTPUT, "ENTER %s()\n", __FUNCTION__)
+#define DLEAVE(a)  fprintf(DEBUG_OUTPUT, "LEAVE %s() %d\n", __FUNCTION__, a)
+#else
+#define DPRINT(fmt,arg...) do { } while (0)
+#define DENTER() do { } while (0)
+#define DLEAVE(a) do { } while (0)
+#endif
+
+/* Errors on/off */
+#define ERROR_DEBUG
+/* #undef ERROR_DEBUG */
+#ifdef ERROR_DEBUG
+#define DERROR(fmt,arg...)     fprintf(stderr, "%s(): " fmt, \
+               __FUNCTION__, ##arg)
+#else
+#define DERROR(fmt,arg...) \
+       do { } while (0)
+#endif
+
+#endif                         /* _DEBUG_H */
diff --git a/maemo/list.h b/maemo/list.h
new file mode 100644 (file)
index 0000000..3a76885
--- /dev/null
@@ -0,0 +1,244 @@
+#ifndef __LIST_H
+#define __LIST_H
+
+/* This file is from Linux Kernel (include/linux/list.h) 
+ * and modified by simply removing hardware prefetching of list items. 
+ * Here by copyright, credits attributed to wherever they belong.
+ * Kulesh Shanmugasundaram (kulesh [squiggly] isis.poly.edu)
+ */
+
+/*
+ * Simple doubly linked list implementation.
+ *
+ * Some of the internal functions ("__xxx") are useful when
+ * manipulating whole lists rather than single entries, as
+ * sometimes we already know the next/prev entries and we can
+ * generate better code by using them directly rather than
+ * using the generic single-entry routines.
+ */
+
+struct list_head {
+       struct list_head *next, *prev;
+};
+
+#define LIST_HEAD_INIT(name) { &(name), &(name) }
+
+#define LIST_HEAD(name) \
+       struct list_head name = LIST_HEAD_INIT(name)
+
+#define INIT_LIST_HEAD(ptr) do { \
+       (ptr)->next = (ptr); (ptr)->prev = (ptr); \
+} while (0)
+
+/*
+ * Insert a new entry between two known consecutive entries. 
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+static inline void __list_add(struct list_head *new,
+                             struct list_head *prev,
+                             struct list_head *next)
+{
+       next->prev = new;
+       new->next = next;
+       new->prev = prev;
+       prev->next = new;
+}
+
+/**
+ * list_add - add a new entry
+ * @new: new entry to be added
+ * @head: list head to add it after
+ *
+ * Insert a new entry after the specified head.
+ * This is good for implementing stacks.
+ */
+static inline void list_add(struct list_head *new, struct list_head *head)
+{
+       __list_add(new, head, head->next);
+}
+
+/**
+ * list_add_tail - add a new entry
+ * @new: new entry to be added
+ * @head: list head to add it before
+ *
+ * Insert a new entry before the specified head.
+ * This is useful for implementing queues.
+ */
+static inline void list_add_tail(struct list_head *new, struct list_head *head)
+{
+       __list_add(new, head->prev, head);
+}
+
+/*
+ * Delete a list entry by making the prev/next entries
+ * point to each other.
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+static inline void __list_del(struct list_head *prev, struct list_head *next)
+{
+       next->prev = prev;
+       prev->next = next;
+}
+
+/**
+ * list_del - deletes entry from list.
+ * @entry: the element to delete from the list.
+ * Note: list_empty on entry does not return true after this, the entry is in an undefined state.
+ */
+static inline void list_del(struct list_head *entry)
+{
+       __list_del(entry->prev, entry->next);
+       entry->next = (void *) 0;
+       entry->prev = (void *) 0;
+}
+
+/**
+ * list_del_init - deletes entry from list and reinitialize it.
+ * @entry: the element to delete from the list.
+ */
+static inline void list_del_init(struct list_head *entry)
+{
+       __list_del(entry->prev, entry->next);
+       INIT_LIST_HEAD(entry); 
+}
+
+/**
+ * list_move - delete from one list and add as another's head
+ * @list: the entry to move
+ * @head: the head that will precede our entry
+ */
+static inline void list_move(struct list_head *list, struct list_head *head)
+{
+        __list_del(list->prev, list->next);
+        list_add(list, head);
+}
+
+/**
+ * list_move_tail - delete from one list and add as another's tail
+ * @list: the entry to move
+ * @head: the head that will follow our entry
+ */
+static inline void list_move_tail(struct list_head *list,
+                                 struct list_head *head)
+{
+        __list_del(list->prev, list->next);
+        list_add_tail(list, head);
+}
+
+/**
+ * list_empty - tests whether a list is empty
+ * @head: the list to test.
+ */
+static inline int list_empty(struct list_head *head)
+{
+       return head->next == head;
+}
+
+static inline void __list_splice(struct list_head *list,
+                                struct list_head *head)
+{
+       struct list_head *first = list->next;
+       struct list_head *last = list->prev;
+       struct list_head *at = head->next;
+
+       first->prev = head;
+       head->next = first;
+
+       last->next = at;
+       at->prev = last;
+}
+
+/**
+ * list_splice - join two lists
+ * @list: the new list to add.
+ * @head: the place to add it in the first list.
+ */
+static inline void list_splice(struct list_head *list, struct list_head *head)
+{
+       if (!list_empty(list))
+               __list_splice(list, head);
+}
+
+/**
+ * list_splice_init - join two lists and reinitialise the emptied list.
+ * @list: the new list to add.
+ * @head: the place to add it in the first list.
+ *
+ * The list at @list is reinitialised
+ */
+static inline void list_splice_init(struct list_head *list,
+                                   struct list_head *head)
+{
+       if (!list_empty(list)) {
+               __list_splice(list, head);
+               INIT_LIST_HEAD(list);
+       }
+}
+
+/**
+ * list_entry - get the struct for this entry
+ * @ptr:       the &struct list_head pointer.
+ * @type:      the type of the struct this is embedded in.
+ * @member:    the name of the list_struct within the struct.
+ */
+#define list_entry(ptr, type, member) \
+       ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
+
+/**
+ * list_for_each       -       iterate over a list
+ * @pos:       the &struct list_head to use as a loop counter.
+ * @head:      the head for your list.
+ */
+#define list_for_each(pos, head) \
+       for (pos = (head)->next; pos != (head); \
+               pos = pos->next)
+/**
+ * list_for_each_prev  -       iterate over a list backwards
+ * @pos:       the &struct list_head to use as a loop counter.
+ * @head:      the head for your list.
+ */
+#define list_for_each_prev(pos, head) \
+       for (pos = (head)->prev; pos != (head); \
+               pos = pos->prev)
+               
+/**
+ * list_for_each_safe  -       iterate over a list safe against removal of list entry
+ * @pos:       the &struct list_head to use as a loop counter.
+ * @n:         another &struct list_head to use as temporary storage
+ * @head:      the head for your list.
+ */
+#define list_for_each_safe(pos, n, head) \
+       for (pos = (head)->next, n = pos->next; pos != (head); \
+               pos = n, n = pos->next)
+
+/**
+ * list_for_each_entry -       iterate over list of given type
+ * @pos:       the type * to use as a loop counter.
+ * @head:      the head for your list.
+ * @member:    the name of the list_struct within the struct.
+ */
+#define list_for_each_entry(pos, head, member)                         \
+       for (pos = list_entry((head)->next, typeof(*pos), member);      \
+            &pos->member != (head);                                    \
+            pos = list_entry(pos->member.next, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
+ * @pos:       the type * to use as a loop counter.
+ * @n:         another type * to use as temporary storage
+ * @head:      the head for your list.
+ * @member:    the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_safe(pos, n, head, member)                 \
+       for (pos = list_entry((head)->next, typeof(*pos), member),      \
+               n = list_entry(pos->member.next, typeof(*pos), member); \
+            &pos->member != (head);                                    \
+            pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
+
+#endif
diff --git a/maemo/reporting.h b/maemo/reporting.h
new file mode 100644 (file)
index 0000000..c51391e
--- /dev/null
@@ -0,0 +1,241 @@
+/**
+ * @file reporting.h - Definition of functions whose represents an interface
+ *                     to report errors. 
+ * <p>
+ * Copyright (C) 2006 Nokia Corporation
+ * <p>
+ * Contact: Eduardo Bezerra Valentin <eduardo.valentin@indt.org.br>
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ * */
+#ifndef _REPORTING_H
+#define _REPORTING_H
+#include "dsp-protocol.h"
+
+#ifdef DEBUG
+const char *dsp_commands[] = {
+       "DSP_CMD_NONE", "No command",
+       "DSP_CMD_INIT", "Informs the DSP that the following data is"
+           "about initialisation",
+       "DSP_CMD_SET_PARAMS", "Informs the DSP that the following "
+           "data is parameters",
+       "DSP_CMD_DATA_WRITE", "Informs the DSP that the following "
+           "data is general data (compressed " "or raw audio or video)",
+       "DSP_CMD_PLAY", "Starts audio or video playback or recording",
+       "DSP_CMD_PAUSE", "Pauses playback",
+       "DSP_CMD_STOP", "Stops playback",
+       "DSP_CMD_SET_VOLUME", "Informs the DSP that the following "
+           "data is volume",
+       "DSP_CMD_STATE", "Requests from the DSP to send information"
+           " about current task node state",
+       "DSP_CMD_SET_TIME", "Informs the DSP that the following data"
+           " is about setting the current" " presentation time",
+       "DSP_CMD_GET_TIME", "Informs the DSP that the ARM queries the"
+           " current presentation time",
+       "ERROR", "This is unused!!!!!",
+       "DSP_CMD_SET_POSTPROC", "Informs the DSP that the following data"
+           " is about setting video post-processing " "parameters",
+       "DSP_CMD_SET_PANNING", "Informs the DSP that the following data "
+           "is about setting the panning",
+       "DSP_CMD_DISCONT", "Informs the DSP about discontinuity in the "
+           "audio stream",
+       "DSP_CMD_MUTE", "Mutes the audio playback",
+       "DSP_CMD_UNMUTE", "Unmutes the audio playback",
+       "ERROR", "This is unused!!!!!",
+       "ERROR", "This is unused!!!!!",
+       "ERROR", "This is unused!!!!!",
+       "DSP_CMD_CLOSE", "Closes the task node"
+};
+
+const char *dsp_return_values[] = {
+       "DSP_NONE", "Error. This isn't a valid return value",
+       "DSP_OK", "Operation successful",
+       "DSP_ERROR_CMD", "Unrecognised or unsupported command value",
+       "DSP_ERROR_FMT", "Unrecognised or unsupported audio format value",
+       "DSP_ERROR_RATE", "Unrecognised or unsupported sampling rate value",
+       "DSP_ERROR_CHANNELS", "Unrecognised or unsupported number of channels",
+       "DSP_ERROR_DS_id", "Destination/source stream id out of range",
+       "DSP_ERROR_MEMORY", "Insufficient memory to perform requested action",
+       "DSP_ERROR_GENERAL", "Unspecified error",
+       "DSP_ERROR_STREAM", "Error in stream (audio or video)",
+       "DSP_ERROR_STATE", "Unexpected task node state",
+       "DSP_ERROR_SYNC", "Error in synchronisation:"
+           "For MP3 – synchronisation marker not found"
+};
+
+const char *dsp_states[] = {
+       "STATE_INITIALISED", "Initialised",
+       "STATE_PLAYING", "Playing/recording",
+       "STATE_STOPPED", "Stopped",
+       "STATE_PAUSED", "Paused",
+       "STATE_UNINITIALISED", "Not initialised",
+       "STATE_RESET", "Reseted",
+       "STATE_MUTED", "Muted"
+};
+
+const char *dsp_rates[] = {
+       "SAMPLE_RATE_96KHZ", "96KHz sampling rate",
+       "SAMPLE_RATE_88_2KHZ", "88.2KHz sampling rate",
+       "SAMPLE_RATE_64KHZ", "64KHz sampling rate",
+       "SAMPLE_RATE_48KHZ", "48KHz sampling rate",
+       "SAMPLE_RATE_44_1KHZ", "44.1KHz sampling rate",
+       "SAMPLE_RATE_32KHZ", "32KHz sampling rate",
+       "SAMPLE_RATE_24KHZ", "24KHz sampling rate",
+       "SAMPLE_RATE_22_05KHZ", "22.05KHz sampling rate",
+       "SAMPLE_RATE_16KHZ", "16KHz sampling rate",
+       "SAMPLE_RATE_12KHZ", "12KHz sampling rate",
+       "SAMPLE_RATE_11_025KHZ", "11.025KHz sampling rate",
+       "SAMPLE_RATE_8KHZ", "8KHz sampling rate",
+       "SAMPLE_RATE_5_5125KHZ", "5.5125Khz sampling rate"
+};
+
+const char *dsp_channels[] = {
+       "0--", "Error - No channel!",
+       "CHANNELS_1", "One channel (mono)",
+       "CHANNELS_2", "Two channels (stereo)"
+};
+
+const char *dsp_audio_fmt[] = {
+       "0", "Error No format!!!",
+       "DSP_AFMT_U8", "Unsigned 8 bits per sample PCM",
+       "DSP_AFMT_S16_LE", "Signed 16 bits per sample PCM, little endian",
+       "DSP_AFMT_S16_BE", "Signed 16 bits per sample PCM, big endian",
+       "DSP_AFMT_S8", "Signed 8 bits per sample PCM",
+       "DSP_AFMT_U16_LE", "Unsigned 16 bits per sample PCM, little endian",
+       "DSP_AFMT_U16_BE", "Unsigned 16 bits per sample PCM, big endian",
+       "DSP_AFMT_ALAW", "A-law encoded PCM",
+       "DSP_AFMT_ULAW", "μ-Law encoded PCM",
+       "DSP_AFMT_MP3", "MP3 stream",
+       "DSP_AFMT_AAC", "AAC stream",
+       "DSP_AFMT_AMR", "AMR stream",
+       "DSP_AFMT_MP2", "MP2 stream",
+       "DSP_AFMT_ILBC", "iLBC stream",
+       "DSP_AFMT_G729", "G.729 stream"
+};
+
+#define ARRAY_SIZE(ary)        (sizeof(ary)/sizeof(ary[0]))
+#define report_table(mens,name,value,table)\
+       do{\
+               if ((unsigned)value >= ARRAY_SIZE(table))\
+                       DPRINT("%s: %d isnt a valid %s value\n",mens,\
+                                                       value,name);\
+               else\
+                       DPRINT("%s: [%d|%s] - %s\n", mens, value, \
+                                       table[value * 2], \
+                                       table[value * 2 + 1]);\
+       }while(0)
+
+#define report_command(m,v)            report_table(m,"command",v,\
+                                               /*20,*/dsp_commands)
+#define report_return_value(m,v)       report_table(m,"return",v,\
+                                               /*11,*/dsp_return_values)
+#define report_state(m,v)              report_table(m,"state",v,\
+                                               /*6,*/dsp_states)
+#define report_sample_rate(m,v)        report_table(m,"sample rate",v,\
+                                               /*12,*/dsp_rates)
+#define report_number_channels(m,v)    report_table(m,"number of channels",v,\
+                                               /*2,*/dsp_channels)
+#define report_audio_fmt(m,v)          report_table(m,"audio format",v,\
+                                               /*14,*/dsp_audio_fmt)
+#define report_dsp_protocol(m,dp)\
+       do{\
+               DPRINT("%s:\n"\
+                       "fd: %d\n"\
+                       "stream_id: %d\n"\
+                       "bridge_buffer_size: %d\n"\
+                       "mmap_buffer_size: %d\n"\
+                       "mmap_buffer: %p\n",\
+                               m,\
+                               dp->fd,\
+                               dp->stream_id,\
+                               dp->bridge_buffer_size,\
+                               dp->mmap_buffer_size,\
+                               dp->mmap_buffer);\
+               report_state("state", dp->state);\
+       }while(0)
+
+#define report_audio_status_info(m, asi)\
+       do{\
+               DPRINT("%s\n", m);\
+               DPRINT("***** Audio status info *****\n");\
+               report_command("\tdsp_cmd", asi.dsp_cmd);\
+               DPRINT("\tstream_id: %d\n", asi.stream_id);\
+               DPRINT("\tds_stream_id: %d\n", asi.ds_stream_id);\
+               DPRINT("\tbridge_buffer_size: %d\n", asi.bridge_buffer_size);\
+               DPRINT("\tmmap_buffer_size: %d\n", asi.mmap_buffer_size);\
+               report_state("\tstatus", asi.status);\
+               DPRINT("\tnum_frames: %d\n", asi.num_frames);\
+               report_sample_rate("\tsample_rate", asi.sample_rate);\
+               report_number_channels("\tnumber_channels", \
+                                               asi.number_channels);\
+               DPRINT("\tvol_scale: %d\n", asi.vol_scale);\
+               DPRINT("\tvol_power2: %d\n", asi.vol_power2);\
+               DPRINT("\tleft_gain: %d\n", asi.left_gain);\
+               DPRINT("\tright_gain: %d\n", asi.right_gain);\
+               report_audio_fmt("\tdsp_audio_fmt", asi.dsp_audio_fmt);\
+       }while(0)
+
+#define report_audio_init_status(m, ais)\
+       do{\
+               DPRINT("%s\n", m);\
+               DPRINT("***** Audio init status *****\n");\
+               report_command("\tdsp_cmd", ais.dsp_cmd);\
+               DPRINT("\tstream_id: %d\n", ais.stream_id);\
+               DPRINT("\tbridge_buffer_size: %d\n", ais.bridge_buffer_size);\
+               DPRINT("\tmmap_buffer_size: %d\n", ais.mmap_buffer_size);\
+               report_return_value("\tinit_status", ais.init_status);\
+       }while(0)
+
+#define report_audio_params(m,ap)\
+       do{\
+               DPRINT("%s\n",m);\
+               DPRINT("**** Audio parameters *****\n");\
+               report_command("\tdsp_cmd",ap.dsp_cmd);\
+               report_audio_fmt("\taudio_format", ap.dsp_audio_fmt);\
+               report_sample_rate("\tsample_rate", ap.sample_rate);\
+               DPRINT("Number of channels %d\n", ap.number_channels);\
+               DPRINT("ds_stream_id: %d\n", ap.ds_stream_id);\
+               DPRINT("stream_priority: %d\n", ap.stream_priority);\
+       }while(0)
+
+#define report_speech_params(m,sp)\
+       do{\
+               DPRINT("%s\n",m);\
+               DPRINT("**** Speech parameters *****\n");\
+               DPRINT("\tdsp_cmd 0x%x\n",sp.dsp_cmd);\
+               report_audio_fmt("\taudio_format", sp.audio_fmt);\
+               report_sample_rate("\tsample_rate", sp.sample_rate);\
+               DPRINT("ds_stream_id: %d\n", sp.ds_stream_id);\
+               DPRINT("stream_priority: %d\n", sp.stream_priority);\
+               DPRINT("frame_size: %d\n", sp.frame_size);\
+       }while(0)
+#else
+
+#define report_command(m,c)
+#define report_return_value(m,c)
+#define report_state(m,c)
+#define report_sample_rate(m,sr)
+#define report_number_channel(m,nc)
+#define report_audio_fmt(m,af)
+#define report_dsp_protocol(m,dp)
+#define report_audio_status_info(m,asi)
+#define report_audio_init_status(m,ais)
+#define report_audio_params(m,ap)
+#define report_speech_params(m,ap)
+
+#endif                         /* _DEBUG */
+
+#endif                         /* _REPORTING_H */
diff --git a/maemo/types.h b/maemo/types.h
new file mode 100644 (file)
index 0000000..12809a1
--- /dev/null
@@ -0,0 +1,126 @@
+/**
+ * @file types.h - datatypes defined to communicate with PCM task 
+ *             node using its protocol. 
+ * <p>
+ * Copyright (C) 2006 Nokia Corporation
+ * <p>
+ * Contact: Eduardo Bezerra Valentin <eduardo.valentin@indt.org.br>
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ * */
+#ifndef _TYPES_H
+#define _TYPES_H
+
+typedef struct {
+       unsigned short dsp_cmd;
+       unsigned short init_status;
+       unsigned short stream_id;
+       unsigned short bridge_buffer_size;
+       unsigned short mmap_buffer_size;
+} audio_init_status_t;
+
+typedef struct {
+       unsigned short dsp_cmd;
+       unsigned short dsp_audio_fmt;
+       unsigned short sample_rate;
+       unsigned short number_channels;
+       unsigned short ds_stream_id;
+       unsigned short stream_priority;
+} audio_params_data_t;
+
+typedef struct {
+       unsigned short dsp_cmd; //DSP_CMD_SET_SPEECH_PARAMS
+       unsigned short audio_fmt;       //S16_LE,ALAW,ULAW,ILBC
+       unsigned short sample_rate;
+       unsigned short ds_stream_id;    //Stream ID from EAP mixer
+       unsigned short stream_priority; //N/A
+       unsigned short frame_size;
+} speech_params_data_t;
+
+typedef struct {
+       unsigned short dsp_cmd;
+       unsigned short stream_id;
+       unsigned short ds_stream_id;
+       unsigned short bridge_buffer_size;
+       unsigned short mmap_buffer_size;
+       unsigned short status;
+       unsigned int num_frames;
+       unsigned short sample_rate;
+       unsigned short number_channels;
+       unsigned short vol_scale;
+       unsigned short vol_power2;
+       unsigned short left_gain;
+       unsigned short right_gain;
+       unsigned short dsp_audio_fmt;
+#ifndef NORMAL_DSP_TASK
+       unsigned short mute;
+       unsigned long int samples_played_high;
+       unsigned long int samples_played_low;
+#endif
+} audio_status_info_t;
+
+typedef struct {
+       unsigned short int dsp_cmd;
+       unsigned short int status;
+} dsp_cmd_status_t;
+
+/* data write status structure */
+typedef struct {
+       unsigned short int dsp_cmd;
+       unsigned short int status;
+       unsigned short int buffer_bytes_free;
+} write_status_t;
+
+typedef struct {
+       unsigned short dsp_cmd;
+       unsigned short data_size;
+} data_write_t;
+
+typedef struct {
+       unsigned short int dsp_cmd;
+       unsigned short int status;
+       unsigned short int frame_size;
+       unsigned int stream_time_ms;
+} read_status_t;
+
+/* get time data structure */
+typedef struct {
+       unsigned short int dsp_cmd;
+       unsigned short int status;
+       unsigned short int stream_ID;
+       long int time_ms;
+} time_data_t;
+
+/* general stream command data structure */
+typedef struct {
+       unsigned short int dsp_cmd;
+       unsigned short int stream_ID;
+} stream_cmd_data_t;
+
+typedef struct {
+       unsigned short dsp_cmd;
+       unsigned short scale;
+       unsigned short power2;
+} volume_data_t;
+
+typedef struct {
+       unsigned short dsp_cmd;
+       unsigned short left_gain;
+       unsigned short right_gain;
+       unsigned short steps;
+} panning_data_t;
+
+#endif                         /* _TYPES_H */