diff options
| author | xuzhuoyi <[email protected]> | 2019-03-27 13:09:19 +0800 |
|---|---|---|
| committer | xuzhuoyi <[email protected]> | 2019-03-27 13:09:19 +0800 |
| commit | 843cc6fcd18b2a775e3e84830743fc4df552c3db (patch) | |
| tree | 792151a993e9ea26ecb7dde0276a49ddf79cb295 | |
| parent | 43a499c008986394f2758705edaab9101edaf0fc (diff) | |
[bsp][tms320f28379d] Add SCI support
| -rw-r--r-- | bsp/tms320f28379d/.config | 43 | ||||
| -rw-r--r-- | bsp/tms320f28379d/.cproject | 6 | ||||
| -rw-r--r-- | bsp/tms320f28379d/.project | 15 | ||||
| -rw-r--r-- | bsp/tms320f28379d/.settings/org.eclipse.core.resources.prefs | 4 | ||||
| -rw-r--r-- | bsp/tms320f28379d/applications/startup.c | 2 | ||||
| -rw-r--r-- | bsp/tms320f28379d/drivers/board.c | 8 | ||||
| -rw-r--r-- | bsp/tms320f28379d/drivers/board.h | 4 | ||||
| -rw-r--r-- | bsp/tms320f28379d/drivers/drv_sci.c | 224 | ||||
| -rw-r--r-- | bsp/tms320f28379d/drivers/drv_sci.h | 16 | ||||
| -rw-r--r-- | bsp/tms320f28379d/libraries/common/include/stdint.h | 523 | ||||
| -rw-r--r-- | bsp/tms320f28379d/rtconfig.h | 14 | ||||
| -rw-r--r-- | bsp/tms320f28379d/rtconfig_project.h | 23 |
12 files changed, 857 insertions, 25 deletions
diff --git a/bsp/tms320f28379d/.config b/bsp/tms320f28379d/.config index 4d68f71848..2ef26e73e3 100644 --- a/bsp/tms320f28379d/.config +++ b/bsp/tms320f28379d/.config @@ -8,17 +8,19 @@ CONFIG_SOC_TMS320F28X=y # RT-Thread Kernel # CONFIG_RT_NAME_MAX=8 +CONFIG_RT_USING_ARCH_DATA_TYPE=y +# CONFIG_RT_USING_SMP is not set CONFIG_RT_ALIGN_SIZE=4 CONFIG_RT_THREAD_PRIORITY_8=y # CONFIG_RT_THREAD_PRIORITY_32 is not set # CONFIG_RT_THREAD_PRIORITY_256 is not set CONFIG_RT_THREAD_PRIORITY_MAX=8 CONFIG_RT_TICK_PER_SECOND=100 -CONFIG_RT_USING_OVERFLOW_CHECK=y +# CONFIG_RT_USING_OVERFLOW_CHECK is not set CONFIG_RT_USING_HOOK=y CONFIG_RT_USING_IDLE_HOOK=y CONFIG_RT_IDEL_HOOK_LIST_SIZE=4 -CONFIG_IDLE_THREAD_STACK_SIZE=256 +CONFIG_IDLE_THREAD_STACK_SIZE=1024 # CONFIG_RT_USING_TIMER_SOFT is not set CONFIG_RT_DEBUG=y CONFIG_RT_DEBUG_COLOR=y @@ -62,7 +64,8 @@ CONFIG_RT_USING_DEVICE=y # CONFIG_RT_USING_INTERRUPT_INFO is not set CONFIG_RT_USING_CONSOLE=y CONFIG_RT_CONSOLEBUF_SIZE=128 -CONFIG_RT_CONSOLE_DEVICE_NAME="uart" +CONFIG_RT_CONSOLE_DEVICE_NAME="scia" +CONFIG_RT_VER_NUM=0x40001 CONFIG_ARCH_TIDSP=y CONFIG_ARCH_TIDSP_C28X=y CONFIG_ARCH_CPU_STACK_GROWS_UPWARD=y @@ -106,11 +109,13 @@ CONFIG_RT_USING_DEVICE_IPC=y CONFIG_RT_PIPE_BUFSZ=512 CONFIG_RT_USING_SERIAL=y CONFIG_RT_SERIAL_USING_DMA=y +CONFIG_RT_SERIAL_RB_BUFSZ=64 # CONFIG_RT_USING_CAN is not set # CONFIG_RT_USING_HWTIMER is not set # CONFIG_RT_USING_CPUTIME is not set # CONFIG_RT_USING_I2C is not set CONFIG_RT_USING_PIN=y +# CONFIG_RT_USING_ADC is not set # CONFIG_RT_USING_PWM is not set # CONFIG_RT_USING_MTD_NOR is not set # CONFIG_RT_USING_MTD_NAND is not set @@ -121,6 +126,7 @@ CONFIG_RT_USING_PIN=y # CONFIG_RT_USING_SPI is not set # CONFIG_RT_USING_WDT is not set # CONFIG_RT_USING_AUDIO is not set +# CONFIG_RT_USING_SENSOR is not set # # Using WiFi @@ -174,6 +180,7 @@ CONFIG_RT_USING_PIN=y # CONFIG_RT_USING_LOGTRACE is not set # CONFIG_RT_USING_RYM is not set # CONFIG_RT_USING_ULOG is not set +# CONFIG_RT_USING_UTEST is not set # # RT-Thread online packages @@ -184,10 +191,12 @@ CONFIG_RT_USING_PIN=y # # CONFIG_PKG_USING_PAHOMQTT is not set # CONFIG_PKG_USING_WEBCLIENT is not set +# CONFIG_PKG_USING_WEBNET is not set # CONFIG_PKG_USING_MONGOOSE is not set # CONFIG_PKG_USING_WEBTERMINAL is not set # CONFIG_PKG_USING_CJSON is not set # CONFIG_PKG_USING_JSMN is not set +# CONFIG_PKG_USING_LIBMODBUS is not set # CONFIG_PKG_USING_LJSON is not set # CONFIG_PKG_USING_EZXML is not set # CONFIG_PKG_USING_NANOPB is not set @@ -205,6 +214,7 @@ CONFIG_RT_USING_PIN=y # Wiced WiFi # # CONFIG_PKG_USING_WLAN_WICED is not set +# CONFIG_PKG_USING_RW007 is not set # CONFIG_PKG_USING_COAP is not set # CONFIG_PKG_USING_NOPOLL is not set # CONFIG_PKG_USING_NETUTILS is not set @@ -218,6 +228,9 @@ CONFIG_RT_USING_PIN=y # CONFIG_PKG_USING_GAGENT_CLOUD is not set # CONFIG_PKG_USING_ALI_IOTKIT is not set # CONFIG_PKG_USING_AZURE is not set +# CONFIG_PKG_USING_TENCENT_IOTKIT is not set +# CONFIG_PKG_USING_NIMBLE is not set +# CONFIG_PKG_USING_OTA_DOWNLOADER is not set # # security packages @@ -238,6 +251,7 @@ CONFIG_RT_USING_PIN=y # # CONFIG_PKG_USING_OPENMV is not set # CONFIG_PKG_USING_MUPDF is not set +# CONFIG_PKG_USING_STEMWIN is not set # # tools packages @@ -247,6 +261,9 @@ CONFIG_RT_USING_PIN=y # CONFIG_PKG_USING_EASYLOGGER is not set # CONFIG_PKG_USING_SYSTEMVIEW is not set # CONFIG_PKG_USING_RDB is not set +# CONFIG_PKG_USING_QRCODE is not set +# CONFIG_PKG_USING_ULOG_EASYFLASH is not set +# CONFIG_PKG_USING_ADBD is not set # # system packages @@ -262,10 +279,12 @@ CONFIG_RT_USING_PIN=y # CONFIG_PKG_USING_LITTLEVGL2RTT is not set # CONFIG_PKG_USING_CMSIS is not set # CONFIG_PKG_USING_DFS_YAFFS is not set +# CONFIG_PKG_USING_LITTLEFS is not set # # peripheral libraries and drivers # +# CONFIG_PKG_USING_SENSORS_DRIVERS is not set # CONFIG_PKG_USING_REALTEK_AMEBA is not set # CONFIG_PKG_USING_SHT2X is not set # CONFIG_PKG_USING_AHT10 is not set @@ -273,6 +292,12 @@ CONFIG_RT_USING_PIN=y # CONFIG_PKG_USING_STM32_SDIO is not set # CONFIG_PKG_USING_ICM20608 is not set # CONFIG_PKG_USING_U8G2 is not set +# CONFIG_PKG_USING_BUTTON is not set +# CONFIG_PKG_USING_MPU6XXX is not set +# CONFIG_PKG_USING_PCF8574 is not set +# CONFIG_PKG_USING_SX12XX is not set +# CONFIG_PKG_USING_SIGNAL_LED is not set +# CONFIG_PKG_USING_KENDRYTE_SDK is not set # # miscellaneous packages @@ -286,10 +311,8 @@ CONFIG_RT_USING_PIN=y # CONFIG_PKG_USING_CANFESTIVAL is not set # CONFIG_PKG_USING_ZLIB is not set # CONFIG_PKG_USING_DSTR is not set - -# -# sample package -# +# CONFIG_PKG_USING_TINYFRAME is not set +# CONFIG_PKG_USING_KENDRYTE_DEMO is not set # # samples: kernel and components samples @@ -298,8 +321,6 @@ CONFIG_RT_USING_PIN=y # CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set # CONFIG_PKG_USING_NETWORK_SAMPLES is not set # CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set - -# -# example package: hello -# # CONFIG_PKG_USING_HELLO is not set +# CONFIG_PKG_USING_VI is not set +# CONFIG_PKG_USING_NNOM is not set diff --git a/bsp/tms320f28379d/.cproject b/bsp/tms320f28379d/.cproject index d2f74c22d6..a4aacf5b46 100644 --- a/bsp/tms320f28379d/.cproject +++ b/bsp/tms320f28379d/.cproject @@ -38,6 +38,7 @@ <option id="com.ti.ccstudio.buildDefinitions.C2000_18.1.compilerID.TMU_SUPPORT.1184307973" name="Specify TMU support (--tmu_support)" superClass="com.ti.ccstudio.buildDefinitions.C2000_18.1.compilerID.TMU_SUPPORT" value="com.ti.ccstudio.buildDefinitions.C2000_18.1.compilerID.TMU_SUPPORT.tmu0" valueType="enumerated"/> <option id="com.ti.ccstudio.buildDefinitions.C2000_18.1.compilerID.INCLUDE_PATH.559432837" name="Add dir to #include search path (--include_path, -I)" superClass="com.ti.ccstudio.buildDefinitions.C2000_18.1.compilerID.INCLUDE_PATH" valueType="includePath"> <listOptionValue builtIn="false" value="${PROJECT_ROOT}"/> + <listOptionValue builtIn="false" value="${PROJECT_LOC}/../../components/drivers/include"/> <listOptionValue builtIn="false" value="${PROJECT_LOC}/libraries/headers/include"/> <listOptionValue builtIn="false" value="${PROJECT_LOC}/libraries/common/include"/> <listOptionValue builtIn="false" value="${PROJECT_LOC}/../../include"/> @@ -51,8 +52,9 @@ </option> <option id="com.ti.ccstudio.buildDefinitions.C2000_18.1.compilerID.DIAG_WRAP.1116445206" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.C2000_18.1.compilerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.C2000_18.1.compilerID.DIAG_WRAP.off" valueType="enumerated"/> <option id="com.ti.ccstudio.buildDefinitions.C2000_18.1.compilerID.DISPLAY_ERROR_NUMBER.1267281219" name="Emit diagnostic identifier numbers (--display_error_number, -pden)" superClass="com.ti.ccstudio.buildDefinitions.C2000_18.1.compilerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/> - <option id="com.ti.ccstudio.buildDefinitions.C2000_18.1.compilerID.DEFINE.1335024937" superClass="com.ti.ccstudio.buildDefinitions.C2000_18.1.compilerID.DEFINE" valueType="definedSymbols"> + <option id="com.ti.ccstudio.buildDefinitions.C2000_18.1.compilerID.DEFINE.1335024937" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.C2000_18.1.compilerID.DEFINE" valueType="definedSymbols"> <listOptionValue builtIn="false" value="CPU1"/> + <listOptionValue builtIn="false" value="_LAUNCHXL_F28379D"/> </option> <inputType id="com.ti.ccstudio.buildDefinitions.C2000_18.1.compiler.inputType__C_SRCS.950197594" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.C2000_18.1.compiler.inputType__C_SRCS"/> <inputType id="com.ti.ccstudio.buildDefinitions.C2000_18.1.compiler.inputType__CPP_SRCS.785224019" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.C2000_18.1.compiler.inputType__CPP_SRCS"/> @@ -60,7 +62,7 @@ <inputType id="com.ti.ccstudio.buildDefinitions.C2000_18.1.compiler.inputType__ASM2_SRCS.1601340693" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.C2000_18.1.compiler.inputType__ASM2_SRCS"/> </tool> <tool id="com.ti.ccstudio.buildDefinitions.C2000_18.1.exe.linkerDebug.133401444" name="C2000 Linker" superClass="com.ti.ccstudio.buildDefinitions.C2000_18.1.exe.linkerDebug"> - <option id="com.ti.ccstudio.buildDefinitions.C2000_18.1.linkerID.STACK_SIZE.1793871018" name="Set C system stack size (--stack_size, -stack)" superClass="com.ti.ccstudio.buildDefinitions.C2000_18.1.linkerID.STACK_SIZE" value="0x200" valueType="string"/> + <option id="com.ti.ccstudio.buildDefinitions.C2000_18.1.linkerID.STACK_SIZE.1793871018" name="Set C system stack size (--stack_size, -stack)" superClass="com.ti.ccstudio.buildDefinitions.C2000_18.1.linkerID.STACK_SIZE" value="0x400" valueType="string"/> <option id="com.ti.ccstudio.buildDefinitions.C2000_18.1.linkerID.MAP_FILE.890856168" name="Link information (map) listed into <file> (--map_file, -m)" superClass="com.ti.ccstudio.buildDefinitions.C2000_18.1.linkerID.MAP_FILE" value="${ProjName}.map" valueType="string"/> <option id="com.ti.ccstudio.buildDefinitions.C2000_18.1.linkerID.OUTPUT_FILE.1475548266" name="Specify output file name (--output_file, -o)" superClass="com.ti.ccstudio.buildDefinitions.C2000_18.1.linkerID.OUTPUT_FILE" value="${ProjName}.out" valueType="string"/> <option id="com.ti.ccstudio.buildDefinitions.C2000_18.1.linkerID.LIBRARY.146551947" name="Include library file or command file as input (--library, -l)" superClass="com.ti.ccstudio.buildDefinitions.C2000_18.1.linkerID.LIBRARY" valueType="libs"> diff --git a/bsp/tms320f28379d/.project b/bsp/tms320f28379d/.project index bab120e2b9..52f4b72a6c 100644 --- a/bsp/tms320f28379d/.project +++ b/bsp/tms320f28379d/.project @@ -26,6 +26,11 @@ </natures> <linkedResources> <link> + <name>DeviceDrivers</name> + <type>2</type> + <locationURI>virtual:/virtual</locationURI> + </link> + <link> <name>Kernel</name> <type>2</type> <locationURI>PARENT-2-PROJECT_LOC/src</locationURI> @@ -35,5 +40,15 @@ <type>2</type> <locationURI>PARENT-2-PROJECT_LOC/libcpu/ti-dsp/c28x</locationURI> </link> + <link> + <name>DeviceDrivers/serial.c</name> + <type>1</type> + <locationURI>PARENT-2-PROJECT_LOC/components/drivers/serial/serial.c</locationURI> + </link> + <link> + <name>DeviceDrivers/src</name> + <type>2</type> + <locationURI>PARENT-2-PROJECT_LOC/components/drivers/src</locationURI> + </link> </linkedResources> </projectDescription> diff --git a/bsp/tms320f28379d/.settings/org.eclipse.core.resources.prefs b/bsp/tms320f28379d/.settings/org.eclipse.core.resources.prefs index 288ca292c6..7fca5cb12c 100644 --- a/bsp/tms320f28379d/.settings/org.eclipse.core.resources.prefs +++ b/bsp/tms320f28379d/.settings/org.eclipse.core.resources.prefs @@ -1,4 +1,8 @@ eclipse.preferences.version=1 +encoding//Debug/DeviceDrivers/src/subdir_rules.mk=UTF-8 +encoding//Debug/DeviceDrivers/src/subdir_vars.mk=UTF-8 +encoding//Debug/DeviceDrivers/subdir_rules.mk=UTF-8 +encoding//Debug/DeviceDrivers/subdir_vars.mk=UTF-8 encoding//Debug/Kernel/subdir_rules.mk=UTF-8 encoding//Debug/Kernel/subdir_vars.mk=UTF-8 encoding//Debug/applications/subdir_rules.mk=UTF-8 diff --git a/bsp/tms320f28379d/applications/startup.c b/bsp/tms320f28379d/applications/startup.c index 301e63a00a..523a45b3b7 100644 --- a/bsp/tms320f28379d/applications/startup.c +++ b/bsp/tms320f28379d/applications/startup.c @@ -47,6 +47,8 @@ void rtthread_startup(void) /* init board */ rt_hw_board_init(); + rt_hw_interrupt_disable(); + /* show version */ rt_show_version(); diff --git a/bsp/tms320f28379d/drivers/board.c b/bsp/tms320f28379d/drivers/board.c index 7960d80d1b..432b5df259 100644 --- a/bsp/tms320f28379d/drivers/board.c +++ b/bsp/tms320f28379d/drivers/board.c @@ -10,16 +10,16 @@ */ #include <rtthread.h> #include "board.h" +#include "drv_sci.h" #include "F28x_Project.h" extern interrupt void RTOSINT_Handler(); - /** * This is the timer interrupt service routine. * */ -interrupt void cpu_timer2_isr (void) +interrupt void cpu_timer2_isr(void) { CpuTimer2Regs.TCR.all = 0x8000; /* enter interrupt */ @@ -30,7 +30,6 @@ interrupt void cpu_timer2_isr (void) rt_interrupt_leave(); } - /** * This function will initial STM32 board. */ @@ -60,6 +59,9 @@ void rt_hw_board_init() #ifdef RT_USING_HEAP rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END); #endif + + rt_hw_sci_init(); + #ifdef RT_USING_COMPONENTS_INIT rt_components_board_init(); #endif diff --git a/bsp/tms320f28379d/drivers/board.h b/bsp/tms320f28379d/drivers/board.h index 2a221a73f9..9f2a057850 100644 --- a/bsp/tms320f28379d/drivers/board.h +++ b/bsp/tms320f28379d/drivers/board.h @@ -11,13 +11,15 @@ #ifndef __BOARD_H__ #define __BOARD_H__ + #include <rtthread.h> #define C28X_SRAM_END 0x00020000 - #define HEAP_BEGIN 0x0000E000 #define HEAP_END C28X_SRAM_END + extern void rt_hw_board_init(void); + #endif diff --git a/bsp/tms320f28379d/drivers/drv_sci.c b/bsp/tms320f28379d/drivers/drv_sci.c new file mode 100644 index 0000000000..ae0390d1bf --- /dev/null +++ b/bsp/tms320f28379d/drivers/drv_sci.c @@ -0,0 +1,224 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2019-02-02 xuzhuoyi first version + */ + +#include "rtdevice.h" +#include "board.h" +#include "drv_sci.h" +#include "F2837xD_device.h" +#include "F2837xD_sci.h" + +typedef long off_t; +#include "F2837xD_sci_io.h" + +#ifdef RT_USING_SERIAL + +#define LOG_TAG "drv.sci" + +/* c28x uart driver class */ +struct c28x_uart +{ + const char *name; + volatile struct SCI_REGS *sci_regs; + struct rt_serial_device serial; +}; + +static struct c28x_uart uart_obj[3] = {0}; + +static rt_err_t c28x_configure(struct rt_serial_device *serial, struct serial_configure *cfg) +{ + struct c28x_uart *uart; + RT_ASSERT(serial != RT_NULL); + RT_ASSERT(cfg != RT_NULL); + uart = (struct c28x_uart *)serial->parent.user_data; + RT_ASSERT(uart != RT_NULL); + + EALLOW; + + // default config + + // 1 stop bit, No loopback + // No parity,8 char bits, + // async mode, idle-line protocol + uart->sci_regs->SCICCR.all = 0x0007; + + // enable TX, RX, internal SCICLK, + // Disable RX ERR, SLEEP, TXWAKE + uart->sci_regs->SCICTL1.all = 0x0003; + + uart->sci_regs->SCICTL2.bit.TXINTENA = 1; + uart->sci_regs->SCICTL2.bit.RXBKINTENA = 1; + + uart->sci_regs->SCIHBAUD.all = 0x0000; // 115200 baud @LSPCLK = 22.5MHz (90 MHz SYSCLK). + uart->sci_regs->SCILBAUD.all = 53; + + uart->sci_regs->SCICTL1.all = 0x0023; // Relinquish SCI from Reset + + switch (cfg->data_bits) + { + case DATA_BITS_5: + uart->sci_regs->SCICCR.bit.SCICHAR = 4; + break; + case DATA_BITS_6: + uart->sci_regs->SCICCR.bit.SCICHAR = 5; + break; + case DATA_BITS_7: + uart->sci_regs->SCICCR.bit.SCICHAR = 6; + break; + case DATA_BITS_8: + uart->sci_regs->SCICCR.bit.SCICHAR = 7; + break; + default: + uart->sci_regs->SCICCR.bit.SCICHAR = 7; + break; + } + switch (cfg->stop_bits) + { + case STOP_BITS_1: + uart->sci_regs->SCICCR.bit.STOPBITS = 0; + break; + case STOP_BITS_2: + uart->sci_regs->SCICCR.bit.STOPBITS = 1; + break; + default: + uart->sci_regs->SCICCR.bit.STOPBITS = 0; + break; + } + switch (cfg->parity) + { + case PARITY_NONE: + uart->sci_regs->SCICCR.bit.PARITYENA = 0; + break; + case PARITY_ODD: + uart->sci_regs->SCICCR.bit.PARITYENA = 1; + uart->sci_regs->SCICCR.bit.PARITY = 0; + break; + case PARITY_EVEN: + uart->sci_regs->SCICCR.bit.PARITYENA = 1; + uart->sci_regs->SCICCR.bit.PARITY = 1; + break; + default: + uart->sci_regs->SCICCR.bit.PARITYENA = 0; + break; + } + + EDIS; + + return RT_EOK; +} + +static rt_err_t c28x_control(struct rt_serial_device *serial, int cmd, void *arg) +{ + struct c28x_uart *uart; + uart = (struct c28x_uart *)serial->parent.user_data; + + EALLOW; + + switch (cmd) + { + /* disable interrupt */ + case RT_DEVICE_CTRL_CLR_INT: + /* disable interrupt */ + uart->sci_regs->SCICTL2.bit.TXINTENA = 0; + uart->sci_regs->SCICTL2.bit.RXBKINTENA = 0; + break; + /* enable interrupt */ + case RT_DEVICE_CTRL_SET_INT: + /* enable interrupt */ + uart->sci_regs->SCICTL2.bit.TXINTENA = 1; + uart->sci_regs->SCICTL2.bit.RXBKINTENA = 1; + break; + } + return RT_EOK; +} + +static int c28x_putc(struct rt_serial_device *serial, char c) +{ + SCI_write(0, &c, 1); + return 1; +} + +static int c28x_getc(struct rt_serial_device *serial) +{ + char ch; + SCI_read(0, &ch, 1); + return ch; +} + +static const struct rt_uart_ops c28x_uart_ops = +{ + .configure = c28x_configure, + .control = c28x_control, + .putc = c28x_putc, + .getc = c28x_getc, +}; + +int rt_hw_sci_init(void) +{ + EALLOW; + + GpioCtrlRegs.GPBMUX1.bit.GPIO42 = 3; + GpioCtrlRegs.GPBMUX1.bit.GPIO43 = 3; + GpioCtrlRegs.GPBGMUX1.bit.GPIO42 = 3; + GpioCtrlRegs.GPBGMUX1.bit.GPIO43 = 3; + + GpioCtrlRegs.GPAMUX2.bit.GPIO18 = 2; + GpioCtrlRegs.GPAMUX2.bit.GPIO19 = 2; + GpioCtrlRegs.GPAGMUX2.bit.GPIO18 = 0; + GpioCtrlRegs.GPAGMUX2.bit.GPIO19 = 0; + + GpioCtrlRegs.GPBMUX2.bit.GPIO56 = 2; + GpioCtrlRegs.GPEMUX1.bit.GPIO139 = 2; + GpioCtrlRegs.GPBGMUX2.bit.GPIO56 = 1; + GpioCtrlRegs.GPEGMUX1.bit.GPIO139 = 1; + + CpuSysRegs.PCLKCR7.bit.SCI_A = 1; + CpuSysRegs.PCLKCR7.bit.SCI_B = 1; + CpuSysRegs.PCLKCR7.bit.SCI_C = 1; + + EDIS; + + struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT; + rt_err_t result = 0; + + uart_obj[0].serial.ops = &c28x_uart_ops; + uart_obj[0].serial.config = config; + uart_obj[0].name = "scia"; + uart_obj[0].sci_regs = &SciaRegs; + + uart_obj[1].serial.ops = &c28x_uart_ops; + uart_obj[1].serial.config = config; + uart_obj[1].name = "scib"; + uart_obj[1].sci_regs = &ScibRegs; + + uart_obj[2].serial.ops = &c28x_uart_ops; + uart_obj[2].serial.config = config; + uart_obj[2].name = "scic"; + uart_obj[2].sci_regs = &ScicRegs; + + + /* register UART device */ + result = rt_hw_serial_register(&uart_obj[0].serial, uart_obj[0].name, + RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, + &uart_obj[0]); + + /* register UART device */ + result = rt_hw_serial_register(&uart_obj[1].serial, uart_obj[1].name, + RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, + &uart_obj[1]); + + /* register UART device */ + result = rt_hw_serial_register(&uart_obj[2].serial, uart_obj[2].name, + RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, + &uart_obj[2]); + + return result; +} + +#endif /* RT_USING_SERIAL */ diff --git a/bsp/tms320f28379d/drivers/drv_sci.h b/bsp/tms320f28379d/drivers/drv_sci.h new file mode 100644 index 0000000000..60fb12bd9b --- /dev/null +++ b/bsp/tms320f28379d/drivers/drv_sci.h @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2019-02-02 xuzhuoyi first version + */ + +#ifndef __DRV_SCI_H__ +#define __DRV_SCI_H__ + +int rt_hw_sci_init(void); + +#endif /* __DRV_SCI_H__ */ diff --git a/bsp/tms320f28379d/libraries/common/include/stdint.h b/bsp/tms320f28379d/libraries/common/include/stdint.h new file mode 100644 index 0000000000..824f5e607d --- /dev/null +++ b/bsp/tms320f28379d/libraries/common/include/stdint.h @@ -0,0 +1,523 @@ +/*****************************************************************************/ +/* STDINT.H */ +/* */ +/* Copyright (c) 2002 Texas Instruments Incorporated */ +/* http://www.ti.com/ */ +/* */ +/* 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. */ +/* */ +/*****************************************************************************/ +#ifndef _STDINT_H_ +#define _STDINT_H_ + +#if __has_include(<sys/stdint.h>) +#include <sys/stdint.h> +#else +/* 7.18.1.1 Exact-width integer types */ + +#if defined(__MSP430__) || defined(__TMS320C55X_PLUS_BYTE__) + typedef signed char int8_t; + typedef unsigned char uint8_t; + typedef int int16_t; + typedef unsigned int uint16_t; + typedef long int32_t; + typedef unsigned long uint32_t; +#elif defined(_TMS320C5XX) || defined(__TMS320C55X__) + typedef int int16_t; + typedef unsigned int uint16_t; + typedef long int32_t; + typedef unsigned long uint32_t; +#elif defined(_TMS320C6X) || defined(__ARM_ARCH) || defined(__ARP32__) || \ + defined(__PRU__) || defined(__FROZEN__) + typedef signed char int8_t; + typedef unsigned char uint8_t; + typedef short int16_t; + typedef unsigned short uint16_t; + typedef int int32_t; + typedef unsigned int uint32_t; +#elif defined (__TMS320C2000__) +#if defined(__TMS320C28XX_CLA__) + typedef short int16_t; + typedef unsigned short uint16_t; + typedef int int32_t; + typedef unsigned int uint32_t; +#else + typedef int int16_t; + typedef unsigned int uint16_t; + typedef long int32_t; + typedef unsigned long uint32_t; +#endif +#endif + +#if defined(__TMS320C55X__) + typedef long long int40_t; + typedef unsigned long long uint40_t; +#elif defined(_TMS320C6X) && !defined(__C6X_MIGRATION__) + typedef __int40_t int40_t; + typedef unsigned __int40_t uint40_t; +#endif + +#if defined(__ARM_ARCH) || defined(_TMS320C6X) || defined(__ARP32__) || \ + defined(__MSP430__) || defined(__PRU__) || defined(__FROZEN__) + typedef long long int64_t; + typedef unsigned long long uint64_t; +#elif defined(__TMS320C2000__) +#if defined(__TMS320C28X__) || \ + (defined(__TMS320C28XX_CLA__) && defined(__TI_EABI__)) + typedef long long int64_t; + typedef unsigned long long uint64_t; +#endif +#endif + +/* 7.18.1.2 Minimum-width integer types */ + +#if defined(_TMS320C6X) || defined(__ARM_ARCH) || defined(__MSP430__) || \ + defined(__TMS320C55X_PLUS_BYTE__) || defined(__ARP32__) || \ + defined(__PRU__) || defined(__FROZEN__) + typedef int8_t int_least8_t; + typedef uint8_t uint_least8_t; +#elif defined(__TMS320C2000__) || defined(_TMS320C5XX) || defined(__TMS320C55X__) + typedef int16_t int_least8_t; + typedef uint16_t uint_least8_t; +#endif + + typedef int16_t int_least16_t; + typedef uint16_t uint_least16_t; + typedef int32_t int_least32_t; + typedef uint32_t uint_least32_t; + +#if defined(__TMS320C55X__) || \ + (defined(_TMS320C6X) && !defined(__C6X_MIGRATION__)) + typedef int40_t int_least40_t; + typedef uint40_t uint_least40_t; +#endif + +#if defined(__ARM_ARCH) || defined(_TMS320C6X) || defined(__FROZEN__) || \ + defined(__ARP32__) || defined(__MSP430__) || defined(__PRU__) + typedef int64_t int_least64_t; + typedef uint64_t uint_least64_t; +#elif defined(__TMS320C2000__) +#if defined(__TMS320C28X__) || \ + (defined(__TMS320C28XX_CLA__) && defined(__TI_EABI__)) + typedef int64_t int_least64_t; + typedef uint64_t uint_least64_t; +#else +/* sorry, [u]int_least64_t not implemented for C27X, CLA */ +#endif +#elif defined(_TMS320C5XX) || defined(__TMS320C55X__) +/* sorry, [u]int_least64_t not implemented for C54x, C55x */ +#endif + +/* 7.18.1.3 Fastest minimum-width integer types */ + +#if defined(_TMS320C5XX) || defined(__TMS320C55X__) || defined(__MSP430__) + typedef int16_t int_fast8_t; + typedef uint16_t uint_fast8_t; + typedef int16_t int_fast16_t; + typedef uint16_t uint_fast16_t; +#elif defined(_TMS320C6X) || defined(__ARM_ARCH) || defined(__ARP32__) || \ + defined(__PRU__) || defined(__FROZEN__) + typedef int32_t int_fast8_t; + typedef uint32_t uint_fast8_t; + typedef int32_t int_fast16_t; + typedef uint32_t uint_fast16_t; +#elif defined (__TMS320C2000__) +#if defined(__TMS320C28XX_CLA__) + typedef int32_t int_fast8_t; + typedef uint32_t uint_fast8_t; + typedef int32_t int_fast16_t; + typedef uint32_t uint_fast16_t; +#else + typedef int16_t int_fast8_t; + typedef uint16_t uint_fast8_t; + typedef int16_t int_fast16_t; + typedef uint16_t uint_fast16_t; +#endif +#endif + + typedef int32_t int_fast32_t; + typedef uint32_t uint_fast32_t; + +#if defined(__TMS320C55X__) || \ + (defined(_TMS320C6X) && !defined(__C6X_MIGRATION__)) + typedef int40_t int_fast40_t; + typedef uint40_t uint_fast40_t; +#endif + +#if defined(__ARM_ARCH) || defined(_TMS320C6X) || defined(__FROZEN__) || \ + defined(__ARP32__) || defined(__MSP430__) || defined(__PRU__) + typedef int64_t int_fast64_t; + typedef uint64_t uint_fast64_t; +#elif defined(__TMS320C2000__) +#if defined(__TMS320C28X__) || \ + (defined(__TMS320C28XX_CLA__) && defined(__TI_EABI__)) + typedef int64_t int_fast64_t; + typedef uint64_t uint_fast64_t; +#else +/* sorry, [u]int_fast64_t not implemented for C27X, CLA */ +#endif +#elif defined(_TMS320C5XX) || defined(__TMS320C55X__) +/* sorry, [u]int_fast64_t not implemented for C54x, C55x */ +#endif + +typedef uint_fast8_t uint8_t; +typedef int_fast8_t int8_t; + +/* 7.18.1.4 Integer types capable of holding object pointers */ +#if defined(_TMS320C5XX) || defined(__TMS320C55X__) || \ + (defined(__MSP430__) && defined(__LARGE_CODE_MODEL__)) || \ + defined(__FROZEN__) + typedef long intptr_t; + typedef unsigned long uintptr_t; +#elif defined(_TMS320C6X) || defined(__ARM_ARCH) || defined(__MSP430__) || \ + defined(__ARP32__) || defined(__PRU__) + typedef int intptr_t; + typedef unsigned int uintptr_t; +#elif defined(__TMS320C2000__) +#if defined(__TMS320C28XX_CLA__) + typedef short intptr_t; + typedef unsigned short uintptr_t; +#else + typedef long intptr_t; + typedef unsigned long uintptr_t; +#endif +#endif + +/* 7.18.1.5 Greatest-width integer types */ +#if defined(__TMS320C55X__) || defined(__ARM_ARCH) || defined(_TMS320C6X) || \ + defined(__ARP32__) || defined(__MSP430__) || defined(__PRU__) || \ + defined(__FROZEN__) + typedef long long intmax_t; + typedef unsigned long long uintmax_t; +#elif defined(_TMS320C5XX) + typedef long intmax_t; + typedef unsigned long uintmax_t; +#elif defined(__TMS320C2000__) +#if defined(__TMS320C28X__) || \ + (defined(__TMS320C28XX_CLA__) && defined(__TI_EABI__)) + typedef long long intmax_t; + typedef unsigned long long uintmax_t; +#else /* C27X or CLA */ + typedef long intmax_t; + typedef unsigned long uintmax_t; +#endif +#endif + +/* + According to footnotes in the 1999 C standard, "C++ implementations + should define these macros only when __STDC_LIMIT_MACROS is defined + before <stdint.h> is included." +*/ +#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) + +/* 7.18.2 Limits of specified width integer types */ + +#if defined(_TMS320C6X) || defined(__ARM_ARCH) || defined(__MSP430__) || \ + defined(__TMS320C55X_PLUS_BYTE__) || defined(__ARP32__) || \ + defined(__PRU__) || defined(__FROZEN__) + #define INT8_MAX 0x7f + #define INT8_MIN (-INT8_MAX-1) + #define UINT8_MAX 0xff +#endif + + #define INT16_MAX 0x7fff + #define INT16_MIN (-INT16_MAX-1) + #define UINT16_MAX 0xffff + + #define INT32_MAX 0x7fffffff + #define INT32_MIN (-INT32_MAX-1) + #define UINT32_MAX 0xffffffff + +#if defined(__TMS320C55X__) || \ + (defined(_TMS320C6X) && !defined(__C6X_MIGRATION__)) + #define INT40_MAX 0x7fffffffff + #define INT40_MIN (-INT40_MAX-1) + #define UINT40_MAX 0xffffffffff +#endif + +#if defined(__ARM_ARCH) || defined(_TMS320C6X) || defined(__FROZEN__) || \ + defined(__ARP32__) || defined(__MSP430__) || defined(__PRU__) + #define INT64_MAX 0x7fffffffffffffff + #define INT64_MIN (-INT64_MAX-1) + #define UINT64_MAX 0xffffffffffffffff +#elif defined(__TMS320C2000__) +#if defined(__TMS320C28X__) || \ + (defined(__TMS320C28XX_CLA__) && defined(__TI_EABI__)) + #define INT64_MAX 0x7fffffffffffffff + #define INT64_MIN (-INT64_MAX-1) + #define UINT64_MAX 0xffffffffffffffff +#endif +#endif + +#if defined(_TMS320C6X) || defined(__ARM_ARCH) || defined(__MSP430__) || \ + defined(__TMS320C55X_PLUS_BYTE__) || defined(__ARP32__) || \ + defined(__PRU__) || defined(__FROZEN__) + #define INT_LEAST8_MAX (INT8_MAX) + #define INT_LEAST8_MIN (INT8_MIN) + #define UINT_LEAST8_MAX (UINT8_MAX) +#elif defined(__TMS320C2000__) || defined(_TMS320C5XX) || defined(__TMS320C55X__) + #define INT_LEAST8_MAX (INT16_MAX) + #define INT_LEAST8_MIN (INT16_MIN) + #define UINT_LEAST8_MAX (UINT16_MAX) +#endif + + #define INT_LEAST16_MAX (INT16_MAX) + #define INT_LEAST16_MIN (INT16_MIN) + #define UINT_LEAST16_MAX (UINT16_MAX) + #define INT_LEAST32_MAX (INT32_MAX) + #define INT_LEAST32_MIN (INT32_MIN) + #define UINT_LEAST32_MAX (UINT32_MAX) + +#if defined(__TMS320C55X__) || \ + (defined(_TMS320C6X) && !defined(__C6X_MIGRATION__)) + #define INT_LEAST40_MAX (INT40_MAX) + #define INT_LEAST40_MIN (INT40_MIN) + #define UINT_LEAST40_MAX (UINT40_MAX) +#endif + +#if defined(__ARM_ARCH) || defined(_TMS320C6X) || defined(__FROZEN__) || \ + defined(__ARP32__) || defined(__MSP430__) || defined(__PRU__) + #define INT_LEAST64_MAX (INT64_MAX) + #define INT_LEAST64_MIN (INT64_MIN) + #define UINT_LEAST64_MAX (UINT64_MAX) +#elif defined(__TMS320C2000__) +#if defined(__TMS320C28X__) || \ + (defined(__TMS320C28XX_CLA__) && defined(__TI_EABI__)) + #define INT_LEAST64_MAX (INT64_MAX) + #define INT_LEAST64_MIN (INT64_MIN) + #define UINT_LEAST64_MAX (UINT64_MAX) +#endif +#endif + +#if defined(_TMS320C5XX) || defined(__TMS320C55X__) + #define INT_FAST8_MAX (INT16_MAX) + #define INT_FAST8_MIN (INT16_MIN) + #define UINT_FAST8_MAX (UINT16_MAX) + #define INT_FAST16_MAX (INT16_MAX) + #define INT_FAST16_MIN (INT16_MIN) + #define UINT_FAST16_MAX (UINT16_MAX) +#elif defined(_TMS320C6X) || defined(__ARM_ARCH) || defined(__ARP32__) || \ + defined(__PRU__) || defined(__FROZEN__) + #define INT_FAST8_MAX (INT32_MAX) + #define INT_FAST8_MIN (INT32_MIN) + #define UINT_FAST8_MAX (UINT32_MAX) + #define INT_FAST16_MAX (INT32_MAX) + #define INT_FAST16_MIN (INT32_MIN) + #define UINT_FAST16_MAX (UINT32_MAX) +#elif defined(__MSP430__) + #define INT_FAST8_MAX (INT16_MAX) + #define INT_FAST8_MIN (INT16_MIN) + #define UINT_FAST8_MAX (UINT16_MAX) + #define INT_FAST16_MAX (INT16_MAX) + #define INT_FAST16_MIN (INT16_MIN) + #define UINT_FAST16_MAX (UINT16_MAX) +#elif defined (__TMS320C2000__) +#if defined(__TMS320C28XX_CLA__) + #define INT_FAST8_MAX (INT32_MAX) + #define INT_FAST8_MIN (INT32_MIN) + #define UINT_FAST8_MAX (UINT32_MAX) + #define INT_FAST16_MAX (INT32_MAX) + #define INT_FAST16_MIN (INT32_MIN) + #define UINT_FAST16_MAX (UINT32_MAX) +#else + #define INT_FAST8_MAX (INT16_MAX) + #define INT_FAST8_MIN (INT16_MIN) + #define UINT_FAST8_MAX (UINT16_MAX) + #define INT_FAST16_MAX (INT16_MAX) + #define INT_FAST16_MIN (INT16_MIN) + #define UINT_FAST16_MAX (UINT16_MAX) +#endif +#endif + + #define INT_FAST32_MAX (INT32_MAX) + #define INT_FAST32_MIN (INT32_MIN) + #define UINT_FAST32_MAX (UINT32_MAX) + +#if defined(__TMS320C55X__) || \ + (defined(_TMS320C6X) && !defined(__C6X_MIGRATION__)) + #define INT_FAST40_MAX (INT40_MAX) + #define INT_FAST40_MIN (INT40_MIN) + #define UINT_FAST40_MAX (UINT40_MAX) +#endif + +#if defined(__ARM_ARCH) || defined(_TMS320C6X) || defined(__FROZEN__) || \ + defined(__ARP32__) || defined(__MSP430__) || defined(__PRU__) + #define INT_FAST64_MAX (INT64_MAX) + #define INT_FAST64_MIN (INT64_MIN) + #define UINT_FAST64_MAX (UINT64_MAX) +#elif defined(__TMS320C2000__) +#if defined(__TMS320C28X__) || \ + (defined(__TMS320C28XX_CLA__) && defined(__TI_EABI__)) + #define INT_FAST64_MAX (INT64_MAX) + #define INT_FAST64_MIN (INT64_MIN) + #define UINT_FAST64_MAX (UINT64_MAX) +#endif +#endif + +#if defined(__MSP430__) && !defined(__LARGE_CODE_MODEL__) + #define INTPTR_MAX (INT16_MAX) + #define INTPTR_MIN (INT16_MIN) + #define UINTPTR_MAX (UINT16_MAX) +#elif defined(__FROZEN__) + #define INTPTR_MAX (INT64_MAX) + #define INTPTR_MIN (INT64_MIN) + #define UINTPTR_MAX (UINT64_MAX) +#else + #define INTPTR_MAX (INT32_MAX) + #define INTPTR_MIN (INT32_MIN) + #define UINTPTR_MAX (UINT32_MAX) +#endif + +#if defined(__ARM_ARCH) || defined(_TMS320C6X) || defined(__FROZEN__) || \ + defined(__ARP32__) || defined(__MSP430__) || defined(__PRU__) + #define INTMAX_MIN (INT64_MIN) + #define INTMAX_MAX (INT64_MAX) + #define UINTMAX_MAX (UINT64_MAX) +#elif defined(__TMS320C55X__) + #define INTMAX_MIN (INT40_MIN) + #define INTMAX_MAX (INT40_MAX) + #define UINTMAX_MAX (UINT40_MAX) +#elif defined(_TMS320C5XX) + #define INTMAX_MIN (INT32_MIN) + #define INTMAX_MAX (INT32_MAX) + #define UINTMAX_MAX (UINT32_MAX) +#elif defined(__TMS320C2000__) +#if defined(__TMS320C28X__) || \ + (defined(__TMS320C28XX_CLA__) && defined(__TI_EABI__)) + #define INTMAX_MIN (INT64_MIN) + #define INTMAX_MAX (INT64_MAX) + #define UINTMAX_MAX (UINT64_MAX) +#else + #define INTMAX_MIN (INT32_MIN) + #define INTMAX_MAX (INT32_MAX) + #define UINTMAX_MAX (UINT32_MAX) +#endif +#endif + +/* 7.18.3 Limits of other integer types */ + +#if defined(_TMS320C5XX) || defined(__TMS320C55X__) || \ + (defined(__MSP430__) && !defined(__LONG_PTRDIFF_T__)) + #define PTRDIFF_MAX (INT16_MAX) + #define PTRDIFF_MIN (INT16_MIN) +#elif defined(__TMS320C2000__) || defined(__MSP430__) || \ + (defined(_TMS320C6X) && !defined(__C6X_MIGRATION__)) || \ + defined(__ARM_ARCH) || defined(__ARP32__) || defined(__PRU__) + #define PTRDIFF_MAX (INT32_MAX) + #define PTRDIFF_MIN (INT32_MIN) +#elif defined(__FROZEN__) + #define PTRDIFF_MAX (INT64_MAX) + #define PTRDIFF_MIN (INT64_MIN) +#endif + +#if defined(_TMS320C5XX) || defined(__TMS320C55X__) || defined(__MSP430__) + #define SIG_ATOMIC_MIN (INT16_MIN) + #define SIG_ATOMIC_MAX (INT16_MAX) +#elif defined(__TMS320C2000__) || defined(_TMS320C6X) || defined(__FROZEN__) || \ + defined(__ARM_ARCH) || defined(__ARP32__) || defined(__PRU__) + #define SIG_ATOMIC_MIN (INT32_MIN) + #define SIG_ATOMIC_MAX (INT32_MAX) +#endif + +#if defined(_TMS320C5XX) || defined(__TMS320C55X__) || \ + (defined(__MSP430__) && !defined(__LONG_PTRDIFF_T__)) + #define SIZE_MAX (UINT16_MAX) +#elif defined(__TMS320C2000__) || defined(__MSP430__) || \ + (defined(_TMS320C6X) && !defined(__C6X_MIGRATION__)) || \ + defined(__ARM_ARCH) || defined(__ARP32__) || defined(__PRU__) + #define SIZE_MAX (UINT32_MAX) +#elif defined(__FROZEN__) + #define SIZE_MAX (UINT64_MAX) +#endif + +#ifndef WCHAR_MAX +#if !defined(__TI_WCHAR_T_BITS__) || __TI_WCHAR_T_BITS__ == 16 +#define WCHAR_MAX 0xffffu +#else +#define WCHAR_MAX 0xffffffffu +#endif +#endif + +#ifndef WCHAR_MIN +#define WCHAR_MIN 0 +#endif + +#if defined(_TMS320C5XX) || defined(__TMS320C55X__) || defined(__MSP430__) + #define WINT_MIN (INT16_MIN) + #define WINT_MAX (INT16_MAX) +#elif defined(__TMS320C2000__) || defined(_TMS320C6X) || defined(__FROZEN__) || \ + defined(__ARM_ARCH) || defined(__ARP32__) || defined(__PRU__) + #define WINT_MIN (INT32_MIN) + #define WINT_MAX (INT32_MAX) +#endif + +/* 7.18.4.1 Macros for minimum-width integer constants */ + +/* + There is a defect report filed against the C99 standard concerning how + the (U)INTN_C macros should be implemented. Please refer to -- + http://wwwold.dkuug.dk/JTC1/SC22/WG14/www/docs/dr_209.htm + for more information. These macros are implemented according to the + suggestion given at this web site. +*/ + + #define INT8_C(value) ((int_least8_t)(value)) + #define UINT8_C(value) ((uint_least8_t)(value)) + #define INT16_C(value) ((int_least16_t)(value)) + #define UINT16_C(value) ((uint_least16_t)(value)) + #define INT32_C(value) ((int_least32_t)(value)) + #define UINT32_C(value) ((uint_least32_t)(value)) + +#if defined(__TMS320C55X__) || \ + (defined(_TMS320C6X) && !defined(__C6X_MIGRATION__)) + #define INT40_C(value) ((int_least40_t)(value)) + #define UINT40_C(value) ((uint_least40_t)(value)) +#endif + +#if defined(__ARM_ARCH) || defined(_TMS320C6X) || defined(__FROZEN__) || \ + defined(__ARP32__) || defined(__MSP430__) || defined(__PRU__) + #define INT64_C(value) ((int_least64_t)(value)) + #define UINT64_C(value) ((uint_least64_t)(value)) +#elif defined(__TMS320C2000__) +#if defined(__TMS320C28X__) || \ + (defined(__TMS320C28XX_CLA__) && defined(__TI_EABI__)) + #define INT64_C(value) ((int_least64_t)(value)) + #define UINT64_C(value) ((uint_least64_t)(value)) +#endif +#endif + +/* 7.18.4.2 Macros for greatest-width integer constants */ + + #define INTMAX_C(value) ((intmax_t)(value)) + #define UINTMAX_C(value) ((uintmax_t)(value)) + +#endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */ +#endif +#endif /* _STDINT_H_ */ diff --git a/bsp/tms320f28379d/rtconfig.h b/bsp/tms320f28379d/rtconfig.h index 139789a5b2..f825d9ef74 100644 --- a/bsp/tms320f28379d/rtconfig.h +++ b/bsp/tms320f28379d/rtconfig.h @@ -9,15 +9,15 @@ /* RT-Thread Kernel */ #define RT_NAME_MAX 8 +#define RT_USING_ARCH_DATA_TYPE #define RT_ALIGN_SIZE 4 #define RT_THREAD_PRIORITY_8 #define RT_THREAD_PRIORITY_MAX 8 #define RT_TICK_PER_SECOND 100 -#define RT_USING_OVERFLOW_CHECK #define RT_USING_HOOK #define RT_USING_IDLE_HOOK #define RT_IDEL_HOOK_LIST_SIZE 4 -#define IDLE_THREAD_STACK_SIZE 256 +#define IDLE_THREAD_STACK_SIZE 1024 #define RT_DEBUG #define RT_DEBUG_COLOR @@ -40,7 +40,8 @@ #define RT_USING_DEVICE #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 -#define RT_CONSOLE_DEVICE_NAME "uart" +#define RT_CONSOLE_DEVICE_NAME "scia" +#define RT_VER_NUM 0x40001 #define ARCH_TIDSP #define ARCH_TIDSP_C28X #define ARCH_CPU_STACK_GROWS_UPWARD @@ -70,6 +71,7 @@ #define RT_PIPE_BUFSZ 512 #define RT_USING_SERIAL #define RT_SERIAL_USING_DMA +#define RT_SERIAL_RB_BUFSZ 64 #define RT_USING_PIN /* Using WiFi */ @@ -138,12 +140,8 @@ /* miscellaneous packages */ -/* sample package */ - /* samples: kernel and components samples */ - -/* example package: hello */ - +#include "rtconfig_project.h" #endif diff --git a/bsp/tms320f28379d/rtconfig_project.h b/bsp/tms320f28379d/rtconfig_project.h new file mode 100644 index 0000000000..df4eb0c1cd --- /dev/null +++ b/bsp/tms320f28379d/rtconfig_project.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2006-2019, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2019-03-27 xuzhuoyi the first version + */ + +#ifndef __RTCONFIG_PROJECT_H__ +#define __RTCONFIG_PROJECT_H__ + +typedef signed char rt_int8_t; /**< 8bit integer type */ +typedef signed short rt_int16_t; /**< 16bit integer type */ +typedef signed long rt_int32_t; /**< 32bit integer type */ +typedef signed long long rt_int64_t; /**< 64bit integer type */ +typedef unsigned char rt_uint8_t; /**< 8bit unsigned integer type */ +typedef unsigned short rt_uint16_t; /**< 16bit unsigned integer type */ +typedef unsigned long rt_uint32_t; /**< 32bit unsigned integer type */ +typedef unsigned long long rt_uint64_t; /**< 64bit unsigned integer type */ + +#endif |
