TiSmartCar/ti_msp_dl_config.h
Boen_Shi 8be2866433 feat(base): 初始化 MSPM0 开发环境
- 添加头文件和配置文件支持
- 更新.gitignore忽略编译和IDE相关文件
- 添加基础的bsp代码
2026-07-16 14:45:26 +08:00

396 lines
22 KiB
C

/*
* Copyright (c) 2023, Texas Instruments Incorporated - http://www.ti.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* ============ ti_msp_dl_config.h =============
* Configured MSPM0 DriverLib module declarations
*
* DO NOT EDIT - This file is generated for the MSPM0G350X
* by the SysConfig tool.
*/
#ifndef ti_msp_dl_config_h
#define ti_msp_dl_config_h
#define CONFIG_MSPM0G350X
#define CONFIG_MSPM0G3507
#if defined(__ti_version__) || defined(__TI_COMPILER_VERSION__)
#define SYSCONFIG_WEAK __attribute__((weak))
#elif defined(__IAR_SYSTEMS_ICC__)
#define SYSCONFIG_WEAK __weak
#elif defined(__GNUC__)
#define SYSCONFIG_WEAK __attribute__((weak))
#endif
#include <ti/devices/msp/msp.h>
#include <ti/driverlib/driverlib.h>
#include <ti/driverlib/m0p/dl_core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* ======== SYSCFG_DL_init ========
* Perform all required MSP DL initialization
*
* This function should be called once at a point before any use of
* MSP DL.
*/
/* clang-format off */
#define POWER_STARTUP_DELAY (16)
#define CPUCLK_FREQ 80000000
/* Defines for Motor */
#define Motor_INST TIMA1
#define Motor_INST_IRQHandler TIMA1_IRQHandler
#define Motor_INST_INT_IRQN (TIMA1_INT_IRQn)
#define Motor_INST_CLK_FREQ 10000000
/* GPIO defines for channel 0 */
#define GPIO_Motor_C0_PORT GPIOA
#define GPIO_Motor_C0_PIN DL_GPIO_PIN_17
#define GPIO_Motor_C0_IOMUX (IOMUX_PINCM39)
#define GPIO_Motor_C0_IOMUX_FUNC IOMUX_PINCM39_PF_TIMA1_CCP0
#define GPIO_Motor_C0_IDX DL_TIMER_CC_0_INDEX
/* GPIO defines for channel 1 */
#define GPIO_Motor_C1_PORT GPIOA
#define GPIO_Motor_C1_PIN DL_GPIO_PIN_16
#define GPIO_Motor_C1_IOMUX (IOMUX_PINCM38)
#define GPIO_Motor_C1_IOMUX_FUNC IOMUX_PINCM38_PF_TIMA1_CCP1
#define GPIO_Motor_C1_IDX DL_TIMER_CC_1_INDEX
/* Defines for Beep */
#define Beep_INST TIMG6
#define Beep_INST_IRQHandler TIMG6_IRQHandler
#define Beep_INST_INT_IRQN (TIMG6_INT_IRQn)
#define Beep_INST_CLK_FREQ 10000000
/* GPIO defines for channel 1 */
#define GPIO_Beep_C1_PORT GPIOA
#define GPIO_Beep_C1_PIN DL_GPIO_PIN_22
#define GPIO_Beep_C1_IOMUX (IOMUX_PINCM47)
#define GPIO_Beep_C1_IOMUX_FUNC IOMUX_PINCM47_PF_TIMG6_CCP1
#define GPIO_Beep_C1_IDX DL_TIMER_CC_1_INDEX
/* Defines for Servo */
#define Servo_INST TIMG8
#define Servo_INST_IRQHandler TIMG8_IRQHandler
#define Servo_INST_INT_IRQN (TIMG8_INT_IRQn)
#define Servo_INST_CLK_FREQ 500000
/* GPIO defines for channel 0 */
#define GPIO_Servo_C0_PORT GPIOA
#define GPIO_Servo_C0_PIN DL_GPIO_PIN_23
#define GPIO_Servo_C0_IOMUX (IOMUX_PINCM53)
#define GPIO_Servo_C0_IOMUX_FUNC IOMUX_PINCM53_PF_TIMG8_CCP0
#define GPIO_Servo_C0_IDX DL_TIMER_CC_0_INDEX
/* GPIO defines for channel 1 */
#define GPIO_Servo_C1_PORT GPIOA
#define GPIO_Servo_C1_PIN DL_GPIO_PIN_2
#define GPIO_Servo_C1_IOMUX (IOMUX_PINCM7)
#define GPIO_Servo_C1_IOMUX_FUNC IOMUX_PINCM7_PF_TIMG8_CCP1
#define GPIO_Servo_C1_IDX DL_TIMER_CC_1_INDEX
/* Defines for Encoder1_TIM */
#define Encoder1_TIM_INST (TIMG7)
#define Encoder1_TIM_INST_IRQHandler TIMG7_IRQHandler
#define Encoder1_TIM_INST_INT_IRQN (TIMG7_INT_IRQn)
/* GPIO defines for channel 0 */
#define GPIO_Encoder1_TIM_C0_PORT GPIOA
#define GPIO_Encoder1_TIM_C0_PIN DL_GPIO_PIN_28
#define GPIO_Encoder1_TIM_C0_IOMUX (IOMUX_PINCM3)
#define GPIO_Encoder1_TIM_C0_IOMUX_FUNC IOMUX_PINCM3_PF_TIMG7_CCP0
/* Defines for Encoder2_TIM */
#define Encoder2_TIM_INST (TIMA0)
#define Encoder2_TIM_INST_IRQHandler TIMA0_IRQHandler
#define Encoder2_TIM_INST_INT_IRQN (TIMA0_INT_IRQn)
/* GPIO defines for channel 0 */
#define GPIO_Encoder2_TIM_C0_PORT GPIOA
#define GPIO_Encoder2_TIM_C0_PIN DL_GPIO_PIN_8
#define GPIO_Encoder2_TIM_C0_IOMUX (IOMUX_PINCM19)
#define GPIO_Encoder2_TIM_C0_IOMUX_FUNC IOMUX_PINCM19_PF_TIMA0_CCP0
/* Defines for Encoder_Count */
#define Encoder_Count_INST (TIMG0)
#define Encoder_Count_INST_IRQHandler TIMG0_IRQHandler
#define Encoder_Count_INST_INT_IRQN (TIMG0_INT_IRQn)
#define Encoder_Count_INST_LOAD_VALUE (49999U)
/* Defines for I2C_0 */
#define I2C_0_INST I2C0
#define I2C_0_INST_IRQHandler I2C0_IRQHandler
#define I2C_0_INST_INT_IRQN I2C0_INT_IRQn
#define I2C_0_BUS_SPEED_HZ 100000
#define GPIO_I2C_0_SDA_PORT GPIOA
#define GPIO_I2C_0_SDA_PIN DL_GPIO_PIN_0
#define GPIO_I2C_0_IOMUX_SDA (IOMUX_PINCM1)
#define GPIO_I2C_0_IOMUX_SDA_FUNC IOMUX_PINCM1_PF_I2C0_SDA
#define GPIO_I2C_0_SCL_PORT GPIOA
#define GPIO_I2C_0_SCL_PIN DL_GPIO_PIN_1
#define GPIO_I2C_0_IOMUX_SCL (IOMUX_PINCM2)
#define GPIO_I2C_0_IOMUX_SCL_FUNC IOMUX_PINCM2_PF_I2C0_SCL
/* Defines for I2C_1 */
#define I2C_1_INST I2C1
#define I2C_1_INST_IRQHandler I2C1_IRQHandler
#define I2C_1_INST_INT_IRQN I2C1_INT_IRQn
#define I2C_1_BUS_SPEED_HZ 100000
#define GPIO_I2C_1_SDA_PORT GPIOB
#define GPIO_I2C_1_SDA_PIN DL_GPIO_PIN_3
#define GPIO_I2C_1_IOMUX_SDA (IOMUX_PINCM16)
#define GPIO_I2C_1_IOMUX_SDA_FUNC IOMUX_PINCM16_PF_I2C1_SDA
#define GPIO_I2C_1_SCL_PORT GPIOB
#define GPIO_I2C_1_SCL_PIN DL_GPIO_PIN_2
#define GPIO_I2C_1_IOMUX_SCL (IOMUX_PINCM15)
#define GPIO_I2C_1_IOMUX_SCL_FUNC IOMUX_PINCM15_PF_I2C1_SCL
/* Defines for PRINTF */
#define PRINTF_INST UART0
#define PRINTF_INST_FREQUENCY 4000000
#define PRINTF_INST_IRQHandler UART0_IRQHandler
#define PRINTF_INST_INT_IRQN UART0_INT_IRQn
#define GPIO_PRINTF_RX_PORT GPIOA
#define GPIO_PRINTF_TX_PORT GPIOA
#define GPIO_PRINTF_RX_PIN DL_GPIO_PIN_11
#define GPIO_PRINTF_TX_PIN DL_GPIO_PIN_10
#define GPIO_PRINTF_IOMUX_RX (IOMUX_PINCM22)
#define GPIO_PRINTF_IOMUX_TX (IOMUX_PINCM21)
#define GPIO_PRINTF_IOMUX_RX_FUNC IOMUX_PINCM22_PF_UART0_RX
#define GPIO_PRINTF_IOMUX_TX_FUNC IOMUX_PINCM21_PF_UART0_TX
#define PRINTF_BAUD_RATE (115200)
#define PRINTF_IBRD_4_MHZ_115200_BAUD (2)
#define PRINTF_FBRD_4_MHZ_115200_BAUD (11)
/* Defines for IMU */
#define IMU_INST UART2
#define IMU_INST_FREQUENCY 4000000
#define IMU_INST_IRQHandler UART2_IRQHandler
#define IMU_INST_INT_IRQN UART2_INT_IRQn
#define GPIO_IMU_RX_PORT GPIOB
#define GPIO_IMU_TX_PORT GPIOB
#define GPIO_IMU_RX_PIN DL_GPIO_PIN_16
#define GPIO_IMU_TX_PIN DL_GPIO_PIN_15
#define GPIO_IMU_IOMUX_RX (IOMUX_PINCM33)
#define GPIO_IMU_IOMUX_TX (IOMUX_PINCM32)
#define GPIO_IMU_IOMUX_RX_FUNC IOMUX_PINCM33_PF_UART2_RX
#define GPIO_IMU_IOMUX_TX_FUNC IOMUX_PINCM32_PF_UART2_TX
#define IMU_BAUD_RATE (115200)
#define IMU_IBRD_4_MHZ_115200_BAUD (2)
#define IMU_FBRD_4_MHZ_115200_BAUD (11)
/* Defines for HOST */
#define HOST_INST UART3
#define HOST_INST_FREQUENCY 4000000
#define HOST_INST_IRQHandler UART3_IRQHandler
#define HOST_INST_INT_IRQN UART3_INT_IRQn
#define GPIO_HOST_RX_PORT GPIOB
#define GPIO_HOST_TX_PORT GPIOB
#define GPIO_HOST_RX_PIN DL_GPIO_PIN_13
#define GPIO_HOST_TX_PIN DL_GPIO_PIN_12
#define GPIO_HOST_IOMUX_RX (IOMUX_PINCM30)
#define GPIO_HOST_IOMUX_TX (IOMUX_PINCM29)
#define GPIO_HOST_IOMUX_RX_FUNC IOMUX_PINCM30_PF_UART3_RX
#define GPIO_HOST_IOMUX_TX_FUNC IOMUX_PINCM29_PF_UART3_TX
#define HOST_BAUD_RATE (115200)
#define HOST_IBRD_4_MHZ_115200_BAUD (2)
#define HOST_FBRD_4_MHZ_115200_BAUD (11)
/* Defines for Stepmotor */
#define Stepmotor_INST UART1
#define Stepmotor_INST_FREQUENCY 4000000
#define Stepmotor_INST_IRQHandler UART1_IRQHandler
#define Stepmotor_INST_INT_IRQN UART1_INT_IRQn
#define GPIO_Stepmotor_RX_PORT GPIOB
#define GPIO_Stepmotor_TX_PORT GPIOB
#define GPIO_Stepmotor_RX_PIN DL_GPIO_PIN_5
#define GPIO_Stepmotor_TX_PIN DL_GPIO_PIN_4
#define GPIO_Stepmotor_IOMUX_RX (IOMUX_PINCM18)
#define GPIO_Stepmotor_IOMUX_TX (IOMUX_PINCM17)
#define GPIO_Stepmotor_IOMUX_RX_FUNC IOMUX_PINCM18_PF_UART1_RX
#define GPIO_Stepmotor_IOMUX_TX_FUNC IOMUX_PINCM17_PF_UART1_TX
#define Stepmotor_BAUD_RATE (115200)
#define Stepmotor_IBRD_4_MHZ_115200_BAUD (2)
#define Stepmotor_FBRD_4_MHZ_115200_BAUD (11)
/* Port definition for Pin Group Encoder1_GPIO */
#define Encoder1_GPIO_PORT (GPIOA)
/* Defines for Encoder1B_GPIO: GPIOA.31 with pinCMx 6 on package pin 39 */
#define Encoder1_GPIO_Encoder1B_GPIO_PIN (DL_GPIO_PIN_31)
#define Encoder1_GPIO_Encoder1B_GPIO_IOMUX (IOMUX_PINCM6)
/* Port definition for Pin Group Encoder2_GPIO */
#define Encoder2_GPIO_PORT (GPIOA)
/* Defines for Encoder2B_GPIO: GPIOA.9 with pinCMx 20 on package pin 55 */
#define Encoder2_GPIO_Encoder2B_GPIO_PIN (DL_GPIO_PIN_9)
#define Encoder2_GPIO_Encoder2B_GPIO_IOMUX (IOMUX_PINCM20)
/* Port definition for Pin Group Lights */
#define Lights_PORT (GPIOA)
/* Defines for Light: GPIOA.18 with pinCMx 40 on package pin 11 */
#define Lights_Light_PIN (DL_GPIO_PIN_18)
#define Lights_Light_IOMUX (IOMUX_PINCM40)
/* Port definition for Pin Group LED */
#define LED_PORT (GPIOB)
/* Defines for Board: GPIOB.22 with pinCMx 50 on package pin 21 */
#define LED_Board_PIN (DL_GPIO_PIN_22)
#define LED_Board_IOMUX (IOMUX_PINCM50)
/* Defines for Led1: GPIOB.25 with pinCMx 56 on package pin 27 */
#define LED_Led1_PIN (DL_GPIO_PIN_25)
#define LED_Led1_IOMUX (IOMUX_PINCM56)
/* Defines for Led2: GPIOB.23 with pinCMx 51 on package pin 22 */
#define LED_Led2_PIN (DL_GPIO_PIN_23)
#define LED_Led2_IOMUX (IOMUX_PINCM51)
/* Defines for Led3: GPIOB.20 with pinCMx 48 on package pin 19 */
#define LED_Led3_PIN (DL_GPIO_PIN_20)
#define LED_Led3_IOMUX (IOMUX_PINCM48)
/* Defines for Key1: GPIOA.7 with pinCMx 14 on package pin 49 */
#define Key_Key1_PORT (GPIOA)
// pins affected by this interrupt request:["Key1"]
#define Key_GPIOA_INT_IRQN (GPIOA_INT_IRQn)
#define Key_GPIOA_INT_IIDX (DL_INTERRUPT_GROUP1_IIDX_GPIOA)
#define Key_Key1_IIDX (DL_GPIO_IIDX_DIO7)
#define Key_Key1_PIN (DL_GPIO_PIN_7)
#define Key_Key1_IOMUX (IOMUX_PINCM14)
/* Defines for Key2: GPIOB.10 with pinCMx 27 on package pin 62 */
#define Key_Key2_PORT (GPIOB)
// groups represented: ["Tracker","Key"]
// pins affected: ["Track1","Track2","Track3","Track4","Track5","Track6","Track7","Key2","Key3","Key4"]
#define GPIO_MULTIPLE_GPIOB_INT_IRQN (GPIOB_INT_IRQn)
#define GPIO_MULTIPLE_GPIOB_INT_IIDX (DL_INTERRUPT_GROUP1_IIDX_GPIOB)
#define Key_Key2_IIDX (DL_GPIO_IIDX_DIO10)
#define Key_Key2_PIN (DL_GPIO_PIN_10)
#define Key_Key2_IOMUX (IOMUX_PINCM27)
/* Defines for Key3: GPIOB.11 with pinCMx 28 on package pin 63 */
#define Key_Key3_PORT (GPIOB)
#define Key_Key3_IIDX (DL_GPIO_IIDX_DIO11)
#define Key_Key3_PIN (DL_GPIO_PIN_11)
#define Key_Key3_IOMUX (IOMUX_PINCM28)
/* Defines for Key4: GPIOB.14 with pinCMx 31 on package pin 2 */
#define Key_Key4_PORT (GPIOB)
#define Key_Key4_IIDX (DL_GPIO_IIDX_DIO14)
#define Key_Key4_PIN (DL_GPIO_PIN_14)
#define Key_Key4_IOMUX (IOMUX_PINCM31)
/* Port definition for Pin Group MotorDirection */
#define MotorDirection_PORT (GPIOA)
/* Defines for AIN1: GPIOA.14 with pinCMx 36 on package pin 7 */
#define MotorDirection_AIN1_PIN (DL_GPIO_PIN_14)
#define MotorDirection_AIN1_IOMUX (IOMUX_PINCM36)
/* Defines for AIN2: GPIOA.15 with pinCMx 37 on package pin 8 */
#define MotorDirection_AIN2_PIN (DL_GPIO_PIN_15)
#define MotorDirection_AIN2_IOMUX (IOMUX_PINCM37)
/* Defines for BIN1: GPIOA.12 with pinCMx 34 on package pin 5 */
#define MotorDirection_BIN1_PIN (DL_GPIO_PIN_12)
#define MotorDirection_BIN1_IOMUX (IOMUX_PINCM34)
/* Defines for BIN2: GPIOA.13 with pinCMx 35 on package pin 6 */
#define MotorDirection_BIN2_PIN (DL_GPIO_PIN_13)
#define MotorDirection_BIN2_IOMUX (IOMUX_PINCM35)
/* Port definition for Pin Group Tracker */
#define Tracker_PORT (GPIOB)
/* Defines for Track1: GPIOB.0 with pinCMx 12 on package pin 47 */
#define Tracker_Track1_IIDX (DL_GPIO_IIDX_DIO0)
#define Tracker_Track1_PIN (DL_GPIO_PIN_0)
#define Tracker_Track1_IOMUX (IOMUX_PINCM12)
/* Defines for Track2: GPIOB.1 with pinCMx 13 on package pin 48 */
#define Tracker_Track2_IIDX (DL_GPIO_IIDX_DIO1)
#define Tracker_Track2_PIN (DL_GPIO_PIN_1)
#define Tracker_Track2_IOMUX (IOMUX_PINCM13)
/* Defines for Track3: GPIOB.21 with pinCMx 49 on package pin 20 */
#define Tracker_Track3_IIDX (DL_GPIO_IIDX_DIO21)
#define Tracker_Track3_PIN (DL_GPIO_PIN_21)
#define Tracker_Track3_IOMUX (IOMUX_PINCM49)
/* Defines for Track4: GPIOB.24 with pinCMx 52 on package pin 23 */
#define Tracker_Track4_IIDX (DL_GPIO_IIDX_DIO24)
#define Tracker_Track4_PIN (DL_GPIO_PIN_24)
#define Tracker_Track4_IOMUX (IOMUX_PINCM52)
/* Defines for Track5: GPIOB.17 with pinCMx 43 on package pin 14 */
#define Tracker_Track5_IIDX (DL_GPIO_IIDX_DIO17)
#define Tracker_Track5_PIN (DL_GPIO_PIN_17)
#define Tracker_Track5_IOMUX (IOMUX_PINCM43)
/* Defines for Track6: GPIOB.18 with pinCMx 44 on package pin 15 */
#define Tracker_Track6_IIDX (DL_GPIO_IIDX_DIO18)
#define Tracker_Track6_PIN (DL_GPIO_PIN_18)
#define Tracker_Track6_IOMUX (IOMUX_PINCM44)
/* Defines for Track7: GPIOB.19 with pinCMx 45 on package pin 16 */
#define Tracker_Track7_IIDX (DL_GPIO_IIDX_DIO19)
#define Tracker_Track7_PIN (DL_GPIO_PIN_19)
#define Tracker_Track7_IOMUX (IOMUX_PINCM45)
/* clang-format on */
void SYSCFG_DL_init(void);
void SYSCFG_DL_initPower(void);
void SYSCFG_DL_GPIO_init(void);
void SYSCFG_DL_SYSCTL_init(void);
void SYSCFG_DL_Motor_init(void);
void SYSCFG_DL_Beep_init(void);
void SYSCFG_DL_Servo_init(void);
void SYSCFG_DL_Encoder1_TIM_init(void);
void SYSCFG_DL_Encoder2_TIM_init(void);
void SYSCFG_DL_Encoder_Count_init(void);
void SYSCFG_DL_I2C_0_init(void);
void SYSCFG_DL_I2C_1_init(void);
void SYSCFG_DL_PRINTF_init(void);
void SYSCFG_DL_IMU_init(void);
void SYSCFG_DL_HOST_init(void);
void SYSCFG_DL_Stepmotor_init(void);
bool SYSCFG_DL_saveConfiguration(void);
bool SYSCFG_DL_restoreConfiguration(void);
#ifdef __cplusplus
}
#endif
#endif /* ti_msp_dl_config_h */