1 /******************************************************************************
2 * Filename: standalone_rom_crypto.h
3 * Revised: $Date: 2015-03-19 15:37:11 +0100 (to, 19 mar 2015) $
4 * Revision: $Revision: 43051 $
5 *
6 * Description: Provide a simple initialization the common ROM-RAM system
7 * needed prior to using the ROM Encryption functions
8 * (ref. <driverlib/RomEncryption.h>)
9 *
10 * Copyright (c) 2015, Texas Instruments Incorporated
11 * All rights reserved.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions are met:
15 *
16 * 1) Redistributions of source code must retain the above copyright notice,
17 * this list of conditions and the following disclaimer.
18 *
19 * 2) Redistributions in binary form must reproduce the above copyright notice,
20 * this list of conditions and the following disclaimer in the documentation
21 * and/or other materials provided with the distribution.
22 *
23 * 3) Neither the name of the ORGANIZATION nor the names of its contributors may
24 * be used to endorse or promote products derived from this software without
25 * specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
31 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGE.
38 *
39 ******************************************************************************/
40
41 #include <stdint.h>
42 #include <inc/hw_chip_def.h>
43
44 // Note: Contents of the HelpFuncTable[] differ between the CC26xx and CC13xx chip family
45 uint32_t HelpFuncTable[] = {
46 0 , // [0] => offset 0x00
47 0 , // [1] => offset 0x04
48 0 , // [2] => offset 0x08
49 0x100046f7, // [3] => offset 0x0C
50 0 , // [4] => offset 0x10
51 0 // [5] => offset 0x14
52 };
53
54
55 uint32_t Rom2RomPatchTable[] = {
56 0x10016975, // [32] => offset 0x80
57 0x10016979, // [33] => offset 0x84
58 0x10016985, // [34] => offset 0x88
59 0x10016a99, // [35] => offset 0x8C
60 0x10016af5, // [36] => offset 0x90
61 0x10016b79, // [37] => offset 0x94
62 0x10016c29, // [38] => offset 0x98
63 0x10016c45, // [39] => offset 0x9C
64 0x10016c79, // [40] => offset 0xA0
65 0x10016d05, // [41] => offset 0xA4
66 0x10016d29, // [42] => offset 0xA8
67 0x10016da1, // [43] => offset 0xAC
68 0x10016dc9, // [44] => offset 0xB0
69 0x10016e8d, // [45] => offset 0xB4
70 0x10016ea1, // [46] => offset 0xB8
71 0x10016ed5, // [47] => offset 0xBC
72 0x10017365, // [48] => offset 0xC0
73 0x100174fd, // [49] => offset 0xC4
74 0x1001767d, // [50] => offset 0xC8
75 0x10017839, // [51] => offset 0xCC
76 0x10017895, // [52] => offset 0xD0
77 0x100178f5, // [53] => offset 0xD4
78 0x10017771, // [54] => offset 0xD8
79 0x100175ed, // [55] => offset 0xDC
80 0x10018b09, // [56] => offset 0xE0
81 0x10018a99, // [57] => offset 0xE4
82 0x10018ac5, // [58] => offset 0xE8
83 0x10018a19, // [59] => offset 0xEC
84 0x10018a35 // [60] => offset 0xF0
85 };
86
87 uint32_t commonROMScratchArea[ 53 ] @0x20004F2C;
88
StandaloneRomCryptoInit(void)89 extern void StandaloneRomCryptoInit( void )
90 {
91 for ( int i = 0 ; i < ( sizeof( commonROMScratchArea ) / sizeof( uint32_t )) ; i++ ) {
92 commonROMScratchArea[ i ] = 0;
93 }
94 commonROMScratchArea[ 3 ] = ((uint32_t)HelpFuncTable);
95 commonROMScratchArea[ 4 ] = ((uint32_t)Rom2RomPatchTable) - ( 32 * sizeof( uint32_t ));
96 }
97