4 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
6 * Global Dynamic + static/overlay Node loader (NLDR) constants and types.
8 * Copyright (C) 2008 Texas Instruments, Inc.
10 * This package is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
14 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22 #include <dspbridge/dbdcddef.h>
23 #include <dspbridge/devdefs.h>
25 #define NLDR_MAXPATHLENGTH 255
28 struct nldr_nodeobject;
31 * ======== nldr_loadtype ========
32 * Load types for a node. Must match values in node.h55.
35 NLDR_STATICLOAD, /* Linked in base image, not overlay */
36 NLDR_DYNAMICLOAD, /* Dynamically loaded node */
37 NLDR_OVLYLOAD /* Linked in base image, overlay node */
41 * ======== nldr_ovlyfxn ========
42 * Causes code or data to be copied from load address to run address. This
43 * is the "cod_writefxn" that gets passed to the DBLL_Library and is used as
44 * the ZL write function.
47 * priv_ref: Handle to identify the node.
48 * dsp_run_addr: Run address of code or data.
49 * dsp_load_addr: Load address of code or data.
50 * ul_num_bytes: Number of (GPP) bytes to copy.
51 * mem_space: RMS_CODE or RMS_DATA.
53 * ul_num_bytes: Success.
58 typedef u32(*nldr_ovlyfxn) (void *priv_ref, u32 dsp_run_addr,
59 u32 dsp_load_addr, u32 ul_num_bytes, u32 mem_space);
62 * ======== nldr_writefxn ========
63 * Write memory function. Used for dynamic load writes.
65 * priv_ref: Handle to identify the node.
66 * dsp_add: Address of code or data.
67 * pbuf: Code or data to be written
68 * ul_num_bytes: Number of (GPP) bytes to write.
69 * mem_space: DBLL_DATA or DBLL_CODE.
71 * ul_num_bytes: Success.
76 typedef u32(*nldr_writefxn) (void *priv_ref,
77 u32 dsp_add, void *pbuf,
78 u32 ul_num_bytes, u32 mem_space);
81 * ======== nldr_attrs ========
82 * Attributes passed to nldr_create function.
85 nldr_ovlyfxn pfn_ovly;
86 nldr_writefxn pfn_write;
92 * ======== nldr_phase ========
93 * Indicates node create, delete, or execute phase function.
103 * Typedefs of loader functions imported from a DLL, or defined in a
108 * ======== nldr_allocate ========
109 * Allocate resources to manage the loading of a node on the DSP.
112 * nldr_obj: Handle of loader that will load the node.
113 * priv_ref: Handle to identify the node.
114 * node_props: Pointer to a dcd_nodeprops for the node.
115 * nldr_nodeobj: Location to store node handle on output. This handle
116 * will be passed to nldr_load/nldr_unload.
117 * pf_phase_split: pointer to int variable referenced in node.c
120 * -ENOMEM: Insufficient memory on GPP.
122 * nldr_init(void) called.
124 * node_props != NULL.
125 * nldr_nodeobj != NULL.
127 * 0: IsValidNode(*nldr_nodeobj).
128 * error: *nldr_nodeobj == NULL.
130 typedef int(*nldr_allocatefxn) (struct nldr_object *nldr_obj,
132 IN const struct dcd_nodeprops
134 OUT struct nldr_nodeobject
136 OUT bool *pf_phase_split);
139 * ======== nldr_create ========
140 * Create a loader object. This object handles the loading and unloading of
141 * create, delete, and execute phase functions of nodes on the DSP target.
144 * nldr: Location to store loader handle on output.
145 * hdev_obj: Device for this processor.
146 * pattrs: Loader attributes.
149 * -ENOMEM: Insufficient memory for requested resources.
151 * nldr_init(void) called.
157 * error: *nldr == NULL.
159 typedef int(*nldr_createfxn) (OUT struct nldr_object **nldr,
160 struct dev_object *hdev_obj,
161 IN const struct nldr_attrs *pattrs);
164 * ======== nldr_delete ========
165 * Delete the NLDR loader.
168 * nldr_obj: Node manager object.
171 * nldr_init(void) called.
176 typedef void (*nldr_deletefxn) (struct nldr_object *nldr_obj);
179 * ======== nldr_exit ========
180 * Discontinue usage of NLDR module.
185 * nldr_init(void) successfully called before.
187 * Any resources acquired in nldr_init(void) will be freed when last NLDR
188 * client calls nldr_exit(void).
190 typedef void (*nldr_exitfxn) (void);
193 * ======== NLDR_Free ========
194 * Free resources allocated in nldr_allocate.
197 * nldr_node_obj: Handle returned from nldr_allocate().
200 * nldr_init(void) called.
201 * Valid nldr_node_obj.
204 typedef void (*nldr_freefxn) (struct nldr_nodeobject *nldr_node_obj);
207 * ======== nldr_get_fxn_addr ========
208 * Get address of create, delete, or execute phase function of a node on
212 * nldr_node_obj: Handle returned from nldr_allocate().
213 * str_fxn: Name of function.
214 * addr: Location to store function address.
217 * -ESPIPE: Address of function not found.
219 * nldr_init(void) called.
220 * Valid nldr_node_obj.
225 typedef int(*nldr_getfxnaddrfxn) (struct nldr_nodeobject
227 char *str_fxn, u32 * addr);
230 * ======== nldr_init ========
231 * Initialize the NLDR module.
235 * TRUE if initialization succeeded, FALSE otherwise.
238 typedef bool(*nldr_initfxn) (void);
241 * ======== nldr_load ========
242 * Load create, delete, or execute phase function of a node on the DSP.
245 * nldr_node_obj: Handle returned from nldr_allocate().
246 * phase: Type of function to load (create, delete, or execute).
249 * -ENOMEM: Insufficient memory on GPP.
250 * -ENXIO: Can't overlay phase because overlay memory
252 * -EILSEQ: Failure in dynamic loader library.
254 * nldr_init(void) called.
255 * Valid nldr_node_obj.
258 typedef int(*nldr_loadfxn) (struct nldr_nodeobject *nldr_node_obj,
259 enum nldr_phase phase);
262 * ======== nldr_unload ========
263 * Unload create, delete, or execute phase function of a node on the DSP.
266 * nldr_node_obj: Handle returned from nldr_allocate().
267 * phase: Node function to unload (create, delete, or execute).
270 * -ENOMEM: Insufficient memory on GPP.
272 * nldr_init(void) called.
273 * Valid nldr_node_obj.
276 typedef int(*nldr_unloadfxn) (struct nldr_nodeobject *nldr_node_obj,
277 enum nldr_phase phase);
280 * ======== node_ldr_fxns ========
282 struct node_ldr_fxns {
283 nldr_allocatefxn pfn_allocate;
284 nldr_createfxn pfn_create;
285 nldr_deletefxn pfn_delete;
286 nldr_exitfxn pfn_exit;
287 nldr_getfxnaddrfxn pfn_get_fxn_addr;
288 nldr_initfxn pfn_init;
289 nldr_loadfxn pfn_load;
290 nldr_unloadfxn pfn_unload;
293 #endif /* NLDRDEFS_ */