]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/blob - qnx/src/ipc3x_dev/ti/syslink/inc/knl/ProcDefs.h
Remove references to SysLink in QNX code base
[ipc/ipcdev.git] / qnx / src / ipc3x_dev / ti / syslink / inc / knl / ProcDefs.h
1 /**
2  *  @file   ProcDefs.h
3  *
4  *  @brief      Definitions for the Processor interface.
5  *
6  *
7  *  @ver        02.00.00.46_alpha1
8  *
9  *  ============================================================================
10  *
11  *  Copyright (c) 2008-2015, Texas Instruments Incorporated
12  *
13  *  Redistribution and use in source and binary forms, with or without
14  *  modification, are permitted provided that the following conditions
15  *  are met:
16  *
17  *  *  Redistributions of source code must retain the above copyright
18  *     notice, this list of conditions and the following disclaimer.
19  *
20  *  *  Redistributions in binary form must reproduce the above copyright
21  *     notice, this list of conditions and the following disclaimer in the
22  *     documentation and/or other materials provided with the distribution.
23  *
24  *  *  Neither the name of Texas Instruments Incorporated nor the names of
25  *     its contributors may be used to endorse or promote products derived
26  *     from this software without specific prior written permission.
27  *
28  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
30  *  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31  *  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
32  *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
33  *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
34  *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
35  *  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
36  *  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
37  *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
38  *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39  *  Contact information for paper mail:
40  *  Texas Instruments
41  *  Post Office Box 655303
42  *  Dallas, Texas 75265
43  *  Contact information:
44  *  http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm?
45  *  DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact
46  *  ============================================================================
47  *
48  */
51 #ifndef ProcDefs_H_0x6a85
52 #define ProcDefs_H_0x6a85
55 /* Osal & Utils headers */
56 #include <ti/syslink/utils/Memory.h>
57 #include <ti/syslink/utils/List.h>
58 #include <OsalMutex.h>
60 /* Module level headers */
61 #include <ti/ipc/MultiProc.h>
62 #include <ti/syslink/ProcMgr.h>
63 #include <ti/syslink/SysLink.h>
65 #include <pthread.h>
67 #if defined (__cplusplus)
68 extern "C" {
69 #endif
72 /* =============================================================================
73  *  Macros and types
74  * =============================================================================
75  */
76 /*!
77  *  @brief   Enumerates the types of Endianism of slave processor.
78  */
79 typedef enum {
80     Processor_Endian_Default  = 0u,
81     /*!< Default endianism (no conversion required) */
82     Processor_Endian_Big      = 1u,
83     /*!< Big endian */
84     Processor_Endian_Little   = 2u,
85     /*!< Little endian */
86     Processor_Endian_EndValue = 3u
87     /*!< End delimiter indicating start of invalid values for this enum */
88 } Processor_Endian;
90 /*!
91  *  @brief   Enumerates the various architectures of processor supported.
92  */
93 typedef enum {
94     Processor_ProcArch_Unknown       = 0u,
95     /* !< Indicates that the architecture is not supported. */
96     Processor_ProcArch_C55x          = 1u,
97     /* !< Indicates that the architecture is C55x. */
98     Processor_ProcArch_C64x          = 2u,
99     /* !< Indicates that the architecture is C64x. */
100     Processor_ProcArch_M3            = 3u,
101     /* !< Indicates that the architecture is CORTEX M3. */
102     Processor_ProcArch_M4            = 4u,
103     /* !< Indicates that the architecture is CORTEX M4. */
104     Processor_ProcArch_C66x          = 5u,
105     /* !< Indicates that the architecture is C66x. */
106     Processor_ProcArch_EndValue      = 6u
107     /*!< End delimiter indicating start of invalid values for this enum */
108 } Processor_ProcArch;
111 /*!
112  *  @brief  Configuration parameters for attaching to the slave Processor
113  */
114 typedef struct Processor_AttachParams_tag {
115     ProcMgr_AttachParams * params;
116     /*!< Common attach parameters for ProcMgr */
117     UInt16                 numMemEntries;
118     /*!< Number of valid memory entries */
119     ProcMgr_AddrInfo       memEntries [ProcMgr_MAX_MEMORY_REGIONS];
120     /*!< Configuration of memory regions */
121     Processor_ProcArch     procArch;
122     /*!< Processor architecture */
123     ProcMgr_Handle         pmHandle;
124     /*!< Handle to proc manager */
125     Ipc_MemoryMap        * sysMemMap;
126     /*!< System Memory map to be added to translation table */
127 } Processor_AttachParams ;
129 /*!
130  *  @brief  Configuration parameters for starting the slave Processor
131  */
132 typedef struct Processor_StartParams_tag {
133     ProcMgr_StartParams * params;
134     /*!< Common start parameters for ProcMgr */
135 } Processor_StartParams ;
138 /* Forward declaration for Processor_Object */
139 typedef struct Processor_Object_tag Processor_Object;
141 /*!
142  *  @brief  Defines Processor object handle
143  */
144 typedef Processor_Object * Processor_Handle;
146 /*!
147  *  @brief  Args type for Processor_MmuCtrlCmd_Register
148  */
149 typedef struct Processor_Register_tag {
150     Int32               timeout;
151     /*!< Timeout. */
152     ProcMgr_CallbackFxn cbFxn;
153     /*!< Client callback function. */
154     Ptr                 arg;
155     /*!< Client arg to pass to the callback function. */
156     ProcMgr_EventType   state[];
157     /*!< States registered for notification. */
158 } Processor_Register;
160 /*!
161  *  @brief  List element for registered fault listeners.
162  */
163 typedef struct Processor_RegisterElem_tag {
164     List_Elem                              elem;
165     /*!< List Elem. */
166     Processor_Register                   * info;
167     /*!< Information about the registered client. */
168     timer_t                                timer;
169     /*!< Timer handle. */
170     UInt16                                 procId;
171     /*!< ProcId associated with elem */
172 } Processor_RegisterElem;
174 /* =============================================================================
175  *  Function pointer types
176  * =============================================================================
177  */
178 /*!
179  *  @brief  Function pointer type for the function to attach to the processor.
180  */
181 typedef Int (*Processor_AttachFxn) (Processor_Handle         handle,
182                                     Processor_AttachParams * params);
184 /*!
185  *  @brief  Function pointer type for the function to detach from the
186  *          procssor
187  */
188 typedef Int (*Processor_DetachFxn) (Processor_Handle handle);
190 /*!
191  *  @brief  Function pointer type for the function to start the processor.
192  */
193 typedef Int (*Processor_StartFxn) (Processor_Handle        handle,
194                                    UInt32                  entryPt,
195                                    Processor_StartParams * params);
197 /*!
198  *  @brief  Function pointer type for the function to stop the processor.
199  */
200 typedef Int (*Processor_StopFxn) (Processor_Handle handle);
202 /*!
203  *  @brief  Function pointer type for the function to read from the slave
204  *          processor's memory.
205  */
206 typedef Int (*Processor_ReadFxn) (Processor_Handle handle,
207                                   UInt32           procAddr,
208                                   UInt32 *         numBytes,
209                                   Ptr              buffer);
211 /*!
212  *  @brief  Function pointer type for the function to write into the slave
213  *          processor's memory.
214  */
215 typedef Int (*Processor_WriteFxn) (Processor_Handle   handle,
216                                    UInt32             procAddr,
217                                    UInt32 *           numBytes,
218                                    Ptr                buffer);
220 /*!
221  *  @brief  Function pointer type for the function to perform device-dependent
222  *          operations.
223  */
224 typedef Int (*Processor_ControlFxn) (Processor_Handle handle,
225                                      Int32            cmd,
226                                      Ptr              arg);
228 /*!
229  *  @brief  Function pointer type for the function to translate between
230  *          two types of address spaces.
231  */
232 typedef Int (*Processor_TranslateAddrFxn) (Processor_Handle handle,
233                                            UInt32 *         dstAddr,
234                                            UInt32           srcAddr);
236 /*!
237  *  @brief  Function pointer type for the function to map address to slave
238  *          address space
239  */
240 typedef Int (*Processor_MapFxn) (Processor_Handle handle,
241                                  UInt32 *         dstAddr,
242                                  UInt32           nSegs,
243                                  Memory_SGList *  sglist);
245 /*!
246  *  @brief  Function pointer type for the function to unmap address from slave
247  *          address space
248  */
249 typedef Int (*Processor_UnmapFxn) (Processor_Handle handle,
250                                    UInt32           addr,
251                                    UInt32           size);
253 /*!
254  *  @brief  Function pointer type for the function that returns proc info
255  */
256 typedef Int (*Processor_GetProcInfoFxn) (Processor_Handle   handle,
257                                          ProcMgr_ProcInfo * procInfo);
259 /*!
260  *  @brief  Function pointer type for the function that returns phys addr
261  */
262 typedef Int (*Processor_VirtToPhysFxn) (Processor_Handle handle,
263                                         UInt32           ba,
264                                         UInt32 *         mappedEntries,
265                                         UInt32           numOfEntries);
267 /*!
268  *  @brief  Function pointer type for the function to register for event notification.
269  */
270 typedef Int (*Processor_RegisterNotifyFxn) (Processor_Handle    handle,
271                                             ProcMgr_CallbackFxn cbFxn,
272                                             Ptr                 arg,
273                                             Int32               timeout,
274                                             ProcMgr_State       state []);
276 /*!
277  *  @brief  Function pointer type for the function to un-register for event notification.
278  */
279 typedef Int (*Processor_UnRegisterNotifyFxn) (Processor_Handle    handle,
280                                               ProcMgr_CallbackFxn cbFxn,
281                                               Ptr                 arg,
282                                               ProcMgr_State       state []);
284 /*!
285  *  @brief  Function pointer type for the function to translate between
286  *          two types of address spaces.
287  */
288 typedef Int (*Processor_TranslateFromPteFxn) (Processor_Handle handle,
289                                               UInt32 *         dstAddr,
290                                               UInt32           srcAddr);
292 /* =============================================================================
293  *  Function table interface
294  * =============================================================================
295  */
296 /*!
297  *  @brief  Function table interface for Processor.
298  */
299 typedef struct Processor_FxnTable_tag {
300     Processor_AttachFxn                attach;
301     /*!< Function to attach to the slave processor */
302     Processor_DetachFxn                detach;
303     /*!< Function to detach from the slave processor */
304     Processor_StartFxn                 start;
305     /*!< Function to start the slave processor */
306     Processor_StopFxn                  stop;
307     /*!< Function to stop the slave processor */
308     Processor_ReadFxn                  read;
309     /*!< Function to read from the slave processor's memory */
310     Processor_WriteFxn                 write;
311     /*!< Function to write into the slave processor's memory */
312     Processor_ControlFxn               control;
313     /*!< Function to perform device-dependent control function */
314     Processor_TranslateAddrFxn         translateAddr;
315     /*!< Function to translate between address ranges */
316     Processor_MapFxn                   map;
317     /*!< Function to map slave addresses to master address space */
318     Processor_UnmapFxn                 unmap;
319     /*!< Function to unmap slave addresses from master address space */
320     Processor_GetProcInfoFxn           getProcInfo;
321     /* !< Function to Get the proc info of the slave */
322     Processor_VirtToPhysFxn            virtToPhys;
323     /*!< Function to convert Virtual to Physical pages */
324     Processor_TranslateFromPteFxn      translateFromPte;
325     /*!< Function to translate slave virtual address into physical using page table */
326 } Processor_FxnTable;
329 /* =============================================================================
330  * Processor structure
331  * =============================================================================
332  */
333 /*
334  *  Generic Processor object. This object defines the handle type for all
335  *  Processor operations.
336  */
337 struct Processor_Object_tag {
338     Processor_FxnTable      procFxnTable;
339     /*!< Interface function table to plug into the generic Processor. */
340     ProcMgr_State           state;
341     /*!< State of the slave processor */
342     ProcMgr_BootMode        bootMode;
343     /*!< Boot mode for the slave processor. */
344     Ptr                     object;
345     /*!< Pointer to Processor-specific object. */
346     UInt16                  procId;
347     /*!< Processor ID addressed by this Processor instance. */
348     List_Handle             registeredNotifiers;
349     /*!< List of clients listening for an MMU fault event. */
350     OsalMutex_Handle        notifiersLock;
351     /*!< List of clients listening for an MMU fault event. */
352 };
355 #if defined (__cplusplus)
357 #endif /* defined (__cplusplus) */
359 #endif /* ProcDefs_H_0x6a85 */