upload tizen1.0 source
[kernel/linux-2.6.36.git] / drivers / staging / tidspbridge / include / dspbridge / dbldefs.h
1 /*
2  * dbldefs.h
3  *
4  * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5  *
6  * Copyright (C) 2005-2006 Texas Instruments, Inc.
7  *
8  * This package is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  *
12  * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15  */
16
17 #ifndef DBLDEFS_
18 #define DBLDEFS_
19
20 /*
21  *  Bit masks for dbl_flags.
22  */
23 #define DBL_NOLOAD   0x0        /* Don't load symbols, code, or data */
24 #define DBL_SYMB     0x1        /* load symbols */
25 #define DBL_CODE     0x2        /* load code */
26 #define DBL_DATA     0x4        /* load data */
27 #define DBL_DYNAMIC  0x8        /* dynamic load */
28 #define DBL_BSS      0x20       /* Unitialized section */
29
30 #define DBL_MAXPATHLENGTH       255
31
32 /*
33  *  ======== dbl_flags ========
34  *  Specifies whether to load code, data, or symbols
35  */
36 typedef s32 dbl_flags;
37
38 /*
39  *  ======== dbl_sect_info ========
40  *  For collecting info on overlay sections
41  */
42 struct dbl_sect_info {
43         const char *name;       /* name of section */
44         u32 sect_run_addr;      /* run address of section */
45         u32 sect_load_addr;     /* load address of section */
46         u32 size;               /* size of section (target MAUs) */
47         dbl_flags type;         /* Code, data, or BSS */
48 };
49
50 /*
51  *  ======== dbl_symbol ========
52  *  (Needed for dynamic load library)
53  */
54 struct dbl_symbol {
55         u32 value;
56 };
57
58 /*
59  *  ======== dbl_alloc_fxn ========
60  *  Allocate memory function.  Allocate or reserve (if reserved == TRUE)
61  *  "size" bytes of memory from segment "space" and return the address in
62  *  *dsp_address (or starting at *dsp_address if reserve == TRUE). Returns 0 on
63  *  success, or an error code on failure.
64  */
65 typedef s32(*dbl_alloc_fxn) (void *hdl, s32 space, u32 size, u32 align,
66                              u32 *dsp_address, s32 seg_id, s32 req,
67                              bool reserved);
68
69 /*
70  *  ======== dbl_free_fxn ========
71  *  Free memory function.  Free, or unreserve (if reserved == TRUE) "size"
72  *  bytes of memory from segment "space"
73  */
74 typedef bool(*dbl_free_fxn) (void *hdl, u32 addr, s32 space, u32 size,
75                              bool reserved);
76
77 /*
78  *  ======== dbl_log_write_fxn ========
79  *  Function to call when writing data from a section, to log the info.
80  *  Can be NULL if no logging is required.
81  */
82 typedef int(*dbl_log_write_fxn) (void *handle,
83                                         struct dbl_sect_info *sect, u32 addr,
84                                         u32 bytes);
85
86 /*
87  *  ======== dbl_sym_lookup ========
88  *  Symbol lookup function - Find the symbol name and return its value.
89  *
90  *  Parameters:
91  *      handle          - Opaque handle
92  *      parg            - Opaque argument.
93  *      name            - Name of symbol to lookup.
94  *      sym             - Location to store address of symbol structure.
95  *
96  *  Returns:
97  *      TRUE:           Success (symbol was found).
98  *      FALSE:          Failed to find symbol.
99  */
100 typedef bool(*dbl_sym_lookup) (void *handle, void *parg, void *rmm_handle,
101                                const char *name, struct dbl_symbol ** sym);
102
103 /*
104  *  ======== dbl_write_fxn ========
105  *  Write memory function.  Write "n" HOST bytes of memory to segment "mtype"
106  *  starting at address "dsp_address" from the buffer "buf".  The buffer is
107  *  formatted as an array of words appropriate for the DSP.
108  */
109 typedef s32(*dbl_write_fxn) (void *hdl, u32 dsp_address, void *buf,
110                              u32 n, s32 mtype);
111
112 /*
113  *  ======== dbl_attrs ========
114  */
115 struct dbl_attrs {
116         dbl_alloc_fxn alloc;
117         dbl_free_fxn free;
118         void *rmm_handle;       /* Handle to pass to alloc, free functions */
119         dbl_write_fxn write;
120         void *input_params;     /* Handle to pass to write, cinit function */
121
122         dbl_log_write_fxn log_write;
123         void *log_write_handle;
124
125         /* Symbol matching function and handle to pass to it */
126         dbl_sym_lookup sym_lookup;
127         void *sym_handle;
128         void *sym_arg;
129
130         /*
131          *  These file manipulation functions should be compatible with the
132          *  "C" run time library functions of the same name.
133          */
134          s32(*fread) (void *, size_t, size_t, void *);
135          s32(*fseek) (void *, long, int);
136          s32(*ftell) (void *);
137          s32(*fclose) (void *);
138         void *(*fopen) (const char *, const char *);
139 };
140
141 #endif /* DBLDEFS_ */