Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
_chnl_sm.h
Go to the documentation of this file.
1 /*
2  * _chnl_sm.h
3  *
4  * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5  *
6  * Private header file defining channel manager and channel objects for
7  * a shared memory channel driver.
8  *
9  * Shared between the modules implementing the shared memory channel class
10  * library.
11  *
12  * Copyright (C) 2005-2006 Texas Instruments, Inc.
13  *
14  * This package is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License version 2 as
16  * published by the Free Software Foundation.
17  *
18  * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
19  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
20  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21  */
22 
23 #ifndef _CHNL_SM_
24 #define _CHNL_SM_
25 
26 #include <dspbridge/dspapi.h>
27 #include <dspbridge/dspdefs.h>
28 
29 #include <linux/list.h>
30 #include <dspbridge/ntfy.h>
31 
32 /*
33  * These target side symbols define the beginning and ending addresses
34  * of shared memory buffer. They are defined in the *cfg.cmd file by
35  * cdb code.
36  */
37 #define CHNL_SHARED_BUFFER_BASE_SYM "_SHM_BEG"
38 #define CHNL_SHARED_BUFFER_LIMIT_SYM "_SHM_END"
39 #define BRIDGEINIT_BIOSGPTIMER "_BRIDGEINIT_BIOSGPTIMER"
40 #define BRIDGEINIT_LOADMON_GPTIMER "_BRIDGEINIT_LOADMON_GPTIMER"
41 
42 #ifndef _CHNL_WORDSIZE
43 #define _CHNL_WORDSIZE 4 /* default _CHNL_WORDSIZE is 2 bytes/word */
44 #endif
45 
46 #define MAXOPPS 16
47 
48 /* Shared memory config options */
49 #define SHM_CURROPP 0 /* Set current OPP in shm */
50 #define SHM_OPPINFO 1 /* Set dsp voltage and freq table values */
51 #define SHM_GETOPP 2 /* Get opp requested by DSP */
52 
58 };
59 
60 struct opp_struct {
64 };
65 
66 /* Request to MPU */
70 };
71 
72 /* Info to MPU */
78 };
79 
80 /* Structure in shared between DSP and PC for communication. */
81 struct shm {
82  u32 dsp_free_mask; /* Written by DSP, read by PC. */
83  u32 host_free_mask; /* Written by PC, read by DSP */
84 
85  u32 input_full; /* Input channel has unread data. */
86  u32 input_id; /* Channel for which input is available. */
87  u32 input_size; /* Size of data block (in DSP words). */
88 
89  u32 output_full; /* Output channel has unread data. */
90  u32 output_id; /* Channel for which output is available. */
91  u32 output_size; /* Size of data block (in DSP words). */
92 
93  u32 arg; /* Arg for Issue/Reclaim (23 bits for 55x). */
94  u32 resvd; /* Keep structure size even for 32-bit DSPs */
95 
96  /* Operating Point structure */
98  /* Operating Point Request structure */
100  /* load monitor information structure */
102  /* Flag for WDT enable/disable F/I clocks */
104  u32 wdt_overflow; /* WDT overflow time */
105  char dummy[176]; /* padding to 256 byte boundary */
106  u32 shm_dbg_var[64]; /* shared memory debug variables */
107 };
108 
109  /* Channel Manager: only one created per board: */
110 struct chnl_mgr {
111  /* Function interface to Bridge driver */
113  struct io_mgr *iomgr; /* IO manager */
114  /* Device this board represents */
116 
117  /* These fields initialized in bridge_chnl_create(): */
118  u32 output_mask; /* Host output channels w/ full buffers */
119  u32 last_output; /* Last output channel fired from DPC */
120  /* Critical section object handle */
122  u32 word_size; /* Size in bytes of DSP word */
123  u8 max_channels; /* Total number of channels */
124  u8 open_channels; /* Total number of open channels */
125  struct chnl_object **channels; /* Array of channels */
126  u8 type; /* Type of channel class library */
127  /* If no shm syms, return for CHNL_Open */
129 };
130 
131 /*
132  * Channel: up to CHNL_MAXCHANNELS per board or if DSP-DMA supported then
133  * up to CHNL_MAXCHANNELS + CHNL_MAXDDMACHNLS per board.
134  */
135 struct chnl_object {
136  /* Pointer back to channel manager */
138  u32 chnl_id; /* Channel id */
139  u8 state; /* Current channel state */
140  s8 chnl_mode; /* Chnl mode and attributes */
141  /* Chnl I/O completion event (user mode) */
142  void *user_event;
143  /* Abstract synchronization object */
145  u32 process; /* Process which created this channel */
146  u32 cb_arg; /* Argument to use with callback */
147  struct list_head io_requests; /* List of IOR's to driver */
148  s32 cio_cs; /* Number of IOC's in queue */
149  s32 cio_reqs; /* Number of IORequests in queue */
150  s32 chnl_packets; /* Initial number of free Irps */
151  /* List of IOC's from driver */
153  struct list_head free_packets_list; /* List of free Irps */
155  u32 bytes_moved; /* Total number of bytes transferred */
156 
157  /* For DSP-DMA */
158 
159  /* Type of chnl transport:CHNL_[PCPY][DDMA] */
161 };
162 
163 /* I/O Request/completion packet: */
164 struct chnl_irp {
165  struct list_head link; /* Link to next CHIRP in queue. */
166  /* Buffer to be filled/emptied. (User) */
168  /* Buffer to be filled/emptied. (System) */
170  u32 arg; /* Issue/Reclaim argument. */
171  u32 dsp_tx_addr; /* Transfer address on DSP side. */
172  u32 byte_size; /* Bytes transferred. */
173  u32 buf_size; /* Actual buffer size when allocated. */
174  u32 status; /* Status of IO completion. */
175 };
176 
177 #endif /* _CHNL_SM_ */