1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
32 33 34 35
36
37 import xdc.runtime.Error;
38 import ti.sysbios.family.arm.ducati.GateSmp;
39
40 /*!
41 * ======== Core ========
42 * Core Identification Module.
43 *
44 * The Core module is used to define which core within a dual core
45 * "Ducati" subsystem an application is being built for.
46 *
47 * At runtime, a comparison is made between the configured Core.id
48 * and the value of PID0 (at address 0xe00fffe0). If they do not
49 * agree, an Error is raised.
50 *
51 * Use of this module has the side effect of configuring default
52 * interrupt vector table placements for Core 0 and Core 1 if
53 * they haven't already been specified by the
54 * {@link ti.sysbios.family.arm.m3.Hwi#vectorTableAddress Hwi.vectorTableAddress}
55 * config parameter.
56 *
57 * Core 0's default vector table placement is at 0x400.
58 *
59 * Core 1's default vector table placement is at 0x800.
60 */
61
62 @ModuleStartup
63
64 module Core inherits ti.sysbios.interfaces.ICore
65 {
66 /*! Hwi scheduler lock bits */
67 const UInt HWI_SCHEDULER_LOCK = 0x0001;
68
69 /*! Swi scheduler lock bits */
70 const UInt SWI_SCHEDULER_LOCK = 0x0002;
71
72 /*! Task scheduler lock bits */
73 const UInt TASK_SCHEDULER_LOCK = 0x0004;
74
75 /*!
76 * Error raised if Core.id does not match the contents
77 * of PID0 (at 0xE00FFFE0).
78 */
79 config Error.Id E_mismatchedIds = {
80 msg: "E_mismatchedIds: Core_Id: %d does not match hardware core Id: %d"
81 };
82
83 override config UInt numCores = 2;
84
85 /*!
86 * Non SMP Ducati Core ID, default is Core 0
87 *
88 * Used for making static decisions based on Core ID
89 */
90 config UInt id = 0;
91
92 /*!
93 * Core's IPU ID, default is IPU 1
94 *
95 * Used to identify core belongs to which IPU sub-system.
96 * This field has only 2 possible valid values, 1 or 2.
97 */
98 config UInt ipuId = 1;
99
100 /*!
101 * Core 1's interrupt stack size, default is Program.stack.
102 */
103 config SizeT core1HwiStackSize;
104
105 @Macro
106 override UInt hwiDisable();
107
108 @Macro
109 override UInt hwiEnable();
110
111 @Macro
112 override Void hwiRestore(UInt key);
113
114 /*!
115 * ======== syncExits ========
116 * synchronize exits for all cores
117 *
118 * If flag set to true, then the first core that exits
119 * (calls BIOS_exit), interrupts the other core and
120 * waits for it to exit.
121 */
122 config Bool syncExits = true;
123
124 /*!
125 * ======== getIpuId ========
126 * return the current core's IPU id
127 */
128 UInt getIpuId();
129
130 /*!
131 * @_nodoc
132 * ======== getCore1HwiStackBase ========
133 */
134 Ptr getCore1HwiStackBase();
135
136 internal:
137
138 config GateSmp.Handle gate;
139
140 config Bool initStackFlag = true;
141
142 143 144 145 146
147 Void hwiFunc(UArg arg);
148
149 150 151 152 153 154
155 Void startCore1();
156
157 158 159 160 161 162
163 Void core1Startup();
164
165 /*!
166 * ======== atexit ========
167 * atexit() func used to signal the other core to halt
168 */
169 Void atexit(Int arg);
170
171 struct Module_State {
172 volatile Bool exitFlag;
173 Bool gateEntered[2];
174 UInt schedulerInts[2];
175 Char core1HwiStack[];
176 };
177 }
178