fc966d23f09d78882c550eb2042b1d5274890c8c
1 /*
2 * Copyright (c) 2011-2012, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
33 /*
34 * ======== Resource.xdc ========
35 */
37 /*!
38 * ======== Resource ========
39 * Resource Module
40 */
42 @Template("./Resource.xdt")
43 @ModuleStartup
44 module Resource {
46 /*!
47 * @def Resource_loadAddr
48 * @brief Default load address for the Resource table
49 */
50 metaonly config UInt loadAddr = 0x3000;
52 /*!
53 * @def Resource_loadSegment
54 * @brief If loadSegment is defined, loadAddr is overriden with the base
55 * address of the loadSegment
56 */
57 metaonly config String loadSegment;
59 /*!
60 * @def Resource_S_SUCCESS
61 * @brief Operation is successful.
62 */
63 const Int S_SUCCESS = 0;
65 /*!
66 * @def Resource_E_NOTFOUND
67 * @brief Element was not found in table
68 */
69 const Int E_NOTFOUND = -1;
71 /*!
72 * @def Resource_RscTable
73 *
74 * @brief An open-ended type-length-value based resource table
75 */
76 struct RscTable {
77 UInt32 ver;
78 UInt32 num;
79 UInt32 reserved[2];
80 UInt32 offset[1];
81 };
83 /*!
84 * @def Resource_MemEntry
85 *
86 * @brief A Resource Table memory type record
87 */
88 struct MemEntry {
89 UInt32 type;
90 UInt32 da; /* Device Virtual Address */
91 UInt32 pa; /* Physical Address */
92 UInt32 len;
93 UInt32 flags;
94 UInt32 reserved;
95 Char name[32];
96 };
98 /*!
99 * @brief Virtual to Physical address translation function
100 *
101 * @sa Resource_physToVirt
102 */
103 @DirectCall
104 Int virtToPhys(UInt32 da, UInt32 *pa);
106 /*!
107 * @brief Physical to Virtual address translation function
108 *
109 * @sa Resource_virtToPhys
110 */
111 @DirectCall
112 Int physToVirt(UInt32 pa, UInt32 *da);
114 @DirectCall
115 Ptr getTraceBufPtr();
117 internal: /* not for client use */
119 /*!
120 * @brief Use resource and resourceLen so table could be properly
121 * allocated
122 *
123 */
124 Void init();
126 /*!
127 * @brief Return the i-th entry in the resource table
128 *
129 */
130 MemEntry *getEntry(UInt index);
132 struct Module_State {
133 RscTable *pTable; /* Resource Resource Table pointer */
134 };
135 }