mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 20:08:15 +08:00
add support to a new board : esp32s3-8048s043.
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 231 KiB |
@@ -0,0 +1,103 @@
|
|||||||
|
================
|
||||||
|
ESP32S3-8048S043
|
||||||
|
================
|
||||||
|
|
||||||
|
.. tags:: chip:esp32, chip:esp32s3
|
||||||
|
|
||||||
|
The `ESP32S3-8048S343 <https://www.openhasp.com/0.7.0/hardware/sunton/esp32-8048s0xx/>` is a dual-core MCU, integrated WI-FI and Bluetooth functions, the main frequency can reach 240MHz, 512KB SRAM, 384KB ROM, 8M PSRAM, Flash size is 16MB.
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:align: center
|
||||||
|
|
||||||
|
* - .. figure:: esp32s3-8048S043.png
|
||||||
|
:align: center
|
||||||
|
|
||||||
|
Features
|
||||||
|
========
|
||||||
|
|
||||||
|
- ESP32-S3 WROOM-1 Module
|
||||||
|
- USB Type-C ports
|
||||||
|
- Power LED
|
||||||
|
- LCD Display
|
||||||
|
- 8MB Octal PSRAM
|
||||||
|
- 16MB SPI Flash
|
||||||
|
- TF card slot
|
||||||
|
- RST and BOOT buttons (BOOT accessible to user)
|
||||||
|
|
||||||
|
Serial Console
|
||||||
|
==============
|
||||||
|
|
||||||
|
UART0 is, by default, the serial console. It connects to the on-board
|
||||||
|
CP2102 converter and is available on the USB connector USB CON8 (J1).
|
||||||
|
|
||||||
|
It will show up as /dev/ttyUSB[n] where [n] will probably be 0.
|
||||||
|
|
||||||
|
Buttons and I/Os
|
||||||
|
================
|
||||||
|
|
||||||
|
The board has two buttons: Boot and EN. The EN button functions only as
|
||||||
|
reset and is not available to software. The BOOT button (connected to IO0)
|
||||||
|
determines boot mode during reset and can be used as software input after
|
||||||
|
initialization. Most I/O pins are available on the back of the board through
|
||||||
|
two JST 1.28mm 4P connectors.
|
||||||
|
|
||||||
|
Configurations
|
||||||
|
==============
|
||||||
|
|
||||||
|
All of the configurations presented below can be tested by running the following commands::
|
||||||
|
|
||||||
|
$ ./tools/configure.sh esp32s3-8048S043:<config_name>
|
||||||
|
$ make flash ESPTOOL_PORT=/dev/ttyUSB0 -j
|
||||||
|
|
||||||
|
Where <config_name> is the name of board configuration you want to use, i.e.: nsh, buttons, tc...
|
||||||
|
Then use a serial console terminal like ``picocom`` configured to 115200 8N1.
|
||||||
|
|
||||||
|
buttons
|
||||||
|
-------
|
||||||
|
|
||||||
|
This configuration shows the use of the buttons subsystem. It can be used by executing
|
||||||
|
the ``buttons`` application and pressing on any of the available board buttons::
|
||||||
|
|
||||||
|
nsh> buttons
|
||||||
|
buttons_main: Starting the button_daemon
|
||||||
|
buttons_main: button_daemon started
|
||||||
|
button_daemon: Running
|
||||||
|
button_daemon: Opening /dev/buttons
|
||||||
|
button_daemon: Supported BUTTONs 0x01
|
||||||
|
nsh> Sample = 1
|
||||||
|
Sample = 0
|
||||||
|
|
||||||
|
nsh
|
||||||
|
---
|
||||||
|
|
||||||
|
Basic NuttShell configuration (console enabled in UART0, exposed via
|
||||||
|
USB connection by means of CP2102 converter, at 115200 bps).
|
||||||
|
|
||||||
|
i2c
|
||||||
|
------
|
||||||
|
|
||||||
|
This configuration can be used to scan and manipulate I2C devices.
|
||||||
|
You can scan for all I2C devices using the following command::
|
||||||
|
|
||||||
|
nsh> i2c dev 0x00 0x7f
|
||||||
|
|
||||||
|
touchscreen
|
||||||
|
------------
|
||||||
|
|
||||||
|
The LCD panel comes with the integrated capacitive touchscreen sensor
|
||||||
|
GT911 connected to the pins 20 (SCL), 19 (SDA) and address 0x5D::
|
||||||
|
|
||||||
|
nsh> tc
|
||||||
|
tc_main: nsamples: 0
|
||||||
|
tc_main: Opening /dev/input0
|
||||||
|
Sample :
|
||||||
|
npoints : 1
|
||||||
|
Point 1 :
|
||||||
|
id : 0
|
||||||
|
flags : 31
|
||||||
|
x : 149
|
||||||
|
y : 140
|
||||||
|
h : 0
|
||||||
|
w : 0
|
||||||
|
pressure : 45
|
||||||
|
timestamp : 0
|
||||||
@@ -477,6 +477,14 @@ config ARCH_BOARD_ESP32S3_DEVKIT
|
|||||||
ESP32-S3-DevKitC-1 version may be based either on ESP32-S3-WROOM-1/1U or
|
ESP32-S3-DevKitC-1 version may be based either on ESP32-S3-WROOM-1/1U or
|
||||||
ESP32-S3-WROOM-2/2U.
|
ESP32-S3-WROOM-2/2U.
|
||||||
|
|
||||||
|
config ARCH_BOARD_ESP32S3_8048S043
|
||||||
|
bool "ESP32-S3 8048S043"
|
||||||
|
depends on ARCH_CHIP_ESP32S3WROOM1N4 || ARCH_CHIP_ESP32S3MINI1N8 || ARCH_CHIP_ESP32S3WROOM1N8R2 || ARCH_CHIP_ESP32S3WROOM1N16R8 || ARCH_CHIP_ESP32S3WROOM2N16R8V || ARCH_CHIP_ESP32S3WROOM2N32R8V || ARCH_CHIP_ESP32S3CUSTOM || ARCH_CHIP_ESP32S3WROOM1N8R8
|
||||||
|
select ARCH_HAVE_BUTTONS
|
||||||
|
select ARCH_HAVE_IRQBUTTONS if ESP32S3_GPIO_IRQ
|
||||||
|
---help---
|
||||||
|
The ESP32-S3 8048S043 features the ESP32-S3 CPU with dual Xtensa LX7 cores.
|
||||||
|
|
||||||
config ARCH_BOARD_ESP32S3_EYE
|
config ARCH_BOARD_ESP32S3_EYE
|
||||||
bool "Espressif ESP32-S3-EYE Board"
|
bool "Espressif ESP32-S3-EYE Board"
|
||||||
depends on ARCH_CHIP_ESP32S3WROOM1N4 || ARCH_CHIP_ESP32S3CUSTOM
|
depends on ARCH_CHIP_ESP32S3WROOM1N4 || ARCH_CHIP_ESP32S3CUSTOM
|
||||||
@@ -3478,6 +3486,7 @@ config ARCH_BOARD
|
|||||||
default "esp32s2-saola-1" if ARCH_BOARD_ESP32S2_SAOLA_1
|
default "esp32s2-saola-1" if ARCH_BOARD_ESP32S2_SAOLA_1
|
||||||
default "franzininho-wifi" if ARCH_BOARD_FRANZININHO_WIFI
|
default "franzininho-wifi" if ARCH_BOARD_FRANZININHO_WIFI
|
||||||
default "esp32s3-devkit" if ARCH_BOARD_ESP32S3_DEVKIT
|
default "esp32s3-devkit" if ARCH_BOARD_ESP32S3_DEVKIT
|
||||||
|
default "esp32s3-8048S043" if ARCH_BOARD_ESP32S3_8048S043
|
||||||
default "esp32s3-eye" if ARCH_BOARD_ESP32S3_EYE
|
default "esp32s3-eye" if ARCH_BOARD_ESP32S3_EYE
|
||||||
default "esp32s3-meadow" if ARCH_BOARD_ESP32S3_MEADOW
|
default "esp32s3-meadow" if ARCH_BOARD_ESP32S3_MEADOW
|
||||||
default "esp32s3-lcd-ev" if ARCH_BOARD_ESP32S3_LCD_EV
|
default "esp32s3-lcd-ev" if ARCH_BOARD_ESP32S3_LCD_EV
|
||||||
@@ -4720,6 +4729,9 @@ endif
|
|||||||
if ARCH_BOARD_ESP32S3_DEVKIT
|
if ARCH_BOARD_ESP32S3_DEVKIT
|
||||||
source "boards/xtensa/esp32s3/esp32s3-devkit/Kconfig"
|
source "boards/xtensa/esp32s3/esp32s3-devkit/Kconfig"
|
||||||
endif
|
endif
|
||||||
|
if ARCH_BOARD_ESP32S3_8048S043
|
||||||
|
source "boards/xtensa/esp32s3/esp32s3-8048S043/Kconfig"
|
||||||
|
endif
|
||||||
if ARCH_BOARD_ESP32S3_EYE
|
if ARCH_BOARD_ESP32S3_EYE
|
||||||
source "boards/xtensa/esp32s3/esp32s3-eye/Kconfig"
|
source "boards/xtensa/esp32s3/esp32s3-eye/Kconfig"
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
#
|
||||||
|
# For a description of the syntax of this configuration file,
|
||||||
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||||
|
#
|
||||||
|
|
||||||
|
if ARCH_BOARD_ESP32S3_8048S043
|
||||||
|
|
||||||
|
config ESP32S3_BOARD_TOUCHSCREEN
|
||||||
|
bool "Enable Board Touchscreen"
|
||||||
|
default n
|
||||||
|
select ESP32S3_I2C0
|
||||||
|
select INPUT
|
||||||
|
select INPUT_TOUCHSCREEN
|
||||||
|
select INPUT_GT9XX
|
||||||
|
---help---
|
||||||
|
Enable board touchscreen support, IC is: GT911
|
||||||
|
|
||||||
|
menu "Board Touchscreen Configuration"
|
||||||
|
depends on ESP32S3_BOARD_TOUCHSCREEN
|
||||||
|
|
||||||
|
config ESP32S3_BOARD_TOUCHSCREEN_PATH
|
||||||
|
string "Touchscreen Path for VFS"
|
||||||
|
default "/dev/input0"
|
||||||
|
|
||||||
|
config ESP32S3_BOARD_TOUCHSCREEN_WIDTH
|
||||||
|
int "Touchscreen Width"
|
||||||
|
default 800
|
||||||
|
depends on ESP32S3_8048S043
|
||||||
|
|
||||||
|
config ESP32S3_BOARD_TOUCHSCREEN_HEIGHT
|
||||||
|
int "Touchscreen Height"
|
||||||
|
default 480
|
||||||
|
depends on ESP32S3_8048S043
|
||||||
|
|
||||||
|
config ESP32S3_BOARD_TOUCHSCREEN_SAMPLE_CACHES
|
||||||
|
int "Touchscreen Sample Cache Number"
|
||||||
|
default 64
|
||||||
|
|
||||||
|
config ESP32S3_BOARD_TOUCHSCREEN_SAMPLE_DELAYS
|
||||||
|
int "Touchscreen Sample Delay Ticks"
|
||||||
|
default 20
|
||||||
|
|
||||||
|
config ESP32S3_BOARD_TOUCHSCREEN_X_MIRROR
|
||||||
|
bool "Touchscreen X Mirror"
|
||||||
|
default y
|
||||||
|
depends on ESP32S3_8048S043
|
||||||
|
|
||||||
|
config ESP32S3_BOARD_TOUCHSCREEN_Y_MIRROR
|
||||||
|
bool "Touchscreen Y Mirror"
|
||||||
|
default n
|
||||||
|
depends on ESP32S3_8048S043
|
||||||
|
|
||||||
|
endmenu # Touchscreen Configuration
|
||||||
|
|
||||||
|
endif # ARCH_BOARD_ESP32S3_8048S043
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
# CONFIG_NSH_ARGCAT is not set
|
||||||
|
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||||
|
CONFIG_ARCH="xtensa"
|
||||||
|
CONFIG_ARCH_BOARD="esp32s3-8048S043"
|
||||||
|
CONFIG_ARCH_BOARD_COMMON=y
|
||||||
|
CONFIG_ARCH_BOARD_ESP32S3_8048S043=y
|
||||||
|
CONFIG_ARCH_CHIP="esp32s3"
|
||||||
|
CONFIG_ARCH_CHIP_ESP32S3=y
|
||||||
|
CONFIG_ARCH_CHIP_ESP32S3WROOM1N4=y
|
||||||
|
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_ARCH_XTENSA=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_DEBUG_FULLOPT=y
|
||||||
|
CONFIG_DEBUG_SYMBOLS=y
|
||||||
|
CONFIG_DEV_GPIO=y
|
||||||
|
CONFIG_ESP32S3_GPIO_IRQ=y
|
||||||
|
CONFIG_ESP32S3_UART0=y
|
||||||
|
CONFIG_EXAMPLES_GPIO=y
|
||||||
|
CONFIG_FS_PROCFS=y
|
||||||
|
CONFIG_HAVE_CXX=y
|
||||||
|
CONFIG_HAVE_CXXINITIALIZE=y
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=3072
|
||||||
|
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||||
|
CONFIG_INIT_STACKSIZE=3072
|
||||||
|
CONFIG_INTELHEX_BINARY=y
|
||||||
|
CONFIG_LINE_MAX=64
|
||||||
|
CONFIG_NSH_ARCHINIT=y
|
||||||
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
CONFIG_NSH_FILEIOSIZE=512
|
||||||
|
CONFIG_NSH_READLINE=y
|
||||||
|
CONFIG_PREALLOC_TIMERS=4
|
||||||
|
CONFIG_RAM_SIZE=114688
|
||||||
|
CONFIG_RAM_START=0x20000000
|
||||||
|
CONFIG_RR_INTERVAL=200
|
||||||
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
CONFIG_START_DAY=6
|
||||||
|
CONFIG_START_MONTH=12
|
||||||
|
CONFIG_START_YEAR=2011
|
||||||
|
CONFIG_SYSLOG_BUFFER=y
|
||||||
|
CONFIG_SYSTEM_NSH=y
|
||||||
|
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
# CONFIG_NSH_ARGCAT is not set
|
||||||
|
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||||
|
CONFIG_ARCH="xtensa"
|
||||||
|
CONFIG_ARCH_BOARD="esp32s3-8048S043"
|
||||||
|
CONFIG_ARCH_BOARD_COMMON=y
|
||||||
|
CONFIG_ARCH_BOARD_ESP32S3_8048S043=y
|
||||||
|
CONFIG_ARCH_CHIP="esp32s3"
|
||||||
|
CONFIG_ARCH_CHIP_ESP32S3=y
|
||||||
|
CONFIG_ARCH_CHIP_ESP32S3WROOM1N4=y
|
||||||
|
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_ARCH_XTENSA=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_DEBUG_ASSERTIONS=y
|
||||||
|
CONFIG_DEBUG_FEATURES=y
|
||||||
|
CONFIG_DEBUG_I2C=y
|
||||||
|
CONFIG_DEBUG_I2C_ERROR=y
|
||||||
|
CONFIG_DEBUG_I2C_INFO=y
|
||||||
|
CONFIG_DEBUG_I2C_WARN=y
|
||||||
|
CONFIG_ESP32S3_I2C0=y
|
||||||
|
CONFIG_ESP32S3_UART0=y
|
||||||
|
CONFIG_FS_PROCFS=y
|
||||||
|
CONFIG_HAVE_CXX=y
|
||||||
|
CONFIG_HAVE_CXXINITIALIZE=y
|
||||||
|
CONFIG_I2CTOOL_DEFFREQ=100000
|
||||||
|
CONFIG_I2CTOOL_MAXBUS=1
|
||||||
|
CONFIG_I2C_RESET=y
|
||||||
|
CONFIG_I2C_TRACE=y
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=3072
|
||||||
|
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||||
|
CONFIG_INIT_STACKSIZE=3072
|
||||||
|
CONFIG_INTELHEX_BINARY=y
|
||||||
|
CONFIG_LINE_MAX=64
|
||||||
|
CONFIG_NSH_ARCHINIT=y
|
||||||
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
CONFIG_NSH_FILEIOSIZE=512
|
||||||
|
CONFIG_NSH_READLINE=y
|
||||||
|
CONFIG_PREALLOC_TIMERS=4
|
||||||
|
CONFIG_RAM_SIZE=114688
|
||||||
|
CONFIG_RAM_START=0x20000000
|
||||||
|
CONFIG_RR_INTERVAL=200
|
||||||
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
CONFIG_START_DAY=28
|
||||||
|
CONFIG_START_MONTH=6
|
||||||
|
CONFIG_START_YEAR=2022
|
||||||
|
CONFIG_SYSLOG_BUFFER=y
|
||||||
|
CONFIG_SYSTEM_I2CTOOL=y
|
||||||
|
CONFIG_SYSTEM_NSH=y
|
||||||
|
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
# CONFIG_NSH_ARGCAT is not set
|
||||||
|
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||||
|
CONFIG_ARCH="xtensa"
|
||||||
|
CONFIG_ARCH_BOARD="esp32s3-8048S043"
|
||||||
|
CONFIG_ARCH_BOARD_COMMON=y
|
||||||
|
CONFIG_ARCH_BOARD_ESP32S3_8048S043=y
|
||||||
|
CONFIG_ARCH_CHIP="esp32s3"
|
||||||
|
CONFIG_ARCH_CHIP_ESP32S3=y
|
||||||
|
CONFIG_ARCH_CHIP_ESP32S3WROOM1N4=y
|
||||||
|
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_ARCH_XTENSA=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_DEBUG_FULLOPT=y
|
||||||
|
CONFIG_DEBUG_SYMBOLS=y
|
||||||
|
CONFIG_ESP32S3_UART0=y
|
||||||
|
CONFIG_FS_PROCFS=y
|
||||||
|
CONFIG_HAVE_CXX=y
|
||||||
|
CONFIG_HAVE_CXXINITIALIZE=y
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=3072
|
||||||
|
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||||
|
CONFIG_INIT_STACKSIZE=3072
|
||||||
|
CONFIG_INTELHEX_BINARY=y
|
||||||
|
CONFIG_LINE_MAX=64
|
||||||
|
CONFIG_NSH_ARCHINIT=y
|
||||||
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
CONFIG_NSH_FILEIOSIZE=512
|
||||||
|
CONFIG_NSH_READLINE=y
|
||||||
|
CONFIG_PREALLOC_TIMERS=4
|
||||||
|
CONFIG_RAM_SIZE=114688
|
||||||
|
CONFIG_RAM_START=0x20000000
|
||||||
|
CONFIG_RR_INTERVAL=200
|
||||||
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
CONFIG_START_DAY=6
|
||||||
|
CONFIG_START_MONTH=12
|
||||||
|
CONFIG_START_YEAR=2011
|
||||||
|
CONFIG_SYSLOG_BUFFER=y
|
||||||
|
CONFIG_SYSTEM_NSH=y
|
||||||
|
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
# CONFIG_NSH_ARGCAT is not set
|
||||||
|
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||||
|
CONFIG_ARCH="xtensa"
|
||||||
|
CONFIG_ARCH_BOARD="esp32s3-8048S043"
|
||||||
|
CONFIG_ARCH_BOARD_COMMON=y
|
||||||
|
CONFIG_ARCH_BOARD_ESP32S3_8048S043=y
|
||||||
|
CONFIG_ARCH_CHIP="esp32s3"
|
||||||
|
CONFIG_ARCH_CHIP_ESP32S3=y
|
||||||
|
CONFIG_ARCH_CHIP_ESP32S3WROOM1N4=y
|
||||||
|
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_ARCH_XTENSA=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_DEBUG_FULLOPT=y
|
||||||
|
CONFIG_DEBUG_SYMBOLS=y
|
||||||
|
CONFIG_ESP32S3_SDMMC=y
|
||||||
|
CONFIG_ESP32S3_UART0=y
|
||||||
|
CONFIG_FS_FAT=y
|
||||||
|
CONFIG_FS_PROCFS=y
|
||||||
|
CONFIG_HAVE_CXX=y
|
||||||
|
CONFIG_HAVE_CXXINITIALIZE=y
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=3072
|
||||||
|
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||||
|
CONFIG_INIT_STACKSIZE=3072
|
||||||
|
CONFIG_INTELHEX_BINARY=y
|
||||||
|
CONFIG_LINE_MAX=64
|
||||||
|
CONFIG_MMCSD_CHECK_READY_STATUS_WITHOUT_SLEEP=y
|
||||||
|
CONFIG_MMCSD_MULTIBLOCK_LIMIT=128
|
||||||
|
CONFIG_NSH_ARCHINIT=y
|
||||||
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
CONFIG_NSH_FILEIOSIZE=512
|
||||||
|
CONFIG_NSH_READLINE=y
|
||||||
|
CONFIG_PREALLOC_TIMERS=4
|
||||||
|
CONFIG_RAM_SIZE=114688
|
||||||
|
CONFIG_RAM_START=0x20000000
|
||||||
|
CONFIG_RR_INTERVAL=200
|
||||||
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
CONFIG_START_DAY=6
|
||||||
|
CONFIG_START_MONTH=12
|
||||||
|
CONFIG_START_YEAR=2011
|
||||||
|
CONFIG_SYSLOG_BUFFER=y
|
||||||
|
CONFIG_SYSTEM_NSH=y
|
||||||
|
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
# CONFIG_NSH_ARGCAT is not set
|
||||||
|
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||||
|
CONFIG_ARCH="xtensa"
|
||||||
|
CONFIG_ARCH_BOARD="esp32s3-8048S043"
|
||||||
|
CONFIG_ARCH_BOARD_COMMON=y
|
||||||
|
CONFIG_ARCH_BOARD_ESP32S3_8048S043=y
|
||||||
|
CONFIG_ARCH_CHIP="esp32s3"
|
||||||
|
CONFIG_ARCH_CHIP_ESP32S3=y
|
||||||
|
CONFIG_ARCH_CHIP_ESP32S3WROOM1N4=y
|
||||||
|
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_ARCH_XTENSA=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_ESP32S3_SPI2=y
|
||||||
|
CONFIG_ESP32S3_SPI3=y
|
||||||
|
CONFIG_ESP32S3_UART0=y
|
||||||
|
CONFIG_FS_PROCFS=y
|
||||||
|
CONFIG_HAVE_CXX=y
|
||||||
|
CONFIG_HAVE_CXXINITIALIZE=y
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=3072
|
||||||
|
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||||
|
CONFIG_INIT_STACKSIZE=3072
|
||||||
|
CONFIG_INTELHEX_BINARY=y
|
||||||
|
CONFIG_LINE_MAX=64
|
||||||
|
CONFIG_NSH_ARCHINIT=y
|
||||||
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
CONFIG_NSH_FILEIOSIZE=512
|
||||||
|
CONFIG_NSH_READLINE=y
|
||||||
|
CONFIG_PREALLOC_TIMERS=4
|
||||||
|
CONFIG_RAM_SIZE=114688
|
||||||
|
CONFIG_RAM_START=0x20000000
|
||||||
|
CONFIG_RR_INTERVAL=200
|
||||||
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
CONFIG_SPITOOL_MINBUS=2
|
||||||
|
CONFIG_START_DAY=6
|
||||||
|
CONFIG_START_MONTH=12
|
||||||
|
CONFIG_START_YEAR=2011
|
||||||
|
CONFIG_SYSLOG_BUFFER=y
|
||||||
|
CONFIG_SYSTEM_NSH=y
|
||||||
|
CONFIG_SYSTEM_SPITOOL=y
|
||||||
|
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
# CONFIG_NSH_ARGCAT is not set
|
||||||
|
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||||
|
CONFIG_ARCH="xtensa"
|
||||||
|
CONFIG_ARCH_BOARD="esp32s3-8048S043"
|
||||||
|
CONFIG_ARCH_BOARD_COMMON=y
|
||||||
|
CONFIG_ARCH_BOARD_ESP32S3_8048S043=y
|
||||||
|
CONFIG_ARCH_CHIP="esp32s3"
|
||||||
|
CONFIG_ARCH_CHIP_ESP32S3=y
|
||||||
|
CONFIG_ARCH_CHIP_ESP32S3WROOM1N4=y
|
||||||
|
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_ARCH_XTENSA=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_DEBUG_ASSERTIONS=y
|
||||||
|
CONFIG_DEBUG_FEATURES=y
|
||||||
|
CONFIG_ESP32S3_BOARD_TOUCHSCREEN=y
|
||||||
|
CONFIG_ESP32S3_BOARD_TOUCHSCREEN_SAMPLE_CACHES=16
|
||||||
|
CONFIG_ESP32S3_BOARD_TOUCHSCREEN_SAMPLE_DELAYS=5
|
||||||
|
CONFIG_ESP32S3_I2C0_SCLPIN=20
|
||||||
|
CONFIG_ESP32S3_I2C0_SDAPIN=19
|
||||||
|
CONFIG_ESP32S3_UART0=y
|
||||||
|
CONFIG_EXAMPLES_TOUCHSCREEN=y
|
||||||
|
CONFIG_FS_PROCFS=y
|
||||||
|
CONFIG_HAVE_CXX=y
|
||||||
|
CONFIG_HAVE_CXXINITIALIZE=y
|
||||||
|
CONFIG_I2CTOOL_DEFFREQ=100000
|
||||||
|
CONFIG_I2CTOOL_MAXBUS=1
|
||||||
|
CONFIG_I2C_RESET=y
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=3072
|
||||||
|
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||||
|
CONFIG_INIT_STACKSIZE=3072
|
||||||
|
CONFIG_INTELHEX_BINARY=y
|
||||||
|
CONFIG_LINE_MAX=64
|
||||||
|
CONFIG_NSH_ARCHINIT=y
|
||||||
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
CONFIG_NSH_FILEIOSIZE=512
|
||||||
|
CONFIG_NSH_READLINE=y
|
||||||
|
CONFIG_PREALLOC_TIMERS=4
|
||||||
|
CONFIG_RAM_SIZE=114688
|
||||||
|
CONFIG_RAM_START=0x20000000
|
||||||
|
CONFIG_RR_INTERVAL=200
|
||||||
|
CONFIG_SCHED_LPWORK=y
|
||||||
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
CONFIG_START_DAY=28
|
||||||
|
CONFIG_START_MONTH=6
|
||||||
|
CONFIG_START_YEAR=2022
|
||||||
|
CONFIG_SYSLOG_BUFFER=y
|
||||||
|
CONFIG_SYSTEM_I2CTOOL=y
|
||||||
|
CONFIG_SYSTEM_NSH=y
|
||||||
|
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/xtensa/esp32s3/esp32s3-8048S043/include/board.h
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __BOARDS_XTENSA_ESP32S3_ESP32S3_8048S043_INCLUDE_BOARD_H
|
||||||
|
#define __BOARDS_XTENSA_ESP32S3_ESP32S3_8048S043_INCLUDE_BOARD_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Clocking *****************************************************************/
|
||||||
|
|
||||||
|
/* The ESP32-S3 8048S043 board is fitted with a 40MHz crystal */
|
||||||
|
|
||||||
|
#define BOARD_XTAL_FREQUENCY 40000000
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ
|
||||||
|
# define BOARD_CLOCK_FREQUENCY (CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ * 1000000)
|
||||||
|
#else
|
||||||
|
# define BOARD_CLOCK_FREQUENCY 80000000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* LED definitions **********************************************************/
|
||||||
|
|
||||||
|
/* Define how many LEDs this board has (needed by userleds) */
|
||||||
|
|
||||||
|
#define BOARD_NLEDS 0
|
||||||
|
|
||||||
|
/* GPIO pins used by the GPIO Subsystem */
|
||||||
|
|
||||||
|
#define BOARD_NGPIOOUT 1 /* Amount of GPIO Output pins */
|
||||||
|
#define BOARD_NGPIOIN 1 /* Amount of GPIO Input without Interruption */
|
||||||
|
#define BOARD_NGPIOINT 1 /* Amount of GPIO Input w/ Interruption pins */
|
||||||
|
|
||||||
|
#endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_8048S043_INCLUDE_BOARD_H */
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/xtensa/esp32s3/esp32s3-8048S043/include/board_memorymap.h
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __BOARDS_XTENSA_ESP32S3_ESP32S3_8048S043_INCLUDE_BOARD_MEMORYMAP_H
|
||||||
|
#define __BOARDS_XTENSA_ESP32S3_ESP32S3_8048S043_INCLUDE_BOARD_MEMORYMAP_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Kernel ROM */
|
||||||
|
|
||||||
|
#define KIROM_START (uintptr_t)__kirom_start
|
||||||
|
#define KIROM_SIZE (uintptr_t)__kirom_size
|
||||||
|
#define KDROM_START (uintptr_t)__kdrom_start
|
||||||
|
#define KDROM_SIZE (uintptr_t)__kdrom_size
|
||||||
|
|
||||||
|
/* Kernel RAM */
|
||||||
|
|
||||||
|
#define KIRAM_START (uintptr_t)__kiram_start
|
||||||
|
#define KIRAM_SIZE (uintptr_t)__kiram_size
|
||||||
|
#define KIRAM_END (uintptr_t)__kiram_end
|
||||||
|
#define KDRAM_START (uintptr_t)__kdram_start
|
||||||
|
#define KDRAM_SIZE (uintptr_t)__kdram_size
|
||||||
|
#define KDRAM_END (uintptr_t)__kdram_end
|
||||||
|
|
||||||
|
/* Exception vectors */
|
||||||
|
|
||||||
|
#define VECTORS_START (uintptr_t)__vectors_start
|
||||||
|
#define VECTORS_END (uintptr_t)__vectors_end
|
||||||
|
|
||||||
|
/* User ROM */
|
||||||
|
|
||||||
|
#define UIROM_START (uintptr_t)__uirom_start
|
||||||
|
#define UIROM_SIZE (uintptr_t)__uirom_size
|
||||||
|
#define UIROM_END (uintptr_t)__uirom_end
|
||||||
|
#define UDROM_START (uintptr_t)__udrom_start
|
||||||
|
#define UDROM_SIZE (uintptr_t)__udrom_size
|
||||||
|
#define UDROM_END (uintptr_t)__udrom_end
|
||||||
|
|
||||||
|
/* User RAM */
|
||||||
|
|
||||||
|
#define UIRAM_START (uintptr_t)__uiram_start
|
||||||
|
#define UIRAM_SIZE (uintptr_t)__uiram_size
|
||||||
|
#define UIRAM_END (uintptr_t)__uiram_end
|
||||||
|
#define UDRAM_START (uintptr_t)__udram_start
|
||||||
|
#define UDRAM_SIZE (uintptr_t)__udram_size
|
||||||
|
#define UDRAM_END (uintptr_t)__udram_end
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Kernel ROM (RX) */
|
||||||
|
|
||||||
|
extern uint8_t __kirom_start[];
|
||||||
|
extern uint8_t __kirom_size[];
|
||||||
|
extern uint8_t __kdrom_start[];
|
||||||
|
extern uint8_t __kdrom_size[];
|
||||||
|
|
||||||
|
/* Kernel RAM (RW) */
|
||||||
|
|
||||||
|
extern uint8_t __kiram_start[];
|
||||||
|
extern uint8_t __kiram_size[];
|
||||||
|
extern uint8_t __kiram_end[];
|
||||||
|
extern uint8_t __kdram_start[];
|
||||||
|
extern uint8_t __kdram_size[];
|
||||||
|
extern uint8_t __kdram_end[];
|
||||||
|
|
||||||
|
/* Exception vectors */
|
||||||
|
|
||||||
|
extern uint8_t __vectors_start[];
|
||||||
|
extern uint8_t __vectors_end[];
|
||||||
|
|
||||||
|
/* User ROM (RX) */
|
||||||
|
|
||||||
|
extern uint8_t __uirom_start[];
|
||||||
|
extern uint8_t __uirom_size[];
|
||||||
|
extern uint8_t __uirom_end[];
|
||||||
|
extern uint8_t __udrom_start[];
|
||||||
|
extern uint8_t __udrom_size[];
|
||||||
|
extern uint8_t __udrom_end[];
|
||||||
|
|
||||||
|
/* User RAM (RW) */
|
||||||
|
|
||||||
|
extern uint8_t __uiram_start[];
|
||||||
|
extern uint8_t __uiram_size[];
|
||||||
|
extern uint8_t __uiram_end[];
|
||||||
|
extern uint8_t __udram_start[];
|
||||||
|
extern uint8_t __udram_size[];
|
||||||
|
extern uint8_t __udram_end[];
|
||||||
|
|
||||||
|
#endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_8048S043_INCLUDE_BOARD_MEMORYMAP_H */
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
############################################################################
|
||||||
|
# boards/xtensa/esp32s3/esp32s3-8048S043/scripts/Make.defs
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
# contributor license agreements. See the NOTICE file distributed with
|
||||||
|
# this work for additional information regarding copyright ownership. The
|
||||||
|
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance with the
|
||||||
|
# License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
include $(TOPDIR)/.config
|
||||||
|
include $(TOPDIR)/tools/Config.mk
|
||||||
|
include $(TOPDIR)/tools/esp32s3/Config.mk
|
||||||
|
include $(TOPDIR)/arch/xtensa/src/lx7/Toolchain.defs
|
||||||
|
|
||||||
|
ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32s3_peripherals.ld
|
||||||
|
ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32s3_rom_aliases.ld
|
||||||
|
|
||||||
|
# Pick the linker scripts from the board level if they exist, if not
|
||||||
|
# pick the common linker scripts.
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_BUILD_PROTECTED),y)
|
||||||
|
ARCHSCRIPT += $(call FINDSCRIPT,protected_memory.ld)
|
||||||
|
ARCHSCRIPT += $(call FINDSCRIPT,kernel-space.ld)
|
||||||
|
else
|
||||||
|
ARCHSCRIPT += $(call FINDSCRIPT,flat_memory.ld)
|
||||||
|
ifneq ($(CONFIG_ESP32S3_APP_FORMAT_LEGACY),y)
|
||||||
|
ARCHSCRIPT += $(call FINDSCRIPT,esp32s3_sections.ld)
|
||||||
|
else
|
||||||
|
ARCHSCRIPT += $(call FINDSCRIPT,legacy_sections.ld)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
||||||
|
ARCHOPTIMIZATION += -fno-strength-reduce
|
||||||
|
endif
|
||||||
|
|
||||||
|
ARCHPICFLAGS = -fpic
|
||||||
|
|
||||||
|
CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
|
||||||
|
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||||
|
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
|
||||||
|
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||||
|
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
|
||||||
|
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
############################################################################
|
||||||
|
# boards/xtensa/esp32s3/esp32s3-8048S043/src/Make.defs
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
# contributor license agreements. See the NOTICE file distributed with
|
||||||
|
# this work for additional information regarding copyright ownership. The
|
||||||
|
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance with the
|
||||||
|
# License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
CSRCS = esp32s3_boot.c esp32s3_bringup.c
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_BOARDCTL),y)
|
||||||
|
CSRCS += esp32s3_appinit.c
|
||||||
|
ifeq ($(CONFIG_BOARDCTL_RESET),y)
|
||||||
|
CSRCS += esp32s3_reset.c
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_BUTTONS),y)
|
||||||
|
CSRCS += esp32s3_buttons.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ESP32S3_SPI),y)
|
||||||
|
CSRCS += esp32s3_board_spi.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_DEV_GPIO),y)
|
||||||
|
CSRCS += esp32s3_gpio.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ESP32S3_BOARD_TOUCHSCREEN),y)
|
||||||
|
CSRCS += esp32s3_board_touchsceen.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
DEPPATH += --dep-path board
|
||||||
|
VPATH += :board
|
||||||
|
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ETC_ROMFS),y)
|
||||||
|
RCSRCS = etc/init.d/rc.sysinit etc/init.d/rcS
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_TXTABLE_PARTITION),y)
|
||||||
|
RCRAWS = etc/txtable.txt
|
||||||
|
endif # CONFIG_TXTABLE_PARTITION
|
||||||
|
endif
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3-8048S043.h
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __BOARDS_XTENSA_ESP32S3_ESP32S3_8048S043_SRC_ESP32S3_8048S043_H
|
||||||
|
#define __BOARDS_XTENSA_ESP32S3_ESP32S3_8048S043_SRC_ESP32S3_8048S043_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
#include <nuttx/compiler.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* ESP32-S3-8048S043 GPIOs **************************************************/
|
||||||
|
|
||||||
|
/* Touchpad */
|
||||||
|
#define TOUCHSCEEN_I2C 0
|
||||||
|
|
||||||
|
/* SCL: 20
|
||||||
|
* SDA: 19
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define TOUCHSCEEN_ADDR (0x5D)
|
||||||
|
#define TOUCHSCEEN_CLOCK (400 * 1000)
|
||||||
|
#define TOUCHSCEEN_INT (-1)
|
||||||
|
|
||||||
|
/* BOOT Button */
|
||||||
|
|
||||||
|
#define BUTTON_BOOT 0
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Types
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp32s3_bringup
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Perform architecture-specific initialization
|
||||||
|
*
|
||||||
|
* CONFIG_BOARD_LATE_INITIALIZE=y :
|
||||||
|
* Called from board_late_initialize().
|
||||||
|
*
|
||||||
|
* CONFIG_BOARD_LATE_INITIALIZE=y && CONFIG_BOARDCTL=y :
|
||||||
|
* Called from the NSH library via board_app_initialize()
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int esp32s3_bringup(void);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp32s3_gpio_init
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Configure the GPIO driver.
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero (OK) is returned on success; A negated errno value is returned
|
||||||
|
* to indicate the nature of any failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEV_GPIO
|
||||||
|
int esp32s3_gpio_init(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_spiflash_init
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Initialize the SPIFLASH and register the MTD device.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP32S3_SPIFLASH
|
||||||
|
int board_spiflash_init(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_i2c_init
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Configure the I2C driver.
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero (OK) is returned on success; A negated errno value is returned
|
||||||
|
* to indicate the nature of any failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_I2C_DRIVER
|
||||||
|
int board_i2c_init(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_touchscreen_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Initialize touchscreen.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* None.
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero (OK) on success; a negated errno value on failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP32S3_BOARD_TOUCHSCREEN
|
||||||
|
int board_touchscreen_initialize(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __ASSEMBLY__ */
|
||||||
|
#endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_8048S043_SRC_ESP32S3_8048S043_H */
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_appinit.c
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
|
||||||
|
#include "esp32s3-8048S043.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_BOARDCTL
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_app_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Perform application specific initialization. This function is never
|
||||||
|
* called directly from application code, but only indirectly via the
|
||||||
|
* (non-standard) boardctl() interface using the command BOARDIOC_INIT.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* arg - The boardctl() argument is passed to the board_app_initialize()
|
||||||
|
* implementation without modification. The argument has no
|
||||||
|
* meaning to NuttX; the meaning of the argument is a contract
|
||||||
|
* between the board-specific initialization logic and the
|
||||||
|
* matching application logic. The value could be such things as a
|
||||||
|
* mode enumeration value, a set of DIP switch settings, a
|
||||||
|
* pointer to configuration data read from a file or serial FLASH,
|
||||||
|
* or whatever you would like to do with it. Every implementation
|
||||||
|
* should accept zero/NULL as a default configuration.
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||||
|
* any failure to indicate the nature of the failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int board_app_initialize(uintptr_t arg)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_BOARD_LATE_INITIALIZE
|
||||||
|
/* Board initialization already performed by board_late_initialize() */
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
#else
|
||||||
|
/* Perform board-specific initialization */
|
||||||
|
|
||||||
|
return esp32s3_bringup();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_BOARDCTL */
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_board_spi.c
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <nuttx/spi/spi.h>
|
||||||
|
|
||||||
|
#include "esp32s3_gpio.h"
|
||||||
|
#include "esp32s3-8048S043.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp32s3_spi2_status
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP32S3_SPI2
|
||||||
|
|
||||||
|
uint8_t esp32s3_spi2_status(struct spi_dev_s *dev, uint32_t devid)
|
||||||
|
{
|
||||||
|
uint8_t status = 0;
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp32s3_spi3_status
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP32S3_SPI3
|
||||||
|
|
||||||
|
uint8_t esp32s3_spi3_status(struct spi_dev_s *dev, uint32_t devid)
|
||||||
|
{
|
||||||
|
uint8_t status = 0;
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,450 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_board_touchsceen.c
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <syslog.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <debug.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <nuttx/spinlock.h>
|
||||||
|
#include <nuttx/wqueue.h>
|
||||||
|
#include <nuttx/input/touchscreen.h>
|
||||||
|
|
||||||
|
#include "esp32s3_i2c.h"
|
||||||
|
#include "esp32s3_gpio.h"
|
||||||
|
#include "hardware/esp32s3_gpio_sigmap.h"
|
||||||
|
|
||||||
|
#include "esp32s3-8048S043.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* GT911 maximum report frame size */
|
||||||
|
|
||||||
|
#define GT911_BUFFER_SIZE 41
|
||||||
|
#define GT911_TOUCHPOINTS 5
|
||||||
|
|
||||||
|
/* GT911 board configuration */
|
||||||
|
|
||||||
|
#define GT911_ADDR TOUCHSCEEN_ADDR
|
||||||
|
#define GT911_CLOCK TOUCHSCEEN_CLOCK
|
||||||
|
|
||||||
|
#define GT911_PATH CONFIG_ESP32S3_BOARD_TOUCHSCREEN_PATH
|
||||||
|
#define GT911_WORK_DELAY CONFIG_ESP32S3_BOARD_TOUCHSCREEN_SAMPLE_DELAYS
|
||||||
|
#define GT911_SAMPLE_CACHES CONFIG_ESP32S3_BOARD_TOUCHSCREEN_SAMPLE_CACHES
|
||||||
|
|
||||||
|
/* GT911 registers address */
|
||||||
|
|
||||||
|
#define GT911_READ_XY_REG 0x814e
|
||||||
|
#define GT911_READ_DATA_REG 0x814f
|
||||||
|
#define GT911_CONFIG_REG 0x8047
|
||||||
|
#define GT911_PRODUCT_ID_REG 0x8140
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Types
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* This structure describes the state of one GT911 driver instance */
|
||||||
|
|
||||||
|
struct gt911_dev_s
|
||||||
|
{
|
||||||
|
struct touch_lowerhalf_s touch_lower; /* Touchsrceen lowerhalf */
|
||||||
|
|
||||||
|
bool has_report; /* Mark if report event */
|
||||||
|
|
||||||
|
struct i2c_master_s *i2c; /* I2C master port */
|
||||||
|
struct work_s work; /* Read sample data work */
|
||||||
|
spinlock_t lock; /* Device specific lock. */
|
||||||
|
|
||||||
|
uint8_t buffer[GT911_BUFFER_SIZE]; /* Read buffer */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* This structure describes the frame of touchpoint */
|
||||||
|
|
||||||
|
begin_packed_struct struct gt911_touchpoint_s
|
||||||
|
{
|
||||||
|
uint8_t id; /* Not used */
|
||||||
|
uint16_t x; /* Touch X-axis */
|
||||||
|
uint16_t y; /* Touch Y-axis */
|
||||||
|
uint16_t pressure; /* Touch pressure */
|
||||||
|
uint8_t reserved; /* Not used */
|
||||||
|
} end_packed_struct;
|
||||||
|
|
||||||
|
/* This structure describes the frame of touchpoint */
|
||||||
|
|
||||||
|
begin_packed_struct struct gt911_data_s
|
||||||
|
{
|
||||||
|
uint8_t touchpoints : 4; /* Touch point number */
|
||||||
|
uint8_t has_key : 1; /* 1: key is inpressed */
|
||||||
|
uint8_t proximity_valid : 1; /* Not used */
|
||||||
|
uint8_t large_detected : 1; /* 1: large-area touch */
|
||||||
|
uint8_t buffer_status : 1; /* 1: input data is valid */
|
||||||
|
|
||||||
|
struct gt911_touchpoint_s touchpoint[0];
|
||||||
|
} end_packed_struct;
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
struct gt911_dev_s g_gt911_dev;
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: gt911_write_reg
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Read GT911 continuous registers value.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* dev - GT911 object pointer
|
||||||
|
* reg - Register start address
|
||||||
|
* buf - Register value buffer
|
||||||
|
* buflen - Register value buffer length
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero (OK) on success; a negated errno value on failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static int gt911_read_reg(struct gt911_dev_s *dev,
|
||||||
|
uint16_t reg,
|
||||||
|
uint8_t *buf,
|
||||||
|
int buflen)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
/* Send the Register Address, MSB first */
|
||||||
|
|
||||||
|
uint8_t regbuf[2] =
|
||||||
|
{
|
||||||
|
reg >> 8, /* First Byte: MSB */
|
||||||
|
reg & 0xff /* Second Byte: LSB */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Compose the I2C Messages */
|
||||||
|
|
||||||
|
struct i2c_msg_s msgv[2] =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
/* Send the I2C Register Address */
|
||||||
|
|
||||||
|
.frequency = GT911_CLOCK,
|
||||||
|
.addr = GT911_ADDR,
|
||||||
|
.flags = 0,
|
||||||
|
.buffer = regbuf,
|
||||||
|
.length = sizeof(regbuf)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
/* Receive the I2C Register Values */
|
||||||
|
|
||||||
|
.frequency = GT911_CLOCK,
|
||||||
|
.addr = GT911_ADDR,
|
||||||
|
.flags = I2C_M_READ,
|
||||||
|
.buffer = buf,
|
||||||
|
.length = buflen
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const int msgv_len = sizeof(msgv) / sizeof(msgv[0]);
|
||||||
|
|
||||||
|
iinfo("reg=0x%x, buflen=%d\n", reg, buflen);
|
||||||
|
DEBUGASSERT(dev && dev->i2c && buf);
|
||||||
|
|
||||||
|
/* Execute the I2C Transfer */
|
||||||
|
|
||||||
|
ret = I2C_TRANSFER(dev->i2c, msgv, msgv_len);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
ierr("I2C Read failed: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_INPUT_INFO
|
||||||
|
iinfodumpbuffer("gt911_read_reg", buf, buflen);
|
||||||
|
#endif /* CONFIG_DEBUG_INPUT_INFO */
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: gt911_write_reg
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Write GT911 register value.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* dev - GT911 object pointer
|
||||||
|
* reg - Register address
|
||||||
|
* val - Register value
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero (OK) on success; a negated errno value on failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static int gt911_write_reg(struct gt911_dev_s *dev,
|
||||||
|
uint16_t reg,
|
||||||
|
uint8_t val)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
/* Send the Register Address, MSB first */
|
||||||
|
|
||||||
|
uint8_t regbuf[3] =
|
||||||
|
{
|
||||||
|
reg >> 8, /* First Byte: MSB */
|
||||||
|
reg & 0xff, /* Second Byte: LSB */
|
||||||
|
val,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Compose the I2C Messages */
|
||||||
|
|
||||||
|
struct i2c_msg_s msgv[1] =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
/* Send the I2C Register Address */
|
||||||
|
|
||||||
|
.frequency = GT911_CLOCK,
|
||||||
|
.addr = GT911_ADDR,
|
||||||
|
.flags = 0,
|
||||||
|
.buffer = regbuf,
|
||||||
|
.length = sizeof(regbuf)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const int msgv_len = sizeof(msgv) / sizeof(msgv[0]);
|
||||||
|
|
||||||
|
iinfo("reg=0x%x, val=%d\n", reg, val);
|
||||||
|
DEBUGASSERT(dev && dev->i2c);
|
||||||
|
|
||||||
|
/* Execute the I2C Transfer */
|
||||||
|
|
||||||
|
ret = I2C_TRANSFER(dev->i2c, msgv, msgv_len);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
ierr("I2C Write failed: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: gt911_touch_event
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Process touch event. Read touchpoint data and send to touch event.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* dev - GT911 object pointer
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static void gt911_touch_event(struct gt911_dev_s *dev)
|
||||||
|
{
|
||||||
|
struct gt911_data_s *data = (struct gt911_data_s *)dev->buffer;
|
||||||
|
struct gt911_touchpoint_s *tp = data->touchpoint;
|
||||||
|
struct touch_sample_s sample;
|
||||||
|
struct touch_point_s *point = sample.point;
|
||||||
|
|
||||||
|
memset(&sample, 0, sizeof(sample));
|
||||||
|
sample.npoints = 1;
|
||||||
|
|
||||||
|
point->x = tp->x;
|
||||||
|
point->y = tp->y;
|
||||||
|
point->pressure = tp->pressure;
|
||||||
|
point->flags = TOUCH_POS_VALID | TOUCH_PRESSURE_VALID;
|
||||||
|
|
||||||
|
if (data->buffer_status)
|
||||||
|
{
|
||||||
|
point->flags |= TOUCH_DOWN;
|
||||||
|
dev->has_report = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
point->flags |= TOUCH_UP;
|
||||||
|
dev->has_report = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
touch_event(dev->touch_lower.priv, &sample);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: gt911_event
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Process GT911 event.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* dev - GT911 object pointer
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static void gt911_event(struct gt911_dev_s *dev)
|
||||||
|
{
|
||||||
|
struct gt911_data_s *data = (struct gt911_data_s *)dev->buffer;
|
||||||
|
|
||||||
|
if (!data->has_key)
|
||||||
|
{
|
||||||
|
gt911_touch_event(dev);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ierr("ERROR: event is invalid\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: gt911_worker
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Process GT911 work, read GT911 report frame and process it.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* arg - GT911 object pointer
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static void gt911_worker(void *arg)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
struct gt911_dev_s *dev = (struct gt911_dev_s *)arg;
|
||||||
|
struct gt911_data_s *data = (struct gt911_data_s *)dev->buffer;
|
||||||
|
clock_t delay = GT911_WORK_DELAY;
|
||||||
|
bool touched = false;
|
||||||
|
|
||||||
|
ret = gt911_read_reg(dev, GT911_READ_XY_REG, dev->buffer, 1);
|
||||||
|
if (ret != 0)
|
||||||
|
{
|
||||||
|
ierr("ERROR: I2C_TRANSFER() failed: %d\n", ret);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data->buffer_status &&
|
||||||
|
(data->touchpoints > 0) &&
|
||||||
|
(data->touchpoints < GT911_TOUCHPOINTS))
|
||||||
|
{
|
||||||
|
ret = gt911_read_reg(dev, GT911_READ_DATA_REG,
|
||||||
|
&dev->buffer[1], data->touchpoints * 8);
|
||||||
|
if (ret != 0)
|
||||||
|
{
|
||||||
|
ierr("ERROR: I2C_TRANSFER() failed: %d\n", ret);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
touched = true;
|
||||||
|
}
|
||||||
|
else if (dev->has_report)
|
||||||
|
{
|
||||||
|
touched = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = gt911_write_reg(dev, GT911_READ_XY_REG, 0);
|
||||||
|
if (ret != 0)
|
||||||
|
{
|
||||||
|
ierr("ERROR: I2C_TRANSFER() failed: %d\n", ret);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (touched)
|
||||||
|
{
|
||||||
|
gt911_event(dev);
|
||||||
|
delay = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
|
ret = work_queue(LPWORK, &dev->work, gt911_worker, dev, delay);
|
||||||
|
if (ret != 0)
|
||||||
|
{
|
||||||
|
ierr("ERROR: work_queue() failed: %d\n", ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_touchscreen_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Initialize touchpad.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* None.
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero (OK) on success; a negated errno value on failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int board_touchscreen_initialize(void)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
struct gt911_dev_s *dev = &g_gt911_dev;
|
||||||
|
|
||||||
|
dev->i2c = esp32s3_i2cbus_initialize(TOUCHSCEEN_I2C);
|
||||||
|
if (!dev->i2c)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: Failed to initialize I2C port %d\n",
|
||||||
|
TOUCHSCEEN_I2C);
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = touch_register(&dev->touch_lower, GT911_PATH,
|
||||||
|
GT911_SAMPLE_CACHES);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: touch_register() failed: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = work_queue(LPWORK, &dev->work, gt911_worker,
|
||||||
|
dev, GT911_WORK_DELAY);
|
||||||
|
if (ret != 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: work_queue() failed: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_boot.c
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
#include <nuttx/mm/mm.h>
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#include "esp32s3-8048S043.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp32s3_board_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* All ESP32-S3 boards must provide the following entry point.
|
||||||
|
* This entry point is called early in the initialization -- after all
|
||||||
|
* memory has been configured and mapped but before any devices have been
|
||||||
|
* initialized.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void esp32s3_board_initialize(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_late_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
|
||||||
|
* initialization call will be performed in the boot-up sequence to a
|
||||||
|
* function called board_late_initialize(). board_late_initialize() will
|
||||||
|
* be called immediately after up_initialize() is called and just before
|
||||||
|
* the initial application is started. This additional initialization
|
||||||
|
* phase may be used, for example, to initialize board-specific device
|
||||||
|
* drivers.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_BOARD_LATE_INITIALIZE
|
||||||
|
void board_late_initialize(void)
|
||||||
|
{
|
||||||
|
/* Perform board-specific initialization */
|
||||||
|
|
||||||
|
esp32s3_bringup();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,265 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_bringup.c
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <syslog.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <debug.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <nuttx/fs/fs.h>
|
||||||
|
#include <nuttx/himem/himem.h>
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP32S3_I2C
|
||||||
|
# include "esp32s3_i2c.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_INPUT_BUTTONS
|
||||||
|
# include <nuttx/input/buttons.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_RTC_DRIVER
|
||||||
|
# include "esp32s3_rtc_lowerhalf.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP32S3_EFUSE
|
||||||
|
# include "esp32s3_efuse.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP32S3_PARTITION_TABLE
|
||||||
|
# include "esp32s3_partition.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP32S3_SPI
|
||||||
|
#include "esp32s3_spi.h"
|
||||||
|
#include "esp32s3_board_spidev.h"
|
||||||
|
# ifdef CONFIG_ESPRESSIF_SPI_BITBANG
|
||||||
|
# include "espressif/esp_spi_bitbang.h"
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP32S3_SDMMC
|
||||||
|
#include "esp32s3_board_sdmmc.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESPRESSIF_TEMP
|
||||||
|
# include "espressif/esp_temperature_sensor.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP_PCNT
|
||||||
|
# include "espressif/esp_pcnt.h"
|
||||||
|
# include "esp32s3_board_pcnt.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_SYSTEM_NXDIAG_ESPRESSIF_CHIP_WO_TOOL
|
||||||
|
# include "espressif/esp_nxdiag.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "esp32s3-8048S043.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp32s3_bringup
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Perform architecture-specific initialization
|
||||||
|
*
|
||||||
|
* CONFIG_BOARD_LATE_INITIALIZE=y :
|
||||||
|
* Called from board_late_initialize().
|
||||||
|
*
|
||||||
|
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y :
|
||||||
|
* Called from the NSH library
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int esp32s3_bringup(void)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
#if defined(CONFIG_ESP32S3_SPIRAM) && \
|
||||||
|
defined(CONFIG_ESP32S3_SPIRAM_BANKSWITCH_ENABLE)
|
||||||
|
ret = esp_himem_init();
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: Failed to init HIMEM: %d\n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_ESP32S3_SPI) && defined(CONFIG_SPI_DRIVER)
|
||||||
|
#ifdef CONFIG_ESP32S3_SPI2
|
||||||
|
ret = board_spidev_initialize(ESP32S3_SPI2);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: Failed to init spidev 2: %d\n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP32S3_SPI3
|
||||||
|
ret = board_spidev_initialize(ESP32S3_SPI3);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: Failed to init spidev 3: %d\n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESPRESSIF_SPI_BITBANG
|
||||||
|
ret = board_spidev_initialize(ESPRESSIF_SPI_BITBANG);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: Failed to init spidev 3: %d\n", ret);
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_ESPRESSIF_SPI_BITBANG */
|
||||||
|
#endif /* CONFIG_ESP32S3_SPI && CONFIG_SPI_DRIVER*/
|
||||||
|
|
||||||
|
#if defined(CONFIG_ESP32S3_EFUSE)
|
||||||
|
ret = esp32s3_efuse_initialize("/dev/efuse");
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: Failed to init EFUSE: %d\n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_FS_PROCFS
|
||||||
|
/* Mount the procfs file system */
|
||||||
|
|
||||||
|
ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_FS_TMPFS
|
||||||
|
/* Mount the tmpfs file system */
|
||||||
|
|
||||||
|
ret = nx_mount(NULL, CONFIG_LIBC_TMPDIR, "tmpfs", 0, NULL);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: Failed to mount tmpfs at %s: %d\n",
|
||||||
|
CONFIG_LIBC_TMPDIR, ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP32S3_PARTITION_TABLE
|
||||||
|
ret = esp32s3_partition_init();
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: Failed to initialize partition error=%d\n",
|
||||||
|
ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESPRESSIF_TEMP
|
||||||
|
struct esp_temp_sensor_config_t cfg = TEMPERATURE_SENSOR_CONFIG(10, 50);
|
||||||
|
ret = esp_temperature_sensor_initialize(cfg);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "Failed to initialize temperature sensor driver: %d\n",
|
||||||
|
ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_RTC_DRIVER
|
||||||
|
/* Instantiate the ESP32-S3 RTC driver */
|
||||||
|
|
||||||
|
ret = esp32s3_rtc_driverinit();
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR,
|
||||||
|
"ERROR: Failed to Instantiate the RTC driver: %d\n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_I2C_DRIVER
|
||||||
|
/* Configure I2C peripheral interfaces */
|
||||||
|
|
||||||
|
ret = board_i2c_init();
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "Failed to initialize I2C driver: %d\n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_INPUT_BUTTONS
|
||||||
|
/* Register the BUTTON driver */
|
||||||
|
|
||||||
|
ret = btn_lower_initialize("/dev/buttons");
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "Failed to initialize button driver: %d\n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_DEV_GPIO) && !defined(CONFIG_GPIO_LOWER_HALF)
|
||||||
|
ret = esp32s3_gpio_init();
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "Failed to initialize GPIO Driver: %d\n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP32S3_SDMMC
|
||||||
|
ret = board_sdmmc_initialize();
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: Failed to initialize SDMMC: %d\n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_SYSTEM_NXDIAG_ESPRESSIF_CHIP_WO_TOOL
|
||||||
|
ret = esp_nxdiag_initialize();
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: esp_nxdiag_initialize failed: %d\n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP32S3_BOARD_TOUCHSCREEN
|
||||||
|
ret = board_touchscreen_initialize();
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "Failed to initialize touchscreen driver\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* If we got here then perhaps not all initialization was successful, but
|
||||||
|
* at least enough succeeded to bring-up NSH with perhaps reduced
|
||||||
|
* capabilities.
|
||||||
|
*/
|
||||||
|
|
||||||
|
UNUSED(ret);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_buttons.c
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <debug.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include <nuttx/arch.h>
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
#include <nuttx/irq.h>
|
||||||
|
|
||||||
|
#include "esp32s3_gpio.h"
|
||||||
|
#include "hardware/esp32s3_gpio_sigmap.h"
|
||||||
|
|
||||||
|
#include "esp32s3-8048S043.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_button_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* board_button_initialize() must be called to initialize button resources.
|
||||||
|
* After that, board_buttons() may be called to collect the current state
|
||||||
|
* of all buttons or board_button_irq() may be called to register button
|
||||||
|
* interrupt handlers.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
uint32_t board_button_initialize(void)
|
||||||
|
{
|
||||||
|
esp32s3_configgpio(BUTTON_BOOT, INPUT_FUNCTION_2 | PULLUP);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_buttons
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* After board_button_initialize() has been called, board_buttons() may be
|
||||||
|
* called to collect the state of all buttons. board_buttons() returns an
|
||||||
|
* 8-bit bit set with each bit associated with a button. See the
|
||||||
|
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
uint32_t board_buttons(void)
|
||||||
|
{
|
||||||
|
uint8_t ret = 0;
|
||||||
|
int i = 0;
|
||||||
|
int n = 0;
|
||||||
|
|
||||||
|
bool b0 = esp32s3_gpioread(BUTTON_BOOT);
|
||||||
|
|
||||||
|
for (i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
up_mdelay(1);
|
||||||
|
|
||||||
|
bool b1 = esp32s3_gpioread(BUTTON_BOOT);
|
||||||
|
|
||||||
|
if (b0 == b1)
|
||||||
|
{
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
n = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (3 == n)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
b0 = b1;
|
||||||
|
}
|
||||||
|
|
||||||
|
iinfo("b=%d n=%d\n", b0, n);
|
||||||
|
|
||||||
|
/* Low value means that the button is pressed */
|
||||||
|
|
||||||
|
if (!b0)
|
||||||
|
{
|
||||||
|
ret = 0x1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_button_irq
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* board_button_irq() may be called to register an interrupt handler that
|
||||||
|
* will be called when a button is depressed or released. The ID value is
|
||||||
|
* a button enumeration value that uniquely identifies a button resource.
|
||||||
|
* See the BUTTON_* definitions in board.h for the meaning of enumeration
|
||||||
|
* value.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
|
int board_button_irq(int id, xcpt_t irqhandler, void *arg)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
DEBUGASSERT(id == 0);
|
||||||
|
|
||||||
|
int irq = ESP32S3_PIN2IRQ(BUTTON_BOOT);
|
||||||
|
|
||||||
|
if (irqhandler != NULL)
|
||||||
|
{
|
||||||
|
/* Make sure the interrupt is disabled */
|
||||||
|
|
||||||
|
esp32s3_gpioirqdisable(irq);
|
||||||
|
|
||||||
|
ret = irq_attach(irq, irqhandler, arg);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: irq_attach() failed: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
gpioinfo("Attach %p\n", irqhandler);
|
||||||
|
|
||||||
|
gpioinfo("Enabling the interrupt\n");
|
||||||
|
|
||||||
|
/* Configure the interrupt for rising and falling edges */
|
||||||
|
|
||||||
|
esp32s3_gpioirqenable(irq, CHANGE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gpioinfo("Disable the interrupt\n");
|
||||||
|
esp32s3_gpioirqdisable(irq);
|
||||||
|
}
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,435 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_gpio.c
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <nuttx/irq.h>
|
||||||
|
#include <arch/irq.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <nuttx/ioexpander/gpio.h>
|
||||||
|
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#include "esp32s3-8048S043.h"
|
||||||
|
#include "esp32s3_gpio.h"
|
||||||
|
#include "hardware/esp32s3_gpio_sigmap.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESPRESSIF_DEDICATED_GPIO
|
||||||
|
#include "espressif/esp_dedic_gpio.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_DEV_GPIO) && !defined(CONFIG_GPIO_LOWER_HALF)
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#if !defined(CONFIG_ESP32S3_GPIO_IRQ) && BOARD_NGPIOINT > 0
|
||||||
|
# error "NGPIOINT is > 0 and GPIO interrupts aren't enabled"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Output pins. GPIO15 is used as an example, any other outputs could be
|
||||||
|
* used.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define GPIO_OUT1 15
|
||||||
|
|
||||||
|
/* Input pins. GPIO18 is used as an example, any other inputs could be
|
||||||
|
* used.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define GPIO_IN1 18
|
||||||
|
|
||||||
|
/* Interrupt pins. GPIO21 is used as an example, any other inputs could be
|
||||||
|
* used.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define GPIO_IRQPIN1 21
|
||||||
|
|
||||||
|
/* Dedicated GPIO pins. GPIO4 and GPIO5 is used as an example, any other
|
||||||
|
* GPIOs could be used.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define GPIO_DEDIC1 4
|
||||||
|
#define GPIO_DEDIC2 5
|
||||||
|
#define GPIO_DEDIC_COUNT 2
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Types
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
struct esp32s3gpio_dev_s
|
||||||
|
{
|
||||||
|
struct gpio_dev_s gpio;
|
||||||
|
uint8_t id;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct esp32s3gpint_dev_s
|
||||||
|
{
|
||||||
|
struct esp32s3gpio_dev_s esp32s3gpio;
|
||||||
|
pin_interrupt_t callback;
|
||||||
|
};
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#if BOARD_NGPIOOUT > 0
|
||||||
|
static int gpout_read(struct gpio_dev_s *dev, bool *value);
|
||||||
|
static int gpout_write(struct gpio_dev_s *dev, bool value);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BOARD_NGPIOIN > 0
|
||||||
|
static int gpin_read(struct gpio_dev_s *dev, bool *value);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BOARD_NGPIOINT > 0
|
||||||
|
static int gpint_read(struct gpio_dev_s *dev, bool *value);
|
||||||
|
static int gpint_attach(struct gpio_dev_s *dev,
|
||||||
|
pin_interrupt_t callback);
|
||||||
|
static int gpint_enable(struct gpio_dev_s *dev, bool enable);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#if BOARD_NGPIOOUT > 0
|
||||||
|
static const struct gpio_operations_s gpout_ops =
|
||||||
|
{
|
||||||
|
.go_read = gpout_read,
|
||||||
|
.go_write = gpout_write,
|
||||||
|
.go_attach = NULL,
|
||||||
|
.go_enable = NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* This array maps the GPIO pins used as OUTPUT */
|
||||||
|
|
||||||
|
static const uint32_t g_gpiooutputs[BOARD_NGPIOOUT] =
|
||||||
|
{
|
||||||
|
GPIO_OUT1
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct esp32s3gpio_dev_s g_gpout[BOARD_NGPIOOUT];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BOARD_NGPIOIN > 0
|
||||||
|
static const struct gpio_operations_s gpin_ops =
|
||||||
|
{
|
||||||
|
.go_read = gpin_read,
|
||||||
|
.go_write = NULL,
|
||||||
|
.go_attach = NULL,
|
||||||
|
.go_enable = NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* This array maps the GPIO pins used as INTERRUPT INPUTS */
|
||||||
|
|
||||||
|
static const uint32_t g_gpioinputs[BOARD_NGPIOIN] =
|
||||||
|
{
|
||||||
|
GPIO_IN1
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct esp32s3gpio_dev_s g_gpin[BOARD_NGPIOIN];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BOARD_NGPIOINT > 0
|
||||||
|
static const struct gpio_operations_s gpint_ops =
|
||||||
|
{
|
||||||
|
.go_read = gpint_read,
|
||||||
|
.go_write = NULL,
|
||||||
|
.go_attach = gpint_attach,
|
||||||
|
.go_enable = gpint_enable,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* This array maps the GPIO pins used as INTERRUPT INPUTS */
|
||||||
|
|
||||||
|
static const uint32_t g_gpiointinputs[BOARD_NGPIOINT] =
|
||||||
|
{
|
||||||
|
GPIO_IRQPIN1,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct esp32s3gpint_dev_s g_gpint[BOARD_NGPIOINT];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* This array maps the GPIO pins used as Dedicated GPIO */
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESPRESSIF_DEDICATED_GPIO
|
||||||
|
static const int g_gpioidedic[GPIO_DEDIC_COUNT] =
|
||||||
|
{
|
||||||
|
GPIO_DEDIC1, GPIO_DEDIC2
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct esp_dedic_gpio_flags_s dedic_gpio_flags =
|
||||||
|
{
|
||||||
|
.input_enable = 1,
|
||||||
|
.invert_input_enable = 0,
|
||||||
|
.output_enable = 1,
|
||||||
|
.invert_output_enable = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
struct esp_dedic_gpio_config_s dedic_gpio_conf =
|
||||||
|
{
|
||||||
|
.gpio_array = g_gpioidedic,
|
||||||
|
.array_size = GPIO_DEDIC_COUNT,
|
||||||
|
.flags = &dedic_gpio_flags,
|
||||||
|
.path = "/dev/dedic_gpio0"
|
||||||
|
};
|
||||||
|
|
||||||
|
struct file *dedicated_gpio = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: gpout_read
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#if BOARD_NGPIOOUT > 0
|
||||||
|
static int gpout_read(struct gpio_dev_s *dev, bool *value)
|
||||||
|
{
|
||||||
|
struct esp32s3gpio_dev_s *esp32s3gpio = (struct esp32s3gpio_dev_s *)dev;
|
||||||
|
|
||||||
|
DEBUGASSERT(esp32s3gpio != NULL && value != NULL);
|
||||||
|
DEBUGASSERT(esp32s3gpio->id < BOARD_NGPIOOUT);
|
||||||
|
gpioinfo("Reading...\n");
|
||||||
|
|
||||||
|
*value = esp32s3_gpioread(g_gpiooutputs[esp32s3gpio->id]);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: gpout_write
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static int gpout_write(struct gpio_dev_s *dev, bool value)
|
||||||
|
{
|
||||||
|
struct esp32s3gpio_dev_s *esp32s3gpio = (struct esp32s3gpio_dev_s *)dev;
|
||||||
|
|
||||||
|
DEBUGASSERT(esp32s3gpio != NULL);
|
||||||
|
DEBUGASSERT(esp32s3gpio->id < BOARD_NGPIOOUT);
|
||||||
|
gpioinfo("Writing %d\n", (int)value);
|
||||||
|
|
||||||
|
esp32s3_gpiowrite(g_gpiooutputs[esp32s3gpio->id], value);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: gpin_read
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#if BOARD_NGPIOIN > 0
|
||||||
|
static int gpin_read(struct gpio_dev_s *dev, bool *value)
|
||||||
|
{
|
||||||
|
struct esp32s3gpio_dev_s *esp32s3gpio = (struct esp32s3gpio_dev_s *)dev;
|
||||||
|
|
||||||
|
DEBUGASSERT(esp32s3gpio != NULL && value != NULL);
|
||||||
|
DEBUGASSERT(esp32s3gpio->id < BOARD_NGPIOIN);
|
||||||
|
gpioinfo("Reading... pin %" PRIu32 "\n", g_gpioinputs[esp32s3gpio->id]);
|
||||||
|
|
||||||
|
*value = esp32s3_gpioread(g_gpioinputs[esp32s3gpio->id]);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp32s3gpio_interrupt
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#if BOARD_NGPIOINT > 0
|
||||||
|
static int esp32s3gpio_interrupt(int irq, void *context, void *arg)
|
||||||
|
{
|
||||||
|
struct esp32s3gpint_dev_s *esp32s3gpint = (struct esp32s3gpint_dev_s *)arg;
|
||||||
|
|
||||||
|
DEBUGASSERT(esp32s3gpint != NULL && esp32s3gpint->callback != NULL);
|
||||||
|
gpioinfo("Interrupt! callback=%p\n", esp32s3gpint->callback);
|
||||||
|
|
||||||
|
esp32s3gpint->callback(&esp32s3gpint->esp32s3gpio.gpio,
|
||||||
|
esp32s3gpint->esp32s3gpio.id);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: gpint_read
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static int gpint_read(struct gpio_dev_s *dev, bool *value)
|
||||||
|
{
|
||||||
|
struct esp32s3gpint_dev_s *esp32s3gpint = (struct esp32s3gpint_dev_s *)dev;
|
||||||
|
|
||||||
|
DEBUGASSERT(esp32s3gpint != NULL && value != NULL);
|
||||||
|
DEBUGASSERT(esp32s3gpint->esp32s3gpio.id < BOARD_NGPIOINT);
|
||||||
|
gpioinfo("Reading int pin...\n");
|
||||||
|
|
||||||
|
*value = esp32s3_gpioread(g_gpiointinputs[esp32s3gpint->esp32s3gpio.id]);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: gpint_attach
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static int gpint_attach(struct gpio_dev_s *dev,
|
||||||
|
pin_interrupt_t callback)
|
||||||
|
{
|
||||||
|
struct esp32s3gpint_dev_s *esp32s3gpint =
|
||||||
|
(struct esp32s3gpint_dev_s *)dev;
|
||||||
|
int irq = ESP32S3_PIN2IRQ(g_gpiointinputs[esp32s3gpint->esp32s3gpio.id]);
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
gpioinfo("Attaching the callback\n");
|
||||||
|
|
||||||
|
/* Make sure the interrupt is disabled */
|
||||||
|
|
||||||
|
esp32s3_gpioirqdisable(irq);
|
||||||
|
ret = irq_attach(irq,
|
||||||
|
esp32s3gpio_interrupt,
|
||||||
|
&g_gpint[esp32s3gpint->esp32s3gpio.id]);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: gpint_attach() failed: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
gpioinfo("Attach %p\n", callback);
|
||||||
|
esp32s3gpint->callback = callback;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: gpint_enable
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static int gpint_enable(struct gpio_dev_s *dev, bool enable)
|
||||||
|
{
|
||||||
|
struct esp32s3gpint_dev_s *esp32s3gpint = (struct esp32s3gpint_dev_s *)dev;
|
||||||
|
int irq = ESP32S3_PIN2IRQ(g_gpiointinputs[esp32s3gpint->esp32s3gpio.id]);
|
||||||
|
|
||||||
|
if (enable)
|
||||||
|
{
|
||||||
|
if (esp32s3gpint->callback != NULL)
|
||||||
|
{
|
||||||
|
gpioinfo("Enabling the interrupt\n");
|
||||||
|
|
||||||
|
/* Configure the interrupt for rising edge */
|
||||||
|
|
||||||
|
esp32s3_gpioirqenable(irq, RISING);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gpioinfo("Disable the interrupt\n");
|
||||||
|
esp32s3_gpioirqdisable(irq);
|
||||||
|
}
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp32s3_gpio_init
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int esp32s3_gpio_init(void)
|
||||||
|
{
|
||||||
|
int pincount = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
#if BOARD_NGPIOOUT > 0
|
||||||
|
for (i = 0; i < BOARD_NGPIOOUT; i++)
|
||||||
|
{
|
||||||
|
/* Setup and register the GPIO pin */
|
||||||
|
|
||||||
|
g_gpout[i].gpio.gp_pintype = GPIO_OUTPUT_PIN;
|
||||||
|
g_gpout[i].gpio.gp_ops = &gpout_ops;
|
||||||
|
g_gpout[i].id = i;
|
||||||
|
gpio_pin_register(&g_gpout[i].gpio, pincount);
|
||||||
|
|
||||||
|
/* Configure the pins that will be used as output */
|
||||||
|
|
||||||
|
esp32s3_gpio_matrix_out(g_gpiooutputs[i], SIG_GPIO_OUT_IDX, 0, 0);
|
||||||
|
esp32s3_configgpio(g_gpiooutputs[i], OUTPUT_FUNCTION_2 |
|
||||||
|
INPUT_FUNCTION_2);
|
||||||
|
esp32s3_gpiowrite(g_gpiooutputs[i], 0);
|
||||||
|
|
||||||
|
pincount++;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BOARD_NGPIOIN > 0
|
||||||
|
for (i = 0; i < BOARD_NGPIOIN; i++)
|
||||||
|
{
|
||||||
|
/* Setup and register the GPIO pin */
|
||||||
|
|
||||||
|
g_gpin[i].gpio.gp_pintype = GPIO_INPUT_PIN;
|
||||||
|
g_gpin[i].gpio.gp_ops = &gpin_ops;
|
||||||
|
g_gpin[i].id = i;
|
||||||
|
gpio_pin_register(&g_gpin[i].gpio, pincount);
|
||||||
|
|
||||||
|
/* Configure the pins that will be used as INPUT */
|
||||||
|
|
||||||
|
esp32s3_configgpio(g_gpioinputs[i], INPUT_FUNCTION_2);
|
||||||
|
|
||||||
|
pincount++;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BOARD_NGPIOINT > 0
|
||||||
|
for (i = 0; i < BOARD_NGPIOINT; i++)
|
||||||
|
{
|
||||||
|
/* Setup and register the GPIO pin */
|
||||||
|
|
||||||
|
g_gpint[i].esp32s3gpio.gpio.gp_pintype = GPIO_INTERRUPT_PIN;
|
||||||
|
g_gpint[i].esp32s3gpio.gpio.gp_ops = &gpint_ops;
|
||||||
|
g_gpint[i].esp32s3gpio.id = i;
|
||||||
|
gpio_pin_register(&g_gpint[i].esp32s3gpio.gpio, pincount);
|
||||||
|
|
||||||
|
/* Configure the pins that will be used as interrupt input */
|
||||||
|
|
||||||
|
esp32s3_configgpio(g_gpiointinputs[i], INPUT_FUNCTION_2 | PULLDOWN);
|
||||||
|
|
||||||
|
pincount++;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESPRESSIF_DEDICATED_GPIO
|
||||||
|
dedicated_gpio = esp_dedic_gpio_new_bundle(&dedic_gpio_conf);
|
||||||
|
|
||||||
|
pincount++;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_DEV_GPIO && !CONFIG_GPIO_LOWER_HALF */
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_reset.c
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <debug.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <nuttx/arch.h>
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
|
||||||
|
#include "esp32s3_systemreset.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_BOARDCTL_RESET
|
||||||
|
|
||||||
|
#if CONFIG_BOARD_ASSERT_RESET_VALUE == EXIT_SUCCESS
|
||||||
|
# error "CONFIG_BOARD_ASSERT_RESET_VALUE must not be equal to EXIT_SUCCESS"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_reset
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Reset board. Support for this function is required by board-level
|
||||||
|
* logic if CONFIG_BOARDCTL_RESET is selected.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* status - Status information provided with the reset event. This
|
||||||
|
* meaning of this status information is board-specific. If not
|
||||||
|
* used by a board, the value zero may be provided in calls to
|
||||||
|
* board_reset().
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* If this function returns, then it was not possible to power-off the
|
||||||
|
* board due to some constraints. The return value in this case is a
|
||||||
|
* board-specific reason for the failure to shutdown.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int board_reset(int status)
|
||||||
|
{
|
||||||
|
syslog(LOG_INFO, "reboot status=%d\n", status);
|
||||||
|
|
||||||
|
switch (status)
|
||||||
|
{
|
||||||
|
case EXIT_SUCCESS:
|
||||||
|
up_shutdown_handler();
|
||||||
|
break;
|
||||||
|
case CONFIG_BOARD_ASSERT_RESET_VALUE:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
up_systemreset();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_BOARDCTL_RESET */
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/xtensa/esp32s3/esp32s3-devkit/src/etc/init.d/rc.sysinit
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/xtensa/esp32s3/esp32s3-devkit/src/etc/init.d/rcS
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_SYSTEM_ADBD
|
||||||
|
adbd &
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_SYSTEM_FASTBOOTD
|
||||||
|
fastbootd &
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
TXTABLE0
|
||||||
|
data 0x100000 0
|
||||||
Reference in New Issue
Block a user