aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/tidspbridge/include/dspbridge/io_sm.h
blob: 903ff12b14de9f6556da9f6e06bb50c60ed06c89 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/*
 * io_sm.h
 *
 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
 *
 * IO dispatcher for a shared memory channel driver.
 * Also, includes macros to simulate shm via port io calls.
 *
 * Copyright (C) 2005-2006 Texas Instruments, Inc.
 *
 * This package is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

#ifndef IOSM_
#define IOSM_

#include <dspbridge/_chnl_sm.h>
#include <dspbridge/host_os.h>

#include <dspbridge/io.h>
#include <dspbridge/mbx_sh.h>	/* shared mailbox codes */

/* Magic code used to determine if DSP signaled exception. */
#define DEH_BASE        MBX_DEH_BASE
#define DEH_LIMIT       MBX_DEH_LIMIT

#define IO_INPUT            0
#define IO_OUTPUT           1
#define IO_SERVICE          2

#ifdef CONFIG_TIDSPBRIDGE_DVFS
/* The maximum number of OPPs that are supported */
extern s32 dsp_max_opps;
/* The Vdd1 opp table information */
extern u32 vdd1_dsp_freq[6][4];
#endif

/*
 *  ======== io_cancel_chnl ========
 *  Purpose:
 *      Cancel IO on a given channel.
 *  Parameters:
 *      hio_mgr:     IO Manager.
 *      chnl:       Index of channel to cancel IO on.
 *  Returns:
 *  Requires:
 *      Valid hio_mgr.
 *  Ensures:
 */
extern void io_cancel_chnl(struct io_mgr *hio_mgr, u32 chnl);

/*
 *  ======== io_dpc ========
 *  Purpose:
 *      Deferred procedure call for shared memory channel driver ISR.  Carries
 *      out the dispatch of I/O.
 *  Parameters:
 *      ref_data:   Pointer to reference data registered via a call to
 *                  DPC_Create().
 *  Returns:
 *  Requires:
 *      Must not block.
 *      Must not acquire resources.
 *      All data touched must be locked in memory if running in kernel mode.
 *  Ensures:
 *      Non-preemptible (but interruptible).
 */
extern void io_dpc(unsigned long ref_data);

/*
 *  ======== io_mbox_msg ========
 *  Purpose:
 *	Main message handler for the shared memory Bridge channel manager.
 *	Determine if this message is ours, then schedules a DPC to
 *	dispatch I/O.
 *  Parameters:
 *	self:	Pointer to its own notifier_block struct.
 *	len:	Length of message.
 *	msg:	Message code received.
 *  Returns:
 *	NOTIFY_OK if handled; NOTIFY_BAD otherwise.
 */
int io_mbox_msg(struct notifier_block *self, unsigned long len, void *msg);

/*
 *  ======== io_request_chnl ========
 *  Purpose:
 *      Request I/O from the DSP. Sets flags in shared memory, then interrupts
 *      the DSP.
 *  Parameters:
 *      hio_mgr:     IO manager handle.
 *      pchnl:      Ptr to the channel requesting I/O.
 *      io_mode:      Mode of channel: {IO_INPUT | IO_OUTPUT}.
 *  Returns:
 *  Requires:
 *      pchnl != NULL
 *  Ensures:
 */
extern void io_request_chnl(struct io_mgr *io_manager,
			    struct chnl_object *pchnl,
			    u8 io_mode, u16 *mbx_val);

/*
 *  ======== iosm_schedule ========
 *  Purpose:
 *      Schedule DPC for IO.
 *  Parameters:
 *      pio_mgr:     Ptr to a I/O manager.
 *  Returns:
 *  Requires:
 *      pchnl != NULL
 *  Ensures:
 */
extern void iosm_schedule(struct io_mgr *io_manager);

/*
 *  ======== io_sh_msetting ========
 *  Purpose:
 *      Sets the shared memory setting
 *  Parameters:
 *      hio_mgr:         Handle to a I/O manager.
 *      desc:             Shared memory type
 *      pargs:          Ptr to shm setting
 *  Returns:
 *  Requires:
 *      hio_mgr != NULL
 *      pargs != NULL
 *  Ensures:
 */
extern int io_sh_msetting(struct io_mgr *hio_mgr, u8 desc, void *pargs);

/*
 *  Misc functions for the CHNL_IO shared memory library:
 */

/* Maximum channel bufsize that can be used. */
extern u32 io_buf_size(struct io_mgr *hio_mgr);

#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE
/*
 *  ========print_dsp_trace_buffer ========
 *      Print DSP tracebuffer.
 */
extern int print_dsp_trace_buffer(struct bridge_dev_context
					 *hbridge_context);

int dump_dsp_stack(struct bridge_dev_context *bridge_context);

void dump_dl_modules(struct bridge_dev_context *bridge_context);

void print_dsp_debug_trace(struct io_mgr *hio_mgr);
#endif

#endif /* IOSM_ */