2 /*
3 Copyright (c) 2017, Texas Instruments Incorporated - http://www.ti.com/
4 All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the
16 * distribution.
17 *
18 * Neither the name of Texas Instruments Incorporated nor the names of
19 * its contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 */
36 //
37 //
38 // ACP Algorithm interface implementation augmentation for custom components
39 //
40 //
41 //
43 #include <xdc/std.h> //<std.h>
44 #include <ti/xdais/ialg.h> //<ialg.h>
45 #include <string.h>
47 #include <acptype.h>
48 #include <iacp.h>
49 #include <paftyp.h>
50 #include <pafstd_a.h>
52 #ifdef THX
53 extern Void ACP_main_thx ();
54 #endif /* THX */
56 Void ACP_main_cus ()
57 {
58 #if 0 // FL: initially don't patch STD shortcuts
59 // Patch for STD alpha codes. (Here only to reduce code size).
60 {
61 extern const ACP_Unit default_s[];
62 extern const ACP_Unit lm_unknown_s[];
63 extern const ACP_Unit lm_standard_s[];
64 extern const ACP_Unit lm_pure_s[];
66 extern struct
67 {
68 Int size;
69 const ACP_Unit *pSequence[64];
70 } IACP_STD_SIGMA_TABLE;
72 const ACP_Unit **shortcut = IACP_STD_SIGMA_TABLE.pSequence;
74 // Standard default alpha code
75 shortcut[0x01] = (Ptr) default_s;
76 shortcut[0x10] = (Ptr) lm_unknown_s;
77 shortcut[execSTDListeningModeStandard & 0xff] = (Ptr) lm_standard_s;
78 shortcut[execSTDListeningModePure & 0xff] = (Ptr) lm_pure_s;
79 }
80 #endif
82 // Patch for the CUStom alpha codes.
83 {
84 extern struct
85 {
86 Int size;
87 const ACP_Unit *pSequence[64];
88 } IACP_CUS_SIGMA_TABLE;
90 //extern const ACP_Unit cus_default_s[];
91 extern const ACP_Unit cus_atboot_s_patch[];
93 extern const ACP_Unit cus_sigma32_s[];
94 extern const ACP_Unit cus_sigma33_s[];
95 extern const ACP_Unit cus_sigma34_s[];
96 extern const ACP_Unit cus_sigma35_s[];
97 extern const ACP_Unit cus_sigma36_s[];
99 //extern const ACP_Unit cus_sigma37_s[];
100 //extern const ACP_Unit cus_sigma38_s[];
101 //extern const ACP_Unit cus_sigma39_s[];
102 //extern const ACP_Unit cus_sigma40_s[];
103 //extern const ACP_Unit cus_sigma41_s[];
104 //extern const ACP_Unit cus_sigma42_s[];
105 //extern const ACP_Unit cus_sigma43_s[];
106 //extern const ACP_Unit cus_sigma44_s[];
107 //extern const ACP_Unit cus_sigma45_s[];
108 //extern const ACP_Unit cus_sigma46_s[];
109 //extern const ACP_Unit cus_sigma47_s[];
111 extern const ACP_Unit cus_sigma48_s[];
112 extern const ACP_Unit cus_sigma49_s[];
113 extern const ACP_Unit cus_sigma50_s[];
114 extern const ACP_Unit cus_sigma51_s[];
115 extern const ACP_Unit cus_sigma52_s[];
116 //extern const ACP_Unit cus_sigma53_s[];
117 //extern const ACP_Unit cus_sigma54_s[];
118 //extern const ACP_Unit cus_sigma55_s[];
119 //extern const ACP_Unit cus_sigma56_s[];
120 //extern const ACP_Unit cus_sigma57_s[];
121 //extern const ACP_Unit cus_sigma58_s[];
122 //extern const ACP_Unit cus_sigma59_s[];
123 //extern const ACP_Unit cus_sigma60_s[];
124 //extern const ACP_Unit cus_sigma61_s[];
125 //extern const ACP_Unit cus_sigma62_s[];
126 //extern const ACP_Unit cus_sigma63_s[];
128 const ACP_Unit **shortcut = IACP_CUS_SIGMA_TABLE.pSequence;
130 // CUStom at-boot alpha code
131 //shortcut[1] = cus_default_s;
132 shortcut[2] = cus_atboot_s_patch;
134 // CUStom Input switching alpha codes
135 shortcut[32] = cus_sigma32_s;
136 shortcut[33] = cus_sigma33_s;
137 shortcut[34] = cus_sigma34_s;
138 shortcut[35] = cus_sigma35_s;
139 shortcut[36] = cus_sigma36_s;
141 //shortcut[37] = cus_sigma37_s;
142 //shortcut[38] = cus_sigma38_s;
143 //shortcut[39] = cus_sigma39_s;
144 //shortcut[40] = cus_sigma40_s;
145 //shortcut[41] = cus_sigma41_s;
146 //shortcut[42] = cus_sigma42_s;
147 //shortcut[43] = cus_sigma43_s;
148 //shortcut[44] = cus_sigma44_s;
149 //shortcut[45] = cus_sigma45_s;
150 //shortcut[46] = cus_sigma46_s;
151 //shortcut[47] = cus_sigma47_s;
153 // CUStom Output switching alpha codes
154 shortcut[48] = cus_sigma48_s;
155 shortcut[49] = cus_sigma49_s;
156 shortcut[50] = cus_sigma50_s;
157 shortcut[51] = cus_sigma51_s;
158 shortcut[52] = cus_sigma52_s;
159 //shortcut[53] = cus_sigma53_s;
160 //shortcut[54] = cus_sigma54_s;
161 //shortcut[55] = cus_sigma55_s;
162 //shortcut[56] = cus_sigma56_s;
163 //shortcut[57] = cus_sigma57_s;
164 //shortcut[58] = cus_sigma58_s;
165 //shortcut[59] = cus_sigma59_s;
166 //shortcut[60] = cus_sigma60_s;
167 //shortcut[61] = cus_sigma61_s;
168 //shortcut[62] = cus_sigma62_s;
169 //shortcut[63] = cus_sigma63_s;
170 }
172 // Enable this when custom phi is to be added
173 // (example code below installs custom phi function 0;
174 // up to 8 functions may be installed).
176 #if 0
177 // Patch for the CUStom phi functions.
178 {
179 extern struct
180 {
181 Int size;
182 IACP_PhiFunction *pFunction[8];
183 } IACP_CUS_PHI_TABLE;
185 IACP_PhiFunction **pFunc = IACP_CUS_PHI_TABLE.pFunction;
187 extern IACP_PhiFunction cust_phifun0;
189 pFunc[0] = cust_phifun0;
190 }
191 #endif
193 #ifdef THX
194 ACP_main_thx ();
195 #endif /* THX */
196 }