Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
io_sm.h
Go to the documentation of this file.
1 /*
2  * io_sm.h
3  *
4  * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5  *
6  * IO dispatcher for a shared memory channel driver.
7  * Also, includes macros to simulate shm via port io calls.
8  *
9  * Copyright (C) 2005-2006 Texas Instruments, Inc.
10  *
11  * This package is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License version 2 as
13  * published by the Free Software Foundation.
14  *
15  * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18  */
19 
20 #ifndef IOSM_
21 #define IOSM_
22 
23 #include <dspbridge/_chnl_sm.h>
24 #include <dspbridge/host_os.h>
25 
26 #include <dspbridge/io.h>
27 #include <dspbridge/mbx_sh.h> /* shared mailbox codes */
28 
29 /* Magic code used to determine if DSP signaled exception. */
30 #define DEH_BASE MBX_DEH_BASE
31 #define DEH_LIMIT MBX_DEH_LIMIT
32 
33 #define IO_INPUT 0
34 #define IO_OUTPUT 1
35 #define IO_SERVICE 2
36 
37 #ifdef CONFIG_TIDSPBRIDGE_DVFS
38 /* The maximum number of OPPs that are supported */
39 extern s32 dsp_max_opps;
40 /* The Vdd1 opp table information */
41 extern u32 vdd1_dsp_freq[6][4];
42 #endif
43 
44 /*
45  * ======== io_cancel_chnl ========
46  * Purpose:
47  * Cancel IO on a given channel.
48  * Parameters:
49  * hio_mgr: IO Manager.
50  * chnl: Index of channel to cancel IO on.
51  * Returns:
52  * Requires:
53  * Valid hio_mgr.
54  * Ensures:
55  */
56 extern void io_cancel_chnl(struct io_mgr *hio_mgr, u32 chnl);
57 
58 /*
59  * ======== io_dpc ========
60  * Purpose:
61  * Deferred procedure call for shared memory channel driver ISR. Carries
62  * out the dispatch of I/O.
63  * Parameters:
64  * ref_data: Pointer to reference data registered via a call to
65  * DPC_Create().
66  * Returns:
67  * Requires:
68  * Must not block.
69  * Must not acquire resources.
70  * All data touched must be locked in memory if running in kernel mode.
71  * Ensures:
72  * Non-preemptible (but interruptible).
73  */
74 extern void io_dpc(unsigned long ref_data);
75 
76 /*
77  * ======== io_mbox_msg ========
78  * Purpose:
79  * Main message handler for the shared memory Bridge channel manager.
80  * Determine if this message is ours, then schedules a DPC to
81  * dispatch I/O.
82  * Parameters:
83  * self: Pointer to its own notifier_block struct.
84  * len: Length of message.
85  * msg: Message code received.
86  * Returns:
87  * NOTIFY_OK if handled; NOTIFY_BAD otherwise.
88  */
89 int io_mbox_msg(struct notifier_block *self, unsigned long len, void *msg);
90 
91 /*
92  * ======== io_request_chnl ========
93  * Purpose:
94  * Request I/O from the DSP. Sets flags in shared memory, then interrupts
95  * the DSP.
96  * Parameters:
97  * hio_mgr: IO manager handle.
98  * pchnl: Ptr to the channel requesting I/O.
99  * io_mode: Mode of channel: {IO_INPUT | IO_OUTPUT}.
100  * Returns:
101  * Requires:
102  * pchnl != NULL
103  * Ensures:
104  */
105 extern void io_request_chnl(struct io_mgr *io_manager,
106  struct chnl_object *pchnl,
107  u8 io_mode, u16 *mbx_val);
108 
109 /*
110  * ======== iosm_schedule ========
111  * Purpose:
112  * Schedule DPC for IO.
113  * Parameters:
114  * pio_mgr: Ptr to a I/O manager.
115  * Returns:
116  * Requires:
117  * pchnl != NULL
118  * Ensures:
119  */
120 extern void iosm_schedule(struct io_mgr *io_manager);
121 
122 /*
123  * ======== io_sh_msetting ========
124  * Purpose:
125  * Sets the shared memory setting
126  * Parameters:
127  * hio_mgr: Handle to a I/O manager.
128  * desc: Shared memory type
129  * pargs: Ptr to shm setting
130  * Returns:
131  * Requires:
132  * hio_mgr != NULL
133  * pargs != NULL
134  * Ensures:
135  */
136 extern int io_sh_msetting(struct io_mgr *hio_mgr, u8 desc, void *pargs);
137 
138 /*
139  * Misc functions for the CHNL_IO shared memory library:
140  */
141 
142 /* Maximum channel bufsize that can be used. */
143 extern u32 io_buf_size(struct io_mgr *hio_mgr);
144 
145 #ifdef CONFIG_TIDSPBRIDGE_BACKTRACE
146 /*
147  * ========print_dsp_trace_buffer ========
148  * Print DSP tracebuffer.
149  */
150 extern int print_dsp_trace_buffer(struct bridge_dev_context
151  *hbridge_context);
152 
153 int dump_dsp_stack(struct bridge_dev_context *bridge_context);
154 
155 void dump_dl_modules(struct bridge_dev_context *bridge_context);
156 
157 void print_dsp_debug_trace(struct io_mgr *hio_mgr);
158 #endif
159 
160 #endif /* IOSM_ */