Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
davinci_cpdma.h
Go to the documentation of this file.
1 /*
2  * Texas Instruments CPDMA Driver
3  *
4  * Copyright (C) 2010 Texas Instruments
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation version 2.
9  *
10  * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11  * kind, whether express or implied; without even the implied warranty
12  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  */
15 #ifndef __DAVINCI_CPDMA_H__
16 #define __DAVINCI_CPDMA_H__
17 
18 #define CPDMA_MAX_CHANNELS BITS_PER_LONG
19 
20 #define tx_chan_num(chan) (chan)
21 #define rx_chan_num(chan) ((chan) + CPDMA_MAX_CHANNELS)
22 #define is_rx_chan(chan) ((chan)->chan_num >= CPDMA_MAX_CHANNELS)
23 #define is_tx_chan(chan) (!is_rx_chan(chan))
24 #define __chan_linear(chan_num) ((chan_num) & (CPDMA_MAX_CHANNELS - 1))
25 #define chan_linear(chan) __chan_linear((chan)->chan_num)
26 
27 struct cpdma_params {
28  struct device *dev;
30  void __iomem *txhdp, *rxhdp, *txcp, *rxcp;
32  int num_chan;
39 
40  /*
41  * Some instances of embedded cpdma controllers have extra control and
42  * status registers. The following flag enables access to these
43  * "extended" registers.
44  */
46 };
47 
62 };
63 
64 struct cpdma_ctlr;
65 struct cpdma_chan;
66 
67 typedef void (*cpdma_handler_fn)(void *token, int len, int status);
68 
70 int cpdma_ctlr_destroy(struct cpdma_ctlr *ctlr);
71 int cpdma_ctlr_start(struct cpdma_ctlr *ctlr);
72 int cpdma_ctlr_stop(struct cpdma_ctlr *ctlr);
73 int cpdma_ctlr_dump(struct cpdma_ctlr *ctlr);
74 
78 int cpdma_chan_start(struct cpdma_chan *chan);
79 int cpdma_chan_stop(struct cpdma_chan *chan);
80 int cpdma_chan_dump(struct cpdma_chan *chan);
81 
83  struct cpdma_chan_stats *stats);
84 int cpdma_chan_submit(struct cpdma_chan *chan, void *token, void *data,
85  int len, gfp_t gfp_mask);
86 int cpdma_chan_process(struct cpdma_chan *chan, int quota);
87 
88 int cpdma_ctlr_int_ctrl(struct cpdma_ctlr *ctlr, bool enable);
89 void cpdma_ctlr_eoi(struct cpdma_ctlr *ctlr);
90 int cpdma_chan_int_ctrl(struct cpdma_chan *chan, bool enable);
91 
93  CPDMA_CMD_IDLE, /* write-only */
94  CPDMA_COPY_ERROR_FRAMES, /* read-write */
95  CPDMA_RX_OFF_LEN_UPDATE, /* read-write */
96  CPDMA_RX_OWNERSHIP_FLIP, /* read-write */
97  CPDMA_TX_PRIO_FIXED, /* read-write */
98  CPDMA_STAT_IDLE, /* read-only */
99  CPDMA_STAT_TX_ERR_CHAN, /* read-only */
100  CPDMA_STAT_TX_ERR_CODE, /* read-only */
101  CPDMA_STAT_RX_ERR_CHAN, /* read-only */
102  CPDMA_STAT_RX_ERR_CODE, /* read-only */
103  CPDMA_RX_BUFFER_OFFSET, /* read-write */
104 };
105 
106 int cpdma_control_get(struct cpdma_ctlr *ctlr, int control);
107 int cpdma_control_set(struct cpdma_ctlr *ctlr, int control, int value);
108 
109 #endif