Root/target/linux/ubicom32/files/arch/ubicom32/include/asm/audionode.h

1/*
2 * audionode.h
3 * audionode and DMA descriptors
4 *
5 * Copyright 2009 Ubicom Inc. <www.ubicom.com>. All rights reserved.
6 *
7 * This file contains confidential information of Ubicom, Inc. and your use of
8 * this file is subject to the Ubicom Software License Agreement distributed with
9 * this file. If you are uncertain whether you are an authorized user or to report
10 * any unauthorized use, please contact Ubicom, Inc. at +1-408-789-2200.
11 * Unauthorized reproduction or distribution of this file is subject to civil and
12 * criminal penalties.
13 *
14 */
15#ifndef _AUDIONODE_H_
16#define _AUDIONODE_H_
17
18#define AUDIO_INT_FLAG_MORE_SAMPLES 0x00000001
19#define AUDIO_INT_FLAG_COMMAND 0x00000002
20
21/*
22 * Commands the Primary OS sends to the audio device
23 */
24enum audio_command {
25    AUDIO_CMD_NONE,
26    AUDIO_CMD_START,
27    AUDIO_CMD_STOP,
28    AUDIO_CMD_PAUSE,
29    AUDIO_CMD_RESUME,
30    AUDIO_CMD_MUTE,
31    AUDIO_CMD_UNMUTE,
32    AUDIO_CMD_SETUP,
33    AUDIO_CMD_ENABLE,
34    AUDIO_CMD_DISABLE,
35};
36
37/*
38 * Flag bits passed in the registers
39 */
40#define CMD_START_FLAG_LE (1 << 0) /* Use Little Endian Mode */
41
42/*
43 * Status bits that audio device can set to indicate reason
44 * for interrupting the Primary OS
45 */
46#define AUDIO_STATUS_PLAY_DMA0_REQUEST (1 << 0) /* Audio device needs samples in DMA0 for playback */
47#define AUDIO_STATUS_PLAY_DMA1_REQUEST (1 << 1) /* Audio device needs samples in DMA1 for playback */
48
49struct audio_dma {
50    /*
51     * NOTE: The active flag shall only be SET by the producer and CLEARED
52     * by the consumer, NEVER the other way around. For playback, the
53     * Primary OS sets this flag and ipAudio clears it.
54     *
55     * The producer shall not modify the ptr or ctr fields when the transfer
56     * is marked as active, as these are used by the consumer to do the
57     * transfer.
58     */
59    volatile u32_t active; /* Nonzero if data in ptr/ctr ready to be transferred */
60    volatile void *ptr; /* Pointer to data to be transferred */
61    volatile u32_t ctr; /* Counter: number of data units to transfer */
62};
63
64#define AUDIONODE_CAP_BE (1 << 0)
65#define AUDIONODE_CAP_LE (1 << 1)
66
67#define AUDIONODE_VERSION 7
68struct audio_node {
69    struct devtree_node dn;
70
71    /*
72     * Version of this node
73     */
74    u32_t version;
75
76    /*
77     * Pointer to the registers
78     */
79    struct audio_regs *regs;
80};
81
82/*
83 * [OCM] Audio registers
84 * Registers exposed as part of our MMIO area
85 */
86#define AUDIO_REGS_VERSION 7
87struct audio_regs {
88    /*
89     * Version of this register set
90     */
91    u32_t version;
92
93    /*
94     * Interrupt status
95     */
96    volatile u32_t int_status;
97
98    /*
99     * Interrupt request
100     */
101    volatile u32_t int_req;
102
103    /*
104     * Current IRQ being serviced
105     */
106    u32_t cur_irq;
107
108    /*
109     * Maximum number of devices supported
110     */
111    u32_t max_devs;
112
113    /*
114     * [DDR] Device registers for each of the devices
115     */
116    struct audio_dev_regs *adr;
117};
118
119#define AUDIO_DEV_REGS_VERSION 2
120struct audio_dev_regs {
121    u32_t version; /* Version of this register set */
122
123    u8_t name[32]; /* Name of this driver */
124    u32_t caps; /* Capabilities of this driver */
125    const u32_t *sample_rates; /* Sample Rates supported by this driver */
126    u32_t n_sample_rates; /* Number of sample rates supported by this driver */
127    u32_t channel_mask; /* A bit set in a particular position means we support this channel configuration */
128    volatile u32_t int_flags; /* Reason for interrupting audio device */
129    volatile enum audio_command command; /* Command from Primary OS */
130    volatile u32_t flags; /* Flag bits for this command */
131    volatile u32_t channels; /* Number of channels */
132    volatile u32_t sample_rate; /* Sample rate */
133    volatile u32_t status; /* Status bits sent from ipAudio to Primary OS */
134    void *primary_os_buffer_ptr; /*
135                             * Playback: Pointer to next sample to be removed from
136                             * Primary OS sample buffer
137                             * Capture: Pointer to where next sample will be inserted
138                             * into Primary OS sample buffer
139                             */
140
141    /*
142     * These are the transfer requests. They are used in alternating
143     * order so that when ipAudio is processing one request, the
144     * Primary OS can fill in the other one.
145     *
146     * NOTE: The active bit shall always be SET by the producer and
147     * CLEARED by the consumer, NEVER the other way around.
148     */
149    struct audio_dma dma_xfer_requests[2];
150};
151
152#endif
153

Archive Download this file



interactive