AM263Px MCU+ SDK  10.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 
81 /* defines the Inputs to the SOC_selectAdcExtChXbarAPI for extChXbarIn param */
82 #define ADC0_EXTCHSEL_BIT0 (0U)
83 #define ADC0_EXTCHSEL_BIT1 (1U)
84 #define ADC1_EXTCHSEL_BIT0 (2U)
85 #define ADC1_EXTCHSEL_BIT1 (3U)
86 #define ADC2_EXTCHSEL_BIT0 (4U)
87 #define ADC2_EXTCHSEL_BIT1 (5U)
88 #define ADC3_EXTCHSEL_BIT0 (6U)
89 #define ADC3_EXTCHSEL_BIT1 (7U)
90 #define ADC4_EXTCHSEL_BIT0 (8U)
91 #define ADC4_EXTCHSEL_BIT1 (9U)
92 #define ADC_R0_EXTCHSEL_BIT0 (10U)
93 #define ADC_R0_EXTCHSEL_BIT1 (11U)
94 #define ADC_R1_EXTCHSEL_BIT0 (12U)
95 #define ADC_R2_EXTCHSEL_BIT1 (13U)
96 
97 
98 #define ADC_EXTCHSELCT_DELAY_3_CYCLES (0U)
99 #define ADC_EXTCHSELCT_DELAY_6_CYCLES (1U)
100 
101 #define CMPSS_LOOP_BACK_INH (0U)
102 #define CMPSS_LOOP_BACK_INL (1U)
103 
105 static inline int32_t MCSPI_lld_isBaseAddrValid(uint32_t baseAddr)
106 {
107  int32_t status = (int32_t)-3;
108 
109  if ((baseAddr == CSL_MCSPI0_U_BASE) || \
110  (baseAddr == CSL_MCSPI1_U_BASE) || \
111  (baseAddr == CSL_MCSPI2_U_BASE) || \
112  (baseAddr == CSL_MCSPI3_U_BASE) || \
113  (baseAddr == CSL_MCSPI4_U_BASE) || \
114  (baseAddr == CSL_MCSPI5_U_BASE) || \
115  (baseAddr == CSL_MCSPI6_U_BASE) || \
116  (baseAddr == CSL_MCSPI7_U_BASE) )
117  {
118  status = 0;
119  }
120 
121  return status;
122 }
123 #define IS_I2C_BASE_ADDR_VALID(baseAddr) ((baseAddr == CSL_I2C0_U_BASE) || \
124  (baseAddr == CSL_I2C1_U_BASE) || \
125  (baseAddr == CSL_I2C2_U_BASE) || \
126  (baseAddr == CSL_I2C3_U_BASE))
127 
129 static inline int32_t MMCSD_lld_isBaseAddrValid(uint32_t baseAddr)
130 {
131  /* Set status to invalid Param */
132  int32_t status = (int32_t)(-3);
133 
134  if (baseAddr == CSL_MMC0_U_BASE)
135 
136  {
137  /* Set status to success */
138  status = 0;
139  }
140 
141  return status;
142 }
144 #define IS_OSPI_BASE_ADDR_VALID(baseAddr) (baseAddr == CSL_FLASH_CONFIG_REG8_U_BASE)
145 
147 #define IS_OSPI_DATA_BASE_ADDR_VALID(baseAddr) (baseAddr == CSL_FLASH_DATA_REG0_U_BASE)
148 
158 int32_t SOC_moduleClockEnable(uint32_t moduleId, uint32_t enable);
159 
170 int32_t SOC_moduleSetClockFrequency(uint32_t moduleId, uint32_t clkId, uint64_t clkRate);
171 
179 const char *SOC_getCoreName(uint16_t coreId);
180 
186 uint64_t SOC_getSelfCpuClk(void);
187 
194 void SOC_controlModuleLockMMR(uint32_t domainId, uint32_t partition);
195 
202 void SOC_controlModuleUnlockMMR(uint32_t domainId, uint32_t partition);
203 
210 void SOC_setEpwmTbClk(uint32_t epwmInstance, uint32_t enable);
211 
218 void SOC_setMultipleEpwmTbClk(uint32_t epwmMask, uint32_t enable);
219 
225 void SOC_enableAdcReference(uint32_t adcInstance);
226 
233 void SOC_enableAdcInternalReference(uint32_t adcInstance, uint32_t enable);
234 
241 void SOC_enableAdcReferenceMonitor(uint32_t adcInstance, uint32_t enable);
242 
249 uint32_t SOC_getAdcReferenceStatus(uint32_t adcInstance);
250 
258 void SOC_enableAdcOsdChannel(uint32_t adcInstance, uint32_t channel, uint32_t enable);
259 
287 void SOC_setAdcOsdConfig(uint32_t adcInstance, uint32_t config);
288 
295 void SOC_enableAdcGlobalForce(uint32_t adcInstance, uint32_t enable);
296 
303 void SOC_adcSocGlobalForce(uint32_t socNumber);
324 void SOC_selectAdcExtChXbar(uint32_t extChXbarOut, uint32_t extChXbarIn);
325 
334 void SOC_selextAdcExtChDelay(uint32_t delay);
335 
341 void SOC_enableAdcDacLoopback(uint32_t enable);
342 
353 void SOC_enableCmpssaDacLoopBack(uint32_t cmpssaInstance, uint32_t dacType, uint32_t enable);
354 
365 void SOC_enableCmpssbDacLoopBack(uint32_t cmpssbInstance, uint32_t dacType, uint32_t enable);
366 
373 void SOC_setEpwmGroup(uint32_t epwmInstance, uint32_t group);
374 
380 void SOC_selectSdfm1Clk0Source(uint8_t source);
381 
382 
393 void SOC_sdfmClkLoopBackConfig(uint32_t sdfmInstance, uint32_t clkInstance, uint32_t defaultValue);
394 
400 void SOC_gateEpwmClock(uint32_t epwmInstance);
401 
407 void SOC_ungateEpwmClock(uint32_t epwmInstance);
408 
414 void SOC_gateFsitxClock(uint32_t fsitxInstance);
415 
421 void SOC_gateFsirxClock(uint32_t fsirxInstance);
422 
428 void SOC_gateCmpssaClock(uint32_t cmpssaInstance);
429 
435 void SOC_ungateCmpssaClock(uint32_t cmpssaInstance);
436 
442 void SOC_gateCmpssbClock(uint32_t cmpssbInstance);
443 
449 void SOC_ungateCmpssbClock(uint32_t cmpssbInstance);
450 
456 void SOC_gateEcapClock(uint32_t ecapInstance);
457 
463 void SOC_ungateEcapClock(uint32_t ecapInstance);
464 
470 void SOC_gateEqepClock(uint32_t eqepInstance);
471 
477 void SOC_ungateEqepClock(uint32_t eqepInstance);
478 
484 void SOC_gateSdfmClock(uint32_t sdfmInstance);
485 
491 void SOC_ungateSdfmClock(uint32_t sdfmInstance);
492 
496 void SOC_gateDacClock(void);
497 
502 
508 void SOC_gateAdcClock(uint32_t adcInstance);
509 
515 void SOC_ungateAdcClock(uint32_t adcInstance);
516 
522 void SOC_gateRdcClock(uint32_t rdcInstance);
523 
529 void SOC_ungateRdcClock(uint32_t rdcInstance);
530 
536 void SOC_gateOttoClock(uint32_t ottoInstance);
537 
543 void SOC_ungateOttoClock(uint32_t ottoInstance);
544 
550 void SOC_gateSdfmPllClock(uint32_t sdfmInstance);
551 
557 void SOC_ungateSdfmPllClock(uint32_t sdfmInstance);
558 
564 void SOC_gateFsiPllClock(uint32_t fsiInstance);
565 
571 void SOC_generateEpwmReset(uint32_t ePWMInstance);
572 
578 void SOC_generateFsiTxReset(uint32_t fsitxInstance);
579 
585 void SOC_generateFsiRxReset(uint32_t fsirxInstance);
586 
592 void SOC_generateCmpssaReset(uint32_t cmpssaInstance);
593 
599 void SOC_generateCmpssbReset(uint32_t cmpssbInstance);
600 
606 void SOC_generateEcapReset(uint32_t ecapInstance);
607 
613 void SOC_generateEqepReset(uint32_t eqepInstance);
614 
620 void SOC_generateSdfmReset(uint32_t sdfmInstance);
621 
626 
632 void SOC_generateAdcReset(uint32_t adcInstance);
633 
639 void SOC_generateRdcReset(uint32_t rdcInstance);
640 
647 void Soc_enableEPWMHalt (uint32_t epwmInstance);
648 
655 void Soc_disableEPWMHalt (uint32_t epwmInstance);
656 
662 void SOC_generateOttoReset(uint32_t ottoInstance);
663 
670 void SOC_selectIcssGpiMux(uint8_t pru_instance, uint32_t mask);
671 
679 uint64_t SOC_virtToPhy(void *virtAddr);
680 
688 void *SOC_phyToVirt(uint64_t phyAddr);
689 
696 
698 static inline int32_t UART_IsBaseAddrValid(uint32_t baseAddr)
699 {
700  int32_t status = (int32_t)-3;
701 
702  if(((baseAddr == CSL_UART0_U_BASE) ||
703  (baseAddr == CSL_UART1_U_BASE) ||
704  (baseAddr == CSL_UART2_U_BASE) ||
705  (baseAddr == CSL_UART3_U_BASE) ||
706  (baseAddr == CSL_UART4_U_BASE) ||
707  (baseAddr == CSL_UART5_U_BASE)))
708  {
709  status = 0;
710  }
711 
712  return status;
713 }
714 
717 #ifdef __cplusplus
718 }
719 #endif
720 
721 #endif
SOC_gateFsitxClock
void SOC_gateFsitxClock(uint32_t fsitxInstance)
Gate the FSI-TX clock.
SOC_enableAdcReferenceMonitor
void SOC_enableAdcReferenceMonitor(uint32_t adcInstance, uint32_t enable)
Enable ADC reference Monitors by writing to Control MMR.
SOC_moduleSetClockFrequency
int32_t SOC_moduleSetClockFrequency(uint32_t moduleId, uint32_t clkId, uint64_t clkRate)
Set module clock to specified frequency.
Soc_disableEPWMHalt
void Soc_disableEPWMHalt(uint32_t epwmInstance)
Halt EPWM with corresponding cPU.
SOC_generateEcapReset
void SOC_generateEcapReset(uint32_t ecapInstance)
Generate ECAP reset.
SOC_ungateSdfmPllClock
void SOC_ungateSdfmPllClock(uint32_t sdfmInstance)
Ungate the SDFM PLL clock.
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_selectAdcExtChXbar
void SOC_selectAdcExtChXbar(uint32_t extChXbarOut, uint32_t extChXbarIn)
Selects the ADC External Channel Select bit for the output from each xbar out.
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_enableCmpssbDacLoopBack
void SOC_enableCmpssbDacLoopBack(uint32_t cmpssbInstance, uint32_t dacType, uint32_t enable)
Enable or disable the CMPSS - DAC Loop Back configuration.
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_ungateDacClock
void SOC_ungateDacClock(void)
Ungate the DAC clock.
soc_rcm.h
SOC_setMultipleEpwmTbClk
void SOC_setMultipleEpwmTbClk(uint32_t epwmMask, uint32_t enable)
Enable or disable Multiple ePWM time base clock from Control MMR.
SOC_setAdcOsdConfig
void SOC_setAdcOsdConfig(uint32_t adcInstance, uint32_t config)
Sets the ADC OSD Configuration.
SOC_gateEqepClock
void SOC_gateEqepClock(uint32_t eqepInstance)
Gate the EQEP clock.
SOC_generateAdcReset
void SOC_generateAdcReset(uint32_t adcInstance)
Generate ADC reset.
SOC_ungateRdcClock
void SOC_ungateRdcClock(uint32_t rdcInstance)
Ungate the HW_RESOLVER clock.
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_ungateEcapClock
void SOC_ungateEcapClock(uint32_t ecapInstance)
Ungate the ECAP clock.
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_enableAdcGlobalForce
void SOC_enableAdcGlobalForce(uint32_t adcInstance, uint32_t enable)
Enable or Disable the ADC instnace for Gloabl SW force.
SOC_enableAdcOsdChannel
void SOC_enableAdcOsdChannel(uint32_t adcInstance, uint32_t channel, uint32_t enable)
Enable or disable the OSD circuit over the ADC channels.
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_selextAdcExtChDelay
void SOC_selextAdcExtChDelay(uint32_t delay)
Mux select to choose delay for ADC Extchsel.
UART_IsBaseAddrValid
static int32_t UART_IsBaseAddrValid(uint32_t baseAddr)
API to validate UART base address.
Definition: soc.h:698
SOC_gateFsiPllClock
void SOC_gateFsiPllClock(uint32_t fsiInstance)
Gate the FSI-TX PLL clock.
SOC_ungateOttoClock
void SOC_ungateOttoClock(uint32_t ottoInstance)
Ungate the OTTO clock.
SOC_ungateCmpssaClock
void SOC_ungateCmpssaClock(uint32_t cmpssaInstance)
Ungate the CMPSS-A clock.
SOC_enableAdcInternalReference
void SOC_enableAdcInternalReference(uint32_t adcInstance, uint32_t enable)
Enables the ADC internal reference.
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:105
SOC_controlModuleLockMMR
void SOC_controlModuleLockMMR(uint32_t domainId, uint32_t partition)
Lock control module partition to prevent writes into control MMRs.
SOC_ungateSdfmClock
void SOC_ungateSdfmClock(uint32_t sdfmInstance)
Ungate the SDFM clock.
SOC_ungateAdcClock
void SOC_ungateAdcClock(uint32_t adcInstance)
ungate the ADC clock
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_ungateCmpssbClock
void SOC_ungateCmpssbClock(uint32_t cmpssbInstance)
Ungate the CMPSS-B clock.
SOC_adcSocGlobalForce
void SOC_adcSocGlobalForce(uint32_t socNumber)
Triggers a global force for the SOC in enabled ADCs the ADCs may be enabled by using SOC_enableAdcGlo...
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_ungateEpwmClock
void SOC_ungateEpwmClock(uint32_t epwmInstance)
Ungate the ePWM clock.
SOC_getAdcReferenceStatus
uint32_t SOC_getAdcReferenceStatus(uint32_t adcInstance)
Gets the Reference status.
SOC_ungateEqepClock
void SOC_ungateEqepClock(uint32_t eqepInstance)
Ungate the EQEP clock.
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_sdfmClkLoopBackConfig
void SOC_sdfmClkLoopBackConfig(uint32_t sdfmInstance, uint32_t clkInstance, uint32_t defaultValue)
Sets the configuraion for the loopback control.
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.
MMCSD_lld_isBaseAddrValid
static int32_t MMCSD_lld_isBaseAddrValid(uint32_t baseAddr)
API to validate MMCSD base addresses.
Definition: soc.h:129
SOC_enableCmpssaDacLoopBack
void SOC_enableCmpssaDacLoopBack(uint32_t cmpssaInstance, uint32_t dacType, uint32_t enable)
Enable or disable the CMPSS - DAC Loop Back configuration.
SOC_enableAdcDacLoopback
void SOC_enableAdcDacLoopback(uint32_t enable)
Enable or Disable the ADC CAL Pin to loopback with DAC.