1 /*
2  * dspapi.h
3  *
4  * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5  *
6  * Includes the wrapper functions called directly by the
7  * DeviceIOControl interface.
8  *
9  * Notes:
10  *   Bridge services exported to Bridge driver are initialized by the DSPAPI on
11  *   behalf of the Bridge driver. Bridge driver must not call module Init/Exit
12  *   functions.
13  *
14  *   To ensure Bridge driver binary compatibility across different platforms,
15  *   for the same processor, a Bridge driver must restrict its usage of system
16  *   services to those exported by the DSPAPI library.
17  *
18  * Copyright (C) 2005-2006 Texas Instruments, Inc.
19  *
20  * This package is free software; you can redistribute it and/or modify
21  * it under the terms of the GNU General Public License version 2 as
22  * published by the Free Software Foundation.
23  *
24  * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
25  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
26  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27  */
28 
29 #ifndef DSPAPI_
30 #define DSPAPI_
31 
32 #include <dspbridge/dspapi-ioctl.h>
33 
34 /* This BRD API Library Version: */
35 #define BRD_API_MAJOR_VERSION   (u32)8	/* .8x - Alpha, .9x - Beta, 1.x FCS */
36 #define BRD_API_MINOR_VERSION   (u32)0
37 
38 /*
39  *  ======== api_call_dev_ioctl ========
40  *  Purpose:
41  *      Call the (wrapper) function for the corresponding API IOCTL.
42  *  Parameters:
43  *      cmd:        IOCTL id, base 0.
44  *      args:       Argument structure.
45  *      result:
46  *  Returns:
47  *      0 if command called; -EINVAL if command not in IOCTL
48  *      table.
49  *  Requires:
50  *  Ensures:
51  */
52 extern int api_call_dev_ioctl(unsigned int cmd,
53 				      union trapped_args *args,
54 				      u32 *result, void *pr_ctxt);
55 
56 /*
57  *  ======== api_init ========
58  *  Purpose:
59  *      Initialize modules used by Bridge API.
60  *      This procedure is called when the driver is loaded.
61  *  Parameters:
62  *  Returns:
63  *      TRUE if success; FALSE otherwise.
64  *  Requires:
65  *  Ensures:
66  */
67 extern bool api_init(void);
68 
69 /*
70  *  ======== api_init_complete2 ========
71  *  Purpose:
72  *      Perform any required bridge initialization which cannot
73  *      be performed in api_init() or dev_start_device() due
74  *      to the fact that some services are not yet
75  *      completely initialized.
76  *  Parameters:
77  *  Returns:
78  *      0:        Allow this device to load
79  *      -EPERM:      Failure.
80  *  Requires:
81  *      Bridge API initialized.
82  *  Ensures:
83  */
84 extern int api_init_complete2(void);
85 
86 /*
87  *  ======== api_exit ========
88  *  Purpose:
89  *      Exit all modules initialized in api_init(void).
90  *      This procedure is called when the driver is unloaded.
91  *  Parameters:
92  *  Returns:
93  *  Requires:
94  *      api_init(void) was previously called.
95  *  Ensures:
96  *      Resources acquired in api_init(void) are freed.
97  */
98 extern void api_exit(void);
99 
100 /* MGR wrapper functions */
101 extern u32 mgrwrap_enum_node_info(union trapped_args *args, void *pr_ctxt);
102 extern u32 mgrwrap_enum_proc_info(union trapped_args *args, void *pr_ctxt);
103 extern u32 mgrwrap_register_object(union trapped_args *args, void *pr_ctxt);
104 extern u32 mgrwrap_unregister_object(union trapped_args *args, void *pr_ctxt);
105 extern u32 mgrwrap_wait_for_bridge_events(union trapped_args *args,
106 					  void *pr_ctxt);
107 
108 extern u32 mgrwrap_get_process_resources_info(union trapped_args *args,
109 					      void *pr_ctxt);
110 
111 /* CPRC (Processor) wrapper Functions */
112 extern u32 procwrap_attach(union trapped_args *args, void *pr_ctxt);
113 extern u32 procwrap_ctrl(union trapped_args *args, void *pr_ctxt);
114 extern u32 procwrap_detach(union trapped_args *args, void *pr_ctxt);
115 extern u32 procwrap_enum_node_info(union trapped_args *args, void *pr_ctxt);
116 extern u32 procwrap_enum_resources(union trapped_args *args, void *pr_ctxt);
117 extern u32 procwrap_get_state(union trapped_args *args, void *pr_ctxt);
118 extern u32 procwrap_get_trace(union trapped_args *args, void *pr_ctxt);
119 extern u32 procwrap_load(union trapped_args *args, void *pr_ctxt);
120 extern u32 procwrap_register_notify(union trapped_args *args, void *pr_ctxt);
121 extern u32 procwrap_start(union trapped_args *args, void *pr_ctxt);
122 extern u32 procwrap_reserve_memory(union trapped_args *args, void *pr_ctxt);
123 extern u32 procwrap_un_reserve_memory(union trapped_args *args, void *pr_ctxt);
124 extern u32 procwrap_map(union trapped_args *args, void *pr_ctxt);
125 extern u32 procwrap_un_map(union trapped_args *args, void *pr_ctxt);
126 extern u32 procwrap_flush_memory(union trapped_args *args, void *pr_ctxt);
127 extern u32 procwrap_stop(union trapped_args *args, void *pr_ctxt);
128 extern u32 procwrap_invalidate_memory(union trapped_args *args, void *pr_ctxt);
129 extern u32 procwrap_begin_dma(union trapped_args *args, void *pr_ctxt);
130 extern u32 procwrap_end_dma(union trapped_args *args, void *pr_ctxt);
131 
132 /* NODE wrapper functions */
133 extern u32 nodewrap_allocate(union trapped_args *args, void *pr_ctxt);
134 extern u32 nodewrap_alloc_msg_buf(union trapped_args *args, void *pr_ctxt);
135 extern u32 nodewrap_change_priority(union trapped_args *args, void *pr_ctxt);
136 extern u32 nodewrap_connect(union trapped_args *args, void *pr_ctxt);
137 extern u32 nodewrap_create(union trapped_args *args, void *pr_ctxt);
138 extern u32 nodewrap_delete(union trapped_args *args, void *pr_ctxt);
139 extern u32 nodewrap_free_msg_buf(union trapped_args *args, void *pr_ctxt);
140 extern u32 nodewrap_get_attr(union trapped_args *args, void *pr_ctxt);
141 extern u32 nodewrap_get_message(union trapped_args *args, void *pr_ctxt);
142 extern u32 nodewrap_pause(union trapped_args *args, void *pr_ctxt);
143 extern u32 nodewrap_put_message(union trapped_args *args, void *pr_ctxt);
144 extern u32 nodewrap_register_notify(union trapped_args *args, void *pr_ctxt);
145 extern u32 nodewrap_run(union trapped_args *args, void *pr_ctxt);
146 extern u32 nodewrap_terminate(union trapped_args *args, void *pr_ctxt);
147 extern u32 nodewrap_get_uuid_props(union trapped_args *args, void *pr_ctxt);
148 
149 /* STRM wrapper functions */
150 extern u32 strmwrap_allocate_buffer(union trapped_args *args, void *pr_ctxt);
151 extern u32 strmwrap_close(union trapped_args *args, void *pr_ctxt);
152 extern u32 strmwrap_free_buffer(union trapped_args *args, void *pr_ctxt);
153 extern u32 strmwrap_get_event_handle(union trapped_args *args, void *pr_ctxt);
154 extern u32 strmwrap_get_info(union trapped_args *args, void *pr_ctxt);
155 extern u32 strmwrap_idle(union trapped_args *args, void *pr_ctxt);
156 extern u32 strmwrap_issue(union trapped_args *args, void *pr_ctxt);
157 extern u32 strmwrap_open(union trapped_args *args, void *pr_ctxt);
158 extern u32 strmwrap_reclaim(union trapped_args *args, void *pr_ctxt);
159 extern u32 strmwrap_register_notify(union trapped_args *args, void *pr_ctxt);
160 extern u32 strmwrap_select(union trapped_args *args, void *pr_ctxt);
161 
162 extern u32 cmmwrap_calloc_buf(union trapped_args *args, void *pr_ctxt);
163 extern u32 cmmwrap_free_buf(union trapped_args *args, void *pr_ctxt);
164 extern u32 cmmwrap_get_handle(union trapped_args *args, void *pr_ctxt);
165 extern u32 cmmwrap_get_info(union trapped_args *args, void *pr_ctxt);
166 
167 #endif /* DSPAPI_ */
168