~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/soc/blackfin/bf5xx-sport.h

Version: ~ [ linux-5.11-rc3 ] ~ [ linux-5.10.7 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.89 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.167 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.215 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.251 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.251 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * File:         bf5xx_sport.h
  3  * Based on:
  4  * Author:       Roy Huang <roy.huang@analog.com>
  5  *
  6  * Created:
  7  * Description:
  8  *
  9  *               Copyright 2004-2007 Analog Devices Inc.
 10  *
 11  * Bugs:         Enter bugs at http://blackfin.uclinux.org/
 12  *
 13  * This program is free software; you can redistribute it and/or modify
 14  * it under the terms of the GNU General Public License as published by
 15  * the Free Software Foundation; either version 2 of the License, or
 16  * (at your option) any later version.
 17  *
 18  * This program is distributed in the hope that it will be useful,
 19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 21  * GNU General Public License for more details.
 22  *
 23  * You should have received a copy of the GNU General Public License
 24  * along with this program; if not, see the file COPYING, or write
 25  * to the Free Software Foundation, Inc.,
 26  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 27  */
 28 
 29 
 30 #ifndef __BF5XX_SPORT_H__
 31 #define __BF5XX_SPORT_H__
 32 
 33 #include <linux/types.h>
 34 #include <linux/wait.h>
 35 #include <linux/workqueue.h>
 36 #include <linux/platform_device.h>
 37 #include <asm/dma.h>
 38 #include <asm/bfin_sport.h>
 39 
 40 #define DESC_ELEMENT_COUNT 9
 41 
 42 struct sport_device {
 43         int num;
 44         int dma_rx_chan;
 45         int dma_tx_chan;
 46         int err_irq;
 47         const unsigned short *pin_req;
 48         struct sport_register *regs;
 49 
 50         unsigned char *rx_buf;
 51         unsigned char *tx_buf;
 52         unsigned int rx_fragsize;
 53         unsigned int tx_fragsize;
 54         unsigned int rx_frags;
 55         unsigned int tx_frags;
 56         unsigned int wdsize;
 57 
 58         /* for dummy dma transfer */
 59         void *dummy_buf;
 60         unsigned int dummy_count;
 61 
 62         /* DMA descriptor ring head of current audio stream*/
 63         struct dmasg *dma_rx_desc;
 64         struct dmasg *dma_tx_desc;
 65         unsigned int rx_desc_bytes;
 66         unsigned int tx_desc_bytes;
 67 
 68         unsigned int rx_run:1; /* rx is running */
 69         unsigned int tx_run:1; /* tx is running */
 70 
 71         struct dmasg *dummy_rx_desc;
 72         struct dmasg *dummy_tx_desc;
 73 
 74         struct dmasg *curr_rx_desc;
 75         struct dmasg *curr_tx_desc;
 76 
 77         int rx_curr_frag;
 78         int tx_curr_frag;
 79 
 80         unsigned int rcr1;
 81         unsigned int rcr2;
 82         int rx_tdm_count;
 83 
 84         unsigned int tcr1;
 85         unsigned int tcr2;
 86         int tx_tdm_count;
 87 
 88         void (*rx_callback)(void *data);
 89         void *rx_data;
 90         void (*tx_callback)(void *data);
 91         void *tx_data;
 92         void (*err_callback)(void *data);
 93         void *err_data;
 94         unsigned char *tx_dma_buf;
 95         unsigned char *rx_dma_buf;
 96 #ifdef CONFIG_SND_BF5XX_MMAP_SUPPORT
 97         dma_addr_t tx_dma_phy;
 98         dma_addr_t rx_dma_phy;
 99         int tx_pos;/*pcm sample count*/
100         int rx_pos;
101         unsigned int tx_buffer_size;
102         unsigned int rx_buffer_size;
103         int tx_delay_pos;
104         int once;
105 #endif
106         void *private_data;
107 };
108 
109 struct sport_param {
110         int num;
111         int dma_rx_chan;
112         int dma_tx_chan;
113         int err_irq;
114         const unsigned short *pin_req;
115         struct sport_register *regs;
116         unsigned int wdsize;
117         unsigned int dummy_count;
118         void *private_data;
119 };
120 
121 struct sport_device *sport_init(struct platform_device *pdev,
122         unsigned int wdsize, unsigned int dummy_count, size_t priv_size);
123 
124 void sport_done(struct sport_device *sport);
125 
126 /* first use these ...*/
127 
128 /* note: multichannel is in units of 8 channels, tdm_count is number of channels
129  *  NOT / 8 ! all channels are enabled by default */
130 int sport_set_multichannel(struct sport_device *sport, int tdm_count,
131                 u32 tx_mask, u32 rx_mask, int packed);
132 
133 int sport_config_rx(struct sport_device *sport,
134                 unsigned int rcr1, unsigned int rcr2,
135                 unsigned int clkdiv, unsigned int fsdiv);
136 
137 int sport_config_tx(struct sport_device *sport,
138                 unsigned int tcr1, unsigned int tcr2,
139                 unsigned int clkdiv, unsigned int fsdiv);
140 
141 /* ... then these: */
142 
143 /* buffer size (in bytes) == fragcount * fragsize_bytes */
144 
145 /* this is not a very general api, it sets the dma to 2d autobuffer mode */
146 
147 int sport_config_rx_dma(struct sport_device *sport, void *buf,
148                 int fragcount, size_t fragsize_bytes);
149 
150 int sport_config_tx_dma(struct sport_device *sport, void *buf,
151                 int fragcount, size_t fragsize_bytes);
152 
153 int sport_tx_start(struct sport_device *sport);
154 int sport_tx_stop(struct sport_device *sport);
155 int sport_rx_start(struct sport_device *sport);
156 int sport_rx_stop(struct sport_device *sport);
157 
158 /* for use in interrupt handler */
159 unsigned long sport_curr_offset_rx(struct sport_device *sport);
160 unsigned long sport_curr_offset_tx(struct sport_device *sport);
161 
162 void sport_incfrag(struct sport_device *sport, int *frag, int tx);
163 void sport_decfrag(struct sport_device *sport, int *frag, int tx);
164 
165 int sport_set_rx_callback(struct sport_device *sport,
166                        void (*rx_callback)(void *), void *rx_data);
167 int sport_set_tx_callback(struct sport_device *sport,
168                        void (*tx_callback)(void *), void *tx_data);
169 int sport_set_err_callback(struct sport_device *sport,
170                        void (*err_callback)(void *), void *err_data);
171 
172 int sport_send_and_recv(struct sport_device *sport, u8 *out_data, \
173                 u8 *in_data, int len);
174 #endif /* BF53X_SPORT_H */
175 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp