[processor-sdk/pdk.git] / packages / ti / boot / sbl / example / k3MulticoreApp / keywriter / main.h
1 /**
2 * \file main.h
3 *
4 * \brief This file contains all macros required for OTP Keywriter
5 *
6 */
8 /*
9 * Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 *
18 * Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the
21 * distribution.
22 *
23 * Neither the name of Texas Instruments Incorporated nor the names of
24 * its contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 *
39 */
40 #ifndef KEYWR_MAIN_H_
41 #define KEYWR_MAIN_H_
43 #include <string.h>
44 #include <ti/csl/cslr_device.h>
45 #include <ti/csl/tistdtypes.h>
46 #include <ti/csl/arch/csl_arch.h>
47 #include <ti/csl/csl_gpio.h>
48 #include <ti/board/board.h>
49 #include <ti/drv/uart/UART.h>
50 #include <ti/drv/uart/src/UART_osal.h>
51 #include <ti/drv/uart/UART_stdio.h>
52 #include <ti/drv/uart/soc/UART_soc.h>
53 #include <ti/drv/sciclient/sciclient.h>
55 #include <ti/boot/sbl/soc/k3/sbl_soc_cfg.h>
56 #include <ti/boot/sbl/soc/k3/sbl_sci_client.h>
58 #include <ti/board/board.h>
59 #include <ti/csl/soc.h>
61 /* Discard any previous definitions
62 * These two macros are defined in sysfw_keywriter.h file.
63 * */
64 #undef TIFS_KEYWRITER_BIN_SIZE_IN_BYTES
65 #undef TIFS_KEYWRITER_BIN
66 #include "ti-fs-keywriter.h"
68 #define OTP_VERSION_STR "OTP Keywriter Revision: 01.00.00.00"
69 #define OTP_LOG_NONE (0U)
70 #define OTP_LOG_MAX (1U)
72 #define OTP_log(dbg_level, ...) if ((int32_t)(dbg_level) <= KEYWRITER_LOG_LEVEL) { UART_printf(__VA_ARGS__); }
75 #if defined (SOC_J721E)
77 #define MCU_UART_TXD_MUX_ADDR (BOARD_WKUP_PMUX_CTRL_ADDR + PIN_WKUP_GPIO0_12)
78 #define WKUP_UART_TXD_MUX_ADDR (BOARD_WKUP_PMUX_CTRL_ADDR + PIN_WKUP_UART0_TXD)
80 #define PIN_INPUT (PIN_INPUT_ENABLE | PIN_PULL_DISABLE)
81 #define PIN_OUTPUT (PIN_PULL_DISABLE)
83 #define BOARD_UART_INSTANCE (0U)
84 #define SBL_ROM_UART_MODULE_INPUT_CLK (48000000U)
85 #define SBL_SYSFW_UART_MODULE_INPUT_CLK (96000000U)
86 #define MCU_FSS0_S0_FWID (1036)
87 #define MCU_FSS0_S0_FW_REGIONS (8)
89 #define BOARD_WKUP_PMUX_CTRL_ADDR (CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C000)
90 #define CTRLMMR_LOCK_KICK0_UNLOCK_VAL (0x68ef3490)
91 #define CTRLMMR_LOCK_KICK1_UNLOCK_VAL (0xd172bc5a)
92 #define WKUP_CTRL_BASE (0x43000000)
93 #define CTRL_MMR0_PARTITION_SIZE (0x4000)
94 #define CTRLMMR_LOCK_KICK0 (0x01008)
95 #define CTRLMMR_LOCK_KICK1 (0x0100c)
97 #endif
99 /**
100 * \brief CSL Reset Vectors.
101 *
102 *
103 * \param fileName
104 * \param lineNo
105 *
106 * \return None
107 *
108 */
109 void KeywrErrLoop (const char *fileName, int32_t lineNo);
111 #endif /* KEYWR_MAIN_H_ */