AM263Px MCU+ SDK  09.01.00
soc.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021-2023 Texas Instruments Incorporated
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * 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
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef SOC_AM263PX_H_
34 #define SOC_AM263PX_H_
35 
36 #ifdef __cplusplus
37 extern "C"
38 {
39 #endif
40 
50 #include <kernel/dpl/SystemP.h>
51 #include <drivers/hw_include/cslr_soc.h>
52 #include "soc_xbar.h"
53 #include "soc_rcm.h"
54 
60 #define SOC_DOMAIN_ID_MAIN (0U)
61 
63 /*Control MMRs partition*/
64 #define MSS_CTRL_PARTITION0 (1)
65 #define TOP_CTRL_PARTITION0 (2)
66 #define CONTROLSS_CTRL_PARTITION0 (3)
67 
68 /*Clock and reset MMRs partition*/
69 #define MSS_RCM_PARTITION0 (4)
70 #define TOP_RCM_PARTITION0 (5)
71 
72 /*Pinmux MMR*/
73 //#define IOMUX_PARTITION0 (6)
74 
75 
76 /* define the unlock and lock values for MSS_CTRL, TOP_CTRL, MSS_RCM, TOP_RCM*/
77 #define KICK_LOCK_VAL (0x00000000U)
78 #define KICK0_UNLOCK_VAL (0x01234567U)
79 #define KICK1_UNLOCK_VAL (0x0FEDCBA8U)
80 
82 static inline int32_t MCSPI_lld_isBaseAddrValid(uint32_t baseAddr)
83 {
84  int32_t status = (int32_t)-3;
85 
86  if ((baseAddr == CSL_MCSPI0_U_BASE) || \
87  (baseAddr == CSL_MCSPI1_U_BASE) || \
88  (baseAddr == CSL_MCSPI2_U_BASE) || \
89  (baseAddr == CSL_MCSPI3_U_BASE) || \
90  (baseAddr == CSL_MCSPI4_U_BASE) || \
91  (baseAddr == CSL_MCSPI5_U_BASE) || \
92  (baseAddr == CSL_MCSPI6_U_BASE) || \
93  (baseAddr == CSL_MCSPI7_U_BASE) )
94  {
95  status = 0;
96  }
97 
98  return status;
99 }
100 
110 int32_t SOC_moduleClockEnable(uint32_t moduleId, uint32_t enable);
111 
122 int32_t SOC_moduleSetClockFrequency(uint32_t moduleId, uint32_t clkId, uint64_t clkRate);
123 
131 const char *SOC_getCoreName(uint16_t coreId);
132 
138 uint64_t SOC_getSelfCpuClk(void);
139 
146 void SOC_controlModuleLockMMR(uint32_t domainId, uint32_t partition);
147 
154 void SOC_controlModuleUnlockMMR(uint32_t domainId, uint32_t partition);
155 
162 void SOC_setEpwmTbClk(uint32_t epwmInstance, uint32_t enable);
163 
169 void SOC_enableAdcReference(uint32_t adcInstance);
170 
177 void SOC_setEpwmGroup(uint32_t epwmInstance, uint32_t group);
178 
184 void SOC_selectSdfm1Clk0Source(uint8_t source);
185 
191 void SOC_gateEpwmClock(uint32_t epwmInstance);
192 
198 void SOC_gateFsitxClock(uint32_t fsitxInstance);
199 
205 void SOC_gateFsirxClock(uint32_t fsirxInstance);
206 
212 void SOC_gateCmpssaClock(uint32_t cmpssaInstance);
213 
219 void SOC_gateCmpssbClock(uint32_t cmpssbInstance);
220 
226 void SOC_gateEcapClock(uint32_t ecapInstance);
227 
233 void SOC_gateEqepClock(uint32_t eqepInstance);
234 
240 void SOC_gateSdfmClock(uint32_t sdfmInstance);
241 
245 void SOC_gateDacClock(void);
246 
252 void SOC_gateAdcClock(uint32_t adcInstance);
253 
259 void SOC_gateRdcClock(uint32_t rdcInstance);
260 
266 void SOC_gateOttoClock(uint32_t ottoInstance);
267 
273 void SOC_gateSdfmPllClock(uint32_t sdfmInstance);
274 
280 void SOC_gateFsiPllClock(uint32_t fsiInstance);
281 
287 void SOC_generateEpwmReset(uint32_t ePWMInstance);
288 
294 void SOC_generateFsiTxReset(uint32_t fsitxInstance);
295 
301 void SOC_generateFsiRxReset(uint32_t fsirxInstance);
302 
308 void SOC_generateCmpssaReset(uint32_t cmpssaInstance);
309 
315 void SOC_generateCmpssbReset(uint32_t cmpssbInstance);
316 
322 void SOC_generateEcapReset(uint32_t ecapInstance);
323 
329 void SOC_generateEqepReset(uint32_t eqepInstance);
330 
336 void SOC_generateSdfmReset(uint32_t sdfmInstance);
337 
342 
348 void SOC_generateAdcReset(uint32_t adcInstance);
349 
355 void SOC_generateRdcReset(uint32_t rdcInstance);
356 
363 void Soc_enableEPWMHalt (uint32_t epwmInstance);
364 
370 void SOC_generateOttoReset(uint32_t ottoInstance);
371 
378 void SOC_selectIcssGpiMux(uint8_t pru_instance, uint32_t mask);
379 
387 uint64_t SOC_virtToPhy(void *virtAddr);
388 
396 void *SOC_phyToVirt(uint64_t phyAddr);
397 
404 
407 #ifdef __cplusplus
408 }
409 #endif
410 
411 #endif
SOC_gateFsitxClock
void SOC_gateFsitxClock(uint32_t fsitxInstance)
Gate the FSI-TX clock.
SOC_moduleSetClockFrequency
int32_t SOC_moduleSetClockFrequency(uint32_t moduleId, uint32_t clkId, uint64_t clkRate)
Set module clock to specified frequency.
SOC_generateEcapReset
void SOC_generateEcapReset(uint32_t ecapInstance)
Generate ECAP reset.
SOC_gateEcapClock
void SOC_gateEcapClock(uint32_t ecapInstance)
Gate the ECAP clock.
SOC_controlModuleUnlockMMR
void SOC_controlModuleUnlockMMR(uint32_t domainId, uint32_t partition)
Unlock control module partition to allow writes into control MMRs.
SOC_selectIcssGpiMux
void SOC_selectIcssGpiMux(uint8_t pru_instance, uint32_t mask)
Selection of ICSS GPI MUX.
SOC_virtToPhy
uint64_t SOC_virtToPhy(void *virtAddr)
SOC Virtual (CPU) to Physical address translation function.
SOC_gateFsirxClock
void SOC_gateFsirxClock(uint32_t fsirxInstance)
Gate the FSI-RX clock.
SOC_gateSdfmPllClock
void SOC_gateSdfmPllClock(uint32_t sdfmInstance)
Gate the SDFM PLL clock.
SOC_gateCmpssaClock
void SOC_gateCmpssaClock(uint32_t cmpssaInstance)
Gate the CMPSS-A clock.
SystemP.h
SOC_gateCmpssbClock
void SOC_gateCmpssbClock(uint32_t cmpssbInstance)
Gate the CMPSS-B clock.
SOC_getFlashDataBaseAddr
uint32_t SOC_getFlashDataBaseAddr(void)
This function gets the SOC mapped data base address of the flash.
SOC_generateCmpssbReset
void SOC_generateCmpssbReset(uint32_t cmpssbInstance)
Generate CMPSS-B reset.
SOC_generateDacReset
void SOC_generateDacReset(void)
Generate DAC reset.
SOC_enableAdcReference
void SOC_enableAdcReference(uint32_t adcInstance)
Enable ADC references by writing to Control MMR.
SOC_gateOttoClock
void SOC_gateOttoClock(uint32_t ottoInstance)
Gate the OTTO clock.
soc_rcm.h
SOC_gateEqepClock
void SOC_gateEqepClock(uint32_t eqepInstance)
Gate the EQEP clock.
SOC_generateAdcReset
void SOC_generateAdcReset(uint32_t adcInstance)
Generate ADC reset.
SOC_generateEpwmReset
void SOC_generateEpwmReset(uint32_t ePWMInstance)
Generate ePWM reset.
SOC_phyToVirt
void * SOC_phyToVirt(uint64_t phyAddr)
Physical to Virtual (CPU) address translation function.
SOC_gateDacClock
void SOC_gateDacClock(void)
Gate the DAC clock.
SOC_getSelfCpuClk
uint64_t SOC_getSelfCpuClk(void)
Get the clock frequency in Hz of the CPU on which the driver is running.
SOC_generateRdcReset
void SOC_generateRdcReset(uint32_t rdcInstance)
Generate RDC reset.
SOC_selectSdfm1Clk0Source
void SOC_selectSdfm1Clk0Source(uint8_t source)
Select the SDFM1 CLK0 source.
SOC_gateFsiPllClock
void SOC_gateFsiPllClock(uint32_t fsiInstance)
Gate the FSI-TX PLL clock.
SOC_gateAdcClock
void SOC_gateAdcClock(uint32_t adcInstance)
Gate the ADC clock.
MCSPI_lld_isBaseAddrValid
static int32_t MCSPI_lld_isBaseAddrValid(uint32_t baseAddr)
API to validate MCSPI base address.
Definition: soc.h:82
SOC_controlModuleLockMMR
void SOC_controlModuleLockMMR(uint32_t domainId, uint32_t partition)
Lock control module partition to prevent writes into control MMRs.
SOC_moduleClockEnable
int32_t SOC_moduleClockEnable(uint32_t moduleId, uint32_t enable)
Enable clock to specified module.
SOC_generateCmpssaReset
void SOC_generateCmpssaReset(uint32_t cmpssaInstance)
Generate CMPSS-A reset.
SOC_generateSdfmReset
void SOC_generateSdfmReset(uint32_t sdfmInstance)
Generate SDFM reset.
SOC_gateEpwmClock
void SOC_gateEpwmClock(uint32_t epwmInstance)
Gate the ePWM clock.
SOC_getCoreName
const char * SOC_getCoreName(uint16_t coreId)
Convert a core ID to a user readable name.
SOC_setEpwmTbClk
void SOC_setEpwmTbClk(uint32_t epwmInstance, uint32_t enable)
Enable or disable ePWM time base clock from Control MMR.
SOC_setEpwmGroup
void SOC_setEpwmGroup(uint32_t epwmInstance, uint32_t group)
Configure the ePWM group.
SOC_gateSdfmClock
void SOC_gateSdfmClock(uint32_t sdfmInstance)
Gate the SDFM clock.
SOC_generateFsiRxReset
void SOC_generateFsiRxReset(uint32_t fsirxInstance)
Generate FSI-RX reset.
Soc_enableEPWMHalt
void Soc_enableEPWMHalt(uint32_t epwmInstance)
Halt EPWM with corresponding cPU.
SOC_generateEqepReset
void SOC_generateEqepReset(uint32_t eqepInstance)
Generate EQEP reset.
soc_xbar.h
SOC_generateOttoReset
void SOC_generateOttoReset(uint32_t ottoInstance)
Generate OTTO reset.
SOC_gateRdcClock
void SOC_gateRdcClock(uint32_t rdcInstance)
Gate the HW_RESOLVER clock.
SOC_generateFsiTxReset
void SOC_generateFsiTxReset(uint32_t fsitxInstance)
Generate FSI-TX reset.