diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 3eeb062da1670..f0d9b75570e9a 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -41,7 +41,7 @@ jobs: echo "::add-matcher::nuttx/.github/nxstyle.json" python3 -m venv .venv source .venv/bin/activate - pip install codespell cmake-format black isort flake8 + pip install codespell cmake-format black isort flake8 cvt2utf cd nuttx commits="${{ github.event.pull_request.base.sha }}..HEAD" git log --oneline $commits diff --git a/AUTHORS b/AUTHORS index 1505dc05e035f..a87b6ced971f8 100644 --- a/AUTHORS +++ b/AUTHORS @@ -23,6 +23,7 @@ David Sidrane Dong Heng Duo Zhang Felipe Moura Oliveira +Filipe do Ó Cavalcanti Flavio Paiva Junqueira Fotis Panagiotopoulos Giorgio Groß @@ -79,6 +80,7 @@ Pierre-Noel Bouteville Pierre-Olivier Vauboin (PO Vauboin) Richard Cochran Robert A. Feretich (Bob Feretich) +Rodrigo Sim Sakari Matias Kapanen (Sakari Kapanen) Sara da Cunha Monteiro de Souza (Sara Monteiro) Sebastian Ene diff --git a/Documentation/components/drivers/special/sensors.rst b/Documentation/components/drivers/special/sensors.rst index 3f964aacc5ced..d66d080814d36 100644 --- a/Documentation/components/drivers/special/sensors.rst +++ b/Documentation/components/drivers/special/sensors.rst @@ -33,3 +33,4 @@ general interface. sensors/sht4x.rst sensors/lsm6dso32.rst sensors/lis2mdl.rst + sensors/l86xxx.rst diff --git a/Documentation/components/drivers/special/sensors/l86xxx.rst b/Documentation/components/drivers/special/sensors/l86xxx.rst new file mode 100644 index 0000000000000..5d8dd9ae285e9 --- /dev/null +++ b/Documentation/components/drivers/special/sensors/l86xxx.rst @@ -0,0 +1,177 @@ +======= +L86-XXX +======= + +.. tags:: experimental + +This driver provides support for the L86-XXX family of GNSS modules by +Quectel via the :doc:`uorb ` interface. +Functionality for this driver was tested using the Quectel L86-M33. + +.. warning:: + This driver only contains preliminary support for a handful of proprietary + 'PMTK' commands There is no support for the entire suite of commands yet. + This driver also does not use the standard uORD GNSS upper half driver and + should eventually be modified such that it does. CONSIDER THIS DRIVER EXPERIMENTAL. + +Application Programming Interface +================================= + +To register the device for use, you will need to enable the standard upper half +serial drivers (``CONFIG_STANDARD_SERIAL``), since the L86-XXX driver requires +the path to the UART interface the module is connected to. You will also need to +ensure that the baud rate of the UART interface is set to 9600, which is the default +baud rate of the L86-XXX series of GNSS modules. + +The driver supports changing the default baud rate and update rate of the GNSS module. +As a result, you will also need to enable serial TERMIOS support (``CONFIG_SERIAL_TERMIOS``). +The baud rate and update rate of the GNSS module can be configured using the ``L86_XXX_BAUD`` and ``L86_XXX_FIX_INT`` options respectively. +Note that a faster update rate will require a higher baud rate to support it and the supported baud rates for the L86-XXX series of GNSS modules are: +* 4800 +* 9600 +* 14400 +* 19200 +* 38400 +* 57600 +* 115200 +The baud rate and update rates of the module are changed at registration time. + +.. code-block:: c + + #if defined(CONFIG_SENSORS_L86_XXX) + #include + + /* Register L86-M33 on USART3 */ + + ret = l86xxx_register("/dev/l86m33", "/dev/ttyS2", 0); + if (ret < 0) { + syslog(LOG_ERR, "Failed to register L86-M33: %d\n", ret); + } + #endif + +Once the driver is registered, it starts a thread that continuously reads raw output from the specified UART device and +parses the output according to `NMEA `_ standards using the +`minmea `_ library included in NuttX. The driver populates the ``sensor_gnss`` struct +and pushes it to the appropriate event once all NMEA messages in its sequence have been read. + + +**uORB commands** +----------------- +The driver implements the ``orb_activate``, ``orb_set_interval`` and, ``orb_ioctl`` operations to interact with the device. +The latter is used to send proprietary 'PMTK' commands which are documented further below. + +**Activate** + +There are 4 modes that the L86-XXX GNSS modules can be in. Those are "Full On Mode", "Standby Mode", "Backup Mode", "Periodic Mode" and, "AlwaysLocateTM Mode". +Calling ``orb_activate`` with ``enable`` set to false will enter the module into "Standby Mode". +In "Standby Mode", the module doesn't output any NMEA messages but the internal core and I/O power domain are still active. + +The module can be re-enabled by calling ``orb_activate`` with ``enable`` set to true, which will hot start the module OR by +sending any 'PMTK' command. + +**Set interval** + +The L86-XXX GNSS modules support interval rates from 1Hz to 10Hz (100ms - 10000ms). When using ``orb_set_interval``, be aware that +increasing the interval of the module may also require and increase in baud rate. An example of how this is performed can be found in +source code of this driver in the register function. + +Any interval rate outside of the supported range will result in a failed call to this function. + +**Control** + +The ``orb_ioctl`` interface allows one to send proprietary 'PMTK' commands to the L86-XXX GNSS module. It effectively works +as a wrapper for the command framework outlined by Quectel. The return value of calls to ``orb_ioctl`` follow this pattern: + +* -EINVAL - Invalid packet +* -ENOSYS - Unsupported packet type +* -EIO - Valid packet, but action failed +* 0 - Valid packet, action succeeded +* Other - Command failed during writing + +The supported commands are their arguments are listed below. + +``SNIOC_HOT_START`` +------------------- +Used to "Hot start" the GNSS module. Normally hot start means the GNSS module was powered down for less +than 3 hours (RTC must be alive) and its ephemeris is still valid. As there is no need for downloading +ephemeris, it is the fastest startup method. + +.. code-block:: c + + orb_ioctl(sensor, SNIOC_HOT_START); + +``SNIOC_WARM_START`` +-------------------- +Used to "Warm start" the GNSS module. Warm start means the GNSS module has approximate information of time, +position and coarse data on satellite positions, but it needs to download ephemeris until it can get a fix. + +.. code-block:: c + + orb_ioctl(sensor, SNIOC_WARM_START); + +``SNIOC_COLD_START`` +-------------------- +Used to "Cold start" the GNSS module. Using this message will force the GNSS module to be restarted without +any prior location information, including time, position, almanacs and ephemeris data. + +.. code-block:: c + + orb_ioctl(sensor, SNIOC_COLD_START); + +``SNIOC_FULL_COLD_START`` +------------------------- +Used to "Full cold start" the GNSS module. This is effectively the same as a cold restart, but additionally +clears system and user configurations. In other words, this resets the GNSS module to its factory settings. +When full-cold started, the GNSS module has no information on its last location. + +.. code-block:: c + + orb_ioctl(sensor, SNIOC_FULL_COLD_START); + +``SNIOC_SET_INTERVAL`` +---------------------- +Used to modify the position fix interval of the GNSS module. The argument is an integer between 100 and 10000, default value is 1000. + +.. code-block:: c + + orb_ioctl(sensor, SNIOC_SET_INTERVAL, 1000); + +``SNIOC_SET_BAUD`` +------------------ +.. note:: + + This feature requires termios support to be enabled(``CONFIG_SERIAL_TERMIOS``) + +Used to modify the baud rate of the GNSS module. The argument is an integer representing a supported baud rate, default value is 9600. +Upon sending this command, the baud rate of the UART interface used to communicate with the module is also modified. +Supported baud rates for the L86-XXX series of GNSS modules are: + +* 4800 +* 9600 +* 14400 +* 19200 +* 38400 +* 57600 +* 115200 + +.. code-block:: c + + orb_ioctl(sensor, SNIOC_SET_BAUD, 9600); + +``SNIOC_SET_OPERATIONAL_MODE`` +------------------------------ +Used to set the navigation mode of the GNSS module. The argument is an ``L86XXX_OPERATIONAL_MODE`` enum: + +* NORMAL - For general purpose +* FITNESS - For instances in which low-speed movements (<5 m/s>) will affect calculations +* AVIATION - For high-dynamic purposes that the large-acceleration movement will have more effect on the position calculation +* BALLOON - For high-altitude balloon purposes that vertical movement will have more effect on the position calculation +* STANDBY - Used to enter standby mode for power saving + +Default mode is NORMAL + +.. code-block:: c + + orb_ioctl(sensor, SNIOC_SET_OPERATIONAL_MODE, NORMAL); + + diff --git a/Documentation/components/libs/libc/index.rst b/Documentation/components/libs/libc/index.rst index fac61e12bf9c6..0394d43dfaca7 100644 --- a/Documentation/components/libs/libc/index.rst +++ b/Documentation/components/libs/libc/index.rst @@ -153,4 +153,5 @@ Implementation Details :maxdepth: 1 :caption: Contents: + stream.rst zoneinfo.rst diff --git a/Documentation/components/libs/libc/stream.rst b/Documentation/components/libs/libc/stream.rst new file mode 100644 index 0000000000000..fbb446060e37b --- /dev/null +++ b/Documentation/components/libs/libc/stream.rst @@ -0,0 +1,181 @@ +lib_bsprintf +============ + +This function is mainly used to output the contents of the input +structure. Supports standard formats for printf and scanf. For detailed +parameters, see: 1. https://en.cppreference.com/w/c/io/fprintf 2. +https://en.cppreference.com/w/c/io/fscanf + +- **special**: + + 1. Float use %hf, “%f” or “%lf” is double, “%Lf” is long double. + 2. The char array is specified with %.xs. for example: “char t[30]” + is specified with “%.30s”, char a [20] - " %.20s " + 3. “%u” is unsigned int. + 4. “%d” is int. + 5. When using %f to format a double data type, the double is + truncated to 6 decimal places by default. + 6. It is recommended that the “char[]” array be placed at the end of + the structure to prevent parameter configuration errors such as + “%.20s” from causing problems in parsing the entire buffer. + +- **demo** + + 1. **struct**: + + :: + + begin_packed_struct + struct test + { + uint8_t a; + uint16_t b; + uint32_t c; + int8_t d; + int16_t e; + int32_t f; + float g; + double h; + char i[32]; + uint64_t j; + int64_t k; + char l; + unsigned char m; + short int n; + unsigned short int o; + int p; + unsigned int q; + long r; + unsigned long s; + long long t; + unsigned long long u; + size_t v; + long double w; + }end_packed_struct; + + 1. **format string**: + + :: + + const char* sg = " uint8_t:[%hhu]\n" \ + " uint16_t:[%hu]\n" \ + " uint32_t:[%u]\n" \ + " int8_t:[%hhd]\n" \ + " int16_t:[%hd]\n" \ + " int32_t:[%d]\n" \ + " float:[%hf]\n" \ + " double:[%f]\n" \ + " char[]:[%.32s]\n" \ + " uint64_t:[%lu]\n" \ + " int64_t:[%ld]\n" \ + " char:[%hhd]\n" \ + " unsigned char:[%hhu]\n" \ + " short int:[%hd]\n" \ + "unsigned short int:[%hu]\n" \ + " int:[%d]\n" \ + " unsigned int:[%u]\n" \ + " long:[%ld]\n" \ + " unsigned long:[%lu]\n" \ + " long long:[%lld]\n" \ + "unsigned long long:[%llu]\n" \ + " size_t:[%uz]\n" \ + " long double:[%Lf]\n"; + + 1. **use**: + + - output to terminal: + + :: + + #ifdef CONFIG_FILE_STREAM + struct lib_stdoutstream_s stdoutstream; + + lib_stdoutstream(&stdoutstream, stdout); + + flockfile(stdout); + lib_bsprintf(&stdoutstream.common, sv, &test_v); + lib_bsprintf(&stdoutstream.common, sg, &test_g); + funlockfile(stdout); + #else + struct lib_rawoutstream_s rawoutstream; + struct lib_bufferedoutstream_s outstream; + + lib_rawoutstream(&rawoutstream, STDOUT_FILENO); + lib_bufferedoutstream(&outstream, &rawoutstream.common); + + lib_bsprintf(&outstream.common, sv, &test_v); + lib_bsprintf(&outstream.common, sg, &test_g); + + lib_stream_flush(&outstream.common); + #endif + +lib_bscanf +========== + +This function adds a formatted standard scanf string to the +structure(lib_bscanf). 1. https://zh.cppreference.com/w/c/io/fscanf + +- **special**: + + 1. Please use %lf for double precision, “%hf” or “%f” for float, long + double (“%Lf”) is not supported. + 2. Please use %hhd or %hhu for a single char or unsigned char. + 3. Use %hd or %hu for short int or unsigned short int. + 4. When using %s or %c, please specify the length of the char array, + such as %32s, %32c. + 5. %s will check the string for spaces. When there are spaces in the + string, it will be truncated. If you want to use string with + spaces, please use %{length}c, but make sure that the length of + the string can fill the array, otherwise an error will occur. + 6. %[] collection and %n are not supported. + +- **demo** + + 1. **struct**: Same as above + 2. **format string**: + + :: + + #define TOSTR(str) #str + #define TONNAME(name) TOSTR(name) + + #define v_uint8_t 97 + #define v_uint16_t 19299 + #define v_uint32_t 22155 + + ...... + + #define v_l_double -9299.9299929912122464755474 + + char bflag[] = "%hhu%hu%u%hhd%hd%d%f%lf%32s%llu%lld%hhd%hhu%hd%hu%d%u%ld%lu%lld%llu%zu%ld"; + + char binput[] = TONNAME(v_uint8_t) \ + " " TONNAME(v_uint16_t) \ + " " TONNAME(v_uint32_t) \ + " " TONNAME(v_int8_t) \ + " " TONNAME(v_int16_t) \ + " " TONNAME(v_int32_t) \ + " " TONNAME(v_float) \ + " " TONNAME(v_double) \ + " " TONNAME(v_char_arr) \ + " " TONNAME(v_uint64_t) \ + " " TONNAME(v_int64_t) \ + " " TONNAME(v_char) \ + " " TONNAME(v_u_char) \ + " " TONNAME(v_s_int) \ + " " TONNAME(v_u_s_int) \ + " " TONNAME(v_int) \ + " " TONNAME(v_u_int) \ + " " TONNAME(v_long) \ + " " TONNAME(v_u_long) \ + " " TONNAME(v_l_l) \ + " " TONNAME(v_u_l_l) \ + " " TONNAME(v_size_t) \ + " " TONNAME(v_l_double); + + 3. **use**: + + :: + + struct test vg; + ret = lib_bscanf(binput, bflag, &vg); diff --git a/Documentation/platforms/risc-v/qemu-rv/boards/rv-virt/index.rst b/Documentation/platforms/risc-v/qemu-rv/boards/rv-virt/index.rst index 7329f198a86ba..6cdbe6ae4e630 100644 --- a/Documentation/platforms/risc-v/qemu-rv/boards/rv-virt/index.rst +++ b/Documentation/platforms/risc-v/qemu-rv/boards/rv-virt/index.rst @@ -371,6 +371,39 @@ nsh64 Identical to the `nsh`_ configuration, but for 64-bit RISC-V. +nsbi +---- + +This is similar to the `knsh`, but using NuttX's native (minimalistic) +SBI. It uses `hostfs` and QEMU in semi-hosting mode to load the +user-space applications. This is intended for 32-bit RISC-V. + +To build it, use the following command:: + + $ make V=1 -j$(nproc) + $ make export V=1 -j$(nproc) + $ pushd ../apps + $ ./tools/mkimport.sh -z -x ../nuttx/nuttx-export-*.tar.gz + $ make import V=1 -j$(nproc) + $ popd + +Run it with QEMU using the default command for 32-bit RISC-V without +the ``-bios none`` option. Please note that it still runs in S-mode, +but bypasses QEMU's OpenSBI. + +In `nsh`, applications can be run directly:: + + nsh> hello + +nsbi64 +------ + +Identical to the `nsbi`_ configuration, but for 64-bit RISC-V. + +Run it with QEMU using the default command for 64-bit RISC-V without +the ``-bios none`` option. Please note that it still runs in S-mode, +but bypasses QEMU's OpenSBI. + smp --- diff --git a/Documentation/platforms/xtensa/esp32/boards/esp32-devkitc/index.rst b/Documentation/platforms/xtensa/esp32/boards/esp32-devkitc/index.rst index 30c69266cca03..dde7e6abcd581 100644 --- a/Documentation/platforms/xtensa/esp32/boards/esp32-devkitc/index.rst +++ b/Documentation/platforms/xtensa/esp32/boards/esp32-devkitc/index.rst @@ -951,6 +951,39 @@ DAC feature with following command with connecting simple LED on GPIO5 After this command you will see LED will light up in different brightness. +sdmmc_spi +--------- + +This configuration is used to mount a FAT/FAT32 SD Card into the OS' filesystem. +It uses SPI to communicate with the SD Card, defaulting to SPI3. + +The SD slot number, SPI port number and minor number can be modified in ``Application Configuration → NSH Library``. + +To access the card's files, make sure ``/dev/mmcsd0`` exists and then execute the following commands:: + + nsh> ls /dev + /dev: + console + mmcsd0 + null + ttyS0 + zero + nsh> mount -t vfat /dev/mmcsd0 /mnt + +This will mount the SD Card to ``/mnt``. Now, you can use the SD Card as a normal filesystem. +For example, you can read a file and write to it:: + + nsh> ls /mnt + /mnt: + hello.txt + nsh> cat /mnt/hello.txt + Hello World + nsh> echo 'NuttX RTOS' >> /mnt/hello.txt + nsh> cat /mnt/hello.txt + Hello World! + NuttX RTOS + nsh> + smp --- diff --git a/Documentation/platforms/xtensa/esp32/boards/esp32-lyrat/index.rst b/Documentation/platforms/xtensa/esp32/boards/esp32-lyrat/index.rst index f148e6cba2818..0ec3e1f0a576a 100644 --- a/Documentation/platforms/xtensa/esp32/boards/esp32-lyrat/index.rst +++ b/Documentation/platforms/xtensa/esp32/boards/esp32-lyrat/index.rst @@ -463,11 +463,14 @@ the ``buttons`` application and pressing on any of the available board buttons:: To avoid any conflicts, it's not registered in the buttons subsystem and, thus, is unable to be used. -mmcsdspi --------- +sdmmc_spi +--------- This configuration is used to mount a FAT/FAT32 SD Card into the OS' filesystem. For the ESP32-LyraT, make sure the DIP switches 1 and 2 are turned to the ON position. + +The SD slot number, SPI port number and minor number can be modified in ``Application Configuration → NSH Library``. + To access the card's files, execute the following commands:: nsh> mount -t vfat /dev/mmcsd0 /mnt diff --git a/Documentation/platforms/xtensa/esp32/boards/esp32-wrover-kit/index.rst b/Documentation/platforms/xtensa/esp32/boards/esp32-wrover-kit/index.rst index 81d6b4d5265b0..093b573b771fd 100644 --- a/Documentation/platforms/xtensa/esp32/boards/esp32-wrover-kit/index.rst +++ b/Documentation/platforms/xtensa/esp32/boards/esp32-wrover-kit/index.rst @@ -202,10 +202,13 @@ driver. You can find LVGL here:: This configuration uses the LVGL demonstration at `apps/examples/lvgldemo`. -mmcsdspi --------- +sdmmc_spi +--------- This configuration is used to mount a FAT/FAT32 SD Card into the OS' filesystem. + +The SD slot number, SPI port number and minor number can be modified in ``Application Configuration → NSH Library``. + To access the card's files, execute the following commands:: nsh> mount -t vfat /dev/mmcsd0 /mnt diff --git a/Documentation/platforms/xtensa/esp32/index.rst b/Documentation/platforms/xtensa/esp32/index.rst index fec15b9745c1f..d6c8a6954ac30 100644 --- a/Documentation/platforms/xtensa/esp32/index.rst +++ b/Documentation/platforms/xtensa/esp32/index.rst @@ -415,7 +415,7 @@ RMT Yes RNG Yes RSA No RTC Yes -SD/MMC No +SD/MMC Yes SPI based SD card driver SDIO No SHA Yes SPI Yes diff --git a/Documentation/platforms/xtensa/esp32s2/boards/esp32s2-saola-1/index.rst b/Documentation/platforms/xtensa/esp32s2/boards/esp32s2-saola-1/index.rst index 880f4116b12c2..74639deeecd1c 100644 --- a/Documentation/platforms/xtensa/esp32s2/boards/esp32s2-saola-1/index.rst +++ b/Documentation/platforms/xtensa/esp32s2/boards/esp32s2-saola-1/index.rst @@ -478,6 +478,39 @@ DAC feature with following command with connecting simple LED on GPIO5 After this command you will see LED will light up in different brightness. +sdmmc_spi +--------- + +This configuration is used to mount a FAT/FAT32 SD Card into the OS' filesystem. +It uses SPI to communicate with the SD Card, defaulting to SPI2. + +The SD slot number, SPI port number and minor number can be modified in ``Application Configuration → NSH Library``. + +To access the card's files, make sure ``/dev/mmcsd0`` exists and then execute the following commands:: + + nsh> ls /dev + /dev: + console + mmcsd0 + null + ttyS0 + zero + nsh> mount -t vfat /dev/mmcsd0 /mnt + +This will mount the SD Card to ``/mnt``. Now, you can use the SD Card as a normal filesystem. +For example, you can read a file and write to it:: + + nsh> ls /mnt + /mnt: + hello.txt + nsh> cat /mnt/hello.txt + Hello World + nsh> echo 'NuttX RTOS' >> /mnt/hello.txt + nsh> cat /mnt/hello.txt + Hello World! + NuttX RTOS + nsh> + timer ----- diff --git a/Documentation/platforms/xtensa/esp32s2/index.rst b/Documentation/platforms/xtensa/esp32s2/index.rst index e8b65c110a0df..1e8ed289bd2a6 100644 --- a/Documentation/platforms/xtensa/esp32s2/index.rst +++ b/Documentation/platforms/xtensa/esp32s2/index.rst @@ -397,6 +397,7 @@ RMT Yes RNG Yes RSA No RTC Yes +SD/MMC Yes SPI based SD card driver SHA No SPI Yes SPIFLASH Yes diff --git a/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-8048S043/esp32s3-8048S043.png b/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-8048S043/esp32s3-8048S043.png new file mode 100644 index 0000000000000..2eb3afa2472f2 Binary files /dev/null and b/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-8048S043/esp32s3-8048S043.png differ diff --git a/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-8048S043/index.rst b/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-8048S043/index.rst new file mode 100644 index 0000000000000..e9d23045fb638 --- /dev/null +++ b/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-8048S043/index.rst @@ -0,0 +1,103 @@ +================ +ESP32S3-8048S043 +================ + +.. tags:: chip:esp32, chip:esp32s3 + +The `ESP32S3-8048S343 ` 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: + $ make flash ESPTOOL_PORT=/dev/ttyUSB0 -j + +Where 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 diff --git a/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst b/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst index 2db6dc49536f6..08b63474eda3e 100644 --- a/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst +++ b/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst @@ -753,6 +753,39 @@ Format and mount the SD/MMC device with following commands:: FAT filesystem is enabled in the default configuration. Other filesystems may also work. +sdmmc_spi +--------- + +This configuration is used to mount a FAT/FAT32 SD Card into the OS' filesystem. +It uses SPI to communicate with the SD Card, defaulting to SPI2. + +The SD slot number, SPI port number and minor number can be modified in ``Application Configuration → NSH Library``. + +To access the card's files, make sure ``/dev/mmcsd0`` exists and then execute the following commands:: + + nsh> ls /dev + /dev: + console + mmcsd0 + null + ttyS0 + zero + nsh> mount -t vfat /dev/mmcsd0 /mnt + +This will mount the SD Card to ``/mnt``. Now, you can use the SD Card as a normal filesystem. +For example, you can read a file and write to it:: + + nsh> ls /mnt + /mnt: + hello.txt + nsh> cat /mnt/hello.txt + Hello World + nsh> echo 'NuttX RTOS' >> /mnt/hello.txt + nsh> cat /mnt/hello.txt + Hello World! + NuttX RTOS + nsh> + smp --- @@ -1038,8 +1071,8 @@ To test it, just run the following:: fastboot -------- -The basic Fastboot configuration is based on esp32s3-devkit:usb_device. -More details about usage of fastboot, please refer to `fastbootd — NuttX latest documentation `_. +| The Fastboot configuration is based on esp32s3-devkit:usb_device and esp32s3-devkit:wifi, and support both **USB** and **TCP** network transport. +| More details about usage of fastboot, please refer to `fastbootd — NuttX latest documentation `_. You can run the configuration and compilation procedure:: @@ -1052,15 +1085,37 @@ To test it, just run the following (**Default is host side**): sudo apt install fastboot -2. List devices running fastboot:: +2. Specify a device / List devices: + + List devices only supported for USB transport:: fastboot devices - Example:: + # Examples $ fastboot devices 1234 fastboot + To specific a device, use "-s" option:: + + # Usage + # + # -s tcp:HOST[:PORT] Specify a TCP network device. + # -s SERIAL Specify a USB device. + + fastboot -s SERIAL COMMAND + fastboot -s tcp:HOST[:PORT] COMMAND + + # Examples + + $ fastboot -s 1234 oem shell ifconfig + wlan0 Link encap:Ethernet HWaddr a0:85:e3:f4:43:30 at RUNNING mtu 1500 + inet addr:192.168.211.111 DRaddr:192.168.211.107 Mask:255.255.255.0 + + PS C:\workspace> fastboot.exe -s tcp:192.168.211.111 oem shell ifconfig + wlan0 Link encap:Ethernet HWaddr a0:85:e3:f4:43:30 at RUNNING mtu 1500 + inet addr:192.168.211.111 DRaddr:192.168.211.107 Mask:255.255.255.0 + 3. Display given variable:: fastboot getvar @@ -1117,3 +1172,45 @@ To test it, just run the following (**Default is host side**): 0050: 44 ff c9 3b 55 51 93 b3 fb 1e 88 9e e9 2d 69 36 D..;UQ.......-i6 0060: 10 d0 70 27 92 91 32 25 f5 cc 1f 59 ea 39 31 24 ..p'..2%...Y.91$ 0070: 3f 2e b0 fe ef 87 df 9b d4 7d 79 2e de 64 f6 ed ?........}y..d.. + +fastboot_usb +------------ + +| The basic Fastboot configuration is based on esp32s3-devkit:usb_device and support **USB** transport only. +| More details about usage of fastboot, please refer to `fastbootd — NuttX latest documentation `_. + +You can run the configuration and compilation procedure:: + + $ ./tools/configure.sh -l lckfb-szpi-esp32s3:fastboot_usb + $ make flash ESPTOOL_PORT=/dev/ttyACMx -j + +fastboot_tcp +------------ + +| The basic Fastboot configuration is based on esp32s3-devkit:wifi and support **TCP** transport only. +| More details about usage of fastboot, please refer to `fastbootd — NuttX latest documentation `_. + +You can run the configuration and compilation procedure:: + + $ ./tools/configure.sh -l esp32s3-devkit:fastboot_tcp + $ make flash ESPTOOL_PORT=/dev/ttyACMx -j + +To test it, just run the following:: + + # Device side + + nsh> wapi psk wlan0 mypasswd 3 + nsh> wapi essid wlan0 myssid 1 + nsh> renew wlan0 + + # Host side + + PS C:\workspace> fastboot.exe -s tcp:HOST[:PORT] oem shell ls + /: + data/ + dev/ + etc/ + proc/ + var/ + OKAY [ 0.063s] + Finished. Total time: 0.064s diff --git a/Documentation/platforms/xtensa/esp32s3/boards/lckfb-szpi-esp32s3/index.rst b/Documentation/platforms/xtensa/esp32s3/boards/lckfb-szpi-esp32s3/index.rst index 4f9bc95b7c2c3..2a994f34c0e96 100644 --- a/Documentation/platforms/xtensa/esp32s3/boards/lckfb-szpi-esp32s3/index.rst +++ b/Documentation/platforms/xtensa/esp32s3/boards/lckfb-szpi-esp32s3/index.rst @@ -147,8 +147,8 @@ Then check the partition:: fastboot -------- -The basic Fastboot configuration is based on lckfb-szpi-esp32s3:usb_device. -More details about usage of fastboot, please refer to `fastbootd — NuttX latest documentation `_. +| The Fastboot configuration is based on lckfb-szpi-esp32s3:usb_device and lckfb-szpi-esp32s3:wifi, and support both **USB** and **TCP** network transport. +| More details about usage of fastboot, please refer to `fastbootd — NuttX latest documentation `_. You can run the configuration and compilation procedure:: @@ -161,15 +161,37 @@ To test it, just run the following (**Default is host side**): sudo apt install fastboot -2. List devices running fastboot:: +2. Specify a device / List devices: + + List devices only supported for USB transport:: fastboot devices - Example:: + # Examples $ fastboot devices 1234 fastboot + To specific a device, use "-s" option:: + + # Usage + # + # -s tcp:HOST[:PORT] Specify a TCP network device. + # -s SERIAL Specify a USB device. + + fastboot -s SERIAL COMMAND + fastboot -s tcp:HOST[:PORT] COMMAND + + # Examples + + $ fastboot -s 1234 oem shell ifconfig + wlan0 Link encap:Ethernet HWaddr a0:85:e3:f4:43:30 at RUNNING mtu 1500 + inet addr:192.168.211.111 DRaddr:192.168.211.107 Mask:255.255.255.0 + + PS C:\workspace> fastboot.exe -s tcp:192.168.211.111 oem shell ifconfig + wlan0 Link encap:Ethernet HWaddr a0:85:e3:f4:43:30 at RUNNING mtu 1500 + inet addr:192.168.211.111 DRaddr:192.168.211.107 Mask:255.255.255.0 + 3. Display given variable:: fastboot getvar @@ -227,6 +249,48 @@ To test it, just run the following (**Default is host side**): 0060: 10 d0 70 27 92 91 32 25 f5 cc 1f 59 ea 39 31 24 ..p'..2%...Y.91$ 0070: 3f 2e b0 fe ef 87 df 9b d4 7d 79 2e de 64 f6 ed ?........}y..d.. +fastboot_usb +------------ + +| The basic Fastboot configuration is based on lckfb-szpi-esp32s3:usb_device and support **USB** transport only. +| More details about usage of fastboot, please refer to `fastbootd — NuttX latest documentation `_. + +You can run the configuration and compilation procedure:: + + $ ./tools/configure.sh -l lckfb-szpi-esp32s3:fastboot_usb + $ make flash ESPTOOL_PORT=/dev/ttyUSBx -j + +fastboot_tcp +------------ + +| The Fastboot TCP network device configuration is based on lckfb-szpi-esp32s3:wifi and support **TCP** network transport only. +| More details about usage of fastboot, please refer to `fastbootd — NuttX latest documentation `_. + +You can run the configuration and compilation procedure:: + + $ ./tools/configure.sh -l lckfb-szpi-esp32s3:fastboot_tcp + $ make flash ESPTOOL_PORT=/dev/ttyUSBx -j + +To test it, just run the following:: + + # Device side + + nsh> wapi psk wlan0 mypasswd 3 + nsh> wapi essid wlan0 myssid 1 + nsh> renew wlan0 + + # Host side + + PS C:\workspace> fastboot.exe -s tcp:HOST[:PORT] oem shell ls + /: + data/ + dev/ + etc/ + proc/ + var/ + OKAY [ 0.063s] + Finished. Total time: 0.064s + pca9557 ------- diff --git a/arch/arm/include/stm32f0l0g0/stm32g0_irq.h b/arch/arm/include/stm32f0l0g0/stm32g0_irq.h index a9d9e676d66dd..d0834d142a2af 100644 --- a/arch/arm/include/stm32f0l0g0/stm32g0_irq.h +++ b/arch/arm/include/stm32f0l0g0/stm32g0_irq.h @@ -79,6 +79,16 @@ #define STM32_IRQ_DMA1CH6 (STM32_IRQ_EXTINT + 11) /* 11: DMA1_CH6 */ #define STM32_IRQ_DMA1CH7 (STM32_IRQ_EXTINT + 11) /* 11: DMA1_CH7 */ #define STM32_IRQ_DMAMUX (STM32_IRQ_EXTINT + 11) /* 11: DMAMUX */ + +#if defined(CONFIG_STM32F0L0G0_STM32G0BX) || \ + defined(CONFIG_STM32F0L0G0_STM32G0C1) +# define STM32_IRQ_DMA2CH1 (STM32_IRQ_EXTINT + 11) /* 11: DMA2_CH1 */ +# define STM32_IRQ_DMA2CH2 (STM32_IRQ_EXTINT + 11) /* 11: DMA2_CH2 */ +# define STM32_IRQ_DMA2CH3 (STM32_IRQ_EXTINT + 11) /* 11: DMA2_CH3 */ +# define STM32_IRQ_DMA2CH4 (STM32_IRQ_EXTINT + 11) /* 11: DMA2_CH4 */ +# define STM32_IRQ_DMA2CH5 (STM32_IRQ_EXTINT + 11) /* 11: DMA2_CH5 */ +#endif + #define STM32_IRQ_ADC (STM32_IRQ_EXTINT + 12) /* 12: ADC */ #define STM32_IRQ_EXTI17_18 (STM32_IRQ_EXTINT + 12) /* 12: EXTI_17_18 */ diff --git a/arch/arm/src/cxd56xx/Kconfig b/arch/arm/src/cxd56xx/Kconfig index 998302b01ca0b..5b2f5af3de38d 100644 --- a/arch/arm/src/cxd56xx/Kconfig +++ b/arch/arm/src/cxd56xx/Kconfig @@ -24,7 +24,7 @@ config CXD56_FCBGA config CXD56_WLCSP bool "WLCSP 100 pin package" -endchoice +endchoice # CXD56xx package selection choice prompt "CXD56xx core selection" @@ -36,7 +36,7 @@ config CXD56_MAINCORE config CXD56_SUBCORE bool "Sub Core" -endchoice +endchoice # CXD56xx core selection config CXD56_CUSTOM_PINCONFIG bool "Board-specific pin configuration" @@ -178,7 +178,8 @@ config CXD56_TIMER_DIVIDER_16 config CXD56_TIMER_DIVIDER_256 bool "Divider 256" -endchoice +endchoice # Timer divider selection + endif # CXD56_TIMER menuconfig CXD56_WDT @@ -500,7 +501,6 @@ config CXD56_DMAC_SPI4_RX bool "DMAC support for SPI4 RX" default n select CXD56_DMAC - ---help--- Enables DMAC for SPI4 RX diff --git a/arch/arm/src/mps/Kconfig b/arch/arm/src/mps/Kconfig index 8a89ae6da9d91..a0d224ce2123f 100644 --- a/arch/arm/src/mps/Kconfig +++ b/arch/arm/src/mps/Kconfig @@ -45,8 +45,8 @@ config ARCH_CHIP_MPS3_AN547 select ARCH_HAVE_TEXT_HEAP select ARCH_HAVE_DATA_HEAP -endchoice +endchoice # ARM MPS Configuration -endmenu +endmenu # MPS Chip Selection -endif +endif # ARCH_CHIP_MPS diff --git a/arch/arm/src/nrf52/Kconfig b/arch/arm/src/nrf52/Kconfig index bd3af5ff3af9d..eb2d0847bdb41 100644 --- a/arch/arm/src/nrf52/Kconfig +++ b/arch/arm/src/nrf52/Kconfig @@ -660,7 +660,7 @@ config NRF52_RADIO_IEEE802154_TRACE_BUFSIZE depends on NRF52_RADIO_IEEE802154_TRACE default 1024 -endif +endif # NRF52_RADIO_IEEE802154 endif #NRF52_RADIO @@ -836,7 +836,7 @@ config NRF52_SDC_MULTIROLE config NRF52_SDC_CENTRAL bool "BLE Central role" -endchoice +endchoice # BLE Controller role config NRF52_SDC_CLOCK_ACCURACY int "Clock Accuracy [PPM]" @@ -882,7 +882,7 @@ config NRF52_SDC_SCAN_BUFFER_COUNT ---help--- The minimum allowed number of buffers is 2. -endif +endif # NRF52_SDC_SCANNING config NRF52_SDC_LE_2M_PHY bool "Support LE 2M PHY" @@ -905,5 +905,4 @@ config NRF52_SDC_PUB_ADDR hex "Configure BT public address" default 0x0000000000 -endif - +endif # NRF52_SOFTDEVICE_CONTROLLER diff --git a/arch/arm/src/stm32f0l0g0/Kconfig b/arch/arm/src/stm32f0l0g0/Kconfig index 4eb19ca36c4ba..b65c6bdb0d944 100644 --- a/arch/arm/src/stm32f0l0g0/Kconfig +++ b/arch/arm/src/stm32f0l0g0/Kconfig @@ -1267,13 +1267,19 @@ config STM32F0L0G0_STM32G030 bool default n select STM32F0L0G0_STM32G0 + select STM32F0L0G0_STM32G03X config STM32F0L0G0_STM32G031 bool default n select STM32F0L0G0_STM32G0 + select STM32F0L0G0_STM32G03X select STM32F0L0G0_HAVE_LPUART1 +config STM32F0L0G0_STM32G03X + bool + default n + config STM32F0L0G0_STM32G041 bool default n @@ -1286,21 +1292,25 @@ config STM32F0L0G0_STM32G050 bool default n select STM32F0L0G0_STM32G0 - select STM32F0L0G0_HAVE_TIM6 - select STM32F0L0G0_HAVE_TIM7 + select STM32F0L0G0_STM32G05X config STM32F0L0G0_STM32G051 bool default n select STM32F0L0G0_STM32G0 + select STM32F0L0G0_STM32G05X select STM32F0L0G0_HAVE_DAC1 select STM32F0L0G0_HAVE_COMP1 select STM32F0L0G0_HAVE_COMP2 - select STM32F0L0G0_HAVE_TIM6 - select STM32F0L0G0_HAVE_TIM7 select STM32F0L0G0_HAVE_TIM15 select STM32F0L0G0_HAVE_LPUART1 +config STM32F0L0G0_STM32G05X + bool + default n + select STM32F0L0G0_HAVE_TIM6 + select STM32F0L0G0_HAVE_TIM7 + config STM32F0L0G0_STM32G061 bool default n @@ -1319,30 +1329,29 @@ config STM32F0L0G0_STM32G070 bool default n select STM32F0L0G0_STM32G0 - select STM32F0L0G0_HAVE_USART3 - select STM32F0L0G0_HAVE_USART4 - select STM32F0L0G0_HAVE_TIM6 - select STM32F0L0G0_HAVE_TIM7 - select STM32F0L0G0_HAVE_TIM15 - select STM32F0L0G0_HAVE_UCPD1 - select STM32F0L0G0_HAVE_UCPD2 + select STM32F0L0G0_STM32G07X config STM32F0L0G0_STM32G071 bool default n select STM32F0L0G0_STM32G0 - select STM32F0L0G0_HAVE_USART3 - select STM32F0L0G0_HAVE_USART4 + select STM32F0L0G0_STM32G07X select STM32F0L0G0_HAVE_DAC1 select STM32F0L0G0_HAVE_COMP1 select STM32F0L0G0_HAVE_COMP2 + select STM32F0L0G0_HAVE_CEC + select STM32F0L0G0_HAVE_LPUART1 + +config STM32F0L0G0_STM32G07X + bool + default n + select STM32F0L0G0_HAVE_USART3 + select STM32F0L0G0_HAVE_USART4 select STM32F0L0G0_HAVE_TIM6 select STM32F0L0G0_HAVE_TIM7 select STM32F0L0G0_HAVE_TIM15 select STM32F0L0G0_HAVE_UCPD1 select STM32F0L0G0_HAVE_UCPD2 - select STM32F0L0G0_HAVE_CEC - select STM32F0L0G0_HAVE_LPUART1 config STM32F0L0G0_STM32G081 bool @@ -1367,30 +1376,24 @@ config STM32F0L0G0_STM32G0B0 bool default n select STM32F0L0G0_STM32G0 - select STM32F0L0G0_HAVE_DMA2 - select STM32F0L0G0_HAVE_USART3 - select STM32F0L0G0_HAVE_USART4 - select STM32F0L0G0_HAVE_USART5 - select STM32F0L0G0_HAVE_USART6 - select STM32F0L0G0_HAVE_LPUART1 - select STM32F0L0G0_HAVE_LPUART2 - select STM32F0L0G0_HAVE_CRS - select STM32F0L0G0_HAVE_TIM4 - select STM32F0L0G0_HAVE_TIM6 - select STM32F0L0G0_HAVE_TIM7 - select STM32F0L0G0_HAVE_TIM15 - select STM32F0L0G0_HAVE_I2C3 - select STM32F0L0G0_HAVE_SPI3 - select STM32F0L0G0_HAVE_I2S2 - select STM32F0L0G0_HAVE_USBDEV - select STM32F0L0G0_HAVE_UCPD1 - select STM32F0L0G0_HAVE_UCPD2 - select STM32F0L0G0_HAVE_HSI48 + select STM32F0L0G0_STM32G0BX config STM32F0L0G0_STM32G0B1 bool default n select STM32F0L0G0_STM32G0 + select STM32F0L0G0_STM32G0BX + select STM32F0L0G0_HAVE_DAC1 + select STM32F0L0G0_HAVE_COMP1 + select STM32F0L0G0_HAVE_COMP2 + select STM32F0L0G0_HAVE_COMP3 + select STM32F0L0G0_HAVE_FDCAN1 + select STM32F0L0G0_HAVE_FDCAN2 + select STM32F0L0G0_HAVE_CEC + +config STM32F0L0G0_STM32G0BX + bool + default n select STM32F0L0G0_HAVE_DMA2 select STM32F0L0G0_HAVE_USART3 select STM32F0L0G0_HAVE_USART4 @@ -1399,10 +1402,6 @@ config STM32F0L0G0_STM32G0B1 select STM32F0L0G0_HAVE_LPUART1 select STM32F0L0G0_HAVE_LPUART2 select STM32F0L0G0_HAVE_CRS - select STM32F0L0G0_HAVE_DAC1 - select STM32F0L0G0_HAVE_COMP1 - select STM32F0L0G0_HAVE_COMP2 - select STM32F0L0G0_HAVE_COMP3 select STM32F0L0G0_HAVE_TIM4 select STM32F0L0G0_HAVE_TIM6 select STM32F0L0G0_HAVE_TIM7 @@ -1413,9 +1412,6 @@ config STM32F0L0G0_STM32G0B1 select STM32F0L0G0_HAVE_USBDEV select STM32F0L0G0_HAVE_UCPD1 select STM32F0L0G0_HAVE_UCPD2 - select STM32F0L0G0_HAVE_FDCAN1 - select STM32F0L0G0_HAVE_FDCAN2 - select STM32F0L0G0_HAVE_CEC select STM32F0L0G0_HAVE_HSI48 config STM32F0L0G0_STM32G0C1 @@ -3698,6 +3694,16 @@ config STM32F0L0G0_ADC1_EXTSEL ---help--- Enable EXTSEL for ADC1. +config STM32F0L0G0_ADC1_CONTINUOUS + bool "Enable ADC1 Continuous Conversion Mode" + default n + depends on STM32F0L0G0_ADC1 + ---help--- + If enabled, the ADC will operate in continuous conversion mode. + Otherwise, it will perform single conversions. + Note: Continuous and discontinuous mode cannot be defined at + the same time + endmenu # ADC Configuration menu "SPI Configuration" diff --git a/arch/arm/src/stm32f0l0g0/hardware/stm32_adc.h b/arch/arm/src/stm32f0l0g0/hardware/stm32_adc.h index 35873b30d2c5b..b855b530df532 100644 --- a/arch/arm/src/stm32f0l0g0/hardware/stm32_adc.h +++ b/arch/arm/src/stm32f0l0g0/hardware/stm32_adc.h @@ -243,8 +243,9 @@ #define ADC_SMPR_SMP2_SHIFT (4) /* Bits 4-6: Sampling time selection 2 */ #define ADC_SMPR_SMP2_MASK (7 << ADC_SMPR_SMP_SHIFT) #define ADC_SMPR_SMPSEL_SHIFT (8) /* Bits 8-26: channel-x sampling time selection */ -#if defined(CONFIG_ARCH_CHIP_STM32G0) -# define ADC_SMPR_SMPSEL(ch, smp) ((smp) << (ADC_SMPR_SMPSEL_SHIFT + ch)) /* ch = [0..18] and smp = 1 or 0 */ +#if defined(CONFIG_ARCH_CHIP_STM32G0) || defined(CONFIG_ARCH_CHIP_STM32C0) +# define ADC_SMPR_SMPSEL(ch, smp) ((smp) << (ADC_SMPR_SMPSEL_SHIFT + ch)) /* ch = [0..22] and smp = 0 or 1 */ +# define ADC_SMPSEL(ch, smp) ((smp) << (ch)) /* For use in adc_sampletime_set */ #else # define ADC_SMPR_SMPSEL(ch, smp) (smp << ADC_SMPR_SMPSEL_SHIFT) #endif diff --git a/arch/arm/src/stm32f0l0g0/hardware/stm32g0_dmamux.h b/arch/arm/src/stm32f0l0g0/hardware/stm32g0_dmamux.h index 67e3a291b29d6..2f1161c7d3777 100644 --- a/arch/arm/src/stm32f0l0g0/hardware/stm32g0_dmamux.h +++ b/arch/arm/src/stm32f0l0g0/hardware/stm32g0_dmamux.h @@ -36,26 +36,290 @@ /* DMAMUX1 mapping **********************************************************/ -/* NOTE: DMAMUX1 channels 0 to 7 are connected to DMA1 channels 0 to 7 */ +/* Peripheral to DMAMUX request line mappings (RM0444 Rev 6, Table 55) */ -#define DMAMUX1_REQ_GEN0 (1) -#define DMAMUX1_REQ_GEN1 (2) -#define DMAMUX1_REQ_GEN2 (3) -#define DMAMUX1_REQ_GEN3 (4) -#define DMAMUX1_ADC1 (5) -#define DMAMUX1_AES_IN (6) -#define DMAMUX1_AES_OUT (7) +#define DMAMUX1_REQ_GEN0 1 +#define DMAMAP_DMA1_REQ_GEN0 DMAMAP_MAP(DMA1, DMAMUX1_REQ_GEN0) +#define DMAMAP_DMA2_REQ_GEN0 DMAMAP_MAP(DMA2, DMAMUX1_REQ_GEN0) +#define DMAMUX1_REQ_GEN1 2 +#define DMAMAP_DMA1_REQ_GEN1 DMAMAP_MAP(DMA1, DMAMUX1_REQ_GEN1) +#define DMAMAP_DMA2_REQ_GEN1 DMAMAP_MAP(DMA2, DMAMUX1_REQ_GEN1) +#define DMAMUX1_REQ_GEN2 3 +#define DMAMAP_DMA1_REQ_GEN2 DMAMAP_MAP(DMA1, DMAMUX1_REQ_GEN2) +#define DMAMAP_DMA2_REQ_GEN2 DMAMAP_MAP(DMA2, DMAMUX1_REQ_GEN2) +#define DMAMUX1_REQ_GEN3 4 +#define DMAMAP_DMA1_REQ_GEN3 DMAMAP_MAP(DMA1, DMAMUX1_REQ_GEN3) +#define DMAMAP_DMA2_REQ_GEN3 DMAMAP_MAP(DMA2, DMAMUX1_REQ_GEN3) +#define DMAMUX1_ADC1 5 +#define DMAMAP_DMA1_ADC1 DMAMAP_MAP(DMA1, DMAMUX1_ADC1) +#define DMAMAP_DMA2_ADC1 DMAMAP_MAP(DMA2, DMAMUX1_ADC1) +#define DMAMUX1_AES_IN 6 +#define DMAMAP_DMA1_AES_IN DMAMAP_MAP(DMA1, DMAMUX1_AES_IN) +#define DMAMAP_DMA2_AES_IN DMAMAP_MAP(DMA2, DMAMUX1_AES_IN) +#define DMAMUX1_AES_OUT 7 +#define DMAMAP_DMA1_AES_OUT DMAMAP_MAP(DMA1, DMAMUX1_AES_OUT) +#define DMAMAP_DMA2_AES_OUT DMAMAP_MAP(DMA2, DMAMUX1_AES_OUT) +#define DMAMUX1_DAC_CH1 8 +#define DMAMAP_DMA1_DAC_CH1 DMAMAP_MAP(DMA1, DMAMUX1_DAC_CH1) +#define DMAMAP_DMA2_DAC_CH1 DMAMAP_MAP(DMA2, DMAMUX1_DAC_CH1) +#define DMAMUX1_DAC_CH2 9 +#define DMAMAP_DMA1_DAC_CH2 DMAMAP_MAP(DMA1, DMAMUX1_DAC_CH2) +#define DMAMAP_DMA2_DAC_CH2 DMAMAP_MAP(DMA2, DMAMUX1_DAC_CH2) +#define DMAMUX1_I2C1_RX 10 +#define DMAMAP_DMA1_I2C1_RX DMAMAP_MAP(DMA1, DMAMUX1_I2C1_RX) +#define DMAMAP_DMA2_I2C1_RX DMAMAP_MAP(DMA2, DMAMUX1_I2C1_RX) +#define DMAMUX1_I2C1_TX 11 +#define DMAMAP_DMA1_I2C1_TX DMAMAP_MAP(DMA1, DMAMUX1_I2C1_TX) +#define DMAMAP_DMA2_I2C1_TX DMAMAP_MAP(DMA2, DMAMUX1_I2C1_TX) +#define DMAMUX1_I2C2_RX 12 +#define DMAMAP_DMA1_I2C2_RX DMAMAP_MAP(DMA1, DMAMUX1_I2C2_RX) +#define DMAMAP_DMA2_I2C2_RX DMAMAP_MAP(DMA2, DMAMUX1_I2C2_RX) +#define DMAMUX1_I2C2_TX 13 +#define DMAMAP_DMA1_I2C2_TX DMAMAP_MAP(DMA1, DMAMUX1_I2C2_TX) +#define DMAMAP_DMA2_I2C2_TX DMAMAP_MAP(DMA2, DMAMUX1_I2C2_TX) +#define DMAMUX1_LPUART1_RX 14 +#define DMAMAP_DMA1_LPUART1_RX DMAMAP_MAP(DMA1, DMAMUX1_LPUART1_RX) +#define DMAMAP_DMA2_LPUART1_RX DMAMAP_MAP(DMA2, DMAMUX1_LPUART1_RX) +#define DMAMUX1_LPUART1_TX 15 +#define DMAMAP_DMA1_LPUART1_TX DMAMAP_MAP(DMA1, DMAMUX1_LPUART1_TX) +#define DMAMAP_DMA2_LPUART1_TX DMAMAP_MAP(DMA2, DMAMUX1_LPUART1_TX) +#define DMAMUX1_SPI1_RX 16 +#define DMAMAP_DMA1_SPI1_RX DMAMAP_MAP(DMA1, DMAMUX1_SPI1_RX) +#define DMAMAP_DMA2_SPI1_RX DMAMAP_MAP(DMA2, DMAMUX1_SPI1_RX) +#define DMAMUX1_SPI1_TX 17 +#define DMAMAP_DMA1_SPI1_TX DMAMAP_MAP(DMA1, DMAMUX1_SPI1_TX) +#define DMAMAP_DMA2_SPI1_TX DMAMAP_MAP(DMA2, DMAMUX1_SPI1_TX) +#define DMAMUX1_SPI2_RX 18 +#define DMAMAP_DMA1_SPI2_RX DMAMAP_MAP(DMA1, DMAMUX1_SPI2_RX) +#define DMAMAP_DMA2_SPI2_RX DMAMAP_MAP(DMA2, DMAMUX1_SPI2_RX) +#define DMAMUX1_SPI2_TX 19 +#define DMAMAP_DMA1_SPI2_TX DMAMAP_MAP(DMA1, DMAMUX1_SPI2_TX) +#define DMAMAP_DMA2_SPI2_TX DMAMAP_MAP(DMA2, DMAMUX1_SPI2_TX) +#define DMAMUX1_TIM1_CH1 20 +#define DMAMAP_DMA1_TIM1_CH1 DMAMAP_MAP(DMA1, DMAMUX1_TIM1_CH1) +#define DMAMAP_DMA2_TIM1_CH1 DMAMAP_MAP(DMA2, DMAMUX1_TIM1_CH1) +#define DMAMUX1_TIM1_CH2 21 +#define DMAMAP_DMA1_TIM1_CH2 DMAMAP_MAP(DMA1, DMAMUX1_TIM1_CH2) +#define DMAMAP_DMA2_TIM1_CH2 DMAMAP_MAP(DMA2, DMAMUX1_TIM1_CH2) +#define DMAMUX1_TIM1_CH3 22 +#define DMAMAP_DMA1_TIM1_CH3 DMAMAP_MAP(DMA1, DMAMUX1_TIM1_CH3) +#define DMAMAP_DMA2_TIM1_CH3 DMAMAP_MAP(DMA2, DMAMUX1_TIM1_CH3) +#define DMAMUX1_TIM1_CH4 23 +#define DMAMAP_DMA1_TIM1_CH4 DMAMAP_MAP(DMA1, DMAMUX1_TIM1_CH4) +#define DMAMAP_DMA2_TIM1_CH4 DMAMAP_MAP(DMA2, DMAMUX1_TIM1_CH4) +#define DMAMUX1_TIM1_TRIG 24 +#define DMAMAP_DMA1_TIM1_TRIG DMAMAP_MAP(DMA1, DMAMUX1_TIM1_TRIG) +#define DMAMAP_DMA2_TIM1_TRIG DMAMAP_MAP(DMA2, DMAMUX1_TIM1_TRIG) +#define DMAMUX1_TIM1_UP 25 +#define DMAMAP_DMA1_TIM1_UP DMAMAP_MAP(DMA1, DMAMUX1_TIM1_UP) +#define DMAMAP_DMA2_TIM1_UP DMAMAP_MAP(DMA2, DMAMUX1_TIM1_UP) +#define DMAMUX1_TIM2_CH1 26 +#define DMAMAP_DMA1_TIM2_CH1 DMAMAP_MAP(DMA1, DMAMUX1_TIM2_CH1) +#define DMAMAP_DMA2_TIM2_CH1 DMAMAP_MAP(DMA2, DMAMUX1_TIM2_CH1) +#define DMAMUX1_TIM2_CH2 27 +#define DMAMAP_DMA1_TIM2_CH2 DMAMAP_MAP(DMA1, DMAMUX1_TIM2_CH2) +#define DMAMAP_DMA2_TIM2_CH2 DMAMAP_MAP(DMA2, DMAMUX1_TIM2_CH2) +#define DMAMUX1_TIM2_CH3 28 +#define DMAMAP_DMA1_TIM2_CH3 DMAMAP_MAP(DMA1, DMAMUX1_TIM2_CH3) +#define DMAMAP_DMA2_TIM2_CH3 DMAMAP_MAP(DMA2, DMAMUX1_TIM2_CH3) +#define DMAMUX1_TIM2_CH4 29 +#define DMAMAP_DMA1_TIM2_CH4 DMAMAP_MAP(DMA1, DMAMUX1_TIM2_CH4) +#define DMAMAP_DMA2_TIM2_CH4 DMAMAP_MAP(DMA2, DMAMUX1_TIM2_CH4) +#define DMAMUX1_TIM2_TRIG 30 +#define DMAMAP_DMA1_TIM2_TRIG DMAMAP_MAP(DMA1, DMAMUX1_TIM2_TRIG) +#define DMAMAP_DMA2_TIM2_TRIG DMAMAP_MAP(DMA2, DMAMUX1_TIM2_TRIG) +#define DMAMUX1_TIM2_UP 31 +#define DMAMAP_DMA1_TIM2_UP DMAMAP_MAP(DMA1, DMAMUX1_TIM2_UP) +#define DMAMAP_DMA2_TIM2_UP DMAMAP_MAP(DMA2, DMAMUX1_TIM2_UP) +#define DMAMUX1_TIM3_CH1 32 +#define DMAMAP_DMA1_TIM3_CH1 DMAMAP_MAP(DMA1, DMAMUX1_TIM3_CH1) +#define DMAMAP_DMA2_TIM3_CH1 DMAMAP_MAP(DMA2, DMAMUX1_TIM3_CH1) +#define DMAMUX1_TIM3_CH2 33 +#define DMAMAP_DMA1_TIM3_CH2 DMAMAP_MAP(DMA1, DMAMUX1_TIM3_CH2) +#define DMAMAP_DMA2_TIM3_CH2 DMAMAP_MAP(DMA2, DMAMUX1_TIM3_CH2) +#define DMAMUX1_TIM3_CH3 34 +#define DMAMAP_DMA1_TIM3_CH3 DMAMAP_MAP(DMA1, DMAMUX1_TIM3_CH3) +#define DMAMAP_DMA2_TIM3_CH3 DMAMAP_MAP(DMA2, DMAMUX1_TIM3_CH3) +#define DMAMUX1_TIM3_CH4 35 +#define DMAMAP_DMA1_TIM3_CH4 DMAMAP_MAP(DMA1, DMAMUX1_TIM3_CH4) +#define DMAMAP_DMA2_TIM3_CH4 DMAMAP_MAP(DMA2, DMAMUX1_TIM3_CH4) +#define DMAMUX1_TIM3_TRIG 36 +#define DMAMAP_DMA1_TIM3_TRIG DMAMAP_MAP(DMA1, DMAMUX1_TIM3_TRIG) +#define DMAMAP_DMA2_TIM3_TRIG DMAMAP_MAP(DMA2, DMAMUX1_TIM3_TRIG) +#define DMAMUX1_TIM3_UP 37 +#define DMAMAP_DMA1_TIM3_UP DMAMAP_MAP(DMA1, DMAMUX1_TIM3_UP) +#define DMAMAP_DMA2_TIM3_UP DMAMAP_MAP(DMA2, DMAMUX1_TIM3_UP) +#define DMAMUX1_TIM6_UP 38 +#define DMAMAP_DMA1_TIM6_UP DMAMAP_MAP(DMA1, DMAMUX1_TIM6_UP) +#define DMAMAP_DMA2_TIM6_UP DMAMAP_MAP(DMA2, DMAMUX1_TIM6_UP) +#define DMAMUX1_TIM7_UP 39 +#define DMAMAP_DMA1_TIM7_UP DMAMAP_MAP(DMA1, DMAMUX1_TIM7_UP) +#define DMAMAP_DMA2_TIM7_UP DMAMAP_MAP(DMA2, DMAMUX1_TIM7_UP) +#define DMAMUX1_TIM15_CH1 40 +#define DMAMAP_DMA1_TIM15_CH1 DMAMAP_MAP(DMA1, DMAMUX1_TIM15_CH1) +#define DMAMAP_DMA2_TIM15_CH1 DMAMAP_MAP(DMA2, DMAMUX1_TIM15_CH1) +#define DMAMUX1_TIM15_CH2 41 +#define DMAMAP_DMA1_TIM15_CH2 DMAMAP_MAP(DMA1, DMAMUX1_TIM15_CH2) +#define DMAMAP_DMA2_TIM15_CH2 DMAMAP_MAP(DMA2, DMAMUX1_TIM15_CH2) +#define DMAMUX1_TIM15_TRIG_COM 42 +#define DMAMAP_DMA1_TIM15_TRIG_COM DMAMAP_MAP(DMA1, DMAMUX1_TIM15_TRIG_COM) +#define DMAMAP_DMA2_TIM15_TRIG_COM DMAMAP_MAP(DMA2, DMAMUX1_TIM15_TRIG_COM) +#define DMAMUX1_TIM15_UP 43 +#define DMAMAP_DMA1_TIM15_UP DMAMAP_MAP(DMA1, DMAMUX1_TIM15_UP) +#define DMAMAP_DMA2_TIM15_UP DMAMAP_MAP(DMA2, DMAMUX1_TIM15_UP) +#define DMAMUX1_TIM16_CH1 44 +#define DMAMAP_DMA1_TIM16_CH1 DMAMAP_MAP(DMA1, DMAMUX1_TIM16_CH1) +#define DMAMAP_DMA2_TIM16_CH1 DMAMAP_MAP(DMA2, DMAMUX1_TIM16_CH1) +#define DMAMUX1_TIM16_COM 45 +#define DMAMAP_DMA1_TIM16_COM DMAMAP_MAP(DMA1, DMAMUX1_TIM16_COM) +#define DMAMAP_DMA2_TIM16_COM DMAMAP_MAP(DMA2, DMAMUX1_TIM16_COM) +#define DMAMUX1_TIM16_UP 46 +#define DMAMAP_DMA1_TIM16_UP DMAMAP_MAP(DMA1, DMAMUX1_TIM16_UP) +#define DMAMAP_DMA2_TIM16_UP DMAMAP_MAP(DMA2, DMAMUX1_TIM16_UP) +#define DMAMUX1_TIM17_CH1 47 +#define DMAMAP_DMA1_TIM17_CH1 DMAMAP_MAP(DMA1, DMAMUX1_TIM17_CH1) +#define DMAMAP_DMA2_TIM17_CH1 DMAMAP_MAP(DMA2, DMAMUX1_TIM17_CH1) +#define DMAMUX1_TIM17_COM 48 +#define DMAMAP_DMA1_TIM17_COM DMAMAP_MAP(DMA1, DMAMUX1_TIM17_COM) +#define DMAMAP_DMA2_TIM17_COM DMAMAP_MAP(DMA2, DMAMUX1_TIM17_COM) +#define DMAMUX1_TIM17_UP 49 +#define DMAMAP_DMA1_TIM17_UP DMAMAP_MAP(DMA1, DMAMUX1_TIM17_UP) +#define DMAMAP_DMA2_TIM17_UP DMAMAP_MAP(DMA2, DMAMUX1_TIM17_UP) +#define DMAMUX1_USART1_RX 50 +#define DMAMAP_DMA1_USART1_RX DMAMAP_MAP(DMA1, DMAMUX1_USART1_RX) +#define DMAMAP_DMA2_USART1_RX DMAMAP_MAP(DMA2, DMAMUX1_USART1_RX) +#define DMAMUX1_USART1_TX 51 +#define DMAMAP_DMA1_USART1_TX DMAMAP_MAP(DMA1, DMAMUX1_USART1_TX) +#define DMAMAP_DMA2_USART1_TX DMAMAP_MAP(DMA2, DMAMUX1_USART1_TX) +#define DMAMUX1_USART2_RX 52 +#define DMAMAP_DMA1_USART2_RX DMAMAP_MAP(DMA1, DMAMUX1_USART2_RX) +#define DMAMAP_DMA2_USART2_RX DMAMAP_MAP(DMA2, DMAMUX1_USART2_RX) +#define DMAMUX1_USART2_TX 53 +#define DMAMAP_DMA1_USART2_TX DMAMAP_MAP(DMA1, DMAMUX1_USART2_TX) +#define DMAMAP_DMA2_USART2_TX DMAMAP_MAP(DMA2, DMAMUX1_USART2_TX) +#define DMAMUX1_USART3_RX 54 +#define DMAMAP_DMA1_USART3_RX DMAMAP_MAP(DMA1, DMAMUX1_USART3_RX) +#define DMAMAP_DMA2_USART3_RX DMAMAP_MAP(DMA2, DMAMUX1_USART3_RX) +#define DMAMUX1_USART3_TX 55 +#define DMAMAP_DMA1_USART3_TX DMAMAP_MAP(DMA1, DMAMUX1_USART3_TX) +#define DMAMAP_DMA2_USART3_TX DMAMAP_MAP(DMA2, DMAMUX1_USART3_TX) +#define DMAMUX1_USART4_RX 56 +#define DMAMAP_DMA1_USART4_RX DMAMAP_MAP(DMA1, DMAMUX1_USART4_RX) +#define DMAMAP_DMA2_USART4_RX DMAMAP_MAP(DMA2, DMAMUX1_USART4_RX) +#define DMAMUX1_USART4_TX 57 +#define DMAMAP_DMA1_USART4_TX DMAMAP_MAP(DMA1, DMAMUX1_USART4_TX) +#define DMAMAP_DMA2_USART4_TX DMAMAP_MAP(DMA2, DMAMUX1_USART4_TX) +#define DMAMUX1_UCPD1_RX 58 +#define DMAMAP_DMA1_UCPD1_RX DMAMAP_MAP(DMA1, DMAMUX1_UCPD1_RX) +#define DMAMAP_DMA2_UCPD1_RX DMAMAP_MAP(DMA2, DMAMUX1_UCPD1_RX) +#define DMAMUX1_UCPD1_TX 59 +#define DMAMAP_DMA1_UCPD1_TX DMAMAP_MAP(DMA1, DMAMUX1_UCPD1_TX) +#define DMAMAP_DMA2_UCPD1_TX DMAMAP_MAP(DMA2, DMAMUX1_UCPD1_TX) +#define DMAMUX1_UCPD2_RX 60 +#define DMAMAP_DMA1_UCPD2_RX DMAMAP_MAP(DMA1, DMAMUX1_UCPD2_RX) +#define DMAMAP_DMA2_UCPD2_RX DMAMAP_MAP(DMA2, DMAMUX1_UCPD2_RX) +#define DMAMUX1_UCPD2_TX 61 +#define DMAMAP_DMA1_UCPD2_TX DMAMAP_MAP(DMA1, DMAMUX1_UCPD2_TX) +#define DMAMAP_DMA2_UCPD2_TX DMAMAP_MAP(DMA2, DMAMUX1_UCPD2_TX) +#define DMAMUX1_I2C3_RX 62 +#define DMAMAP_DMA1_I2C3_RX DMAMAP_MAP(DMA1, DMAMUX1_I2C3_RX) +#define DMAMAP_DMA2_I2C3_RX DMAMAP_MAP(DMA2, DMAMUX1_I2C3_RX) +#define DMAMUX1_I2C3_TX 63 +#define DMAMAP_DMA1_I2C3_TX DMAMAP_MAP(DMA1, DMAMUX1_I2C3_TX) +#define DMAMAP_DMA2_I2C3_TX DMAMAP_MAP(DMA2, DMAMUX1_I2C3_TX) +#define DMAMUX1_LPUART2_RX 64 +#define DMAMAP_DMA1_LPUART2_RX DMAMAP_MAP(DMA1, DMAMUX1_LPUART2_RX) +#define DMAMAP_DMA2_LPUART2_RX DMAMAP_MAP(DMA2, DMAMUX1_LPUART2_RX) +#define DMAMUX1_LPUART2_TX 65 +#define DMAMAP_DMA1_LPUART2_TX DMAMAP_MAP(DMA1, DMAMUX1_LPUART2_TX) +#define DMAMAP_DMA2_LPUART2_TX DMAMAP_MAP(DMA2, DMAMUX1_LPUART2_TX) +#define DMAMUX1_SPI3_RX 66 +#define DMAMAP_DMA1_SPI3_RX DMAMAP_MAP(DMA1, DMAMUX1_SPI3_RX) +#define DMAMAP_DMA2_SPI3_RX DMAMAP_MAP(DMA2, DMAMUX1_SPI3_RX) +#define DMAMUX1_SPI3_TX 67 +#define DMAMAP_DMA1_SPI3_TX DMAMAP_MAP(DMA1, DMAMUX1_SPI3_TX) +#define DMAMAP_DMA2_SPI3_TX DMAMAP_MAP(DMA2, DMAMUX1_SPI3_TX) +#define DMAMUX1_TIM4_CH1 68 +#define DMAMAP_DMA1_TIM4_CH1 DMAMAP_MAP(DMA1, DMAMUX1_TIM4_CH1) +#define DMAMAP_DMA2_TIM4_CH1 DMAMAP_MAP(DMA2, DMAMUX1_TIM4_CH1) +#define DMAMUX1_TIM4_CH2 69 +#define DMAMAP_DMA1_TIM4_CH2 DMAMAP_MAP(DMA1, DMAMUX1_TIM4_CH2) +#define DMAMAP_DMA2_TIM4_CH2 DMAMAP_MAP(DMA2, DMAMUX1_TIM4_CH2) +#define DMAMUX1_TIM4_CH3 70 +#define DMAMAP_DMA1_TIM4_CH3 DMAMAP_MAP(DMA1, DMAMUX1_TIM4_CH3) +#define DMAMAP_DMA2_TIM4_CH3 DMAMAP_MAP(DMA2, DMAMUX1_TIM4_CH3) +#define DMAMUX1_TIM4_CH4 71 +#define DMAMAP_DMA1_TIM4_CH4 DMAMAP_MAP(DMA1, DMAMUX1_TIM4_CH4) +#define DMAMAP_DMA2_TIM4_CH4 DMAMAP_MAP(DMA2, DMAMUX1_TIM4_CH4) +#define DMAMUX1_TIM4_TRIG 72 +#define DMAMAP_DMA1_TIM4_TRIG DMAMAP_MAP(DMA1, DMAMUX1_TIM4_TRIG) +#define DMAMAP_DMA2_TIM4_TRIG DMAMAP_MAP(DMA2, DMAMUX1_TIM4_TRIG) +#define DMAMUX1_TIM4_UP 73 +#define DMAMAP_DMA1_TIM4_UP DMAMAP_MAP(DMA1, DMAMUX1_TIM4_UP) +#define DMAMAP_DMA2_TIM4_UP DMAMAP_MAP(DMA2, DMAMUX1_TIM4_UP) +#define DMAMUX1_USART5_RX 74 +#define DMAMAP_DMA1_USART5_RX DMAMAP_MAP(DMA1, DMAMUX1_USART5_RX) +#define DMAMAP_DMA2_USART5_RX DMAMAP_MAP(DMA2, DMAMUX1_USART5_RX) +#define DMAMUX1_USART5_TX 75 +#define DMAMAP_DMA1_USART5_TX DMAMAP_MAP(DMA1, DMAMUX1_USART5_TX) +#define DMAMAP_DMA2_USART5_TX DMAMAP_MAP(DMA2, DMAMUX1_USART5_TX) +#define DMAMUX1_USART6_RX 76 +#define DMAMAP_DMA1_USART6_RX DMAMAP_MAP(DMA1, DMAMUX1_USART6_RX) +#define DMAMAP_DMA2_USART6_RX DMAMAP_MAP(DMA2, DMAMUX1_USART6_RX) +#define DMAMUX1_USART6_TX 77 +#define DMAMAP_DMA1_USART6_TX DMAMAP_MAP(DMA1, DMAMUX1_USART6_TX) +#define DMAMAP_DMA2_USART6_TX DMAMAP_MAP(DMA2, DMAMUX1_USART6_TX) -/* TODO: ... */ +/* DMAMUX trigger input sources (Table 56, RM0444 Rev 6) */ -/* DMAP for DMA1 */ +#define DMAMUX_TRIG_EXTI0 0 +#define DMAMUX_TRIG_EXTI1 1 +#define DMAMUX_TRIG_EXTI2 2 +#define DMAMUX_TRIG_EXTI3 3 +#define DMAMUX_TRIG_EXTI4 4 +#define DMAMUX_TRIG_EXTI5 5 +#define DMAMUX_TRIG_EXTI6 6 +#define DMAMUX_TRIG_EXTI7 7 +#define DMAMUX_TRIG_EXTI8 8 +#define DMAMUX_TRIG_EXTI9 9 +#define DMAMUX_TRIG_EXTI10 10 +#define DMAMUX_TRIG_EXTI11 11 +#define DMAMUX_TRIG_EXTI12 12 +#define DMAMUX_TRIG_EXTI13 13 +#define DMAMUX_TRIG_EXTI14 14 +#define DMAMUX_TRIG_EXTI15 15 +#define DMAMUX_TRIG_EVT0 16 +#define DMAMUX_TRIG_EVT1 17 +#define DMAMUX_TRIG_EVT2 18 +#define DMAMUX_TRIG_EVT3 19 +#define DMAMUX_TRIG_LPTIM1_OUT 20 +#define DMAMUX_TRIG_LPTIM2_OUT 21 +#define DMAMUX_TRIG_TIM14_OC 22 -#define DMAMAP_DMA1_REQGEN0 DMAMAP_MAP(DMA1, DMAMUX1_REQ_GEN0) -#define DMAMAP_DMA1_REQGEN1 DMAMAP_MAP(DMA1, DMAMUX1_REQ_GEN1) -#define DMAMAP_DMA1_REQGEN2 DMAMAP_MAP(DMA1, DMAMUX1_REQ_GEN2) -#define DMAMAP_DMA1_REQGEN3 DMAMAP_MAP(DMA1, DMAMUX1_REQ_GEN3) -#define DMAMAP_DMA1_ADC1 DMAMAP_MAP(DMA1, DMAMUX1_ADC1) +/* Sync inputs use the same values as trigger inputs (Table 57) */ -/* TODO: ... */ +#define DMAMUX_SYNC_EXTI0 0 +#define DMAMUX_SYNC_EXTI1 1 +#define DMAMUX_SYNC_EXTI2 2 +#define DMAMUX_SYNC_EXTI3 3 +#define DMAMUX_SYNC_EXTI4 4 +#define DMAMUX_SYNC_EXTI5 5 +#define DMAMUX_SYNC_EXTI6 6 +#define DMAMUX_SYNC_EXTI7 7 +#define DMAMUX_SYNC_EXTI8 8 +#define DMAMUX_SYNC_EXTI9 9 +#define DMAMUX_SYNC_EXTI10 10 +#define DMAMUX_SYNC_EXTI11 11 +#define DMAMUX_SYNC_EXTI12 12 +#define DMAMUX_SYNC_EXTI13 13 +#define DMAMUX_SYNC_EXTI14 14 +#define DMAMUX_SYNC_EXTI15 15 +#define DMAMUX_SYNC_EVT0 16 +#define DMAMUX_SYNC_EVT1 17 +#define DMAMUX_SYNC_EVT2 18 +#define DMAMUX_SYNC_EVT3 19 +#define DMAMUX_SYNC_LPTIM1_OUT 20 +#define DMAMUX_SYNC_LPTIM2_OUT 21 +#define DMAMUX_SYNC_TIM14_OC 22 #endif /* __ARCH_ARM_SRC_STM32F0L0G0_HARDWARE_STM32G0_DMAMUX_H */ diff --git a/arch/arm/src/stm32f0l0g0/hardware/stm32g0_memorymap.h b/arch/arm/src/stm32f0l0g0/hardware/stm32g0_memorymap.h index df536a60d361f..595e1886b4cfa 100644 --- a/arch/arm/src/stm32f0l0g0/hardware/stm32g0_memorymap.h +++ b/arch/arm/src/stm32f0l0g0/hardware/stm32g0_memorymap.h @@ -101,7 +101,7 @@ /* AHB1 Base Addresses ******************************************************/ #define STM32_DMA1_BASE 0x40020000 /* 0x40020000-0x400203ff: DMA1 */ -#define STM32_DMAMUX_BASE 0x40020800 /* 0x40020800-0x40020bff: DMAMUX */ +#define STM32_DMAMUX1_BASE 0x40020800 /* 0x40020800-0x40020bff: DMAMUX */ #define STM32_RCC_BASE 0x40021000 /* 0x40021000-0x400213ff: Reset and Clock control RCC */ #define STM32_EXTI_BASE 0x40021800 /* 0x40021800-0x40021bff: EXTI */ #define STM32_FLASHIF_BASE 0x40022000 /* 0x40022000-0x400223ff: Flash memory interface */ diff --git a/arch/arm/src/stm32f0l0g0/hardware/stm32g0_rcc.h b/arch/arm/src/stm32f0l0g0/hardware/stm32g0_rcc.h index 659c9c28d009b..940cb9e6ba2ca 100644 --- a/arch/arm/src/stm32f0l0g0/hardware/stm32g0_rcc.h +++ b/arch/arm/src/stm32f0l0g0/hardware/stm32g0_rcc.h @@ -202,7 +202,8 @@ /* AHB peripheral reset register */ #define RCC_AHBRSTR_DMA1RST (1 << 0) /* Bit 0: DMA 1 reset */ - /* Bits 1-7: Reserved */ +#define RCC_AHBRSTR_DMA2RST (1 << 1) /* Bit 1: DMA 2 reset */ + /* Bits 2-7: Reserved */ #define RCC_AHBRSTR_MIFRST (1 << 8) /* Bit 8: Memory interface reset */ /* Bits 9-11: Reserved */ #define RCC_AHBRSTR_CRCRST (1 << 12) /* Bit 12: Memory interface reset */ @@ -265,7 +266,8 @@ /* AHB Peripheral Clock enable register */ #define RCC_AHBENR_DMA1EN (1 << 0) /* Bit 0: DMA 1 enable */ - /* Bits 1-7: Reserved */ +#define RCC_AHBENR_DMA2EN (1 << 1) /* Bit 1: DMA 2 enable */ + /* Bits 2-7: Reserved */ #define RCC_AHBENR_MIFEN (1 << 8) /* Bit 8: Memory interface enable */ /* Bits 9-11: Reserved */ #define RCC_AHBENR_CRCEN (1 << 12) /* Bit 12: Memory interface enable */ @@ -321,7 +323,8 @@ /* AHB peripheral clock enable in Sleep mode register */ #define RCC_AHBSMENR_DMA1SMEN (1 << 0) /* Bit 0: DMA 1 enable in Sleep mode */ - /* Bits 1-7: Reserved */ +#define RCC_AHBSMENR_DMA2SMEN (1 << 1) /* Bit 1: DMA 2 enable in Sleep mode */ + /* Bits 2-7: Reserved */ #define RCC_AHBSMENR_MIFSMEN (1 << 8) /* Bit 8: Memory interface enable in Sleep mode */ /* Bits 9-11: Reserved */ #define RCC_AHBSMENR_CRCSMEN (1 << 12) /* Bit 12: Memory interface enable in Sleep mode */ diff --git a/arch/arm/src/stm32f0l0g0/stm32_adc.c b/arch/arm/src/stm32f0l0g0/stm32_adc.c index 0d1dc0bd3bb82..d597cd6084296 100644 --- a/arch/arm/src/stm32f0l0g0/stm32_adc.c +++ b/arch/arm/src/stm32f0l0g0/stm32_adc.c @@ -102,23 +102,26 @@ /* Sample time default configuration */ -/* G0 support additional sample time selection 2 */ +/* C0 and G0 support additional sample time selection 2 */ -#if defined(CONFIG_STM32F0L0G0_STM32G0) +#if defined(CONFIG_STM32F0L0G0_STM32G0) || defined(CONFIG_STM32F0L0G0_STM32C0) # define ADC_HAVE_SMPR_SMP2 #endif #if defined(ADC_HAVE_DMA) || (ADC_MAX_SAMPLES == 1) -# ifdef ADC_SMPR_13p5 -# define ADC_SMP1_DEFAULT ADC_SMPR_13p5 -# define ADC_SMP2_DEFAULT ADC_SMPR_13p5 -# else +# if defined(CONFIG_ARCH_CHIP_STM32C0) || defined(CONFIG_ARCH_CHIP_STM32G0) # define ADC_SMP1_DEFAULT ADC_SMPR_12p5 # define ADC_SMP2_DEFAULT ADC_SMPR_12p5 +# else +# define ADC_SMP1_DEFAULT ADC_SMPR_13p5 # endif #else /* Slow down sampling frequency */ -# define ADC_SMP1_DEFAULT ADC_SMPR_239p5 -# define ADC_SMP2_DEFAULT ADC_SMPR_239p5 +# if defined(CONFIG_ARCH_CHIP_STM32C0) || defined(CONFIG_ARCH_CHIP_STM32G0) +# define ADC_SMP1_DEFAULT ADC_SMPR_160p5 +# define ADC_SMP2_DEFAULT ADC_SMPR_160p5 +# else +# define ADC_SMP1_DEFAULT ADC_SMPR_239p5 +# endif #endif #ifdef ADC_HAVE_SMPR_SMP2 @@ -218,12 +221,14 @@ struct stm32_dev_s uint16_t dmabatch; /* Number of conversions for DMA batch */ #endif #ifdef CONFIG_STM32F0L0G0_ADC_CHANGE_SAMPLETIME - /* Sample time selection. These bits must be written only when ADON=0. - * REVISIT: this takes too much space. We need only 3 bits per channel. - */ + /* Sample time selection. These bits must be written only when ADON=0. */ - uint8_t sample_rate[ADC_CHANNELS_NUMBER]; - uint8_t adc_channels; /* ADC channels number */ +# ifdef ADC_HAVE_SMPR_SMP2 + uint8_t sample_rate[2]; /* [0] for SMP1, [1] for SMP2 */ + uint32_t smpsel; /* ADC Sample Rate Selection Bits */ +# else + uint8_t sample_rate[1]; /* Only SMP1 is used */ +# endif #endif #ifdef ADC_HAVE_TIMER uint8_t trigger; /* Timer trigger channel: 0=CC1, 1=CC2, 2=CC3, @@ -1408,6 +1413,10 @@ static void adc_mode_cfg(struct stm32_dev_s *priv) clrbits |= ADC_CFGR1_EXTEN_MASK; setbits |= ADC_CFGR1_EXTEN_NONE; +#ifdef CONFIG_STM32F0L0G0_ADC1_CONTINUOUS + setbits |= ADC_CFGR1_CONT; +#endif + /* Set CFGR configuration */ adc_modifyreg(priv, STM32_ADC_CFGR1_OFFSET, clrbits, setbits); @@ -1437,8 +1446,33 @@ static void adc_sampletime_cfg(struct adc_dev_s *dev) /* Initialize the same sample time for each ADC. * During sample cycles channel selection bits must remain unchanged. */ - #ifdef CONFIG_STM32F0L0G0_ADC_CHANGE_SAMPLETIME + struct adc_sample_time_s time_samples = { +# ifdef STM32_ADC1_SMPR_SMP1 + .smp1 = STM32_ADC1_SMPR_SMP1, +# else + .smp1 = ADC_SMP1_DEFAULT, +# endif + +# ifdef ADC_HAVE_SMPR_SMP2 +# ifdef STM32_ADC1_SMPR_SMP2 + .smp2 = STM32_ADC1_SMPR_SMP2, +# else + .smp2 = ADC_SMP2_DEFAULT, +# endif + +# ifdef STM32_ADC1_SMPR_SMPSEL + .smpsel = STM32_ADC1_SMPR_SMPSEL +# else + .smpsel = ADC_SMPSEL_DEFAULT +# endif +# else + .smp2 = 0, + .smpsel = 0 +# endif + }; + + adc_sampletime_set((struct stm32_adc_dev_s *)dev, &time_samples); adc_sampletime_write((struct stm32_adc_dev_s *)dev); #else struct stm32_dev_s *priv = (struct stm32_dev_s *)dev->ad_priv; @@ -1448,7 +1482,7 @@ static void adc_sampletime_cfg(struct adc_dev_s *dev) setbits |= ADC_SMP1_DEFAULT << ADC_SMPR_SMP1_SHIFT; -# ifdef ADC_HAVE_SMPR_SMP2 +#ifdef ADC_HAVE_SMPR_SMP2 /* Configure sample time 2 */ setbits |= ADC_SMP2_DEFAULT << ADC_SMPR_SMP2_SHIFT; @@ -1456,12 +1490,11 @@ static void adc_sampletime_cfg(struct adc_dev_s *dev) /* Configure sample time selection */ setbits |= ADC_SMPSEL_DEFAULT << ADC_SMPR_SMPSEL_SHIFT; -# endif +#endif /* Write SMPR register */ adc_putreg(priv, STM32_ADC_SMPR_OFFSET, setbits); - #endif } @@ -1596,7 +1629,7 @@ static void adc_configure(struct adc_dev_s *dev) adc_voltreg_cfg(priv); - /* Calibrate ADC - doesn't work for now */ + /* Calibrate ADC */ adc_calibrate(priv); @@ -2717,6 +2750,7 @@ static int adc_llops_regbufregister(struct stm32_adc_dev_s *dev, } #endif /* ADC_HAVE_DMA */ +#ifdef CONFIG_STM32F0L0G0_ADC_CHANGE_SAMPLETIME /**************************************************************************** * Name: adc_sampletime_write * @@ -2729,10 +2763,19 @@ static int adc_llops_regbufregister(struct stm32_adc_dev_s *dev, * ****************************************************************************/ -#ifdef CONFIG_STM32F0L0G0_ADC_CHANGE_SAMPLETIME static void adc_sampletime_write(struct stm32_adc_dev_s *dev) { - #error TODO adc_sampletime_write + struct stm32_dev_s *priv = (struct stm32_dev_s *)dev; + uint32_t smpr = 0; + + smpr |= ((uint32_t)priv->sample_rate[0] << ADC_SMPR_SMP1_SHIFT); + +#ifdef ADC_HAVE_SMPR_SMP2 + smpr |= ((uint32_t)priv->sample_rate[1] << ADC_SMPR_SMP2_SHIFT); + smpr |= ((uint32_t)priv->smpsel << ADC_SMPR_SMPSEL_SHIFT); +#endif + + adc_putreg(priv, STM32_ADC_SMPR_OFFSET, smpr); } /**************************************************************************** @@ -2756,10 +2799,16 @@ static void adc_sampletime_write(struct stm32_adc_dev_s *dev) * ****************************************************************************/ -void adc_sampletime_set(struct stm32_adc_dev_s *dev, - struct adc_sample_time_s *time_samples) +static void adc_sampletime_set(struct stm32_adc_dev_s *dev, + struct adc_sample_time_s *time_samples) { - #error TODO adc_sampletime_write + struct stm32_dev_s *priv = (struct stm32_dev_s *)dev; + + priv->sample_rate[0] = time_samples->smp1; +#ifdef ADC_HAVE_SMPR_SMP2 + priv->sample_rate[1] = time_samples->smp2; + priv->smpsel = time_samples->smpsel; +#endif } #endif /* CONFIG_STM32F0L0G0_ADC_CHANGE_SAMPLETIME */ diff --git a/arch/arm/src/stm32f0l0g0/stm32_adc.h b/arch/arm/src/stm32f0l0g0/stm32_adc.h index 23cb4b0184222..89ac9b8da5d21 100644 --- a/arch/arm/src/stm32f0l0g0/stm32_adc.h +++ b/arch/arm/src/stm32f0l0g0/stm32_adc.h @@ -326,30 +326,11 @@ enum stm32_adc_resoluton_e #ifdef CONFIG_STM32F0L0G0_ADC_CHANGE_SAMPLETIME -/* Channel and sample time pair */ - -typedef struct adc_channel_s -{ - uint8_t channel:5; - - /* Sampling time individually for each channel. - * It differs between families - */ - - uint8_t sample_time:3; -} adc_channel_t; - -/* This structure will be used while setting channels to specified by the - * "channel-sample time" pairs' values - */ - struct adc_sample_time_s { - adc_channel_t *channel; /* Array of channels */ - uint8_t channels_nbr:5; /* Number of channels in array */ - bool all_same:1; /* All channels will get the - * same value of the sample time */ - uint8_t all_ch_sample_time:3; /* Sample time for all channels */ + uint8_t smp1; /* Sample time for channels with SMPSEL bit = 0 */ + uint8_t smp2; /* Sample time for channels with SMPSEL bit = 1 */ + uint32_t smpsel; /* Bitmask for selecting which channels use SMP2 */ }; #endif /* CONFIG_STM32F0L0G0_ADC_CHANGE_SAMPLETIME */ diff --git a/arch/arm/src/stm32f0l0g0/stm32_dma_v1mux.c b/arch/arm/src/stm32f0l0g0/stm32_dma_v1mux.c index 2f354348ba5e9..460a84fc6e486 100644 --- a/arch/arm/src/stm32f0l0g0/stm32_dma_v1mux.c +++ b/arch/arm/src/stm32f0l0g0/stm32_dma_v1mux.c @@ -51,11 +51,23 @@ #define DMA_CONTROLLERS 2 #ifdef CONFIG_STM32F0L0G0_DMA1 -# if defined(CONFIG_ARCH_CHIP_STM32C0) +# if defined(CONFIG_ARCH_CHIP_STM32C0) || \ + defined(CONFIG_STM32F0L0G0_STM32G03X) || \ + defined(CONFIG_STM32F0L0G0_STM32G041) # define DMA1_NCHAN 5 # define DMA2_NCHAN 0 +# elif defined(CONFIG_STM32F0L0G0_STM32G05X) || \ + defined(CONFIG_STM32F0L0G0_STM32G061) || \ + defined(CONFIG_STM32F0L0G0_STM32G07X) || \ + defined(CONFIG_STM32F0L0G0_STM32G081) +# define DMA1_NCHAN 7 +# define DMA2_NCHAN 0 +# elif defined(CONFIG_STM32F0L0G0_STM32G0BX) || \ + defined(CONFIG_STM32F0L0G0_STM32G0C1) +# define DMA1_NCHAN 7 +# define DMA2_NCHAN 5 # else -# error +# error "Unsupported STM32F0L0G0 subfamily" # endif #else # define DMA1_NCHAN 0 @@ -73,10 +85,20 @@ /* DMAMUX channels */ -#if defined(CONFIG_ARCH_CHIP_STM32C0) +#if defined(CONFIG_ARCH_CHIP_STM32C0) || \ + defined(CONFIG_STM32F0L0G0_STM32G03X) || \ + defined(CONFIG_STM32F0L0G0_STM32G041) # define DMAMUX_NCHANNELS 5 +#elif defined(CONFIG_STM32F0L0G0_STM32G05X) || \ + defined(CONFIG_STM32F0L0G0_STM32G061) || \ + defined(CONFIG_STM32F0L0G0_STM32G07X) || \ + defined(CONFIG_STM32F0L0G0_STM32G081) +# define DMAMUX_NCHANNELS 7 +#elif defined(CONFIG_STM32F0L0G0_STM32G0BX) || \ + defined(CONFIG_STM32F0L0G0_STM32G0C1) +# define DMAMUX_NCHANNELS 12 #else -# error +# error "Unknown chip for DMAMUX channel count" #endif /**************************************************************************** diff --git a/arch/arm/src/stm32f0l0g0/stm32g0_rcc.c b/arch/arm/src/stm32f0l0g0/stm32g0_rcc.c index 18e34d9c557d0..ca15e3a737c95 100644 --- a/arch/arm/src/stm32f0l0g0/stm32g0_rcc.c +++ b/arch/arm/src/stm32f0l0g0/stm32g0_rcc.c @@ -125,6 +125,12 @@ static inline void rcc_enableahb(void) regval |= RCC_AHBENR_DMA1EN; #endif +#ifdef CONFIG_STM32F0L0G0_DMA2 + /* DMA 1 clock enable */ + + regval |= RCC_AHBENR_DMA2EN; +#endif + #ifdef CONFIG_STM32F0L0G0_MIF /* Memory interface clock enable */ diff --git a/arch/risc-v/src/common/riscv_swint.c b/arch/risc-v/src/common/riscv_swint.c index 9ecd4c78e0ca5..7b92136d17ae1 100644 --- a/arch/risc-v/src/common/riscv_swint.c +++ b/arch/risc-v/src/common/riscv_swint.c @@ -312,10 +312,10 @@ int riscv_swint(int irq, void *context, void *arg) */ #ifdef CONFIG_DEBUG_SYSCALL_INFO - if (cmd <= SYS_switch_context) + if (regs[REG_A0] <= SYS_switch_context) { svcinfo("SWInt Return: Context switch!\n"); - up_dump_register(tcb.xcp.regs); + up_dump_register(tcb->xcp.regs); } else { diff --git a/arch/risc-v/src/qemu-rv/qemu_rv_mm_init.c b/arch/risc-v/src/qemu-rv/qemu_rv_mm_init.c index 54c7143587b3c..bc3ab73d5125b 100644 --- a/arch/risc-v/src/qemu-rv/qemu_rv_mm_init.c +++ b/arch/risc-v/src/qemu-rv/qemu_rv_mm_init.c @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -57,7 +58,8 @@ #define PGT_L2_VBASE PGT_L2_PBASE #define PGT_L1_SIZE (1024) /* Enough to map 4 GiB */ -#define PGT_L2_SIZE (3072) /* Enough to map 12 MiB */ +#define PGT_L2_SIZE (4096) /* Enough to map continuous 12 MiB, + * even unaligned */ #define SLAB_COUNT (sizeof(m_l2_pgtable) / RV_MMU_PAGE_SIZE) @@ -191,18 +193,13 @@ static uintptr_t slab_alloc(void) static void map_region(uintptr_t paddr, uintptr_t vaddr, size_t size, uint32_t mmuflags) { + uintptr_t alignaddr; uintptr_t endaddr; uintptr_t pbase; - int npages; - int i; - int j; - - /* How many pages */ - npages = (size + RV_MMU_PAGE_MASK) >> RV_MMU_PAGE_SHIFT; endaddr = vaddr + size; - for (i = 0; i < npages; i += RV_MMU_PAGE_ENTRIES) + while (vaddr < endaddr) { /* See if a mapping exists ? */ @@ -223,7 +220,8 @@ static void map_region(uintptr_t paddr, uintptr_t vaddr, size_t size, /* Then add the mappings */ - for (j = 0; j < RV_MMU_PAGE_ENTRIES && vaddr < endaddr; j++) + alignaddr = ALIGN_UP_MASK(vaddr + 1, RV_MMU_SECTION_ALIGN_MASK); + while (vaddr < alignaddr && vaddr < endaddr) { mmu_ln_setentry(KMM_PBASE_IDX, pbase, paddr, vaddr, mmuflags); paddr += KMM_PAGE_SIZE; diff --git a/arch/xtensa/src/esp32s3/esp32s3_lcd.c b/arch/xtensa/src/esp32s3/esp32s3_lcd.c index 5cf54210d80c1..bf036064202ba 100644 --- a/arch/xtensa/src/esp32s3/esp32s3_lcd.c +++ b/arch/xtensa/src/esp32s3/esp32s3_lcd.c @@ -312,8 +312,8 @@ static struct esp32s3_lcd_s g_lcd_priv; static const struct fb_videoinfo_s g_base_videoinfo = { .fmt = ESP32S3_LCD_COLOR_FMT, - .xres = CONFIG_ESP32S3_LCD_VRES, - .yres = CONFIG_ESP32S3_LCD_HRES, + .xres = CONFIG_ESP32S3_LCD_HRES, + .yres = CONFIG_ESP32S3_LCD_VRES, .nplanes = 1 }; @@ -443,7 +443,7 @@ static uint32_t esp32s3_lcd_getreg(uintptr_t address) if (esp32s3_lcd_checkreg(false, regval, address)) { - lcdinfo("%" PRIx32 " ->%" PRIx32 "\n", address, regval); + lcdinfo("%" PRIuPTR " ->%" PRIu32 "\n", address, regval); } return regval; @@ -470,7 +470,7 @@ static void esp32s3_lcd_putreg(uintptr_t address, uint32_t regval) { if (esp32s3_lcd_checkreg(true, regval, address)) { - lcdinfo("%" PRIx32 " <-%" PRIx32 "\n", address, regval); + lcdinfo("%" PRIuPTR " <-%" PRIu32 "\n", address, regval); } putreg32(regval, address); @@ -854,7 +854,7 @@ static void esp32s3_lcd_enableclk(void) clk_b = ESP32S3_LCD_CLK_RES / divisor; clk_a = CONFIG_ESP32S3_LCD_CLOCK_MHZ / divisor; - lcdinfo("divisor=%d\n", divisor); + lcdinfo("divisor= %" PRIu32 "\n", divisor); #else clk_b = clk_a = 0; #endif diff --git a/boards/Kconfig b/boards/Kconfig index 64f394f707242..13ca936f4ca2f 100644 --- a/boards/Kconfig +++ b/boards/Kconfig @@ -434,8 +434,8 @@ config ARCH_BOARD_ESP32C3_XIAO select ARCH_HAVE_BUTTONS select ARCH_HAVE_IRQBUTTONS ---help--- - The XIAO-ESP32C3 from Seeed Studio features the ESP32-C3 CPU with a RISC-V core, - supporting IEEE 802.11 b/g/n WiFi, and Bluetooth 5 (BLE) protocols. + The XIAO-ESP32C3 from Seeed Studio features the ESP32-C3 CPU with a RISC-V core, + supporting IEEE 802.11 b/g/n WiFi, and Bluetooth 5 (BLE) protocols. config ARCH_BOARD_ESP32S2_KALUGA_1 bool "Espressif ESP32-S2-Kaluga-1 V1.3" @@ -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-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 bool "Espressif ESP32-S3-EYE Board" 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 "franzininho-wifi" if ARCH_BOARD_FRANZININHO_WIFI 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-meadow" if ARCH_BOARD_ESP32S3_MEADOW default "esp32s3-lcd-ev" if ARCH_BOARD_ESP32S3_LCD_EV @@ -4720,6 +4729,9 @@ endif if ARCH_BOARD_ESP32S3_DEVKIT source "boards/xtensa/esp32s3/esp32s3-devkit/Kconfig" endif +if ARCH_BOARD_ESP32S3_8048S043 +source "boards/xtensa/esp32s3/esp32s3-8048S043/Kconfig" +endif if ARCH_BOARD_ESP32S3_EYE source "boards/xtensa/esp32s3/esp32s3-eye/Kconfig" endif diff --git a/boards/arm/stm32f0l0g0/nucleo-g0b1re/configs/adc_dma/defconfig b/boards/arm/stm32f0l0g0/nucleo-g0b1re/configs/adc_dma/defconfig new file mode 100644 index 0000000000000..9e3142018509b --- /dev/null +++ b/boards/arm/stm32f0l0g0/nucleo-g0b1re/configs/adc_dma/defconfig @@ -0,0 +1,70 @@ +# +# 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_LIBC_LONG_LONG is not set +# CONFIG_NSH_ARGCAT is not set +# CONFIG_STM32F0G0L0_USE_LEGACY_PINMAP is not set +CONFIG_ADC=y +CONFIG_ADC_FIFOSIZE=64 +CONFIG_ANALOG=y +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="nucleo-g0b1re" +CONFIG_ARCH_BOARD_NUCLEO_G0B1RE=y +CONFIG_ARCH_CHIP="stm32f0l0g0" +CONFIG_ARCH_CHIP_STM32G0=y +CONFIG_ARCH_CHIP_STM32G0B1RE=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_BOARDCTL=y +CONFIG_BOARD_LATE_INITIALIZE=y +CONFIG_BOARD_LOOPSPERMSEC=4164 +CONFIG_BUILTIN=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DISABLE_ENVIRON=y +CONFIG_DISABLE_MOUNTPOINT=y +CONFIG_DISABLE_MQUEUE=y +CONFIG_DISABLE_POSIX_TIMERS=y +CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y +CONFIG_EXAMPLES_ADC=y +CONFIG_EXAMPLES_ADC_NSAMPLES=1 +CONFIG_EXAMPLES_HELLO=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INIT_STACKSIZE=1536 +CONFIG_INTELHEX_BINARY=y +CONFIG_LINE_MAX=64 +CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6 +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=64 +CONFIG_NSH_READLINE=y +CONFIG_NUNGET_CHARS=0 +CONFIG_POSIX_SPAWN_DEFAULT_STACKSIZE=1536 +CONFIG_PTHREAD_MUTEX_UNSAFE=y +CONFIG_PTHREAD_STACK_DEFAULT=1536 +CONFIG_RAM_SIZE=147456 +CONFIG_RAM_START=0x20000000 +CONFIG_RAW_BINARY=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_WAITPID=y +CONFIG_START_DAY=19 +CONFIG_START_MONTH=5 +CONFIG_START_YEAR=2013 +CONFIG_STDIO_DISABLE_BUFFERING=y +CONFIG_STM32F0L0G0_ADC1=y +CONFIG_STM32F0L0G0_ADC1_CONTINUOUS=y +CONFIG_STM32F0L0G0_ADC1_DMA=y +CONFIG_STM32F0L0G0_ADC1_DMA_CFG=1 +CONFIG_STM32F0L0G0_ADC_CHANGE_SAMPLETIME=y +CONFIG_STM32F0L0G0_ADC_LL_OPS=y +CONFIG_STM32F0L0G0_ADC_OVERSAMPLE=y +CONFIG_STM32F0L0G0_ADC_OVSR=7 +CONFIG_STM32F0L0G0_ADC_OVSS=4 +CONFIG_STM32F0L0G0_DMA1=y +CONFIG_STM32F0L0G0_PWR=y +CONFIG_STM32F0L0G0_USART2=y +CONFIG_SYSTEM_NSH=y +CONFIG_TASK_NAME_SIZE=0 +CONFIG_USART2_SERIAL_CONSOLE=y diff --git a/boards/arm/stm32f0l0g0/nucleo-g0b1re/include/board.h b/boards/arm/stm32f0l0g0/nucleo-g0b1re/include/board.h index eb7ddb5c28f6e..1e81287481c55 100644 --- a/boards/arm/stm32f0l0g0/nucleo-g0b1re/include/board.h +++ b/boards/arm/stm32f0l0g0/nucleo-g0b1re/include/board.h @@ -210,12 +210,15 @@ /* ADC */ -#define GPIO_ADC1_IN0 (GPIO_ANALOG | GPIO_PORTA | GPIO_PIN0) +#define GPIO_ADC1_A0 GPIO_ADC1_IN0_1 +#define GPIO_ADC1_A1 GPIO_ADC1_IN1_1 +#define GPIO_ADC1_A2 GPIO_ADC1_IN4_1 +#define GPIO_ADC1_A3 GPIO_ADC1_IN9_1 /* DMA channels *************************************************************/ /* ADC */ -#define ADC1_DMA_CHAN DMACHAN_ADC1 /* DMA1_CH1 */ +#define ADC1_DMA_CHAN DMAMAP_DMA1_ADC1 #endif /* __BOARDS_ARM_STM32F0L0G0_NUCLEO_G0B1RE_INCLUDE_BOARD_H */ diff --git a/boards/arm/stm32f0l0g0/nucleo-g0b1re/src/stm32_adc.c b/boards/arm/stm32f0l0g0/nucleo-g0b1re/src/stm32_adc.c index aed55de1d91f0..e2d73a3d20797 100644 --- a/boards/arm/stm32f0l0g0/nucleo-g0b1re/src/stm32_adc.c +++ b/boards/arm/stm32f0l0g0/nucleo-g0b1re/src/stm32_adc.c @@ -46,7 +46,7 @@ /* The number of ADC channels in the conversion list */ -#define ADC1_NCHANNELS 1 +#define ADC1_NCHANNELS 4 /**************************************************************************** * Private Function Prototypes @@ -58,16 +58,22 @@ /* Identifying number of each ADC channel (even if NCHANNELS is less ) */ -static const uint8_t g_chanlist1[1] = +static const uint8_t g_chanlist1[ADC1_NCHANNELS] = { - 0 + 0, + 1, + 4, + 9 }; /* Configurations of pins used by each ADC channel */ -static const uint32_t g_pinlist1[1] = +static const uint32_t g_pinlist1[ADC1_NCHANNELS] = { - GPIO_ADC1_IN0 + GPIO_ADC1_A0, + GPIO_ADC1_A1, + GPIO_ADC1_A2, + GPIO_ADC1_A3 }; /**************************************************************************** diff --git a/boards/risc-v/qemu-rv/rv-virt/scripts/ld-nuttsbi.script b/boards/risc-v/qemu-rv/rv-virt/scripts/ld-nuttsbi.script index 7d209f460e4f6..fb1ca6cc6374e 100644 --- a/boards/risc-v/qemu-rv/rv-virt/scripts/ld-nuttsbi.script +++ b/boards/risc-v/qemu-rv/rv-virt/scripts/ld-nuttsbi.script @@ -155,6 +155,12 @@ SECTIONS _edata = . ; } + .noinit (NOLOAD) : ALIGN(4) + { + *(.noinit) + *(.noinit.*) + } > ksram + .bss : { _sbss = . ; diff --git a/fs/notify/notify.h b/boards/xtensa/esp32/common/include/esp32_board_sdmmc.h similarity index 68% rename from fs/notify/notify.h rename to boards/xtensa/esp32/common/include/esp32_board_sdmmc.h index 4016b737d7459..73117940ddee2 100644 --- a/fs/notify/notify.h +++ b/boards/xtensa/esp32/common/include/esp32_board_sdmmc.h @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/notify/notify.h + * boards/xtensa/esp32/common/include/esp32_board_sdmmc.h * * SPDX-License-Identifier: Apache-2.0 * @@ -20,41 +20,52 @@ * ****************************************************************************/ -#ifndef __FS_NOTIFY_NOTIFY_H -#define __FS_NOTIFY_NOTIFY_H +#ifndef __BOARDS_XTENSA_ESP32_COMMON_INCLUDE_ESP32_BOARD_SDMMC_H +#define __BOARDS_XTENSA_ESP32_COMMON_INCLUDE_ESP32_BOARD_SDMMC_H /**************************************************************************** * Included Files ****************************************************************************/ -#include +#include /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ +#ifndef __ASSEMBLY__ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + /**************************************************************************** - * Public Type Definitions + * Public Function Prototypes ****************************************************************************/ /**************************************************************************** - * Public Function Prototypes + * Name: board_sdmmc_initialize + * + * Description: + * Configure a SPI subsystem peripheral to communicate with SD card. + * + * Returned Value: + * Zero (OK) is returned on success; A negated errno value is returned + * to indicate the nature of any failure. + * ****************************************************************************/ -/* These are internal OS interface and are not available to applications */ - -void notify_open(FAR const char *path, int oflags); -void notify_close(FAR const char *path, int oflags); -void notify_close2(FAR struct inode *inode); -void notify_read(FAR struct file *filep); -void notify_write(FAR struct file *filep); -void notify_chstat(FAR struct file *filep); -void notify_unlink(FAR const char *path); -void notify_unmount(FAR const char *path); -void notify_mkdir(FAR const char *path); -void notify_create(FAR const char *path); -void notify_rename(FAR const char *oldpath, bool oldisdir, - FAR const char *newpath, bool newisdir); -void notify_initialize(void); +int board_sdmmc_initialize(void); +#undef EXTERN +#if defined(__cplusplus) +} #endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_XTENSA_ESP32_COMMON_INCLUDE_ESP32_BOARD_SDMMC_H */ diff --git a/boards/xtensa/esp32/common/src/Make.defs b/boards/xtensa/esp32/common/src/Make.defs index 3bf716925e3f1..a49cbf93d7187 100644 --- a/boards/xtensa/esp32/common/src/Make.defs +++ b/boards/xtensa/esp32/common/src/Make.defs @@ -170,6 +170,10 @@ ifeq ($(CONFIG_ESP_MCPWM),y) CSRCS += esp32_board_mcpwm.c endif +ifeq ($(CONFIG_MMCSD_SPI),y) + CSRCS += esp32_board_sdmmc.c +endif + DEPPATH += --dep-path src VPATH += :src CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)src diff --git a/boards/xtensa/esp32/esp32-audio-kit/src/esp32_mmcsd.c b/boards/xtensa/esp32/common/src/esp32_board_sdmmc.c similarity index 70% rename from boards/xtensa/esp32/esp32-audio-kit/src/esp32_mmcsd.c rename to boards/xtensa/esp32/common/src/esp32_board_sdmmc.c index 93705cee8faa7..1badb1fa59579 100644 --- a/boards/xtensa/esp32/esp32-audio-kit/src/esp32_mmcsd.c +++ b/boards/xtensa/esp32/common/src/esp32_board_sdmmc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/xtensa/esp32/esp32-audio-kit/src/esp32_mmcsd.c + * boards/xtensa/esp32/common/src/esp32_board_sdmmc.c * * SPDX-License-Identifier: Apache-2.0 * @@ -24,17 +24,12 @@ * Included Files ****************************************************************************/ -#include #include +#include #include #include -#include -#include -#include -#include #include "esp32_spi.h" -#include "esp32-audio-kit.h" /**************************************************************************** * Pre-processor Definitions @@ -56,31 +51,43 @@ * Name: esp32_mmcsd_initialize * * Description: - * Initialize SPI-based SD card and card detect thread. + * Configure a SPI subsystem peripheral to communicate with SD card. + * + * Returned Value: + * Zero (OK) is returned on success; A negated errno value is returned + * to indicate the nature of any failure. + * ****************************************************************************/ -int esp32_mmcsd_initialize(int minor) +int board_sdmmc_initialize(void) { struct spi_dev_s *spi; - int rv; + int ret; - mcinfo("INFO: Initializing mmcsd card\n"); + syslog(LOG_INFO, "INFO: init MMC/SD slot %d on SPI%d: /dev/mmcsd%d\n", + CONFIG_NSH_MMCSDSLOTNO, CONFIG_NSH_MMCSDSPIPORTNO, + CONFIG_NSH_MMCSDMINOR); spi = esp32_spibus_initialize(CONFIG_NSH_MMCSDSPIPORTNO); + if (spi == NULL) { - mcerr("ERROR: Failed to initialize SPI port %d\n", 2); + syslog(LOG_ERR, "ERROR: failed to initialize SPI%d.\n", + CONFIG_NSH_MMCSDSPIPORTNO); return -ENODEV; } - rv = mmcsd_spislotinitialize(minor, 0, spi); - if (rv < 0) + /* Mounts to /dev/mmcsdN where N in the minor number */ + + ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, + CONFIG_NSH_MMCSDSLOTNO, spi); + if (ret < 0) { - mcerr("ERROR: Failed to bind SPI port %d to SD slot %d\n", - 2, 0); - return rv; + syslog(LOG_ERR, "ERROR: failed to bind SPI%d to SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); + return ret; } - spiinfo("INFO: mmcsd card has been initialized successfully\n"); + syslog(LOG_INFO, "INFO: MMCSD initialized\n"); return OK; } diff --git a/boards/xtensa/esp32/esp32-audio-kit/src/Make.defs b/boards/xtensa/esp32/esp32-audio-kit/src/Make.defs index e5f9f0f1a4ad9..08b0e170c4e3b 100644 --- a/boards/xtensa/esp32/esp32-audio-kit/src/Make.defs +++ b/boards/xtensa/esp32/esp32-audio-kit/src/Make.defs @@ -33,10 +33,6 @@ CSRCS += esp32_reset.c endif endif -ifeq ($(CONFIG_MMCSD),y) -CSRCS += esp32_mmcsd.c -endif - ifeq ($(CONFIG_DEV_GPIO),y) CSRCS += esp32_gpio.c endif @@ -48,4 +44,3 @@ endif DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board - diff --git a/boards/xtensa/esp32/esp32-audio-kit/src/esp32-audio-kit.h b/boards/xtensa/esp32/esp32-audio-kit/src/esp32-audio-kit.h index 1ecd025e3a4aa..a042aa708dd85 100644 --- a/boards/xtensa/esp32/esp32-audio-kit/src/esp32-audio-kit.h +++ b/boards/xtensa/esp32/esp32-audio-kit/src/esp32-audio-kit.h @@ -152,16 +152,6 @@ int esp32_es8388_initialize(int i2c_port, uint8_t i2c_addr, int i2c_freq, int board_i2sdev_initialize(int port); #endif -/**************************************************************************** - * Name: esp32_mmcsd_initialize - * - * Description: - * Initialize SPI-based SD card and card detect thread. - * - ****************************************************************************/ - -int esp32_mmcsd_initialize(int minor); - /**************************************************************************** * Name: esp32_spiflash_init * diff --git a/boards/xtensa/esp32/esp32-audio-kit/src/esp32_bringup.c b/boards/xtensa/esp32/esp32-audio-kit/src/esp32_bringup.c index 4f5b71ddcae9b..50b11c22bb860 100644 --- a/boards/xtensa/esp32/esp32-audio-kit/src/esp32_bringup.c +++ b/boards/xtensa/esp32/esp32-audio-kit/src/esp32_bringup.c @@ -108,6 +108,10 @@ # include "esp32_lcd_backpack.h" #endif +#ifdef CONFIG_MMCSD_SPI +# include "esp32_board_sdmmc.h" +#endif + #include "esp32-audio-kit.h" /**************************************************************************** @@ -172,8 +176,8 @@ int esp32_bringup(void) } #endif -#ifdef CONFIG_MMCSD - ret = esp32_mmcsd_initialize(0); +#ifdef CONFIG_MMCSD_SPI + ret = board_sdmmc_initialize(); if (ret < 0) { syslog(LOG_ERR, "Failed to initialize SD slot: %d\n", ret); diff --git a/boards/xtensa/esp32/esp32-devkitc/configs/sdmmc_spi/defconfig b/boards/xtensa/esp32/esp32-devkitc/configs/sdmmc_spi/defconfig new file mode 100644 index 0000000000000..1c0f2271f1eb3 --- /dev/null +++ b/boards/xtensa/esp32/esp32-devkitc/configs/sdmmc_spi/defconfig @@ -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_ARCH_LEDS is not set +# CONFIG_ESP32_SPI3_DMA is not set +# CONFIG_MMCSD_HAVE_CARDDETECT is not set +# CONFIG_MMCSD_HAVE_WRITEPROTECT is not set +# CONFIG_NSH_ARGCAT is not set +# CONFIG_NSH_CMDOPT_HEXDUMP is not set +# CONFIG_SPI_CALLBACK is not set +# CONFIG_SPI_EXCHANGE is not set +CONFIG_ARCH="xtensa" +CONFIG_ARCH_BOARD="esp32-devkitc" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ESP32_DEVKITC=y +CONFIG_ARCH_CHIP="esp32" +CONFIG_ARCH_CHIP_ESP32=y +CONFIG_ARCH_CHIP_ESP32WROVER=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARCH_XTENSA=y +CONFIG_BOARD_LOOPSPERMSEC=16717 +CONFIG_BUILTIN=y +CONFIG_ESP32_SPI3=y +CONFIG_ESP32_UART0=y +CONFIG_FAT_LCNAMES=y +CONFIG_FAT_LFN=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=y +CONFIG_MM_REGIONS=3 +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_MMCSDSPIPORTNO=3 +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 diff --git a/boards/xtensa/esp32/esp32-devkitc/src/Make.defs b/boards/xtensa/esp32/esp32-devkitc/src/Make.defs index 1c9f6f8cd7efa..16b4cddaa6689 100644 --- a/boards/xtensa/esp32/esp32-devkitc/src/Make.defs +++ b/boards/xtensa/esp32/esp32-devkitc/src/Make.defs @@ -29,10 +29,6 @@ CSRCS += esp32_reset.c endif endif -ifeq ($(CONFIG_MMCSD),y) -CSRCS += esp32_mmcsd.c -endif - ifeq ($(CONFIG_DEV_GPIO),y) CSRCS += esp32_gpio.c endif diff --git a/boards/xtensa/esp32/esp32-devkitc/src/esp32-devkitc.h b/boards/xtensa/esp32/esp32-devkitc/src/esp32-devkitc.h index aa4399f0cfb8e..cb3aa58609f66 100644 --- a/boards/xtensa/esp32/esp32-devkitc/src/esp32-devkitc.h +++ b/boards/xtensa/esp32/esp32-devkitc/src/esp32-devkitc.h @@ -111,15 +111,6 @@ int esp32_bringup(void); -/**************************************************************************** - * Name: esp32_mmcsd_initialize - * - * Description: - * Initialize SPI-based SD card and card detect thread. - ****************************************************************************/ - -int esp32_mmcsd_initialize(int minor); - /**************************************************************************** * Name: esp32_gpio_init ****************************************************************************/ diff --git a/boards/xtensa/esp32/esp32-devkitc/src/esp32_bringup.c b/boards/xtensa/esp32/esp32-devkitc/src/esp32_bringup.c index bc6b7741644d3..a2baea659d8cb 100644 --- a/boards/xtensa/esp32/esp32-devkitc/src/esp32_bringup.c +++ b/boards/xtensa/esp32/esp32-devkitc/src/esp32_bringup.c @@ -191,6 +191,10 @@ # include "esp32_board_adc.h" #endif +#ifdef CONFIG_MMCSD_SPI +# include "esp32_board_sdmmc.h" +#endif + #include "esp32-devkitc.h" /**************************************************************************** @@ -272,8 +276,8 @@ int esp32_bringup(void) } #endif -#ifdef CONFIG_MMCSD - ret = esp32_mmcsd_initialize(0); +#ifdef CONFIG_MMCSD_SPI + ret = board_sdmmc_initialize(); if (ret < 0) { syslog(LOG_ERR, "Failed to initialize SD slot: %d\n", ret); diff --git a/boards/xtensa/esp32/esp32-ethernet-kit/src/Make.defs b/boards/xtensa/esp32/esp32-ethernet-kit/src/Make.defs index ffaac61c1db51..863d57f96cd98 100644 --- a/boards/xtensa/esp32/esp32-ethernet-kit/src/Make.defs +++ b/boards/xtensa/esp32/esp32-ethernet-kit/src/Make.defs @@ -29,10 +29,6 @@ CSRCS += esp32_reset.c endif endif -ifeq ($(CONFIG_MMCSD),y) -CSRCS += esp32_mmcsd.c -endif - ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += esp32_buttons.c endif @@ -40,4 +36,3 @@ endif DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board - diff --git a/boards/xtensa/esp32/esp32-ethernet-kit/src/esp32-ethernet-kit.h b/boards/xtensa/esp32/esp32-ethernet-kit/src/esp32-ethernet-kit.h index 0a880131ca8dc..288914677291a 100644 --- a/boards/xtensa/esp32/esp32-ethernet-kit/src/esp32-ethernet-kit.h +++ b/boards/xtensa/esp32/esp32-ethernet-kit/src/esp32-ethernet-kit.h @@ -83,15 +83,6 @@ int esp32_bringup(void); -/**************************************************************************** - * Name: esp32_mmcsd_initialize - * - * Description: - * Initialize SPI-based SD card and card detect thread. - ****************************************************************************/ - -int esp32_mmcsd_initialize(int minor); - /**************************************************************************** * Name: esp32_spiflash_init * diff --git a/boards/xtensa/esp32/esp32-ethernet-kit/src/esp32_bringup.c b/boards/xtensa/esp32/esp32-ethernet-kit/src/esp32_bringup.c index fea11679dec76..96511de395818 100644 --- a/boards/xtensa/esp32/esp32-ethernet-kit/src/esp32_bringup.c +++ b/boards/xtensa/esp32/esp32-ethernet-kit/src/esp32_bringup.c @@ -79,6 +79,10 @@ # include "esp32_rtc_lowerhalf.h" #endif +#ifdef CONFIG_MMCSD_SPI +# include "esp32_board_sdmmc.h" +#endif + #include "esp32-ethernet-kit.h" /**************************************************************************** @@ -133,8 +137,8 @@ int esp32_bringup(void) } #endif -#ifdef CONFIG_MMCSD - ret = esp32_mmcsd_initialize(0); +#ifdef CONFIG_MMCSD_SPI + ret = board_sdmmc_initialize(); if (ret < 0) { syslog(LOG_ERR, "Failed to initialize SD slot: %d\n", ret); diff --git a/boards/xtensa/esp32/esp32-lyrat/configs/mmcsdspi/defconfig b/boards/xtensa/esp32/esp32-lyrat/configs/sdmmc_spi/defconfig similarity index 92% rename from boards/xtensa/esp32/esp32-lyrat/configs/mmcsdspi/defconfig rename to boards/xtensa/esp32/esp32-lyrat/configs/sdmmc_spi/defconfig index 70072b6cb2ba8..510fc0058715c 100644 --- a/boards/xtensa/esp32/esp32-lyrat/configs/mmcsdspi/defconfig +++ b/boards/xtensa/esp32/esp32-lyrat/configs/sdmmc_spi/defconfig @@ -24,11 +24,6 @@ CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH_XTENSA=y CONFIG_BOARD_LOOPSPERMSEC=16717 CONFIG_BUILTIN=y -CONFIG_DEBUG_FEATURES=y -CONFIG_DEBUG_MEMCARD=y -CONFIG_DEBUG_MEMCARD_ERROR=y -CONFIG_DEBUG_MEMCARD_INFO=y -CONFIG_DEBUG_MEMCARD_WARN=y CONFIG_ESP32_SPI2=y CONFIG_ESP32_SPI2_CSPIN=13 CONFIG_ESP32_SPI2_MISOPIN=2 diff --git a/boards/xtensa/esp32/esp32-lyrat/src/Make.defs b/boards/xtensa/esp32/esp32-lyrat/src/Make.defs index addad5fd72b37..151ba475de3d8 100644 --- a/boards/xtensa/esp32/esp32-lyrat/src/Make.defs +++ b/boards/xtensa/esp32/esp32-lyrat/src/Make.defs @@ -33,10 +33,6 @@ CSRCS += esp32_reset.c endif endif -ifeq ($(CONFIG_MMCSD),y) -CSRCS += esp32_mmcsd.c -endif - ifeq ($(CONFIG_DEV_GPIO),y) CSRCS += esp32_gpio.c endif @@ -48,4 +44,3 @@ endif DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board - diff --git a/boards/xtensa/esp32/esp32-lyrat/src/esp32-lyrat.h b/boards/xtensa/esp32/esp32-lyrat/src/esp32-lyrat.h index ff95d9ba262d4..dad3cc92e24e2 100644 --- a/boards/xtensa/esp32/esp32-lyrat/src/esp32-lyrat.h +++ b/boards/xtensa/esp32/esp32-lyrat/src/esp32-lyrat.h @@ -148,16 +148,6 @@ int esp32_es8388_initialize(int i2c_port, uint8_t i2c_addr, int i2c_freq, int board_i2sdev_initialize(int port); #endif -/**************************************************************************** - * Name: esp32_mmcsd_initialize - * - * Description: - * Initialize SPI-based SD card and card detect thread. - * - ****************************************************************************/ - -int esp32_mmcsd_initialize(int minor); - /**************************************************************************** * Name: esp32_spiflash_init * diff --git a/boards/xtensa/esp32/esp32-lyrat/src/esp32_bringup.c b/boards/xtensa/esp32/esp32-lyrat/src/esp32_bringup.c index 4efe5397ec755..42e3bee9990e1 100644 --- a/boards/xtensa/esp32/esp32-lyrat/src/esp32_bringup.c +++ b/boards/xtensa/esp32/esp32-lyrat/src/esp32_bringup.c @@ -109,6 +109,10 @@ # include "esp32_lcd_backpack.h" #endif +#ifdef CONFIG_MMCSD_SPI +# include "esp32_board_sdmmc.h" +#endif + #include "esp32-lyrat.h" /**************************************************************************** @@ -173,8 +177,8 @@ int esp32_bringup(void) } #endif -#ifdef CONFIG_MMCSD - ret = esp32_mmcsd_initialize(0); +#ifdef CONFIG_MMCSD_SPI + ret = board_sdmmc_initialize(); if (ret < 0) { syslog(LOG_ERR, "Failed to initialize SD slot: %d\n", ret); diff --git a/boards/xtensa/esp32/esp32-sparrow-kit/src/Make.defs b/boards/xtensa/esp32/esp32-sparrow-kit/src/Make.defs index 1b1dcfafd5589..ebcaac6be4a64 100644 --- a/boards/xtensa/esp32/esp32-sparrow-kit/src/Make.defs +++ b/boards/xtensa/esp32/esp32-sparrow-kit/src/Make.defs @@ -35,10 +35,6 @@ CSRCS += esp32_reset.c endif endif -ifeq ($(CONFIG_MMCSD),y) -CSRCS += esp32_mmcsd.c -endif - ifeq ($(CONFIG_DEV_GPIO),y) CSRCS += esp32_gpio.c endif diff --git a/boards/xtensa/esp32/esp32-sparrow-kit/src/esp32-sparrow-kit.h b/boards/xtensa/esp32/esp32-sparrow-kit/src/esp32-sparrow-kit.h index 61ab018c68471..c73afcf32d91a 100644 --- a/boards/xtensa/esp32/esp32-sparrow-kit/src/esp32-sparrow-kit.h +++ b/boards/xtensa/esp32/esp32-sparrow-kit/src/esp32-sparrow-kit.h @@ -89,16 +89,6 @@ int esp32_bringup(void); -/**************************************************************************** - * Name: esp32_mmcsd_initialize - * - * Description: - * Initialize SPI-based SD card and card detect thread. - * - ****************************************************************************/ - -int esp32_mmcsd_initialize(int minor); - /**************************************************************************** * Name: esp32_spiflash_init * diff --git a/boards/xtensa/esp32/esp32-sparrow-kit/src/esp32_bringup.c b/boards/xtensa/esp32/esp32-sparrow-kit/src/esp32_bringup.c index a7a404f3562b9..593ba16795b20 100644 --- a/boards/xtensa/esp32/esp32-sparrow-kit/src/esp32_bringup.c +++ b/boards/xtensa/esp32/esp32-sparrow-kit/src/esp32_bringup.c @@ -120,6 +120,10 @@ # include "esp32_lcd_backpack.h" #endif +#ifdef CONFIG_MMCSD_SPI +# include "esp32_board_sdmmc.h" +#endif + #include "esp32-sparrow-kit.h" /**************************************************************************** @@ -184,8 +188,8 @@ int esp32_bringup(void) } #endif -#ifdef CONFIG_MMCSD - ret = esp32_mmcsd_initialize(0); +#ifdef CONFIG_MMCSD_SPI + ret = board_sdmmc_initialize(); if (ret < 0) { syslog(LOG_ERR, "Failed to initialize SD slot: %d\n", ret); diff --git a/boards/xtensa/esp32/esp32-sparrow-kit/src/esp32_mmcsd.c b/boards/xtensa/esp32/esp32-sparrow-kit/src/esp32_mmcsd.c deleted file mode 100644 index 47f224f6637a3..0000000000000 --- a/boards/xtensa/esp32/esp32-sparrow-kit/src/esp32_mmcsd.c +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** - * boards/xtensa/esp32/esp32-sparrow-kit/src/esp32_mmcsd.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 -#include -#include -#include -#include -#include -#include -#include - -#include "esp32_spi.h" -#include "esp32-sparrow-kit.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: esp32_mmcsd_initialize - * - * Description: - * Initialize SPI-based SD card and card detect thread. - ****************************************************************************/ - -int esp32_mmcsd_initialize(int minor) -{ - struct spi_dev_s *spi; - int rv; - - mcinfo("INFO: Initializing mmcsd card\n"); - - spi = esp32_spibus_initialize(CONFIG_NSH_MMCSDSPIPORTNO); - if (spi == NULL) - { - mcerr("ERROR: Failed to initialize SPI port %d\n", 2); - return -ENODEV; - } - - rv = mmcsd_spislotinitialize(minor, 0, spi); - if (rv < 0) - { - mcerr("ERROR: Failed to bind SPI port %d to SD slot %d\n", - 2, 0); - return rv; - } - - spiinfo("INFO: mmcsd card has been initialized successfully\n"); - return OK; -} diff --git a/boards/xtensa/esp32/esp32-wrover-kit/configs/mmcsdspi/defconfig b/boards/xtensa/esp32/esp32-wrover-kit/configs/sdmmc_spi/defconfig similarity index 92% rename from boards/xtensa/esp32/esp32-wrover-kit/configs/mmcsdspi/defconfig rename to boards/xtensa/esp32/esp32-wrover-kit/configs/sdmmc_spi/defconfig index cd0619d808e4a..959d03808656b 100644 --- a/boards/xtensa/esp32/esp32-wrover-kit/configs/mmcsdspi/defconfig +++ b/boards/xtensa/esp32/esp32-wrover-kit/configs/sdmmc_spi/defconfig @@ -24,11 +24,6 @@ CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH_XTENSA=y CONFIG_BOARD_LOOPSPERMSEC=16717 CONFIG_BUILTIN=y -CONFIG_DEBUG_FEATURES=y -CONFIG_DEBUG_MEMCARD=y -CONFIG_DEBUG_MEMCARD_ERROR=y -CONFIG_DEBUG_MEMCARD_INFO=y -CONFIG_DEBUG_MEMCARD_WARN=y CONFIG_ESP32_SPI2=y CONFIG_ESP32_SPI2_CSPIN=13 CONFIG_ESP32_SPI2_MISOPIN=2 diff --git a/boards/xtensa/esp32/esp32-wrover-kit/src/Make.defs b/boards/xtensa/esp32/esp32-wrover-kit/src/Make.defs index ab2bf6444edf5..1b50c05b12d52 100644 --- a/boards/xtensa/esp32/esp32-wrover-kit/src/Make.defs +++ b/boards/xtensa/esp32/esp32-wrover-kit/src/Make.defs @@ -35,10 +35,6 @@ CSRCS += esp32_reset.c endif endif -ifeq ($(CONFIG_MMCSD),y) -CSRCS += esp32_mmcsd.c -endif - ifeq ($(CONFIG_DEV_GPIO),y) CSRCS += esp32_gpio.c endif @@ -50,4 +46,3 @@ endif DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board - diff --git a/boards/xtensa/esp32/esp32-wrover-kit/src/esp32-wrover-kit.h b/boards/xtensa/esp32/esp32-wrover-kit/src/esp32-wrover-kit.h index aea94dc404731..862cf630fedd1 100644 --- a/boards/xtensa/esp32/esp32-wrover-kit/src/esp32-wrover-kit.h +++ b/boards/xtensa/esp32/esp32-wrover-kit/src/esp32-wrover-kit.h @@ -92,16 +92,6 @@ int esp32_bringup(void); -/**************************************************************************** - * Name: esp32_mmcsd_initialize - * - * Description: - * Initialize SPI-based SD card and card detect thread. - * - ****************************************************************************/ - -int esp32_mmcsd_initialize(int minor); - /**************************************************************************** * Name: esp32_spiflash_init * diff --git a/boards/xtensa/esp32/esp32-wrover-kit/src/esp32_bringup.c b/boards/xtensa/esp32/esp32-wrover-kit/src/esp32_bringup.c index 844284493e21d..65d84ec9b47d8 100644 --- a/boards/xtensa/esp32/esp32-wrover-kit/src/esp32_bringup.c +++ b/boards/xtensa/esp32/esp32-wrover-kit/src/esp32_bringup.c @@ -108,6 +108,10 @@ # include "esp32_zerocross.h" #endif +#ifdef CONFIG_MMCSD_SPI +# include "esp32_board_sdmmc.h" +#endif + #include "esp32-wrover-kit.h" /**************************************************************************** @@ -172,8 +176,8 @@ int esp32_bringup(void) } #endif -#ifdef CONFIG_MMCSD - ret = esp32_mmcsd_initialize(0); +#ifdef CONFIG_MMCSD_SPI + ret = board_sdmmc_initialize(); if (ret < 0) { syslog(LOG_ERR, "Failed to initialize SD slot: %d\n", ret); diff --git a/boards/xtensa/esp32/esp32-wrover-kit/src/esp32_mmcsd.c b/boards/xtensa/esp32/esp32-wrover-kit/src/esp32_mmcsd.c deleted file mode 100644 index c561908e50350..0000000000000 --- a/boards/xtensa/esp32/esp32-wrover-kit/src/esp32_mmcsd.c +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** - * boards/xtensa/esp32/esp32-wrover-kit/src/esp32_mmcsd.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 -#include -#include -#include -#include -#include -#include -#include - -#include "esp32_spi.h" -#include "esp32-wrover-kit.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: esp32_mmcsd_initialize - * - * Description: - * Initialize SPI-based SD card and card detect thread. - ****************************************************************************/ - -int esp32_mmcsd_initialize(int minor) -{ - struct spi_dev_s *spi; - int rv; - - mcinfo("INFO: Initializing mmcsd card\n"); - - spi = esp32_spibus_initialize(CONFIG_NSH_MMCSDSPIPORTNO); - if (spi == NULL) - { - mcerr("ERROR: Failed to initialize SPI port %d\n", 2); - return -ENODEV; - } - - rv = mmcsd_spislotinitialize(minor, 0, spi); - if (rv < 0) - { - mcerr("ERROR: Failed to bind SPI port %d to SD slot %d\n", - 2, 0); - return rv; - } - - spiinfo("INFO: mmcsd card has been initialized successfully\n"); - return OK; -} diff --git a/boards/xtensa/esp32/ttgo_eink5_v2/src/Make.defs b/boards/xtensa/esp32/ttgo_eink5_v2/src/Make.defs index 15527116f0b18..967db5dfa7ed8 100644 --- a/boards/xtensa/esp32/ttgo_eink5_v2/src/Make.defs +++ b/boards/xtensa/esp32/ttgo_eink5_v2/src/Make.defs @@ -29,10 +29,6 @@ CSRCS += esp32_reset.c endif endif -ifeq ($(CONFIG_MMCSD),y) -CSRCS += esp32_mmcsd.c -endif - ifeq ($(CONFIG_DEV_GPIO),y) CSRCS += esp32_gpio.c endif @@ -56,4 +52,3 @@ endif DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board - diff --git a/boards/xtensa/esp32/ttgo_eink5_v2/src/esp32_bringup.c b/boards/xtensa/esp32/ttgo_eink5_v2/src/esp32_bringup.c index d72fdfbd01a45..747840629a7c8 100644 --- a/boards/xtensa/esp32/ttgo_eink5_v2/src/esp32_bringup.c +++ b/boards/xtensa/esp32/ttgo_eink5_v2/src/esp32_bringup.c @@ -135,6 +135,10 @@ # include "esp32_lcd_backpack.h" #endif +#ifdef CONFIG_MMCSD_SPI +# include "esp32_board_sdmmc.h" +#endif + #include "ttgo_eink5_v2.h" /**************************************************************************** @@ -222,8 +226,8 @@ int esp32_bringup(void) } #endif -#ifdef CONFIG_MMCSD - ret = esp32_mmcsd_initialize(0); +#ifdef CONFIG_MMCSD_SPI + ret = board_sdmmc_initialize(); if (ret < 0) { syslog(LOG_ERR, "Failed to initialize SD slot: %d\n", ret); diff --git a/boards/xtensa/esp32/ttgo_eink5_v2/src/ttgo_eink5_v2.h b/boards/xtensa/esp32/ttgo_eink5_v2/src/ttgo_eink5_v2.h index c3eeb27942251..b8033d050f5f5 100644 --- a/boards/xtensa/esp32/ttgo_eink5_v2/src/ttgo_eink5_v2.h +++ b/boards/xtensa/esp32/ttgo_eink5_v2/src/ttgo_eink5_v2.h @@ -100,15 +100,6 @@ int esp32_bringup(void); -/**************************************************************************** - * Name: esp32_mmcsd_initialize - * - * Description: - * Initialize SPI-based SD card and card detect thread. - ****************************************************************************/ - -int esp32_mmcsd_initialize(int minor); - /**************************************************************************** * Name: esp32_gpio_init ****************************************************************************/ diff --git a/boards/xtensa/esp32/ttgo_t_display_esp32/src/Make.defs b/boards/xtensa/esp32/ttgo_t_display_esp32/src/Make.defs index e5f3d24f8bd72..722539876db30 100644 --- a/boards/xtensa/esp32/ttgo_t_display_esp32/src/Make.defs +++ b/boards/xtensa/esp32/ttgo_t_display_esp32/src/Make.defs @@ -29,10 +29,6 @@ CSRCS += esp32_reset.c endif endif -ifeq ($(CONFIG_MMCSD),y) -CSRCS += esp32_mmcsd.c -endif - ifeq ($(CONFIG_DEV_GPIO),y) CSRCS += esp32_gpio.c endif @@ -56,4 +52,3 @@ endif DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board - diff --git a/boards/xtensa/esp32/ttgo_t_display_esp32/src/esp32_bringup.c b/boards/xtensa/esp32/ttgo_t_display_esp32/src/esp32_bringup.c index b986a6ce97f51..48a0272e2131f 100644 --- a/boards/xtensa/esp32/ttgo_t_display_esp32/src/esp32_bringup.c +++ b/boards/xtensa/esp32/ttgo_t_display_esp32/src/esp32_bringup.c @@ -144,6 +144,10 @@ # include "esp32_lcd_backpack.h" #endif +#ifdef CONFIG_MMCSD_SPI +# include "esp32_board_sdmmc.h" +#endif + #include "ttgo_t_display_esp32.h" /**************************************************************************** @@ -225,8 +229,8 @@ int esp32_bringup(void) } #endif -#ifdef CONFIG_MMCSD - ret = esp32_mmcsd_initialize(0); +#ifdef CONFIG_MMCSD_SPI + ret = board_sdmmc_initialize(); if (ret < 0) { syslog(LOG_ERR, "Failed to initialize SD slot: %d\n", ret); diff --git a/boards/xtensa/esp32/ttgo_t_display_esp32/src/esp32_mmcsd.c b/boards/xtensa/esp32/ttgo_t_display_esp32/src/esp32_mmcsd.c deleted file mode 100644 index 39683322cfe65..0000000000000 --- a/boards/xtensa/esp32/ttgo_t_display_esp32/src/esp32_mmcsd.c +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** - * boards/xtensa/esp32/ttgo_t_display_esp32/src/esp32_mmcsd.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 -#include -#include -#include -#include -#include -#include -#include - -#include "esp32_spi.h" -#include "ttgo_t_display_esp32.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: esp32_mmcsd_initialize - * - * Description: - * Initialize SPI-based SD card and card detect thread. - ****************************************************************************/ - -int esp32_mmcsd_initialize(int minor) -{ - struct spi_dev_s *spi; - int rv; - - mcinfo("INFO: Initializing mmcsd card\n"); - - spi = esp32_spibus_initialize(CONFIG_NSH_MMCSDSPIPORTNO); - if (spi == NULL) - { - mcerr("ERROR: Failed to initialize SPI port %d\n", 2); - return -ENODEV; - } - - rv = mmcsd_spislotinitialize(minor, 0, spi); - if (rv < 0) - { - mcerr("ERROR: Failed to bind SPI port %d to SD slot %d\n", - 2, 0); - return rv; - } - - spiinfo("INFO: mmcsd card has been initialized successfully\n"); - return OK; -} diff --git a/boards/xtensa/esp32/ttgo_t_display_esp32/src/ttgo_t_display_esp32.h b/boards/xtensa/esp32/ttgo_t_display_esp32/src/ttgo_t_display_esp32.h index 78736d2b1f868..f9b6a675c90e3 100644 --- a/boards/xtensa/esp32/ttgo_t_display_esp32/src/ttgo_t_display_esp32.h +++ b/boards/xtensa/esp32/ttgo_t_display_esp32/src/ttgo_t_display_esp32.h @@ -94,15 +94,6 @@ int esp32_bringup(void); -/**************************************************************************** - * Name: esp32_mmcsd_initialize - * - * Description: - * Initialize SPI-based SD card and card detect thread. - ****************************************************************************/ - -int esp32_mmcsd_initialize(int minor); - /**************************************************************************** * Name: esp32_gpio_init ****************************************************************************/ diff --git a/boards/xtensa/esp32s2/common/include/esp32s2_board_sdmmc.h b/boards/xtensa/esp32s2/common/include/esp32s2_board_sdmmc.h new file mode 100644 index 0000000000000..851a297d27c48 --- /dev/null +++ b/boards/xtensa/esp32s2/common/include/esp32s2_board_sdmmc.h @@ -0,0 +1,74 @@ +/**************************************************************************** + * boards/xtensa/esp32s2/common/include/esp32s2_board_sdmmc.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_ESP32S2_COMMON_INCLUDE_ESP32S2_BOARD_SDMMC_H +#define __BOARDS_XTENSA_ESP32S2_COMMON_INCLUDE_ESP32S2_BOARD_SDMMC_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: board_sdmmc_initialize + * + * Description: + * Initialize SPI-based SD card. + * + * Input Parameters: + * None. + * + * Returned Value: + * Zero (OK) is returned on success; A negated errno value is returned + * to indicate the nature of any failure. + * + ****************************************************************************/ + +int board_sdmmc_initialize(void); + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_XTENSA_ESP32S2_COMMON_INCLUDE_ESP32S2_BOARD_SDMMC_H */ diff --git a/boards/xtensa/esp32s2/common/src/Make.defs b/boards/xtensa/esp32s2/common/src/Make.defs index ad51dfd7a27d0..359fba5fed514 100644 --- a/boards/xtensa/esp32s2/common/src/Make.defs +++ b/boards/xtensa/esp32s2/common/src/Make.defs @@ -86,6 +86,10 @@ ifeq ($(CONFIG_ESP_PCNT),y) CSRCS += esp32s2_board_pcnt.c endif +ifeq ($(CONFIG_MMCSD_SPI), y) + CSRCS += esp32s2_board_sdmmc.c +endif + ifeq ($(CONFIG_ESP32S2_TWAI)$(CONFIG_ARCH_BUTTONS),y) CHIP_SERIES = $(patsubst "%",%,$(CONFIG_ESPRESSIF_CHIP_SERIES)) CHIPHALDIR = $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)chip$(DELIM)esp-hal-3rdparty diff --git a/boards/xtensa/esp32/esp32-devkitc/src/esp32_mmcsd.c b/boards/xtensa/esp32s2/common/src/esp32s2_board_sdmmc.c similarity index 68% rename from boards/xtensa/esp32/esp32-devkitc/src/esp32_mmcsd.c rename to boards/xtensa/esp32s2/common/src/esp32s2_board_sdmmc.c index 8feb2dda3aa2d..d92a9b8325f39 100644 --- a/boards/xtensa/esp32/esp32-devkitc/src/esp32_mmcsd.c +++ b/boards/xtensa/esp32s2/common/src/esp32s2_board_sdmmc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/xtensa/esp32/esp32-devkitc/src/esp32_mmcsd.c + * boards/xtensa/esp32s2/common/src/esp32s2_board_sdmmc.c * * SPDX-License-Identifier: Apache-2.0 * @@ -24,17 +24,12 @@ * Included Files ****************************************************************************/ -#include #include +#include #include #include -#include -#include -#include -#include -#include "esp32_spi.h" -#include "esp32-devkitc.h" +#include "esp32s2_spi.h" /**************************************************************************** * Pre-processor Definitions @@ -56,31 +51,43 @@ * Name: esp32_mmcsd_initialize * * Description: - * Initialize SPI-based SD card and card detect thread. + * Configure a SPI subsystem peripheral to communicate with SD card. + * + * Returned Value: + * Zero (OK) is returned on success; A negated errno value is returned + * to indicate the nature of any failure. + * ****************************************************************************/ -int esp32_mmcsd_initialize(int minor) +int board_sdmmc_initialize(void) { struct spi_dev_s *spi; - int rv; + int ret; - mcinfo("INFO: Initializing mmcsd card\n"); + syslog(LOG_INFO, "INFO: init MMC/SD slot %d on SPI%d: /dev/mmcsd%d\n", + CONFIG_NSH_MMCSDSLOTNO, CONFIG_NSH_MMCSDSPIPORTNO, + CONFIG_NSH_MMCSDMINOR); + + spi = esp32s2_spibus_initialize(CONFIG_NSH_MMCSDSPIPORTNO); - spi = esp32_spibus_initialize(CONFIG_NSH_MMCSDSPIPORTNO); if (spi == NULL) { - mcerr("ERROR: Failed to initialize SPI port %d\n", 2); + syslog(LOG_ERR, "ERROR: failed to initialize SPI%d.\n", + CONFIG_NSH_MMCSDSPIPORTNO); return -ENODEV; } - rv = mmcsd_spislotinitialize(minor, 0, spi); - if (rv < 0) + /* Mounts to /dev/mmcsdN where N in the minor number */ + + ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, + CONFIG_NSH_MMCSDSLOTNO, spi); + if (ret < 0) { - mcerr("ERROR: Failed to bind SPI port %d to SD slot %d\n", - 2, 0); - return rv; + syslog(LOG_ERR, "ERROR: failed to bind SPI%d to SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); + return ret; } - spiinfo("INFO: mmcsd card has been initialized successfully\n"); + syslog(LOG_INFO, "INFO: MMCSD initialized\n"); return OK; } diff --git a/boards/xtensa/esp32s2/common/src/esp32s2_board_spi.c b/boards/xtensa/esp32s2/common/src/esp32s2_board_spi.c index 871afa5c39856..ed1292768fa86 100644 --- a/boards/xtensa/esp32s2/common/src/esp32s2_board_spi.c +++ b/boards/xtensa/esp32s2/common/src/esp32s2_board_spi.c @@ -52,6 +52,11 @@ uint8_t esp32s2_spi2_status(struct spi_dev_s *dev, uint32_t devid) { uint8_t status = 0; + if (devid == SPIDEV_MMCSD(0)) + { + return SPI_STATUS_PRESENT; + } + return status; } @@ -94,6 +99,11 @@ uint8_t esp32s2_spi3_status(struct spi_dev_s *dev, uint32_t devid) { uint8_t status = 0; + if (devid == SPIDEV_MMCSD(0)) + { + return SPI_STATUS_PRESENT; + } + return status; } diff --git a/boards/xtensa/esp32s2/esp32s2-saola-1/configs/sdmmc_spi/defconfig b/boards/xtensa/esp32s2/esp32s2-saola-1/configs/sdmmc_spi/defconfig new file mode 100644 index 0000000000000..ff762234a700f --- /dev/null +++ b/boards/xtensa/esp32s2/esp32s2-saola-1/configs/sdmmc_spi/defconfig @@ -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_ARCH_LEDS is not set +# CONFIG_ESP32S2_SPI2_DMA is not set +# CONFIG_MMCSD_HAVE_CARDDETECT is not set +# CONFIG_MMCSD_HAVE_WRITEPROTECT is not set +# CONFIG_NDEBUG is not set +# CONFIG_NSH_ARGCAT is not set +# CONFIG_NSH_CMDOPT_HEXDUMP is not set +# CONFIG_SPI_EXCHANGE is not set +CONFIG_ARCH="xtensa" +CONFIG_ARCH_BOARD="esp32s2-saola-1" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ESP32S2_SAOLA_1=y +CONFIG_ARCH_CHIP="esp32s2" +CONFIG_ARCH_CHIP_ESP32S2=y +CONFIG_ARCH_CHIP_ESP32S2WROVER=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARCH_XTENSA=y +CONFIG_BOARD_LOOPSPERMSEC=16717 +CONFIG_BUILTIN=y +CONFIG_ESP32S2_MERGE_BINS=y +CONFIG_ESP32S2_SPI2=y +CONFIG_ESP32S2_UART0=y +CONFIG_FAT_LCNAMES=y +CONFIG_FAT_LFN=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=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_MMCSDSPIPORTNO=2 +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 diff --git a/boards/xtensa/esp32s2/esp32s2-saola-1/src/esp32s2_bringup.c b/boards/xtensa/esp32s2/esp32s2-saola-1/src/esp32s2_bringup.c index cd090470fbb1b..03ec565d7c612 100644 --- a/boards/xtensa/esp32s2/esp32s2-saola-1/src/esp32s2_bringup.c +++ b/boards/xtensa/esp32s2/esp32s2-saola-1/src/esp32s2_bringup.c @@ -117,6 +117,10 @@ # include "espressif/esp_sdm.h" #endif +#ifdef CONFIG_MMCSD_SPI +# include "esp32s2_board_sdmmc.h" +#endif + #include "esp32s2-saola-1.h" /**************************************************************************** @@ -480,6 +484,14 @@ int esp32s2_bringup(void) } #endif +#ifdef CONFIG_MMCSD_SPI + ret = board_sdmmc_initialize(); + if (ret < 0) + { + syslog(LOG_ERR, "Failed to initialize SDMMC: %d\n", ret); + } +#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. diff --git a/boards/xtensa/esp32s3/common/include/esp32s3_board_sdmmc.h b/boards/xtensa/esp32s3/common/include/esp32s3_board_sdmmc.h index fcea06484b1be..097bd6989591d 100644 --- a/boards/xtensa/esp32s3/common/include/esp32s3_board_sdmmc.h +++ b/boards/xtensa/esp32s3/common/include/esp32s3_board_sdmmc.h @@ -54,7 +54,7 @@ extern "C" * Name: board_sdmmc_initialize * * Description: - * Configure the sdmmc subsystem. + * Configure the SDMMC peripheral to communicate with SDIO or MMC card. * * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned @@ -66,10 +66,28 @@ int board_sdmmc_initialize(void); #endif /* CONFIG_ESP32S3_SDMMC */ +/**************************************************************************** + * Name: board_sdmmc_spi_initialize + * + * Description: + * Initialize SPI-based SD card. + * + * Input Parameters: + * None. + * + * Returned Value: + * Zero (OK) is returned on success; A negated errno value is returned + * to indicate the nature of any failure. + * + ****************************************************************************/ +#ifdef CONFIG_MMCSD_SPI +int board_sdmmc_spi_initialize(void); +#endif /* CONFIG_MMCSD_SPI */ + #undef EXTERN #if defined(__cplusplus) } #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_XTENSA_ESP32S3_COMMON_INCLUDE_ESP32S3_BOARD_SDMMC_H */ \ No newline at end of file +#endif /* __BOARDS_XTENSA_ESP32S3_COMMON_INCLUDE_ESP32S3_BOARD_SDMMC_H */ diff --git a/boards/xtensa/esp32s3/common/src/Make.defs b/boards/xtensa/esp32s3/common/src/Make.defs index 51864aa215a4d..100c9a84a747f 100644 --- a/boards/xtensa/esp32s3/common/src/Make.defs +++ b/boards/xtensa/esp32s3/common/src/Make.defs @@ -86,6 +86,10 @@ ifeq ($(CONFIG_ESP_MCPWM),y) CSRCS += esp32s3_board_mcpwm.c endif +ifeq ($(CONFIG_MMCSD_SPI),y) + CSRCS += esp32s3_board_sdmmc.c +endif + ifeq ($(CONFIG_ESP32S3_SDMMC),y) CSRCS += esp32s3_board_sdmmc.c endif diff --git a/boards/xtensa/esp32s3/common/src/esp32s3_board_sdmmc.c b/boards/xtensa/esp32s3/common/src/esp32s3_board_sdmmc.c index 7378b527a41ed..ac55f26f6e612 100644 --- a/boards/xtensa/esp32s3/common/src/esp32s3_board_sdmmc.c +++ b/boards/xtensa/esp32s3/common/src/esp32s3_board_sdmmc.c @@ -32,6 +32,11 @@ #include #include +#ifdef CONFIG_MMCSD_SPI +#include +#include "esp32s3_spi.h" +#endif + extern struct sdio_dev_s *sdio_initialize(int slotno); /**************************************************************************** * Public Functions @@ -41,7 +46,7 @@ extern struct sdio_dev_s *sdio_initialize(int slotno); * Name: board_sdmmc_initialize * * Description: - * Configure the sdmmc subsystem. + * Configure the SDMMC peripheral to communicate with SDIO or MMC card. * * Input Parameters: * None. @@ -73,3 +78,53 @@ int board_sdmmc_initialize(void) return OK; } + +/**************************************************************************** + * Name: board_sdmmc_spi_initialize + * + * Description: + * Initialize SPI-based SD card. + * + * Input Parameters: + * None. + * + * Returned Value: + * Zero (OK) is returned on success; A negated errno value is returned + * to indicate the nature of any failure. + * + ****************************************************************************/ + +#ifdef CONFIG_MMCSD_SPI +int board_sdmmc_spi_initialize(void) +{ + struct spi_dev_s *spi; + int ret; + + syslog(LOG_INFO, "INFO: init MMC/SD slot %d on SPI%d: /dev/mmcsd%d\n", + CONFIG_NSH_MMCSDSLOTNO, CONFIG_NSH_MMCSDSPIPORTNO, + CONFIG_NSH_MMCSDMINOR); + + spi = esp32s3_spibus_initialize(CONFIG_NSH_MMCSDSPIPORTNO); + + if (spi == NULL) + { + syslog(LOG_ERR, "ERROR: failed to initialize SPI%d.\n", + CONFIG_NSH_MMCSDSPIPORTNO); + return -ENODEV; + } + + /* Mounts to /dev/mmcsdN where N in the minor number */ + + ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, + CONFIG_NSH_MMCSDSLOTNO, spi); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: failed to bind SPI%d to SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); + return ret; + } + + syslog(LOG_INFO, "INFO: MMCSD initialized\n"); + return OK; +} +#endif /* CONFIG_MMCSD_SPI */ diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/Kconfig b/boards/xtensa/esp32s3/esp32s3-8048S043/Kconfig new file mode 100644 index 0000000000000..b74da2e168792 --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/Kconfig @@ -0,0 +1,62 @@ +# +# 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_LCD + bool "Enable Board LCD" + default n + depends on ESP32S3_LCD + ---help--- + Enable board LCD support. + +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 diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/configs/gpio/defconfig b/boards/xtensa/esp32s3/esp32s3-8048S043/configs/gpio/defconfig new file mode 100644 index 0000000000000..fe95018e07767 --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/configs/gpio/defconfig @@ -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 diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/configs/i2c/defconfig b/boards/xtensa/esp32s3/esp32s3-8048S043/configs/i2c/defconfig new file mode 100644 index 0000000000000..8a94a971ada9c --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/configs/i2c/defconfig @@ -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 diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/configs/lcd/defconfig b/boards/xtensa/esp32s3/esp32s3-8048S043/configs/lcd/defconfig new file mode 100644 index 0000000000000..b57872857c65e --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/configs/lcd/defconfig @@ -0,0 +1,90 @@ +# +# 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_FULLOPT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_ESP32S3_BOARD_LCD=y +CONFIG_ESP32S3_DMA=y +CONFIG_ESP32S3_FLASH_FREQ_80M=y +CONFIG_ESP32S3_FLASH_MODE_QIO=y +CONFIG_ESP32S3_LCD=y +CONFIG_ESP32S3_LCD_CLOCK_MHZ=18 +CONFIG_ESP32S3_LCD_DATA0_PIN=8 +CONFIG_ESP32S3_LCD_DATA10_PIN=4 +CONFIG_ESP32S3_LCD_DATA11_PIN=45 +CONFIG_ESP32S3_LCD_DATA12_PIN=48 +CONFIG_ESP32S3_LCD_DATA13_PIN=47 +CONFIG_ESP32S3_LCD_DATA14_PIN=21 +CONFIG_ESP32S3_LCD_DATA15_PIN=14 +CONFIG_ESP32S3_LCD_DATA1_PIN=3 +CONFIG_ESP32S3_LCD_DATA2_PIN=46 +CONFIG_ESP32S3_LCD_DATA3_PIN=9 +CONFIG_ESP32S3_LCD_DATA4_PIN=1 +CONFIG_ESP32S3_LCD_DATA5_PIN=5 +CONFIG_ESP32S3_LCD_DATA6_PIN=6 +CONFIG_ESP32S3_LCD_DATA7_PIN=7 +CONFIG_ESP32S3_LCD_DATA8_PIN=15 +CONFIG_ESP32S3_LCD_DATA9_PIN=16 +CONFIG_ESP32S3_LCD_HBACKPORCH=16 +CONFIG_ESP32S3_LCD_HE_PIN=40 +CONFIG_ESP32S3_LCD_HFRONTPORCH=20 +CONFIG_ESP32S3_LCD_HPULSEWIDTH=30 +CONFIG_ESP32S3_LCD_HRES=800 +CONFIG_ESP32S3_LCD_HSYNC_PIN=39 +CONFIG_ESP32S3_LCD_PCLK_PIN=42 +CONFIG_ESP32S3_LCD_REGDEBUG=y +CONFIG_ESP32S3_LCD_VBACKPORCH=10 +CONFIG_ESP32S3_LCD_VFRONTPORCH=22 +CONFIG_ESP32S3_LCD_VSYNC_PIN=41 +CONFIG_ESP32S3_PSRAM_8M=y +CONFIG_ESP32S3_SPEED_UP_ISR=y +CONFIG_ESP32S3_SPIRAM=y +CONFIG_ESP32S3_SPIRAM_MODE_OCT=y +CONFIG_ESP32S3_SPIRAM_SPEED_80M=y +CONFIG_ESP32S3_UART0=y +CONFIG_EXAMPLES_FB=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_MM_REGIONS=2 +CONFIG_NDEBUG=y +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 diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/configs/nsh/defconfig b/boards/xtensa/esp32s3/esp32s3-8048S043/configs/nsh/defconfig new file mode 100644 index 0000000000000..dd7256c048c56 --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/configs/nsh/defconfig @@ -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 diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/configs/sdmmc/defconfig b/boards/xtensa/esp32s3/esp32s3-8048S043/configs/sdmmc/defconfig new file mode 100644 index 0000000000000..9e12de69c26c8 --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/configs/sdmmc/defconfig @@ -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 diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/configs/spi/defconfig b/boards/xtensa/esp32s3/esp32s3-8048S043/configs/spi/defconfig new file mode 100644 index 0000000000000..ffad5c7733b6c --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/configs/spi/defconfig @@ -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 diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/configs/touchscreen/defconfig b/boards/xtensa/esp32s3/esp32s3-8048S043/configs/touchscreen/defconfig new file mode 100644 index 0000000000000..165b919651a2b --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/configs/touchscreen/defconfig @@ -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 diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/include/board.h b/boards/xtensa/esp32s3/esp32s3-8048S043/include/board.h new file mode 100644 index 0000000000000..5a683ca92bc2f --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/include/board.h @@ -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 */ diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/include/board_memorymap.h b/boards/xtensa/esp32s3/esp32s3-8048S043/include/board_memorymap.h new file mode 100644 index 0000000000000..2e30a8d567840 --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/include/board_memorymap.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 + +/**************************************************************************** + * 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 */ diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/scripts/Make.defs b/boards/xtensa/esp32s3/esp32s3-8048S043/scripts/Make.defs new file mode 100644 index 0000000000000..df22216cd22da --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/scripts/Make.defs @@ -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__ diff --git a/fs/notify/Make.defs b/boards/xtensa/esp32s3/esp32s3-8048S043/src/Make.defs similarity index 52% rename from fs/notify/Make.defs rename to boards/xtensa/esp32s3/esp32s3-8048S043/src/Make.defs index 6b7fc42ec9d54..2a6a16151c25b 100644 --- a/fs/notify/Make.defs +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/src/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# fs/notify/Make.defs +# boards/xtensa/esp32s3/esp32s3-8048S043/src/Make.defs # # SPDX-License-Identifier: Apache-2.0 # @@ -20,12 +20,43 @@ # ############################################################################ -# Include FSNOTIFY build support +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_FS_NOTIFY),y) -CSRCS += inotify.c +ifeq ($(CONFIG_ESP32S3_SPI),y) +CSRCS += esp32s3_board_spi.c endif -DEPPATH += --dep-path notify -VPATH += :notify +ifeq ($(CONFIG_DEV_GPIO),y) +CSRCS += esp32s3_gpio.c +endif + +ifeq ($(CONFIG_ESP32S3_BOARD_LCD),y) +CSRCS += esp32s3_lcd.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 diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3-8048S043.h b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3-8048S043.h new file mode 100644 index 0000000000000..43364f0833ea1 --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3-8048S043.h @@ -0,0 +1,168 @@ +/**************************************************************************** + * 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 +#include +#include + +/**************************************************************************** + * 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) + +#define ESP32S3_DISPLAY_BCKL (2) + +/* 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 + +/**************************************************************************** + * Name: board_lcd_initialize + * + * Description: + * Initialize LCD. + * + * Input Parameters: + * None. + * + * Returned Value: + * Zero (OK) on success; a negated errno value on failure. + * + ****************************************************************************/ + +#ifdef CONFIG_ESP32S3_BOARD_LCD +int board_lcd_initialize(void); +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_8048S043_SRC_ESP32S3_8048S043_H */ \ No newline at end of file diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_appinit.c b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_appinit.c new file mode 100644 index 0000000000000..2140a4f17a110 --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_appinit.c @@ -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 + +#include +#include + +#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 */ diff --git a/boards/xtensa/esp32/ttgo_eink5_v2/src/esp32_mmcsd.c b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_board_spi.c similarity index 65% rename from boards/xtensa/esp32/ttgo_eink5_v2/src/esp32_mmcsd.c rename to boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_board_spi.c index e1c2c09890dad..c7546c6556f01 100644 --- a/boards/xtensa/esp32/ttgo_eink5_v2/src/esp32_mmcsd.c +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_board_spi.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/xtensa/esp32/ttgo_eink5_v2/src/esp32_mmcsd.c + * boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_board_spi.c * * SPDX-License-Identifier: Apache-2.0 * @@ -24,63 +24,51 @@ * Included Files ****************************************************************************/ -#include #include -#include + +#include +#include +#include + #include -#include -#include -#include -#include -#include "esp32_spi.h" -#include "ttgo_eink5_v2.h" +#include "esp32s3_gpio.h" +#include "esp32s3-8048S043.h" /**************************************************************************** - * Pre-processor Definitions + * Private Functions ****************************************************************************/ /**************************************************************************** - * Private Definitions + * Public Functions ****************************************************************************/ /**************************************************************************** - * Private Functions + * Name: esp32s3_spi2_status ****************************************************************************/ -/**************************************************************************** - * Public Functions - ****************************************************************************/ +#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: esp32_mmcsd_initialize - * - * Description: - * Initialize SPI-based SD card and card detect thread. + * Name: esp32s3_spi3_status ****************************************************************************/ -int esp32_mmcsd_initialize(int minor) +#ifdef CONFIG_ESP32S3_SPI3 + +uint8_t esp32s3_spi3_status(struct spi_dev_s *dev, uint32_t devid) { - struct spi_dev_s *spi; - int rv; - - mcinfo("INFO: Initializing mmcsd card\n"); - - spi = esp32_spibus_initialize(2); - if (spi == NULL) - { - mcerr("ERROR: Failed to initialize SPI port %d\n", 2); - return -ENODEV; - } - - rv = mmcsd_spislotinitialize(minor, 0, spi); - if (rv < 0) - { - mcerr("ERROR: Failed to bind SPI port %d to SD slot %d\n", - 2, 0); - return rv; - } - - spiinfo("INFO: mmcsd card has been initialized successfully\n"); - return OK; + uint8_t status = 0; + + return status; } + +#endif diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_board_touchsceen.c b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_board_touchsceen.c new file mode 100644 index 0000000000000..1007cd4cb0967 --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_board_touchsceen.c @@ -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 + +#include +#include +#include +#include +#include +#include +#include +#include + +#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; +} diff --git a/boards/xtensa/esp32/esp32-ethernet-kit/src/esp32_mmcsd.c b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_boot.c similarity index 65% rename from boards/xtensa/esp32/esp32-ethernet-kit/src/esp32_mmcsd.c rename to boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_boot.c index 32732db91c6a1..f41eba9183dd0 100644 --- a/boards/xtensa/esp32/esp32-ethernet-kit/src/esp32_mmcsd.c +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_boot.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/xtensa/esp32/esp32-ethernet-kit/src/esp32_mmcsd.c + * boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_boot.c * * SPDX-License-Identifier: Apache-2.0 * @@ -24,24 +24,18 @@ * Included Files ****************************************************************************/ -#include #include -#include -#include -#include -#include -#include -#include -#include "esp32_spi.h" -#include "esp32-ethernet-kit.h" +#include -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ +#include +#include +#include + +#include "esp32s3-8048S043.h" /**************************************************************************** - * Private Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** @@ -53,34 +47,39 @@ ****************************************************************************/ /**************************************************************************** - * Name: esp32_mmcsd_initialize + * Name: esp32s3_board_initialize * * Description: - * Initialize SPI-based SD card and card detect thread. + * 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. + * ****************************************************************************/ -int esp32_mmcsd_initialize(int minor) +void esp32s3_board_initialize(void) { - struct spi_dev_s *spi; - int rv; - - mcinfo("INFO: Initializing mmcsd card\n"); +} - spi = esp32_spibus_initialize(2); - if (spi == NULL) - { - mcerr("ERROR: Failed to initialize SPI port %d\n", 2); - return -ENODEV; - } +/**************************************************************************** + * 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. + * + ****************************************************************************/ - rv = mmcsd_spislotinitialize(minor, 0, spi); - if (rv < 0) - { - mcerr("ERROR: Failed to bind SPI port %d to SD slot %d\n", - 2, 0); - return rv; - } +#ifdef CONFIG_BOARD_LATE_INITIALIZE +void board_late_initialize(void) +{ + /* Perform board-specific initialization */ - spiinfo("INFO: mmcsd card has been initialized successfully\n"); - return OK; + esp32s3_bringup(); } +#endif diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_bringup.c b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_bringup.c new file mode 100644 index 0000000000000..e19570155b711 --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_bringup.c @@ -0,0 +1,273 @@ +/**************************************************************************** + * 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 + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#ifdef CONFIG_ESP32S3_I2C +# include "esp32s3_i2c.h" +#endif + +#ifdef CONFIG_INPUT_BUTTONS +# include +#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 + +#ifdef CONFIG_ESP32S3_BOARD_LCD + ret = board_lcd_initialize(); + if (ret < 0) + { + syslog(LOG_ERR, "Failed to initialize the LCD\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; +} diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_buttons.c b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_buttons.c new file mode 100644 index 0000000000000..1bb8d4e82f0cf --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_buttons.c @@ -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 + +#include +#include +#include + +#include +#include +#include + +#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 diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_gpio.c b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_gpio.c new file mode 100644 index 0000000000000..fcc802bb7c5c8 --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_gpio.c @@ -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 + +#include +#include +#include +#include +#include + +#include + +#include + +#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 */ diff --git a/boards/xtensa/esp32/esp32-lyrat/src/esp32_mmcsd.c b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_lcd.c similarity index 63% rename from boards/xtensa/esp32/esp32-lyrat/src/esp32_mmcsd.c rename to boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_lcd.c index 5a2fbfff8a625..7c378fd5af8be 100644 --- a/boards/xtensa/esp32/esp32-lyrat/src/esp32_mmcsd.c +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_lcd.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/xtensa/esp32/esp32-lyrat/src/esp32_mmcsd.c + * boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_lcd.c * * SPDX-License-Identifier: Apache-2.0 * @@ -24,24 +24,35 @@ * Included Files ****************************************************************************/ -#include #include -#include -#include -#include -#include -#include + #include +#include +#include +#include +#include +#include +#include +#include +#include -#include "esp32_spi.h" -#include "esp32-lyrat.h" +#include "esp32s3_gpio.h" +#include "esp32s3-8048S043.h" /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** - * Private Definitions + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * External Functions + ****************************************************************************/ + +/**************************************************************************** + * Private Data ****************************************************************************/ /**************************************************************************** @@ -53,34 +64,38 @@ ****************************************************************************/ /**************************************************************************** - * Name: esp32_mmcsd_initialize + * Name: board_lcd_initialize * * Description: - * Initialize SPI-based SD card and card detect thread. + * Initialize LCD. + * + * Input Parameters: + * None. + * + * Returned Value: + * Zero (OK) on success; a negated errno value on failure. + * ****************************************************************************/ -int esp32_mmcsd_initialize(int minor) +int board_lcd_initialize(void) { - struct spi_dev_s *spi; - int rv; + int ret; - mcinfo("INFO: Initializing mmcsd card\n"); + esp32s3_configgpio(ESP32S3_DISPLAY_BCKL, OUTPUT); + esp32s3_gpiowrite(ESP32S3_DISPLAY_BCKL, true); - spi = esp32_spibus_initialize(CONFIG_NSH_MMCSDSPIPORTNO); - if (spi == NULL) - { - mcerr("ERROR: Failed to initialize SPI port %d\n", 2); - return -ENODEV; - } +#ifdef CONFIG_VIDEO_FB + /* Initialize and register the framebuffer driver */ - rv = mmcsd_spislotinitialize(minor, 0, spi); - if (rv < 0) + ret = fb_register(0, 0); + if (ret < 0) { - mcerr("ERROR: Failed to bind SPI port %d to SD slot %d\n", - 2, 0); - return rv; + syslog(LOG_ERR, "ERROR: fb_register() failed: %d\n", ret); + return ret; } +#else + UNUSED(ret); +#endif - spiinfo("INFO: mmcsd card has been initialized successfully\n"); - return OK; + return 0; } diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_reset.c b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_reset.c new file mode 100644 index 0000000000000..a5900abcab8fe --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_reset.c @@ -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 + +#include +#include +#include +#include +#include + +#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 */ diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/src/etc/init.d/rc.sysinit b/boards/xtensa/esp32s3/esp32s3-8048S043/src/etc/init.d/rc.sysinit new file mode 100644 index 0000000000000..6279920d9ba9b --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/src/etc/init.d/rc.sysinit @@ -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 + diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/src/etc/init.d/rcS b/boards/xtensa/esp32s3/esp32s3-8048S043/src/etc/init.d/rcS new file mode 100644 index 0000000000000..3579391234726 --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/src/etc/init.d/rcS @@ -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 + +#ifdef CONFIG_SYSTEM_ADBD +adbd & +#endif + +#ifdef CONFIG_SYSTEM_FASTBOOTD +fastbootd & +#endif diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/src/etc/txtable.txt b/boards/xtensa/esp32s3/esp32s3-8048S043/src/etc/txtable.txt new file mode 100644 index 0000000000000..903b1684fedb0 --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/src/etc/txtable.txt @@ -0,0 +1,2 @@ +TXTABLE0 +data 0x100000 0 diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/configs/fastboot/defconfig b/boards/xtensa/esp32s3/esp32s3-devkit/configs/fastboot/defconfig index cf1ad5e2eb3b8..d0dcdb153aacf 100644 --- a/boards/xtensa/esp32s3/esp32s3-devkit/configs/fastboot/defconfig +++ b/boards/xtensa/esp32s3/esp32s3-devkit/configs/fastboot/defconfig @@ -1,18 +1,105 @@ -#include "../usb_device/defconfig" +# +# 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_ARCH_LEDS is not set +# CONFIG_NDEBUG is not set +# CONFIG_NSH_ARGCAT is not set +CONFIG_ALLOW_BSD_COMPONENTS=y +CONFIG_ARCH="xtensa" +CONFIG_ARCH_BOARD="esp32s3-devkit" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ESP32S3_DEVKIT=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_BCH=y CONFIG_BOARDCTL_USBDEVCTRL=y -CONFIG_CDCACM=n +CONFIG_BOARD_LOOPSPERMSEC=16717 +CONFIG_BUILTIN=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DEFAULT_TASK_STACKSIZE=4096 +CONFIG_DRIVERS_IEEE80211=y +CONFIG_DRIVERS_WIRELESS=y +CONFIG_ESP32S3_OTG=y CONFIG_ESP32S3_OTG_ENDPOINT_NUM=2 +CONFIG_ESP32S3_RT_TIMER_TASK_STACK_SIZE=4096 +CONFIG_ESP32S3_SPIFLASH=y +CONFIG_ESP32S3_SPIFLASH_SPIFFS=y +CONFIG_ESP32S3_UART0=y +CONFIG_ESPRESSIF_WIFI=y CONFIG_ETC_ROMFS=y -CONFIG_EXAMPLES_USBSERIAL=n +CONFIG_EXAMPLES_RANDOM=y +CONFIG_FS_PROCFS=y CONFIG_FS_ROMFS=y -CONFIG_NSH_CMDOPT_HEXDUMP=y +CONFIG_HAVE_CXX=y +CONFIG_HAVE_CXXINITIALIZE=y +CONFIG_IDLETHREAD_STACKSIZE=3072 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INIT_STACKSIZE=8192 +CONFIG_INTELHEX_BINARY=y +CONFIG_IOB_NBUFFERS=124 +CONFIG_IOB_THROTTLE=24 +CONFIG_LINE_MAX=64 +CONFIG_NAME_MAX=48 +CONFIG_NETDB_DNSCLIENT=y +CONFIG_NETDEV_LATEINIT=y +CONFIG_NETDEV_PHY_IOCTL=y +CONFIG_NETDEV_WIRELESS_IOCTL=y +CONFIG_NETUTILS_CJSON=y +CONFIG_NETUTILS_IPERF=y +CONFIG_NET_BROADCAST=y +CONFIG_NET_ETH_PKTSIZE=1514 +CONFIG_NET_ICMP_SOCKET=y +CONFIG_NET_TCP=y +CONFIG_NET_TCPBACKLOG=y +CONFIG_NET_TCP_DELAYED_ACK=y +CONFIG_NET_TCP_WRITE_BUFFERS=y +CONFIG_NET_UDP=y +CONFIG_NET_UDP_WRITE_BUFFERS=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_READLINE=y CONFIG_PIPES=y +CONFIG_POSIX_SPAWN_DEFAULT_STACKSIZE=2048 +CONFIG_PREALLOC_TIMERS=4 +CONFIG_PTHREAD_MUTEX_TYPES=y +CONFIG_RAM_SIZE=114688 +CONFIG_RAM_START=0x20000000 +CONFIG_RR_INTERVAL=200 CONFIG_SCHED_CHILD_STATUS=y CONFIG_SCHED_HAVE_PARENT=y +CONFIG_SCHED_LPWORK=y +CONFIG_SIG_DEFAULT=y +CONFIG_SMP=y +CONFIG_SMP_NCPUS=2 +CONFIG_SPIFFS_NAME_MAX=128 +CONFIG_START_DAY=6 +CONFIG_START_MONTH=12 +CONFIG_START_YEAR=2011 +CONFIG_SYSLOG_BUFFER=y +CONFIG_SYSTEM_DHCPC_RENEW=y CONFIG_SYSTEM_FASTBOOTD=y CONFIG_SYSTEM_FASTBOOTD_SHELL=y CONFIG_SYSTEM_FASTBOOTD_USB_BOARDCTL=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_PING=y CONFIG_SYSTEM_POPEN=y +CONFIG_TIMER=y +CONFIG_TLS_TASK_NELEM=4 +CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_USBADB=y CONFIG_USBFASTBOOT=y +CONFIG_WIRELESS=y +CONFIG_WIRELESS_WAPI=y +CONFIG_WIRELESS_WAPI_CMDTOOL=y +CONFIG_WIRELESS_WAPI_INITCONF=y +CONFIG_WIRELESS_WAPI_STACKSIZE=8192 diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/configs/fastboot_tcp/defconfig b/boards/xtensa/esp32s3/esp32s3-devkit/configs/fastboot_tcp/defconfig new file mode 100644 index 0000000000000..ed4c73ccc737a --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-devkit/configs/fastboot_tcp/defconfig @@ -0,0 +1,95 @@ +# +# 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_ARCH_LEDS is not set +# CONFIG_NDEBUG is not set +# CONFIG_NSH_ARGCAT is not set +# CONFIG_NSH_CMDOPT_HEXDUMP is not set +CONFIG_ALLOW_BSD_COMPONENTS=y +CONFIG_ARCH="xtensa" +CONFIG_ARCH_BOARD="esp32s3-devkit" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ESP32S3_DEVKIT=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_DEFAULT_TASK_STACKSIZE=4096 +CONFIG_DRIVERS_IEEE80211=y +CONFIG_DRIVERS_WIRELESS=y +CONFIG_ESP32S3_RT_TIMER_TASK_STACK_SIZE=4096 +CONFIG_ESP32S3_SPIFLASH=y +CONFIG_ESP32S3_SPIFLASH_SPIFFS=y +CONFIG_ESP32S3_UART0=y +CONFIG_ESPRESSIF_WIFI=y +CONFIG_ETC_ROMFS=y +CONFIG_EXAMPLES_RANDOM=y +CONFIG_FS_PROCFS=y +CONFIG_FS_ROMFS=y +CONFIG_IDLETHREAD_STACKSIZE=3072 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INIT_STACKSIZE=8192 +CONFIG_INTELHEX_BINARY=y +CONFIG_IOB_NBUFFERS=124 +CONFIG_IOB_THROTTLE=24 +CONFIG_LINE_MAX=64 +CONFIG_NAME_MAX=48 +CONFIG_NETDB_DNSCLIENT=y +CONFIG_NETDEV_LATEINIT=y +CONFIG_NETDEV_PHY_IOCTL=y +CONFIG_NETDEV_WIRELESS_IOCTL=y +CONFIG_NETUTILS_CJSON=y +CONFIG_NETUTILS_IPERF=y +CONFIG_NET_BROADCAST=y +CONFIG_NET_ETH_PKTSIZE=1514 +CONFIG_NET_ICMP_SOCKET=y +CONFIG_NET_TCP=y +CONFIG_NET_TCPBACKLOG=y +CONFIG_NET_TCP_DELAYED_ACK=y +CONFIG_NET_TCP_WRITE_BUFFERS=y +CONFIG_NET_UDP=y +CONFIG_NET_UDP_WRITE_BUFFERS=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_READLINE=y +CONFIG_PIPES=y +CONFIG_POSIX_SPAWN_DEFAULT_STACKSIZE=2048 +CONFIG_PREALLOC_TIMERS=4 +CONFIG_PTHREAD_MUTEX_TYPES=y +CONFIG_RAM_SIZE=114688 +CONFIG_RAM_START=0x20000000 +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_CHILD_STATUS=y +CONFIG_SCHED_HAVE_PARENT=y +CONFIG_SCHED_LPWORK=y +CONFIG_SIG_DEFAULT=y +CONFIG_SMP=y +CONFIG_SMP_NCPUS=2 +CONFIG_SPIFFS_NAME_MAX=128 +CONFIG_START_DAY=6 +CONFIG_START_MONTH=12 +CONFIG_START_YEAR=2011 +CONFIG_SYSLOG_BUFFER=y +CONFIG_SYSTEM_DHCPC_RENEW=y +CONFIG_SYSTEM_FASTBOOTD=y +CONFIG_SYSTEM_FASTBOOTD_SHELL=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_PING=y +CONFIG_SYSTEM_POPEN=y +CONFIG_TIMER=y +CONFIG_TLS_TASK_NELEM=4 +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_WIRELESS=y +CONFIG_WIRELESS_WAPI=y +CONFIG_WIRELESS_WAPI_CMDTOOL=y +CONFIG_WIRELESS_WAPI_INITCONF=y +CONFIG_WIRELESS_WAPI_STACKSIZE=8192 diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/configs/fastboot_usb/defconfig b/boards/xtensa/esp32s3/esp32s3-devkit/configs/fastboot_usb/defconfig new file mode 100644 index 0000000000000..cf1ad5e2eb3b8 --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-devkit/configs/fastboot_usb/defconfig @@ -0,0 +1,18 @@ +#include "../usb_device/defconfig" +CONFIG_BCH=y +CONFIG_BOARDCTL_USBDEVCTRL=y +CONFIG_CDCACM=n +CONFIG_ESP32S3_OTG_ENDPOINT_NUM=2 +CONFIG_ETC_ROMFS=y +CONFIG_EXAMPLES_USBSERIAL=n +CONFIG_FS_ROMFS=y +CONFIG_NSH_CMDOPT_HEXDUMP=y +CONFIG_PIPES=y +CONFIG_SCHED_CHILD_STATUS=y +CONFIG_SCHED_HAVE_PARENT=y +CONFIG_SYSTEM_FASTBOOTD=y +CONFIG_SYSTEM_FASTBOOTD_SHELL=y +CONFIG_SYSTEM_FASTBOOTD_USB_BOARDCTL=y +CONFIG_SYSTEM_POPEN=y +CONFIG_USBADB=y +CONFIG_USBFASTBOOT=y diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/configs/sdmmc_spi/defconfig b/boards/xtensa/esp32s3/esp32s3-devkit/configs/sdmmc_spi/defconfig new file mode 100644 index 0000000000000..e0fad37021ea0 --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-devkit/configs/sdmmc_spi/defconfig @@ -0,0 +1,55 @@ +# +# 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_ARCH_LEDS is not set +# CONFIG_MMCSD_HAVE_CARDDETECT is not set +# CONFIG_MMCSD_HAVE_WRITEPROTECT is not set +# CONFIG_NDEBUG is not set +# CONFIG_NSH_ARGCAT is not set +# CONFIG_NSH_CMDOPT_HEXDUMP is not set +CONFIG_ARCH="xtensa" +CONFIG_ARCH_BOARD="esp32s3-devkit" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ESP32S3_DEVKIT=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_UART0=y +CONFIG_FAT_LCNAMES=y +CONFIG_FAT_LFN=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=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_MMCSDSPIPORTNO=2 +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 diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/src/esp32s3_board_spi.c b/boards/xtensa/esp32s3/esp32s3-devkit/src/esp32s3_board_spi.c index 2975555328bc3..45298b4ef8e74 100644 --- a/boards/xtensa/esp32s3/esp32s3-devkit/src/esp32s3_board_spi.c +++ b/boards/xtensa/esp32s3/esp32s3-devkit/src/esp32s3_board_spi.c @@ -53,6 +53,11 @@ uint8_t esp32s3_spi2_status(struct spi_dev_s *dev, uint32_t devid) { uint8_t status = 0; + if (devid == SPIDEV_MMCSD(0)) + { + return SPI_STATUS_PRESENT; + } + return status; } @@ -95,6 +100,11 @@ uint8_t esp32s3_spi3_status(struct spi_dev_s *dev, uint32_t devid) { uint8_t status = 0; + if (devid == SPIDEV_MMCSD(0)) + { + return SPI_STATUS_PRESENT; + } + return status; } diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/src/esp32s3_bringup.c b/boards/xtensa/esp32s3/esp32s3-devkit/src/esp32s3_bringup.c index 63a70c7b06af1..d254bde29f367 100644 --- a/boards/xtensa/esp32s3/esp32s3-devkit/src/esp32s3_bringup.c +++ b/boards/xtensa/esp32s3/esp32s3-devkit/src/esp32s3_bringup.c @@ -116,7 +116,7 @@ # endif #endif -#ifdef CONFIG_ESP32S3_SDMMC +#if defined(CONFIG_ESP32S3_SDMMC) || defined(CONFIG_MMCSD_SPI) #include "esp32s3_board_sdmmc.h" #endif @@ -512,6 +512,14 @@ int esp32s3_bringup(void) } #endif +#ifdef CONFIG_MMCSD_SPI + ret = board_sdmmc_spi_initialize(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to initialize SDMMC: %d\n", ret); + } +#endif + #ifdef CONFIG_ESP32S3_AES_ACCELERATOR ret = esp32s3_aes_init(); if (ret < 0) diff --git a/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/configs/fastboot/defconfig b/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/configs/fastboot/defconfig index cf1ad5e2eb3b8..fc6620847f999 100644 --- a/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/configs/fastboot/defconfig +++ b/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/configs/fastboot/defconfig @@ -1,18 +1,105 @@ -#include "../usb_device/defconfig" +# +# 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_ARCH_LEDS is not set +# CONFIG_NDEBUG is not set +# CONFIG_NSH_ARGCAT is not set +CONFIG_ALLOW_BSD_COMPONENTS=y +CONFIG_ARCH="xtensa" +CONFIG_ARCH_BOARD="lckfb-szpi-esp32s3" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ESP32S3_LCKFB_SZPI=y +CONFIG_ARCH_CHIP="esp32s3" +CONFIG_ARCH_CHIP_ESP32S3=y +CONFIG_ARCH_CHIP_ESP32S3WROOM1N16R8=y +CONFIG_ARCH_INTERRUPTSTACK=2048 +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARCH_XTENSA=y CONFIG_BCH=y CONFIG_BOARDCTL_USBDEVCTRL=y -CONFIG_CDCACM=n +CONFIG_BOARD_LOOPSPERMSEC=16717 +CONFIG_BUILTIN=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DEFAULT_TASK_STACKSIZE=4096 +CONFIG_DRIVERS_IEEE80211=y +CONFIG_DRIVERS_WIRELESS=y +CONFIG_ESP32S3_OTG=y CONFIG_ESP32S3_OTG_ENDPOINT_NUM=2 +CONFIG_ESP32S3_RT_TIMER_TASK_STACK_SIZE=4096 +CONFIG_ESP32S3_SPIFLASH=y +CONFIG_ESP32S3_SPIFLASH_SPIFFS=y +CONFIG_ESP32S3_UART0=y +CONFIG_ESPRESSIF_WIFI=y CONFIG_ETC_ROMFS=y -CONFIG_EXAMPLES_USBSERIAL=n +CONFIG_EXAMPLES_RANDOM=y +CONFIG_FS_PROCFS=y CONFIG_FS_ROMFS=y -CONFIG_NSH_CMDOPT_HEXDUMP=y +CONFIG_HAVE_CXX=y +CONFIG_HAVE_CXXINITIALIZE=y +CONFIG_IDLETHREAD_STACKSIZE=3072 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INIT_STACKSIZE=8192 +CONFIG_INTELHEX_BINARY=y +CONFIG_IOB_NBUFFERS=124 +CONFIG_IOB_THROTTLE=24 +CONFIG_LINE_MAX=64 +CONFIG_NAME_MAX=48 +CONFIG_NETDB_DNSCLIENT=y +CONFIG_NETDEV_LATEINIT=y +CONFIG_NETDEV_PHY_IOCTL=y +CONFIG_NETDEV_WIRELESS_IOCTL=y +CONFIG_NETUTILS_CJSON=y +CONFIG_NETUTILS_IPERF=y +CONFIG_NET_BROADCAST=y +CONFIG_NET_ETH_PKTSIZE=1514 +CONFIG_NET_ICMP_SOCKET=y +CONFIG_NET_TCP=y +CONFIG_NET_TCPBACKLOG=y +CONFIG_NET_TCP_DELAYED_ACK=y +CONFIG_NET_TCP_WRITE_BUFFERS=y +CONFIG_NET_UDP=y +CONFIG_NET_UDP_WRITE_BUFFERS=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_READLINE=y CONFIG_PIPES=y +CONFIG_POSIX_SPAWN_DEFAULT_STACKSIZE=2048 +CONFIG_PREALLOC_TIMERS=4 +CONFIG_PTHREAD_MUTEX_TYPES=y +CONFIG_RAM_SIZE=114688 +CONFIG_RAM_START=0x20000000 +CONFIG_RR_INTERVAL=200 CONFIG_SCHED_CHILD_STATUS=y CONFIG_SCHED_HAVE_PARENT=y +CONFIG_SCHED_LPWORK=y +CONFIG_SIG_DEFAULT=y +CONFIG_SMP=y +CONFIG_SMP_NCPUS=2 +CONFIG_SPIFFS_NAME_MAX=128 +CONFIG_START_DAY=6 +CONFIG_START_MONTH=12 +CONFIG_START_YEAR=2011 +CONFIG_SYSLOG_BUFFER=y +CONFIG_SYSTEM_DHCPC_RENEW=y CONFIG_SYSTEM_FASTBOOTD=y CONFIG_SYSTEM_FASTBOOTD_SHELL=y CONFIG_SYSTEM_FASTBOOTD_USB_BOARDCTL=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_PING=y CONFIG_SYSTEM_POPEN=y +CONFIG_TIMER=y +CONFIG_TLS_TASK_NELEM=4 +CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_USBADB=y CONFIG_USBFASTBOOT=y +CONFIG_WIRELESS=y +CONFIG_WIRELESS_WAPI=y +CONFIG_WIRELESS_WAPI_CMDTOOL=y +CONFIG_WIRELESS_WAPI_INITCONF=y +CONFIG_WIRELESS_WAPI_STACKSIZE=8192 diff --git a/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/configs/fastboot_tcp/defconfig b/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/configs/fastboot_tcp/defconfig new file mode 100644 index 0000000000000..4208ae5e8238c --- /dev/null +++ b/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/configs/fastboot_tcp/defconfig @@ -0,0 +1,93 @@ +# +# 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_ARCH_LEDS is not set +# CONFIG_NDEBUG is not set +# CONFIG_NSH_ARGCAT is not set +# CONFIG_NSH_CMDOPT_HEXDUMP is not set +CONFIG_ALLOW_BSD_COMPONENTS=y +CONFIG_ARCH="xtensa" +CONFIG_ARCH_BOARD="lckfb-szpi-esp32s3" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ESP32S3_LCKFB_SZPI=y +CONFIG_ARCH_CHIP="esp32s3" +CONFIG_ARCH_CHIP_ESP32S3=y +CONFIG_ARCH_CHIP_ESP32S3WROOM1N16R8=y +CONFIG_ARCH_INTERRUPTSTACK=2048 +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARCH_XTENSA=y +CONFIG_BOARD_LOOPSPERMSEC=16717 +CONFIG_BUILTIN=y +CONFIG_DEFAULT_TASK_STACKSIZE=4096 +CONFIG_DRIVERS_IEEE80211=y +CONFIG_DRIVERS_WIRELESS=y +CONFIG_ESP32S3_RT_TIMER_TASK_STACK_SIZE=4096 +CONFIG_ESP32S3_SPIFLASH=y +CONFIG_ESP32S3_SPIFLASH_SPIFFS=y +CONFIG_ESP32S3_UART0=y +CONFIG_ESPRESSIF_WIFI=y +CONFIG_EXAMPLES_RANDOM=y +CONFIG_FS_PROCFS=y +CONFIG_IDLETHREAD_STACKSIZE=3072 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INIT_STACKSIZE=8192 +CONFIG_INTELHEX_BINARY=y +CONFIG_IOB_NBUFFERS=124 +CONFIG_IOB_THROTTLE=24 +CONFIG_LINE_MAX=64 +CONFIG_NAME_MAX=48 +CONFIG_NETDB_DNSCLIENT=y +CONFIG_NETDEV_LATEINIT=y +CONFIG_NETDEV_PHY_IOCTL=y +CONFIG_NETDEV_WIRELESS_IOCTL=y +CONFIG_NETUTILS_CJSON=y +CONFIG_NETUTILS_IPERF=y +CONFIG_NET_BROADCAST=y +CONFIG_NET_ETH_PKTSIZE=1514 +CONFIG_NET_ICMP_SOCKET=y +CONFIG_NET_TCP=y +CONFIG_NET_TCPBACKLOG=y +CONFIG_NET_TCP_DELAYED_ACK=y +CONFIG_NET_TCP_WRITE_BUFFERS=y +CONFIG_NET_UDP=y +CONFIG_NET_UDP_WRITE_BUFFERS=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_READLINE=y +CONFIG_PIPES=y +CONFIG_POSIX_SPAWN_DEFAULT_STACKSIZE=2048 +CONFIG_PREALLOC_TIMERS=4 +CONFIG_PTHREAD_MUTEX_TYPES=y +CONFIG_RAM_SIZE=114688 +CONFIG_RAM_START=0x20000000 +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_CHILD_STATUS=y +CONFIG_SCHED_HAVE_PARENT=y +CONFIG_SCHED_LPWORK=y +CONFIG_SIG_DEFAULT=y +CONFIG_SMP=y +CONFIG_SMP_NCPUS=2 +CONFIG_SPIFFS_NAME_MAX=128 +CONFIG_START_DAY=6 +CONFIG_START_MONTH=12 +CONFIG_START_YEAR=2011 +CONFIG_SYSLOG_BUFFER=y +CONFIG_SYSTEM_DHCPC_RENEW=y +CONFIG_SYSTEM_FASTBOOTD=y +CONFIG_SYSTEM_FASTBOOTD_SHELL=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_PING=y +CONFIG_SYSTEM_POPEN=y +CONFIG_TIMER=y +CONFIG_TLS_TASK_NELEM=4 +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_WIRELESS=y +CONFIG_WIRELESS_WAPI=y +CONFIG_WIRELESS_WAPI_CMDTOOL=y +CONFIG_WIRELESS_WAPI_INITCONF=y +CONFIG_WIRELESS_WAPI_STACKSIZE=8192 diff --git a/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/configs/fastboot_usb/defconfig b/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/configs/fastboot_usb/defconfig new file mode 100644 index 0000000000000..cf1ad5e2eb3b8 --- /dev/null +++ b/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/configs/fastboot_usb/defconfig @@ -0,0 +1,18 @@ +#include "../usb_device/defconfig" +CONFIG_BCH=y +CONFIG_BOARDCTL_USBDEVCTRL=y +CONFIG_CDCACM=n +CONFIG_ESP32S3_OTG_ENDPOINT_NUM=2 +CONFIG_ETC_ROMFS=y +CONFIG_EXAMPLES_USBSERIAL=n +CONFIG_FS_ROMFS=y +CONFIG_NSH_CMDOPT_HEXDUMP=y +CONFIG_PIPES=y +CONFIG_SCHED_CHILD_STATUS=y +CONFIG_SCHED_HAVE_PARENT=y +CONFIG_SYSTEM_FASTBOOTD=y +CONFIG_SYSTEM_FASTBOOTD_SHELL=y +CONFIG_SYSTEM_FASTBOOTD_USB_BOARDCTL=y +CONFIG_SYSTEM_POPEN=y +CONFIG_USBADB=y +CONFIG_USBFASTBOOT=y diff --git a/drivers/input/button_upper.c b/drivers/input/button_upper.c index 98ae78c3fbad6..6a871ff2c7b31 100644 --- a/drivers/input/button_upper.c +++ b/drivers/input/button_upper.c @@ -61,7 +61,7 @@ struct btn_upperhalf_s FAR const struct btn_lowerhalf_s *bu_lower; - btn_buttonset_t bu_sample; /* Last sampled button states */ + btn_buttonset_t bu_sample; /* Last sampled button states */ bool bu_enabled; /* The following is a singly linked list of open references to the diff --git a/drivers/input/gt9xx.c b/drivers/input/gt9xx.c index fee2a7ef76659..3c55103b830fd 100644 --- a/drivers/input/gt9xx.c +++ b/drivers/input/gt9xx.c @@ -196,7 +196,7 @@ static int gt9xx_i2c_read(FAR struct gt9xx_dev_s *dev, const int msgv_len = sizeof(msgv) / sizeof(msgv[0]); - iinfo("reg=0x%x, buflen=%ld\n", reg, buflen); + iinfo("reg=0x%x, buflen=%zu\n", reg, buflen); DEBUGASSERT(dev && dev->i2c && buf); /* Execute the I2C Transfer */ @@ -482,10 +482,10 @@ static ssize_t gt9xx_read(FAR struct file *filep, FAR char *buffer, /* Returned Touch Sample will have 0 or 1 Touch Points */ - iinfo("buflen=%ld\n", buflen); + iinfo("buflen=%zu\n", buflen); if (buflen < outlen) { - ierr("Buffer should be at least %ld bytes, got %ld bytes\n", + ierr("Buffer should be at least %zu bytes, got %zu bytes\n", outlen, buflen); return -EINVAL; } diff --git a/drivers/segger/CMakeLists.txt b/drivers/segger/CMakeLists.txt index cbdc9d31c2edb..6c0d2d3bc0902 100644 --- a/drivers/segger/CMakeLists.txt +++ b/drivers/segger/CMakeLists.txt @@ -23,7 +23,7 @@ if(CONFIG_SEGGER_RTT OR CONFIG_SEGGER_SYSVIEW) if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/SystemView) - set(SYSVIEW_VERSION 354) + set(SYSVIEW_VERSION 356) FetchContent_Declare( systemview diff --git a/drivers/segger/config/SEGGER_RTT_Conf.h b/drivers/segger/config/SEGGER_RTT_Conf.h index b4bc1f8d6747d..d1a0e56ae4611 100644 --- a/drivers/segger/config/SEGGER_RTT_Conf.h +++ b/drivers/segger/config/SEGGER_RTT_Conf.h @@ -38,7 +38,7 @@ ****************************************************************************/ #ifndef __ASSEMBLY__ -extern struct rspinlock_s g_segger_lock; +extern rspinlock_t g_segger_lock; #endif #ifdef CONFIG_SEGGER_RTT_UNCACHED_OFF_VARIABLE diff --git a/drivers/segger/segger.c b/drivers/segger/segger.c index d179bccef15fa..efc67b9d35fb9 100644 --- a/drivers/segger/segger.c +++ b/drivers/segger/segger.c @@ -30,7 +30,7 @@ * Public Data ****************************************************************************/ -struct rspinlock_s g_segger_lock = RSPINLOCK_INITIALIZER; +rspinlock_t g_segger_lock = RSPINLOCK_INITIALIZER; ptrdiff_t g_segger_offset = PTRDIFF_MAX; /**************************************************************************** diff --git a/drivers/sensors/CMakeLists.txt b/drivers/sensors/CMakeLists.txt index 5db532c7e900c..9f4810a40ef9b 100644 --- a/drivers/sensors/CMakeLists.txt +++ b/drivers/sensors/CMakeLists.txt @@ -20,6 +20,8 @@ # # ############################################################################## +# Include sensor drivers + if(CONFIG_SENSORS) set(SRCS sensor.c) @@ -31,6 +33,14 @@ if(CONFIG_SENSORS) list(APPEND SRCS sensor_rpmsg.c) endif() + if(CONFIG_SENSORS_NAU7802) + list(APPEND SRCS nau7802.c) + endif() + + if(CONFIG_SENSORS_L86_XXX) + list(APPEND SRCS l86xxx_uorb.c) + endif() + if(CONFIG_SENSORS_GNSS) set_source_files_properties( gnss_uorb.c DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/.. @@ -62,23 +72,12 @@ if(CONFIG_SENSORS) list(APPEND SRCS adxl345_base.c) endif() - if(CONFIG_SENSORS_ADXL362) - list(APPEND SRCS adxl362_uorb.c) - endif() - - if(CONFIG_SENSORS_BH1749NUC) - list(APPEND SRCS bh1749nuc_base.c) - if(CONFIG_SENSORS_BH1749NUC_UORB) - list(APPEND SRCS bh1749nuc_uorb.c) - else() - list(APPEND SRCS bh1749nuc.c) - endif() - endif() - if(CONFIG_SENSORS_DHTXX) list(APPEND SRCS dhtxx.c) endif() + # These drivers can be used with sensor connected over SPI or I2C bus + if(CONFIG_SENSORS_BMI270) list(APPEND SRCS bmi270_base.c) if(CONFIG_SENSORS_BMI270_UORB) @@ -166,7 +165,12 @@ if(CONFIG_SENSORS) endif() if(CONFIG_SENSORS_BH1749NUC) - list(APPEND SRCS bh1749nuc.c) + list(APPEND SRCS bh1749nuc_base.c) + if(CONFIG_SENSORS_BH1749NUC_UORB) + list(APPEND SRCS bh1749nuc_uorb.c) + else() + list(APPEND SRCS bh1749nuc.c) + endif() endif() if(CONFIG_SENSORS_BH1750FVI) @@ -186,6 +190,15 @@ if(CONFIG_SENSORS) endif() endif() + if(CONFIG_SENSORS_BMI088) + list(APPEND SRCS bmi088_base.c) + if(CONFIG_SENSORS_BMI088_UORB) + list(APPEND SRCS bmi088_uorb.c) + else() + list(APPEND SRCS bmi088.c) + endif() + endif() + if(CONFIG_SENSORS_BMP180) list(APPEND SRCS bmp180_base.c) if(CONFIG_SENSORS_BMP180_UORB) @@ -193,7 +206,6 @@ if(CONFIG_SENSORS) else() list(APPEND SRCS bmp180.c) endif() - endif() if(CONFIG_SENSORS_BMP280) @@ -216,6 +228,10 @@ if(CONFIG_SENSORS) list(APPEND SRCS hts221.c) endif() + if(CONFIG_SENSORS_LIS2MDL) + list(APPEND SRCS lis2mdl_uorb.c) + endif() + if(CONFIG_LM75_I2C) list(APPEND SRCS lm75.c) endif() @@ -232,6 +248,10 @@ if(CONFIG_SENSORS) list(APPEND SRCS mb7040.c) endif() + if(CONFIG_SENSORS_MCP9600) + list(APPEND SRCS mcp9600_uorb.c) + endif() + if(CONFIG_SENSORS_MCP9844) list(APPEND SRCS mcp9844.c) endif() @@ -256,10 +276,6 @@ if(CONFIG_SENSORS) list(APPEND SRCS ltc4151.c) endif() - if(CONFIG_SENSORS_LIS2MDL) - list(APPEND SRCS lis2mdl_uorb.c) - endif() - if(CONFIG_SENSORS_INA219) list(APPEND SRCS ina219.c) endif() @@ -334,6 +350,10 @@ if(CONFIG_SENSORS) list(APPEND SRCS adxl345_spi.c) endif() + if(CONFIG_SENSORS_ADXL362) + list(APPEND SRCS adxl362_uorb.c) + endif() + if(CONFIG_SENSORS_ADXL372) if(CONFIG_SENSORS_ADXL372_UORB) list(APPEND SRCS adxl372_uorb.c) @@ -382,16 +402,6 @@ if(CONFIG_SENSORS) list(APPEND SRCS as5048a.c) endif() - if(CONFIG_SENSORS_BMI088) - list(APPEND SRCS bmi088_base.c) - if(CONFIG_SENSORS_BMI088_UORB) - list(APPEND SRCS bmi088_uorb.c) - else() - list(APPEND SRCS bmi088.c) - endif() - - endif() - endif() # CONFIG_SPI # These drivers depend on 1WIRE support @@ -454,6 +464,12 @@ if(CONFIG_SENSORS) list(APPEND SRCS hdc1008.c) endif() + # ANALOG MAX31865 + + if(CONFIG_SENSORS_MAX31865) + list(APPEND SRCS max31865.c) + endif() + # SONY CXD5602PWBIMU if(CONFIG_SENSORS_CXD5602PWBIMU) diff --git a/drivers/sensors/Kconfig b/drivers/sensors/Kconfig index 3cbbc3fd31b54..dcd1bd6aec3f8 100644 --- a/drivers/sensors/Kconfig +++ b/drivers/sensors/Kconfig @@ -838,6 +838,35 @@ config KXTJ9_I2C_BUS_SPEED endif # SENSORS_KXTJ9 +config SENSORS_L86_XXX + bool "Quectel L86-XXX GNSS support" + default n + depends on SERIAL && STANDARD_SERIAL && UORB + ---help--- + Enable driver support for the L86-XXX series of GNSS modules. + +config SENSORS_L86_XXX_THREAD_STACKSIZE + int "Stack size for L86XXX module collection thread" + default 10000 + depends on SENSORS_L86_XXX + +config L86_XXX_BAUD + int "Quectel L86-XXX baud rate" + default 9600 + depends on SENSORS_L86_XXX && SERIAL_TERMIOS + range 4800 115200 + ---help--- + Supported values are: 4800, 9600, 14400, 19200, 38400, 57600 and 115200 + +config L86_XXX_FIX_INT + int "Quectel L86-XXX fix interval rate" + default 1000 + depends on SENSORS_L86_XXX && SERIAL_TERMIOS + range 100 10000 + ---help--- + Rate in ms at which module obtains satellite fix. Supported values + are integers between 100 10000 + config SENSORS_LIS2DH bool "STMicro LIS2DH device support" default n diff --git a/drivers/sensors/Make.defs b/drivers/sensors/Make.defs index 2cdfcfbb3eda0..d3d7e0f554e8d 100644 --- a/drivers/sensors/Make.defs +++ b/drivers/sensors/Make.defs @@ -34,11 +34,14 @@ ifeq ($(CONFIG_SENSORS_RPMSG),y) CSRCS += sensor_rpmsg.c endif - ifeq ($(CONFIG_SENSORS_NAU7802),y) CSRCS += nau7802.c endif +ifeq ($(CONFIG_SENSORS_L86_XXX),y) + CSRCS += l86xxx_uorb.c +endif + ifeq ($(CONFIG_SENSORS_GNSS),y) CSRCS += gnss_uorb.c endif diff --git a/drivers/sensors/l86xxx_uorb.c b/drivers/sensors/l86xxx_uorb.c new file mode 100644 index 0000000000000..219cdedae1879 --- /dev/null +++ b/drivers/sensors/l86xxx_uorb.c @@ -0,0 +1,840 @@ +/**************************************************************************** + * drivers/sensors/l86xxx_uorb.c + * + * NOTE: EXPERIMENTAL DRIVER + * + * Contributed by Carleton University InSpace + * + * 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 +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef CONFIG_SENSORS_L86_XXX_THREAD_STACKSIZE +#define CONFIG_SENSORS_L86_XXX_THREAD_STACKSIZE 10000 +#endif + +#ifndef CONFIG_L86_XXX_BAUD +#define CONFIG_L86_XXX_BAUD 9600 +#endif + +#if CONFIG_L86_XXX_BAUD == 4800 || CONFIG_L86_XXX_BAUD == 9600 || CONFIG_L86_XXX_BAUD == 14400 || CONFIG_L86_XXX_BAUD == 19200 || CONFIG_L86_XXX_BAUD == 38400 || CONFIG_L86_XXX_BAUD == 57600 || CONFIG_L86_XXX_BAUD == 115200 + #define L86_XXX_BAUD_RATE CONFIG_L86_XXX_BAUD +#else + #error "Invalid baud rate. Supported baud rates are: 4800, 5600, 14400, 19200, 38400, 57600, 115200" +#endif + +#if CONFIG_L86_XXX_FIX_INT < 100 || CONFIG_L86_XXX_FIX_INT > 10000 + #error "Invalid fix interval rate. Values must be between 100 and 10000" +#endif + +/* Helper to get array length */ + +#define MINMEA_MAX_LENGTH 256 + +/**************************************************************************** + * Private Data Types + ****************************************************************************/ + +/* GNSS device struct */ + +typedef struct +{ + FAR struct file uart; /* UART interface */ + struct sensor_lowerhalf_s lower; /* UORB lower-half */ + mutex_t devlock; /* Exclusive access */ + sem_t run; /* Start/stop collection thread */ + bool enabled; /* If module has started */ + char buffer[MINMEA_MAX_LENGTH]; /* Buffer for UART interface */ + int bufbytes; +#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS + int16_t crefs; /* Number of open references */ +#endif +} l86xxx_dev_s; + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static int l86xxx_control(FAR struct sensor_lowerhalf_s *lower, + FAR struct file *filep, int cmd, unsigned long arg); +static int l86xxx_activate(FAR struct sensor_lowerhalf_s *lower, + FAR struct file *filep, bool enable); +static int l86xxx_set_interval(FAR struct sensor_lowerhalf_s *lower, + FAR struct file *filep, + FAR uint32_t *period_us); +static int set_baud_rate(l86xxx_dev_s *dev, int br); +static int send_command(l86xxx_dev_s *dev, + L86XXX_PMTK_COMMAND cmd, unsigned long arg); +static int read_line(l86xxx_dev_s *dev); + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const struct sensor_ops_s g_sensor_ops = +{ + .control = l86xxx_control, + .activate = l86xxx_activate, + .set_interval = l86xxx_set_interval, +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +#ifdef CONFIG_SERIAL_TERMIOS +/**************************************************************************** + * Name: set_baud_rate + * + * Description: + * Sets baud rate of UART interface + * + * Arguments: + * dev - Pointer L86-XXX priv struct + * br - Baud rate + * + * Returns: + * -EINVAL - Invalid baud rate + * 0 - Command succeeded, baud rate changed + * Other - Error occurred during ioctl call + ****************************************************************************/ + +static int set_baud_rate(l86xxx_dev_s *dev, int br) +{ + struct termios opt; + int err; + err = file_ioctl(&dev->uart, TCGETS, &opt); + if (err < 0) + { + snwarn("Couldn't get interface settings: %d\n", err); + return err; + } + + cfmakeraw(&opt); + + switch (br) + { + case 4800: + case 9600: + case 14400: + case 19200: + case 38400: + case 57600: + case 115200: + { + cfsetispeed(&opt, br); + cfsetospeed(&opt, br); + break; + } + + default: + { + snerr("Invalid baud rate, %ld\n", br); + return -EINVAL; + } + } + + err = file_ioctl(&dev->uart, TCSETS, &opt); + if (err < 0) + { + snerr("Couldn't change baud rate of U(S)ART interface: %d\n", err); + return err; + } + + /* These calls to read_line will flush out the buffer + after the baud rate change + */ + + for (int i = 0; i < 5; ++i) + { + err = read_line(dev); + if (err < 0) + { + snerr("Problem occurred when flushing buffer %d\n", err); + return err; + } + } + + return 0; +} +#endif + +/**************************************************************************** + * Name: send_command + * + * Description: + * Sends command L86-XXX GNSS device and waits for acknowledgement + * if command supports it. + * + * Arguments: + * dev - Pointer L86-XXX priv struct + * cmd - L86XXX_COMMAND enum + * arg - Dependent on command type. Could be used for preset + * enum, numeric args or struct pointers + * + * Returns: + * Flag defined by device + * -EINVAL - Invalid packet + * -ENOSYS - Unsupported packet type + * -EIO - Valid packet, but action failed + * 0 - Valid packet, action succeeded + * Other - Command failed during writing + ****************************************************************************/ + +static int send_command(l86xxx_dev_s *dev, + L86XXX_PMTK_COMMAND cmd, unsigned long arg) +{ + char buf[50]; + int bw1; + int bw2; + int err; + int ret; + uint8_t checksum; + + nxmutex_lock(&dev->devlock); + switch (cmd) + { + case CMD_HOT_START: + case CMD_WARM_START: + case CMD_COLD_START: + case CMD_FULL_COLD_START: + { + bw1 = snprintf(buf, sizeof(buf), "$PMTK%d", cmd); + break; + } + + case CMD_STANDBY_MODE: + { + bw1 = snprintf(buf, sizeof(buf), "$PMTK%d,0", cmd); + break; + } + + case SET_NMEA_BAUDRATE: + { + bw1 = snprintf(buf, sizeof(buf), "$PMTK%d,%d", cmd, (int)arg); + break; + } + + case SET_POS_FIX: + { + bw1 = snprintf(buf, sizeof(buf), "$PMTK%d,%d", cmd, (int)arg); + break; + } + + case FR_MODE: + { + bw1 = snprintf(buf, sizeof(buf), "$PMTK%d,%d", cmd, (int)arg); + break; + } + + default: + return -ENOSYS; + } + + sninfo("Sending command: %s to L86", buf); + + checksum = minmea_checksum(buf); + bw2 = snprintf(buf + bw1, sizeof(buf) - bw1, "*%02X\r\n", checksum); + + err = file_write(&dev->uart, buf, bw1 + bw2); + if (err < 0) + { + snerr("Could not send command to device\n"); + return err; + } + + /* These commands do not send ACKs + so just return after they've been written + */ + + if (cmd == CMD_HOT_START || + cmd == CMD_WARM_START || + cmd == CMD_COLD_START || + cmd == CMD_FULL_COLD_START) + { + nxmutex_unlock(&dev->devlock); + return 0; + } + + /* Setting baud rate also doesn't send an ACK but the interface baud rate + needs to be updated + */ + + if (cmd == SET_NMEA_BAUDRATE) + { + nxsig_usleep(20000); /* Should wait for a bit before changing interface baud rate */ + ret = set_baud_rate(dev, (int)arg); + nxmutex_unlock(&dev->devlock); + return ret; + } + + /* Some commands will send ACKs, + wait for them here before unlocking the mutex + */ + + /* ACK message will be $PMTK001,, + flag num indicates success of command + 0 = Invalid packet + 1 = Unsupported packet type + 2 = Valid packet, but action failed + 3 = Valid packet, action succeeded + */ + + memset(buf, '\0', 50); + snprintf(buf, 50, "$PMTK001,%d", cmd); + sninfo("Waiting for ACK from L86...\n"); + for (; ; ) + { + read_line(dev); + if (strncmp(buf, dev->buffer, strlen(buf)) == 0) break; + } + + sninfo("ACK received!\n"); + nxmutex_unlock(&dev->devlock); + + /* Flag num is always in position 13 of ack, subtract by '0' + to obtain return val + */ + + ret = dev->buffer[13] - '0'; + if (ret == 1) + { + return -ENOSYS; + } + else if (ret == 2) + { + return -EIO; + } + else if (ret == 3) + { + return 0; + } + else + { + return -EINVAL; + } +} + +/**************************************************************************** + * Name: read_line + * + * Description: + * Reads line from UART interface and stores in priv buffer + * + * Arguments: + * dev - Pointer L86-XXX priv struct + * + * Returns: + * Negative number if reading from device failed, else number + * of bytes read + ****************************************************************************/ + +static int read_line(l86xxx_dev_s *dev) +{ + memset(dev->buffer, '\0', sizeof(dev->buffer)); + int line_len = 0; + int err; + char next_char; + do + { + err = file_read(&dev->uart, &next_char, 1); + if (err < 0) + { + snerr("Couldn't read from UART device: %d\n", err); + return err; + } + + if (next_char != '\r' && next_char != '\n') + { + dev->buffer[line_len++] = next_char; + } + } + while (next_char != '\r' && next_char != '\n' + && line_len < sizeof(dev->buffer)); + dev->buffer[line_len] = '\0'; + return line_len; +} + +/**************************************************************************** + * Name: l86xxx_control + * + * Description: + * Send commands to the l86xxx GNSS module + * + * Returns: + * -ENOSYS if ioctl command is not supported, + * else return value from send_command + ****************************************************************************/ + +static int l86xxx_control(FAR struct sensor_lowerhalf_s *lower, + FAR struct file *filep, int cmd, unsigned long arg) +{ + FAR l86xxx_dev_s *dev = container_of(lower, FAR l86xxx_dev_s, lower); + L86XXX_PMTK_COMMAND pmtk_cmd; + switch (cmd) + { + case SNIOC_HOT_START: + pmtk_cmd = CMD_HOT_START; + break; + case SNIOC_WARM_START: + pmtk_cmd = CMD_WARM_START; + break; + case SNIOC_COLD_START: + pmtk_cmd = CMD_COLD_START; + break; + case SNIOC_FULL_COLD_START: + pmtk_cmd = CMD_FULL_COLD_START; + break; + case SNIOC_SET_INTERVAL: + pmtk_cmd = SET_POS_FIX; + break; + case SNIOC_SET_BAUD: + pmtk_cmd = SET_NMEA_BAUDRATE; + break; + case SNIOC_SET_OPERATIONAL_MODE: + if (arg == STANDBY) + { + pmtk_cmd = CMD_STANDBY_MODE; + } + else + { + pmtk_cmd = FR_MODE; + } + + break; + default: + snerr("Unsupported command\n"); + return -ENOSYS; + } + + return send_command(dev, pmtk_cmd, arg); +} + +/**************************************************************************** + * Name: l86xxx_activate + * + * Description: + * Puts GNSS module into hot start mode or standby mode depending + * on args + * + * Returns: + * Return value from send_command + ****************************************************************************/ + +static int l86xxx_activate(FAR struct sensor_lowerhalf_s *lower, + FAR struct file *filep, bool enable) +{ + FAR l86xxx_dev_s *dev = container_of(lower, FAR l86xxx_dev_s, lower); + + /* If not already enabled, start gps */ + + if (enable && !dev->enabled) + { + nxsem_post(&dev->run); + dev->enabled = true; + return send_command(dev, CMD_HOT_START, (int)NULL); + } + + /* If not already disabled, send gps into standby mode */ + + else if (!enable && dev->enabled) + { + dev->enabled = false; + return send_command(dev, CMD_STANDBY_MODE, 0); + } + + return 0; +} + +/**************************************************************************** + * Name: l86xxx_set_interval + * + * Description: + * Set position fix interval of L86-XXX GNSS module + * + * Returns: + * -EINVAL if invalid interval, else return value from send_command + ****************************************************************************/ + +static int l86xxx_set_interval(FAR struct sensor_lowerhalf_s *lower, + FAR struct file *filep, + FAR uint32_t *period_us) +{ + FAR l86xxx_dev_s *dev = container_of(lower, FAR l86xxx_dev_s, lower); + int fix_interval = *period_us; + if (fix_interval < 100 || fix_interval > 10000) + { + return -EINVAL; + } + + int ret = send_command(dev, SET_POS_FIX, fix_interval); + return ret; +} + +/**************************************************************************** + * Name: l86xxx_thread + * + * Description: + * Kernel thread to poll the l86xxx + ****************************************************************************/ + +static int l86xxx_thread(int argc, FAR char *argv[]) +{ + FAR l86xxx_dev_s *dev = + (FAR l86xxx_dev_s *)((uintptr_t)strtoul(argv[1], NULL, 16)); + struct sensor_gnss gps; + memset(&gps, 0, sizeof(gps)); + dev->enabled = true; + int err; + int bw; + + /* Read full line of NMEA output */ + + for (; ; ) + { + /* If the sensor is disabled + * wait until enabled with activate function + */ + + if (!dev->enabled) + { + err = nxsem_wait(&dev->run); + if (err < 0) + { + snerr("Couldn't wait on semaphore\n"); + continue; + } + } + + /* Mutex required because some commands send ACKS */ + + err = nxmutex_lock(&dev->devlock); + if (err < 0) + { + snerr("Couldn't lock mutex\n"); + return err; + } + + bw = read_line(dev); + + /* Parse line based on NMEA sentence type */ + + if (bw > 0) + { + switch (minmea_sentence_id(dev->buffer, false)) + { + /* Time data is obtained from RMC sentence */ + + case MINMEA_SENTENCE_RMC: + { + struct minmea_sentence_rmc frame; + struct tm tm; + if (minmea_check(dev->buffer, false) && + minmea_parse_rmc(&frame, dev->buffer)) + { + gps.timestamp = sensor_get_timestamp(); + minmea_getdatetime(&tm, &frame.date, &frame.time); + gps.time_utc = mktime(&tm); + } + break; + } + + /* Velocity data is obtained from VTG sentence */ + + case MINMEA_SENTENCE_VTG: + { + struct minmea_sentence_vtg frame; + + if (minmea_parse_vtg(&frame, dev->buffer)) + { + gps.ground_speed = minmea_tofloat(&frame.speed_kph) * 3.6; /* Convert speed in kph to mps */ + gps.course = minmea_tofloat(&frame.true_track_degrees); + } + break; + } + + /* 3D positional data is obtained from GGA sentence */ + + case MINMEA_SENTENCE_GGA: + { + struct minmea_sentence_gga frame; + + if (minmea_parse_gga(&frame, dev->buffer)) + { + gps.latitude = minmea_tocoord(&frame.latitude); + gps.longitude = minmea_tocoord(&frame.longitude); + gps.altitude = minmea_tofloat(&frame.altitude); + gps.altitude_ellipsoid = minmea_tofloat(&frame.height); + } + break; + } + + /* Precision dilution and satellite data is obtained from + * GSA sentence + */ + + case MINMEA_SENTENCE_GSA: + { + struct minmea_sentence_gsa frame; + + if (minmea_parse_gsa(&frame, dev->buffer)) + { + gps.hdop = minmea_tofloat(&frame.hdop); + gps.pdop = minmea_tofloat(&frame.pdop); + gps.vdop = minmea_tofloat(&frame.vdop); + uint32_t sats = 0; + for (int i = 0; i < 12; ++i) + { + if (frame.sats[i] != 0) + { + ++sats; + } + } + + gps.satellites_used = sats; + } + break; + } + + /* GSV and GLL data are transmitted by the l86-XXX but do not + provide additional information. Since GLL is always the last + message transmitted, events will be pushed whenever that + sentence is read + */ + + case MINMEA_SENTENCE_GLL: + { + dev->lower.push_event(dev->lower.priv, &gps, sizeof(gps)); + } + + /* All remaining sentences are not transmitted by the module */ + + case MINMEA_SENTENCE_GSV: + case MINMEA_SENTENCE_GBS: + case MINMEA_SENTENCE_GST: + case MINMEA_SENTENCE_ZDA: + { + break; + } + + case MINMEA_INVALID: + { + snerr("Read invalid NMEA statement: %s\n", dev->buffer); + break; + } + + case MINMEA_UNKNOWN: + { + /* Message could be non-standard NMEA message, + in that case just ignore + */ + + if (strncmp("$GPTXT", dev->buffer, strlen("$GPTXT")) == 0) + { + break; + } + + snwarn("Read unknown NMEA statement: %s %d\n", + dev->buffer, bw); + break; + } + } + } + + nxmutex_unlock(&dev->devlock); + } + + return 0; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: l86xxx_register + * + * Description: + * Register the L86-XXX GNSS device driver. + * + * Arguments: + * uartpath - The path to the UART character driver connected to the + * transceiver + * devno - The device number to use for the topic (i.e. /dev/mag0) + ****************************************************************************/ + +int l86xxx_register(FAR const char *uartpath, int devno) +{ + FAR l86xxx_dev_s *priv = NULL; + int err; + char *buf; + + DEBUGASSERT(uartpath != NULL); + + /* Initialize device structure */ + + priv = kmm_zalloc(sizeof(l86xxx_dev_s)); + if (priv == NULL) + { + snerr("Failed to allocate instance of L86-XXX driver.\n"); + return -ENOMEM; + } + + memset(priv, 0, sizeof(l86xxx_dev_s)); + + /* Initialize mutex */ + + err = nxmutex_init(&priv->devlock); + if (err < 0) + { + snerr("Failed to initialize mutex for L86-XXX device: %d\n", err); + goto free_mem; + } + + /* Initialize semaphore */ + + err = nxsem_init(&priv->run, 0, 0); + if (err < 0) + { + snerr("Failed to register L86-XXX driver: %d\n", err); + goto destroy_mutex; + } + + /* Open UART interface for use */ + + err = file_open(&priv->uart, uartpath, O_RDWR | O_CLOEXEC); + if (err < 0) + { + wlerr("Failed to open UART interface %s for L86-XXX driver: %d\n", + uartpath, err); + goto destroy_sem; + } + + /* Setup sensor with configured settings */ + + sninfo("Waiting for GNSS to start...\n"); + buf = "$PMTK010,001*2E"; + for (; ; ) + { + read_line(priv); + if (strncmp(buf, priv->buffer, strlen(buf)) == 0) break; + } + + sninfo("GNSS module started.\n"); + + #ifdef CONFIG_SERIAL_TERMIOS + err = send_command(priv, SET_NMEA_BAUDRATE, L86_XXX_BAUD_RATE); + if (err < 0) + { + snwarn("Couldn't set baud rate of device: %d\n", err); + } + + err = send_command(priv, SET_POS_FIX, CONFIG_L86_XXX_FIX_INT); + if (err < 0) + { + snwarn("Couldn't set position fix interval, %d\n", err); + } + + #endif + + /* Register UORB Sensor */ + + priv->lower.ops = &g_sensor_ops; + priv->lower.type = SENSOR_TYPE_GNSS; + + err = sensor_register(&priv->lower, devno); + if (err < 0) + { + snerr("Failed to register L86-XXX driver: %d\n", err); + goto close_file; + } + + FAR char *argv[2]; + char arg1[32]; + snprintf(arg1, 16, "%p", priv); + argv[0] = arg1; + argv[1] = NULL; + err = kthread_create("l86xxx_thread", SCHED_PRIORITY_DEFAULT, + CONFIG_SENSORS_L86_XXX_THREAD_STACKSIZE, + l86xxx_thread, argv); + + if (err < 0) + { + snerr("Failed to create the l86xxx notification kthread\n"); + goto sensor_unreg; + } + + sninfo("Registered L86-XXX driver with kernel polling thread" + " with baud rate %d and update rate %d", + L86_XXX_BAUD_RATE, + CONFIG_L86_XXX_FIX_INT); + + /* Cleanup items on error */ + + if (err < 0) + { + sensor_unreg: + sensor_unregister(&priv->lower, devno); + close_file: + file_close(&priv->uart); + destroy_sem: + nxsem_destroy(&priv->run); + destroy_mutex: + nxmutex_destroy(&priv->devlock); + free_mem: + kmm_free(priv); + } + + return err; +} diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index f6b9100a15df0..ebc4b1dee28f4 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -248,7 +248,7 @@ config SERIAL_TIOCGICOUNT default n ---help--- The ioctl TIOCGICOUNT is used to collect errors from serial ports - such as frame error, overrun, parity, etc. + such as frame error, overrun, parity, etc. config SERIAL_TIOCSERGSTRUCT bool "Support TIOCSERGSTRUCT" diff --git a/fs/Kconfig b/fs/Kconfig index 5aec56452e04b..4ac276b6b5d05 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -135,7 +135,6 @@ source "fs/mqueue/Kconfig" source "fs/shm/Kconfig" source "fs/mmap/Kconfig" source "fs/partition/Kconfig" -source "fs/notify/Kconfig" source "fs/fat/Kconfig" source "fs/nfs/Kconfig" source "fs/nxffs/Kconfig" diff --git a/fs/Make.defs b/fs/Make.defs deleted file mode 100644 index 00739fab5d4b4..0000000000000 --- a/fs/Make.defs +++ /dev/null @@ -1,21 +0,0 @@ -# ############################################################################## -# fs/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. -# -# ############################################################################## diff --git a/fs/Makefile b/fs/Makefile index e2879e437c005..f1edefed65531 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -66,7 +66,6 @@ include rpmsgfs/Make.defs include zipfs/Make.defs include mnemofs/Make.defs include v9fs/Make.defs -include notify/Make.defs endif CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)fs diff --git a/fs/driver/fs_registerblockdriver.c b/fs/driver/fs_registerblockdriver.c index 51798bfc35b00..aae4d026918a3 100644 --- a/fs/driver/fs_registerblockdriver.c +++ b/fs/driver/fs_registerblockdriver.c @@ -32,7 +32,7 @@ #include #include "inode/inode.h" -#include "notify/notify.h" +#include "vfs/vfs.h" #ifndef CONFIG_DISABLE_MOUNTPOINT diff --git a/fs/driver/fs_registerdriver.c b/fs/driver/fs_registerdriver.c index eda177d4e6fbe..c14052ff78211 100644 --- a/fs/driver/fs_registerdriver.c +++ b/fs/driver/fs_registerdriver.c @@ -33,7 +33,7 @@ #include #include "inode/inode.h" -#include "notify/notify.h" +#include "vfs/vfs.h" /**************************************************************************** * Public Functions diff --git a/fs/driver/fs_registermtddriver.c b/fs/driver/fs_registermtddriver.c index 4fc63a7e2c0e7..c91d1f267364c 100644 --- a/fs/driver/fs_registermtddriver.c +++ b/fs/driver/fs_registermtddriver.c @@ -33,7 +33,7 @@ #include #include "inode/inode.h" -#include "notify/notify.h" +#include "vfs/vfs.h" #if defined(CONFIG_MTD) && !defined(CONFIG_DISABLE_MOUNTPOINT) diff --git a/fs/driver/fs_registerpipedriver.c b/fs/driver/fs_registerpipedriver.c index 9b1dfdeb83a3c..b9a8329eb2d8e 100644 --- a/fs/driver/fs_registerpipedriver.c +++ b/fs/driver/fs_registerpipedriver.c @@ -32,7 +32,7 @@ #include #include "inode/inode.h" -#include "notify/notify.h" +#include "vfs/vfs.h" #ifdef CONFIG_PIPES diff --git a/fs/driver/fs_unregisterblockdriver.c b/fs/driver/fs_unregisterblockdriver.c index b1c66fac027c7..d4e34d0600c74 100644 --- a/fs/driver/fs_unregisterblockdriver.c +++ b/fs/driver/fs_unregisterblockdriver.c @@ -29,7 +29,7 @@ #include #include "inode/inode.h" -#include "notify/notify.h" +#include "vfs/vfs.h" /**************************************************************************** * Public Functions diff --git a/fs/driver/fs_unregisterdriver.c b/fs/driver/fs_unregisterdriver.c index 441e397bdb7e0..fe5ec1e595e7d 100644 --- a/fs/driver/fs_unregisterdriver.c +++ b/fs/driver/fs_unregisterdriver.c @@ -29,7 +29,7 @@ #include #include "inode/inode.h" -#include "notify/notify.h" +#include "vfs/vfs.h" /**************************************************************************** * Public Functions diff --git a/fs/driver/fs_unregistermtddriver.c b/fs/driver/fs_unregistermtddriver.c index 8babd5020d606..1ad1aa0875b55 100644 --- a/fs/driver/fs_unregistermtddriver.c +++ b/fs/driver/fs_unregistermtddriver.c @@ -30,7 +30,7 @@ #include #include "inode/inode.h" -#include "notify/notify.h" +#include "vfs/vfs.h" /**************************************************************************** * Public Functions diff --git a/fs/driver/fs_unregisterpipedriver.c b/fs/driver/fs_unregisterpipedriver.c index 9e530505cbb5c..69d7e2a4a0cec 100644 --- a/fs/driver/fs_unregisterpipedriver.c +++ b/fs/driver/fs_unregisterpipedriver.c @@ -29,7 +29,7 @@ #include #include "inode/inode.h" -#include "notify/notify.h" +#include "vfs/vfs.h" #ifdef CONFIG_PIPES diff --git a/fs/event/event_close.c b/fs/event/event_close.c index 1749cf1eda558..c2e8cd8a4a784 100644 --- a/fs/event/event_close.c +++ b/fs/event/event_close.c @@ -34,7 +34,7 @@ #include #include "inode/inode.h" -#include "notify/notify.h" +#include "vfs/vfs.h" /**************************************************************************** * Public Functions diff --git a/fs/event/event_open.c b/fs/event/event_open.c index f0b2bf76c524d..a2457096b37e5 100644 --- a/fs/event/event_open.c +++ b/fs/event/event_open.c @@ -36,7 +36,7 @@ #include #include "inode/inode.h" -#include "notify/notify.h" +#include "vfs/vfs.h" #include "event/event.h" /**************************************************************************** diff --git a/fs/fs_initialize.c b/fs/fs_initialize.c index 3c281fcbf2f26..a95f4ac31d02b 100644 --- a/fs/fs_initialize.c +++ b/fs/fs_initialize.c @@ -28,11 +28,10 @@ #include #include -#include "notify/notify.h" #include "rpmsgfs/rpmsgfs.h" #include "inode/inode.h" #include "aio/aio.h" -#include "vfs/lock.h" +#include "vfs/vfs.h" #include "fs_heap.h" /**************************************************************************** diff --git a/fs/mount/fs_mount.c b/fs/mount/fs_mount.c index 1d852bee725a5..9c32435b7f13c 100644 --- a/fs/mount/fs_mount.c +++ b/fs/mount/fs_mount.c @@ -37,7 +37,7 @@ #include "driver/driver.h" #include "inode/inode.h" -#include "notify/notify.h" +#include "vfs/vfs.h" /**************************************************************************** * Pre-processor Definitions diff --git a/fs/mount/fs_umount2.c b/fs/mount/fs_umount2.c index 546f6ff98fb2c..b030a316e0fa6 100644 --- a/fs/mount/fs_umount2.c +++ b/fs/mount/fs_umount2.c @@ -34,7 +34,7 @@ #include #include "inode/inode.h" -#include "notify/notify.h" +#include "vfs/vfs.h" /**************************************************************************** * Public Functions diff --git a/fs/mqueue/mq_open.c b/fs/mqueue/mq_open.c index 7b270bba1dce1..683f94c1c01fb 100644 --- a/fs/mqueue/mq_open.c +++ b/fs/mqueue/mq_open.c @@ -41,7 +41,7 @@ #include "inode/inode.h" #include "mqueue/mqueue.h" -#include "notify/notify.h" +#include "vfs/vfs.h" /**************************************************************************** * Private Functions Prototypes diff --git a/fs/mqueue/mq_unlink.c b/fs/mqueue/mq_unlink.c index cc32de0b56599..a0a2a275b6586 100644 --- a/fs/mqueue/mq_unlink.c +++ b/fs/mqueue/mq_unlink.c @@ -36,7 +36,7 @@ #include "inode/inode.h" #include "mqueue/mqueue.h" -#include "notify/notify.h" +#include "vfs/vfs.h" /**************************************************************************** * Private Functions diff --git a/fs/notify/CMakeLists.txt b/fs/notify/CMakeLists.txt deleted file mode 100644 index 9594cc62fe24c..0000000000000 --- a/fs/notify/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -# ############################################################################## -# fs/notify/CMakeLists.txt -# -# 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. -# -# ############################################################################## - -if(CONFIG_FS_NOTIFY) - target_sources(fs PRIVATE inotify.c) -endif() diff --git a/fs/notify/Kconfig b/fs/notify/Kconfig deleted file mode 100644 index 9dd9bef234aeb..0000000000000 --- a/fs/notify/Kconfig +++ /dev/null @@ -1,25 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see the file kconfig-language.txt in the NuttX tools repository. -# - -config FS_NOTIFY - bool "FS Notify System" - default n - ---help--- - The Fsnotify System - -if FS_NOTIFY -config FS_NOTIFY_BUCKET_SIZE - int "Dir hash bucket size" - default 64 - -config FS_NOTIFY_MAX_EVENTS - int "Max events in one notify device" - default 1024 - -config FS_NOTIFY_FD_POLLWAITERS - int "Max pollwaiters in one notify device" - default 2 - -endif # FS_NOTIFY diff --git a/fs/procfs/fs_procfsproc.c b/fs/procfs/fs_procfsproc.c index 94f30357709f1..cfdebd9d59e8c 100644 --- a/fs/procfs/fs_procfsproc.c +++ b/fs/procfs/fs_procfsproc.c @@ -1330,7 +1330,7 @@ static ssize_t proc_groupfd(FAR struct proc_file_s *procfile, fdp->f_backtrace, CONFIG_FS_BACKTRACE); #endif - procfile->line[linesize - 2] = '\n'; + procfile->line[linesize - 1] = '\n'; } file_put(filep); diff --git a/fs/semaphore/sem_close.c b/fs/semaphore/sem_close.c index 09bb257d00f36..da8b1c0a1740e 100644 --- a/fs/semaphore/sem_close.c +++ b/fs/semaphore/sem_close.c @@ -35,7 +35,7 @@ #include #include "inode/inode.h" -#include "notify/notify.h" +#include "vfs/vfs.h" #ifdef CONFIG_FS_NAMED_SEMAPHORES diff --git a/fs/semaphore/sem_open.c b/fs/semaphore/sem_open.c index cacccb2fc21a7..d346377831b1a 100644 --- a/fs/semaphore/sem_open.c +++ b/fs/semaphore/sem_open.c @@ -42,7 +42,7 @@ #include #include "inode/inode.h" -#include "notify/notify.h" +#include "vfs/vfs.h" #include "semaphore/semaphore.h" #ifdef CONFIG_FS_NAMED_SEMAPHORES diff --git a/fs/semaphore/sem_unlink.c b/fs/semaphore/sem_unlink.c index e00fabab095aa..fc0186e7f133f 100644 --- a/fs/semaphore/sem_unlink.c +++ b/fs/semaphore/sem_unlink.c @@ -36,7 +36,7 @@ #include #include "inode/inode.h" -#include "notify/notify.h" +#include "vfs/vfs.h" #include "semaphore/semaphore.h" /**************************************************************************** diff --git a/fs/shm/shm_open.c b/fs/shm/shm_open.c index 4c7018700447f..7d799743c9b02 100644 --- a/fs/shm/shm_open.c +++ b/fs/shm/shm_open.c @@ -31,7 +31,7 @@ #include #include "inode/inode.h" -#include "notify/notify.h" +#include "vfs/vfs.h" #include "shm/shmfs.h" /**************************************************************************** diff --git a/fs/shm/shm_unlink.c b/fs/shm/shm_unlink.c index 25f6297dd9321..bd4850c8294d5 100644 --- a/fs/shm/shm_unlink.c +++ b/fs/shm/shm_unlink.c @@ -29,7 +29,7 @@ #include #include "inode/inode.h" -#include "notify/notify.h" +#include "vfs/vfs.h" /**************************************************************************** * Private Functions diff --git a/fs/vfs/CMakeLists.txt b/fs/vfs/CMakeLists.txt index f261bdfec0433..40d31ff0fbc00 100644 --- a/fs/vfs/CMakeLists.txt +++ b/fs/vfs/CMakeLists.txt @@ -53,14 +53,18 @@ set(SRCS fs_syncfs.c fs_truncate.c) +# File notify support + +if(CONFIG_FS_NOTIFY) + list(APPEND SRCS fs_inotify.c) +endif() + # File lock support if(NOT "${CONFIG_FS_LOCK_BUCKET_SIZE}" STREQUAL "0") list(APPEND SRCS fs_lock.c) endif() -# Certain interfaces are not available if there is no mountpoint support - if(NOT "${CONFIG_PSEUDOFS_SOFTLINKS}" STREQUAL "0") list(APPEND SRCS fs_link.c fs_symlink.c fs_readlink.c) endif() diff --git a/fs/vfs/Kconfig b/fs/vfs/Kconfig index aab361518f511..b84b08778b875 100644 --- a/fs/vfs/Kconfig +++ b/fs/vfs/Kconfig @@ -65,6 +65,27 @@ config SIGNAL_FD_NPOLLWAITERS endif # SIGNAL_FD +config FS_NOTIFY + bool "FS Notify System" + default n + ---help--- + The Fsnotify System + +if FS_NOTIFY +config FS_NOTIFY_BUCKET_SIZE + int "Dir hash bucket size" + default 64 + +config FS_NOTIFY_MAX_EVENTS + int "Max events in one notify device" + default 1024 + +config FS_NOTIFY_FD_POLLWAITERS + int "Max pollwaiters in one notify device" + default 2 + +endif # FS_NOTIFY + config FS_BACKTRACE int "VFS backtrace" default 0 diff --git a/fs/vfs/Make.defs b/fs/vfs/Make.defs index 089415c25f89c..e1b54a238945a 100644 --- a/fs/vfs/Make.defs +++ b/fs/vfs/Make.defs @@ -29,7 +29,9 @@ CSRCS += fs_rename.c fs_rmdir.c fs_select.c fs_sendfile.c fs_stat.c CSRCS += fs_statfs.c fs_uio.c fs_unlink.c fs_write.c fs_dir.c fs_fsync.c CSRCS += fs_syncfs.c fs_truncate.c -# Certain interfaces are not available if there is no mountpoint support +ifeq ($(CONFIG_FS_NOTIFY),y) +CSRCS += fs_inotify.c +endif ifneq ($(CONFIG_FS_LOCK_BUCKET_SIZE),0) CSRCS += fs_lock.c diff --git a/fs/vfs/fs_close.c b/fs/vfs/fs_close.c index b7b5cee751a1b..575d3c1e3f70e 100644 --- a/fs/vfs/fs_close.c +++ b/fs/vfs/fs_close.c @@ -39,10 +39,9 @@ # include #endif -#include "notify/notify.h" #include "inode/inode.h" #include "sched/sched.h" -#include "vfs/lock.h" +#include "vfs.h" /**************************************************************************** * Private Functions diff --git a/fs/vfs/fs_fchstat.c b/fs/vfs/fs_fchstat.c index 00b54625b4278..fd64700b2b081 100644 --- a/fs/vfs/fs_fchstat.c +++ b/fs/vfs/fs_fchstat.c @@ -33,8 +33,8 @@ #include -#include "notify/notify.h" #include "inode/inode.h" +#include "vfs.h" /**************************************************************************** * Private Functions diff --git a/fs/notify/inotify.c b/fs/vfs/fs_inotify.c similarity index 99% rename from fs/notify/inotify.c rename to fs/vfs/fs_inotify.c index 92d0cdd21fbed..3d55960b8971a 100644 --- a/fs/notify/inotify.c +++ b/fs/vfs/fs_inotify.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/notify/inotify.c + * fs/vfs/fs_inotify.c * * SPDX-License-Identifier: Apache-2.0 * diff --git a/fs/vfs/fs_ioctl.c b/fs/vfs/fs_ioctl.c index c422d3f3b6e75..31306f2f75da2 100644 --- a/fs/vfs/fs_ioctl.c +++ b/fs/vfs/fs_ioctl.c @@ -33,7 +33,7 @@ #include #include "inode/inode.h" -#include "lock.h" +#include "vfs.h" /**************************************************************************** * Private Functions diff --git a/fs/vfs/fs_lock.c b/fs/vfs/fs_lock.c index 7b673f98744b0..ff43d28f38871 100644 --- a/fs/vfs/fs_lock.c +++ b/fs/vfs/fs_lock.c @@ -38,9 +38,9 @@ #include #include -#include "lock.h" #include "sched/sched.h" #include "fs_heap.h" +#include "vfs.h" /**************************************************************************** * Pre-processor Definitions diff --git a/fs/vfs/fs_mkdir.c b/fs/vfs/fs_mkdir.c index 5878ef330745a..c9be09d10495f 100644 --- a/fs/vfs/fs_mkdir.c +++ b/fs/vfs/fs_mkdir.c @@ -34,8 +34,8 @@ #include -#include "notify/notify.h" #include "inode/inode.h" +#include "vfs.h" /**************************************************************************** * Pre-processor Definitions diff --git a/fs/vfs/fs_open.c b/fs/vfs/fs_open.c index 1d528899990c2..6f5de6a1e9865 100644 --- a/fs/vfs/fs_open.c +++ b/fs/vfs/fs_open.c @@ -42,7 +42,7 @@ #include "sched/sched.h" #include "inode/inode.h" #include "driver/driver.h" -#include "notify/notify.h" +#include "vfs.h" /**************************************************************************** * Private Functions diff --git a/fs/vfs/fs_pseudofile.c b/fs/vfs/fs_pseudofile.c index a6fadb02c20c1..7b091bce740e2 100644 --- a/fs/vfs/fs_pseudofile.c +++ b/fs/vfs/fs_pseudofile.c @@ -40,8 +40,8 @@ #include #include "inode/inode.h" -#include "notify/notify.h" #include "fs_heap.h" +#include "vfs.h" /**************************************************************************** * Private Types diff --git a/fs/vfs/fs_read.c b/fs/vfs/fs_read.c index 51d1ce48fb430..857dcfcdd500a 100644 --- a/fs/vfs/fs_read.c +++ b/fs/vfs/fs_read.c @@ -35,8 +35,8 @@ #include -#include "notify/notify.h" #include "inode/inode.h" +#include "vfs.h" /**************************************************************************** * Private Functions diff --git a/fs/vfs/fs_rename.c b/fs/vfs/fs_rename.c index 7cd8319796a2d..03a1a811c373d 100644 --- a/fs/vfs/fs_rename.c +++ b/fs/vfs/fs_rename.c @@ -37,9 +37,9 @@ #include #include -#include "notify/notify.h" #include "inode/inode.h" #include "fs_heap.h" +#include "vfs.h" /**************************************************************************** * Pre-processor Definitions diff --git a/fs/vfs/fs_rmdir.c b/fs/vfs/fs_rmdir.c index ddfc8e72d3bff..f2b53284ddb36 100644 --- a/fs/vfs/fs_rmdir.c +++ b/fs/vfs/fs_rmdir.c @@ -33,8 +33,8 @@ #include -#include "notify/notify.h" #include "inode/inode.h" +#include "vfs.h" /**************************************************************************** * Pre-processor Definitions diff --git a/fs/vfs/fs_symlink.c b/fs/vfs/fs_symlink.c index cb32bff301a05..c06d231a890db 100644 --- a/fs/vfs/fs_symlink.c +++ b/fs/vfs/fs_symlink.c @@ -37,9 +37,9 @@ #include #include -#include "notify/notify.h" #include "inode/inode.h" #include "fs_heap.h" +#include "vfs.h" /**************************************************************************** * Pre-processor Definitions diff --git a/fs/vfs/fs_truncate.c b/fs/vfs/fs_truncate.c index 0be857e2ff4b4..2f7dbe6d06651 100644 --- a/fs/vfs/fs_truncate.c +++ b/fs/vfs/fs_truncate.c @@ -34,8 +34,8 @@ #include -#include "notify/notify.h" #include "inode/inode.h" +#include "vfs.h" /**************************************************************************** * Public Functions diff --git a/fs/vfs/fs_unlink.c b/fs/vfs/fs_unlink.c index 8d33d70033c3b..8726610a26035 100644 --- a/fs/vfs/fs_unlink.c +++ b/fs/vfs/fs_unlink.c @@ -33,8 +33,8 @@ #include -#include "notify/notify.h" #include "inode/inode.h" +#include "vfs.h" /**************************************************************************** * Pre-processor Definitions diff --git a/fs/vfs/fs_write.c b/fs/vfs/fs_write.c index 303b0be76aa21..8d4cc5da2947b 100644 --- a/fs/vfs/fs_write.c +++ b/fs/vfs/fs_write.c @@ -35,8 +35,8 @@ #include -#include "notify/notify.h" #include "inode/inode.h" +#include "vfs.h" /**************************************************************************** * Private Functions diff --git a/fs/vfs/lock.h b/fs/vfs/vfs.h similarity index 82% rename from fs/vfs/lock.h rename to fs/vfs/vfs.h index 2a51c9a14441c..a412bcd6a8b49 100644 --- a/fs/vfs/lock.h +++ b/fs/vfs/vfs.h @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/vfs/lock.h + * fs/vfs/vfs.h * * SPDX-License-Identifier: Apache-2.0 * @@ -20,13 +20,14 @@ * ****************************************************************************/ -#ifndef __FS_VFS_LOCK_H -#define __FS_VFS_LOCK_H +#ifndef __FS_VFS_VFS_H +#define __FS_VFS_VFS_H /**************************************************************************** * Included Files ****************************************************************************/ +#include #include /**************************************************************************** @@ -105,4 +106,21 @@ int file_setlk(FAR struct file *filep, FAR struct flock *flock, bool nonblock); #endif /* CONFIG_FS_LOCK_BUCKET_SIZE */ -#endif /* __FS_VFS_LOCK_H */ + +#ifdef CONFIG_FS_NOTIFY +void notify_open(FAR const char *path, int oflags); +void notify_close(FAR const char *path, int oflags); +void notify_close2(FAR struct inode *inode); +void notify_read(FAR struct file *filep); +void notify_write(FAR struct file *filep); +void notify_chstat(FAR struct file *filep); +void notify_unlink(FAR const char *path); +void notify_unmount(FAR const char *path); +void notify_mkdir(FAR const char *path); +void notify_create(FAR const char *path); +void notify_rename(FAR const char *oldpath, bool oldisdir, + FAR const char *newpath, bool newisdir); +void notify_initialize(void); +#endif /* CONFIG_FS_NOTIFY */ + +#endif /* __FS_VFS_VFS_H */ diff --git a/include/nuttx/notifier.h b/include/nuttx/notifier.h index 87ebdb78abc5e..7fdbdbdb79fad 100644 --- a/include/nuttx/notifier.h +++ b/include/nuttx/notifier.h @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include diff --git a/include/nuttx/sched_note.h b/include/nuttx/sched_note.h index 4795bbfbf6ec4..5c13eee3ea3ff 100644 --- a/include/nuttx/sched_note.h +++ b/include/nuttx/sched_note.h @@ -36,7 +36,7 @@ #include #include -#include +#include /* For system call numbers definition */ diff --git a/include/nuttx/sensors/ioctl.h b/include/nuttx/sensors/ioctl.h index 6b10c41d4f11f..ff2e6b7d0ab51 100644 --- a/include/nuttx/sensors/ioctl.h +++ b/include/nuttx/sensors/ioctl.h @@ -498,6 +498,19 @@ #define SNIOC_GET_CALIBVALUE _SNIOC(0x00A3) +/* Command: SNIOC_SET_BAUD + * Description: Sets the baud rate of the sensor. + */ + +#define SNIOC_SET_BAUD _SNIOC(0x00A4) + +/* IOCTL commands unique to the L86XXX and other GNSS modules */ + +#define SNIOC_HOT_START _SNIOC(0X00A5) +#define SNIOC_WARM_START _SNIOC(0X00A6) +#define SNIOC_COLD_START _SNIOC(0X00A7) +#define SNIOC_FULL_COLD_START _SNIOC(0X00A8) + /**************************************************************************** * Public types ****************************************************************************/ diff --git a/include/nuttx/sensors/l86xxx.h b/include/nuttx/sensors/l86xxx.h new file mode 100644 index 0000000000000..b2faf247cb6b5 --- /dev/null +++ b/include/nuttx/sensors/l86xxx.h @@ -0,0 +1,82 @@ +/**************************************************************************** + * include/nuttx/sensors/l86xxx.h + * + * NOTE: EXPERIMENTAL DRIVER + * + * 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 __INCLUDE_NUTTX_SENSORS_L86XXX_H +#define __INCLUDE_NUTTX_SENSORS_L86XXX_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Pre-Processor Declarations + ****************************************************************************/ + +/**************************************************************************** + * Public Data Types + ****************************************************************************/ + +typedef enum +{ + CMD_HOT_START = 101, + CMD_WARM_START = 102, + CMD_COLD_START = 103, + CMD_FULL_COLD_START = 104, + CMD_STANDBY_MODE = 161, + SET_POS_FIX = 220, + SET_NMEA_BAUDRATE = 251, + FR_MODE = 886, +} L86XXX_PMTK_COMMAND; + +typedef enum +{ + NORMAL = 0, + FITNESS = 1, + AVIATION = 2, + BALLOON = 3, + STANDBY = 4, +} L86XXX_OPERATIONAL_MODE; + +/**************************************************************************** + * Public Functions Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: l86xxx_register + * + * Description: + * Register the L86-XXX GNSS device driver. + * + * Arguments: + * uartpath - The path to the UART character driver connected to the + * GNSS module + * devno - The device number to use for the topic (i.e. /dev/mag0) + ****************************************************************************/ + +int l86xxx_register(FAR const char *uartpath, int devno); + +#endif /* __INCLUDE_NUTTX_SENSORS_L86XXX_H */ \ No newline at end of file diff --git a/include/nuttx/spinlock.h b/include/nuttx/spinlock.h index c1013e6401558..44493a820834a 100644 --- a/include/nuttx/spinlock.h +++ b/include/nuttx/spinlock.h @@ -37,9 +37,7 @@ #include #include -#if defined(CONFIG_TICKET_SPINLOCK) || defined(CONFIG_RW_SPINLOCK) -# include -#endif +#include #include @@ -86,22 +84,6 @@ extern "C" # define __SP_UNLOCK_FUNCTION 1 #endif -#define RSPINLOCK_CPU_INVALID (-1) -#define RSPINLOCK_INITIALIZER {RSPINLOCK_CPU_INVALID, SP_UNLOCKED, 0} - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -struct rspinlock_s -{ - /* Which cpu is holding spinlock, and taking recursive count */ - - volatile int holder; - volatile spinlock_t lock; - volatile unsigned int count; -}; - /**************************************************************************** * Public Function Prototypes ****************************************************************************/ @@ -198,11 +180,9 @@ static inline spinlock_t up_testset(FAR volatile spinlock_t *lock) * ****************************************************************************/ -static inline_function void rspin_lock_init(FAR struct rspinlock_s *lock) +static inline_function void rspin_lock_init(FAR rspinlock_t *lock) { - lock->holder = RSPINLOCK_CPU_INVALID; - spin_lock_init(&lock->lock); - lock->count = 0; + lock->val = 0; } /**************************************************************************** @@ -579,7 +559,7 @@ irqstate_t spin_lock_irqsave_nopreempt(FAR volatile spinlock_t *lock) } /**************************************************************************** - * Name: rspin_lock_irqsave_nopreempt + * Name: rspin_lock_irqsave/rspin_lock_irqsave_nopreempt * * Description: * Nest supported spinlock, can support UINT8_MAX max depth. @@ -603,24 +583,41 @@ irqstate_t spin_lock_irqsave_nopreempt(FAR volatile spinlock_t *lock) ****************************************************************************/ static inline_function -irqstate_t rspin_lock_irqsave_nopreempt(FAR struct rspinlock_s *lock) +irqstate_t rspin_lock_irqsave(FAR rspinlock_t *lock) { - /* For race condition, we may get cpuid in stack and then thread - * moved to other cpu. So we have to get cpuid with irq disabled. - */ + rspinlock_t new_val; + rspinlock_t old_val = RSPINLOCK_INITIALIZER; + irqstate_t flags = up_irq_save(); + int cpu = this_cpu() + 1; + + new_val.count = 1; + new_val.owner = cpu; - irqstate_t flags = up_irq_save(); - int cpu = this_cpu(); + /* Try seize the ownership of the lock. */ - if (lock->holder != cpu) + while (!atomic_cmpxchg_acquire((FAR atomic_t *)&lock->val, + (FAR atomic_t *)&old_val.val, new_val.val)) { - spin_lock(&lock->lock); - sched_lock(); - DEBUGASSERT(lock->count == 0); - lock->holder = cpu; + /* Already owned this lock. */ + + if (old_val.owner == cpu) + { + lock->count += 1; + break; + } + + old_val.val = 0; } - lock->count++; + return flags; +} + +static inline_function +irqstate_t rspin_lock_irqsave_nopreempt(FAR rspinlock_t *lock) +{ + irqstate_t flags = rspin_lock_irqsave(lock); + sched_lock(); + return flags; } @@ -791,7 +788,7 @@ void spin_unlock_irqrestore_nopreempt(FAR volatile spinlock_t *lock, } /**************************************************************************** - * Name: rspin_unlock_irqrestore_nopreempt + * Name: rspin_unlock_irqrestore/rspin_unlock_irqrestore_nopreempt * * Description: * Nest supported spinunlock, can support UINT8_MAX max depth. @@ -818,19 +815,27 @@ void spin_unlock_irqrestore_nopreempt(FAR volatile spinlock_t *lock, ****************************************************************************/ static inline_function -void rspin_unlock_irqrestore_nopreempt(FAR struct rspinlock_s *lock, - irqstate_t flags) +void rspin_unlock_irqrestore(FAR rspinlock_t *lock, irqstate_t flags) { - DEBUGASSERT(lock->holder == this_cpu()); + DEBUGASSERT(lock->owner == this_cpu() + 1); + if (--lock->count == 0) { - lock->holder = RSPINLOCK_CPU_INVALID; - spin_unlock_irqrestore_nopreempt(&lock->lock, flags); + atomic_set_release((FAR atomic_t *)&lock->val, 0); + up_irq_restore(flags); } /* If not last rspinlock restore, up_irq_restore should not required */ } +static inline_function +void rspin_unlock_irqrestore_nopreempt(FAR rspinlock_t *lock, + irqstate_t flags) +{ + rspin_unlock_irqrestore(lock, flags); + sched_unlock(); +} + #if defined(CONFIG_RW_SPINLOCK) /**************************************************************************** diff --git a/include/nuttx/spinlock_type.h b/include/nuttx/spinlock_type.h index e50c9254c7cbd..0a50c9ed45e49 100644 --- a/include/nuttx/spinlock_type.h +++ b/include/nuttx/spinlock_type.h @@ -29,10 +29,6 @@ #include -#if defined(CONFIG_RW_SPINLOCK) || defined(CONFIG_TICKET_SPINLOCK) -#include -#endif - #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" @@ -43,7 +39,7 @@ extern "C" #endif #if defined(CONFIG_RW_SPINLOCK) -typedef atomic_t rwlock_t; +typedef uint32_t rwlock_t; # define RW_SP_UNLOCKED 0 # define RW_SP_READ_LOCKED 1 # define RW_SP_WRITE_LOCKED -1 @@ -58,8 +54,8 @@ typedef uint8_t spinlock_t; typedef struct spinlock_s { - atomic_t owner; - atomic_t next; + uint32_t owner; + uint32_t next; } spinlock_t; # define SP_UNLOCKED (spinlock_t){0, 0} @@ -81,6 +77,21 @@ typedef struct spinlock_s #endif /* CONFIG_SPINLOCK */ +#define RSPINLOCK_CPU_INVALID (-1) +#define RSPINLOCK_INITIALIZER {0} + +typedef union rspinlock_u +{ + /* Which cpu is holding spinlock, and taking recursive count */ + + uint32_t val; + struct + { + uint16_t owner; + uint16_t count; + }; +} rspinlock_t; + #undef EXTERN #if defined(__cplusplus) } diff --git a/libs/libc/netdb/lib_dnsquery.c b/libs/libc/netdb/lib_dnsquery.c index 670fae69e183b..f7bb8e0a4ae51 100644 --- a/libs/libc/netdb/lib_dnsquery.c +++ b/libs/libc/netdb/lib_dnsquery.c @@ -902,6 +902,7 @@ static int dns_query_callback(FAR void *arg, FAR struct sockaddr *addr, { if (!stream && should_try_stream) { + close(sd); /* Close current socket before trying stream mode */ stream = true; goto try_stream; /* Don't consume retry count */ } @@ -961,6 +962,7 @@ static int dns_query_callback(FAR void *arg, FAR struct sockaddr *addr, { if (!stream && should_try_stream) { + close(sd); /* Close current socket before trying stream mode */ stream = true; goto try_stream; /* Don't consume retry count */ } diff --git a/libs/libc/stdio/README.md b/libs/libc/stdio/README.md deleted file mode 100644 index 887c77ca62580..0000000000000 --- a/libs/libc/stdio/README.md +++ /dev/null @@ -1,155 +0,0 @@ -# lib_bsprintf - This function is mainly used to output the contents of the input structure. Supports standard formats for printf and scanf. - For detailed parameters, see: - 1. https://en.cppreference.com/w/c/io/fprintf - 2. https://en.cppreference.com/w/c/io/fscanf - -- **special**: - 1. Float use %hf, "%f" or "%lf" is double, "%Lf" is long double. - 2. The char array is specified with %.xs. for example: "char t[30]" is specified with "%.30s", char a [20] - " %.20s " - 3. "%u" is unsigned int. - 4. "%d" is int. - 5. When using %f to format a double data type, the double is truncated to 6 decimal places by default. - 6. It is recommended that the "char[]" array be placed at the end of the structure to prevent parameter configuration errors such as "%.20s" from causing problems in parsing the entire buffer. -- **demo** - 1. **struct**: - ~~~ - begin_packed_struct - struct test - { - uint8_t a; - uint16_t b; - uint32_t c; - int8_t d; - int16_t e; - int32_t f; - float g; - double h; - char i[32]; - uint64_t j; - int64_t k; - char l; - unsigned char m; - short int n; - unsigned short int o; - int p; - unsigned int q; - long r; - unsigned long s; - long long t; - unsigned long long u; - size_t v; - long double w; - }end_packed_struct; - ~~~ - 1. **format string**: - ~~~ - const char* sg = " uint8_t:[%hhu]\n" \ - " uint16_t:[%hu]\n" \ - " uint32_t:[%u]\n" \ - " int8_t:[%hhd]\n" \ - " int16_t:[%hd]\n" \ - " int32_t:[%d]\n" \ - " float:[%hf]\n" \ - " double:[%f]\n" \ - " char[]:[%.32s]\n" \ - " uint64_t:[%lu]\n" \ - " int64_t:[%ld]\n" \ - " char:[%hhd]\n" \ - " unsigned char:[%hhu]\n" \ - " short int:[%hd]\n" \ - "unsigned short int:[%hu]\n" \ - " int:[%d]\n" \ - " unsigned int:[%u]\n" \ - " long:[%ld]\n" \ - " unsigned long:[%lu]\n" \ - " long long:[%lld]\n" \ - "unsigned long long:[%llu]\n" \ - " size_t:[%uz]\n" \ - " long double:[%Lf]\n"; - ~~~ - 1. **use**: - - output to terminal: - ~~~ - #ifdef CONFIG_FILE_STREAM - struct lib_stdoutstream_s stdoutstream; - - lib_stdoutstream(&stdoutstream, stdout); - - flockfile(stdout); - lib_bsprintf(&stdoutstream.common, sv, &test_v); - lib_bsprintf(&stdoutstream.common, sg, &test_g); - funlockfile(stdout); - #else - struct lib_rawoutstream_s rawoutstream; - struct lib_bufferedoutstream_s outstream; - - lib_rawoutstream(&rawoutstream, STDOUT_FILENO); - lib_bufferedoutstream(&outstream, &rawoutstream.common); - - lib_bsprintf(&outstream.common, sv, &test_v); - lib_bsprintf(&outstream.common, sg, &test_g); - - lib_stream_flush(&outstream.common); - #endif - ~~~ - -# lib_bscanf - This function adds a formatted standard scanf string to the structure(lib_bscanf). - 1. https://zh.cppreference.com/w/c/io/fscanf - -- **special**: - 1. Please use %lf for double precision, "%hf" or "%f" for float, long double ("%Lf") is not supported. - 2. Please use %hhd or %hhu for a single char or unsigned char. - 3. Use %hd or %hu for short int or unsigned short int. - 4. When using %s or %c, please specify the length of the char array, such as %32s, %32c. - 5. %s will check the string for spaces. When there are spaces in the string, it will be truncated. If you want to use string with spaces, please use %{length}c, but make sure that the length of the string can fill the array, otherwise an error will occur. - 6. %[] collection and %n are not supported. - -- **demo** - 1. **struct**: - Same as above - 1. **format string**: - ~~~ - #define TOSTR(str) #str - #define TONNAME(name) TOSTR(name) - - #define v_uint8_t 97 - #define v_uint16_t 19299 - #define v_uint32_t 22155 - - ...... - - #define v_l_double -9299.9299929912122464755474 - - char bflag[] = "%hhu%hu%u%hhd%hd%d%f%lf%32s%llu%lld%hhd%hhu%hd%hu%d%u%ld%lu%lld%llu%zu%ld"; - - char binput[] = TONNAME(v_uint8_t) \ - " " TONNAME(v_uint16_t) \ - " " TONNAME(v_uint32_t) \ - " " TONNAME(v_int8_t) \ - " " TONNAME(v_int16_t) \ - " " TONNAME(v_int32_t) \ - " " TONNAME(v_float) \ - " " TONNAME(v_double) \ - " " TONNAME(v_char_arr) \ - " " TONNAME(v_uint64_t) \ - " " TONNAME(v_int64_t) \ - " " TONNAME(v_char) \ - " " TONNAME(v_u_char) \ - " " TONNAME(v_s_int) \ - " " TONNAME(v_u_s_int) \ - " " TONNAME(v_int) \ - " " TONNAME(v_u_int) \ - " " TONNAME(v_long) \ - " " TONNAME(v_u_long) \ - " " TONNAME(v_l_l) \ - " " TONNAME(v_u_l_l) \ - " " TONNAME(v_size_t) \ - " " TONNAME(v_l_double); - ~~~ - 3. **use**: - ~~~ - struct test vg; - ret = lib_bscanf(binput, bflag, &vg); - ~~~ \ No newline at end of file diff --git a/sched/clock/clock_initialize.c b/sched/clock/clock_initialize.c index ba02b0893a646..8fa925730eee6 100644 --- a/sched/clock/clock_initialize.c +++ b/sched/clock/clock_initialize.c @@ -40,6 +40,8 @@ #include #include +#include + #include "clock/clock.h" #ifdef CONFIG_CLOCK_TIMEKEEPING # include "clock/clock_timekeeping.h" diff --git a/sched/misc/panic_notifier.c b/sched/misc/panic_notifier.c index 329c581e0b97b..ed8e28950e377 100644 --- a/sched/misc/panic_notifier.c +++ b/sched/misc/panic_notifier.c @@ -26,6 +26,7 @@ #include #include +#include #include diff --git a/tools/checkpatch.sh b/tools/checkpatch.sh index 2665477062228..c2453e032c616 100755 --- a/tools/checkpatch.sh +++ b/tools/checkpatch.sh @@ -32,7 +32,16 @@ range=0 spell=0 encoding=0 message=0 + +# CMake cmake_warning_once=0 + +# Python +black_warning_once=0 +flake8_warning_once=0 +isort_warning_once=0 + +cvt2utf_warning_once=0 codespell_config_file_location_was_shown_once=0 usage() { @@ -67,6 +76,14 @@ is_rust_file() { fi } +is_python_file() { + if [[ ${@##*.} == 'py' ]]; then + echo 1 + else + echo 0 + fi +} + is_cmake_file() { file_name=$(basename $@) if [ "$file_name" == "CMakeLists.txt" ] || [[ "$file_name" =~ \.cmake$ ]]; then @@ -88,18 +105,55 @@ check_file() { esac fi - if [ ${@##*.} == 'py' ]; then + if [ "$(is_python_file $@)" == "1" ]; then setupcfg="${TOOLDIR}/../.github/linters/setup.cfg" - black --check "$@" || fail=1 - flake8 --config "${setupcfg}" "$@" || fail=1 - isort --diff --check-only --settings-path "${setupcfg}" "$@" - if [ $? -ne 0 ]; then - # Format in place - isort --settings-path "${setupcfg}" "$@" + if ! command -v black &> /dev/null; then + if [ $black_warning_once == 0 ]; then + echo -e "\nblack not found, run following command to install:" + echo " $ pip install black" + black_warning_once=1 + fi + fail=1 + elif ! black --check $@ 2>&1; then + if [ $black_warning_once == 0 ]; then + echo -e "\nblack check failed, run following command to update the style:" + echo -e " $ black \n" + black_warning_once=1 + fi + fail=1 + fi + if ! command -v flake8 &> /dev/null; then + if [ $flake8_warning_once == 0 ]; then + echo -e "\nflake8 not found, run following command to install:" + echo " $ pip install flake8" + flake8_warning_once=1 + fi + fail=1 + elif ! flake8 --config "${setupcfg}" "$@" 2>&1; then + if [ $flake8_warning_once == 0 ]; then + echo -e "\nflake8 check failed !!!" + flake8_warning_once=1 + fi + fail=1 + fi + if ! command -v isort &> /dev/null; then + if [ $isort_warning_once == 0 ]; then + echo -e "\nisort not found, run following command to install:" + echo " $ pip install isort" + isort_warning_once=1 + fi + fail=1 + elif ! isort --diff --check-only --settings-path "${setupcfg}" "$@" 2>&1; then + if [ $isort_warning_once == 0 ]; then + isort --settings-path "${setupcfg}" "$@" + isort_warning_once=1 + fi fail=1 fi elif [ "$(is_rust_file $@)" == "1" ]; then if ! command -v rustfmt &> /dev/null; then + echo -e "\nrustfmt not found, run following command to install:" + echo " $ rustup component add rustfmt" fail=1 elif ! rustfmt --edition 2021 --check $@ 2>&1; then fail=1 @@ -126,24 +180,45 @@ check_file() { fi if [ $spell != 0 ]; then - if [ "$codespell_config_file_location_was_shown_once" != "1" ]; then + if ! command -v codespell &> /dev/null; then + if [ $codespell_config_file_location_was_shown_once == 0 ]; then + echo -e "\ncodespell not found, run following command to install:" + echo " $ pip install codespell" + codespell_config_file_location_was_shown_once=1 + fi + fail=1 + else + if [ $codespell_config_file_location_was_shown_once != 1 ]; then # show the configuration file location just once during (not for each input file) codespell_args="-q 7" codespell_config_file_location_was_shown_once=1 - else + else codespell_args="" - fi - if ! codespell $codespell_args ${@: -1}; then - fail=1 + fi + if ! codespell $codespell_args ${@: -1}; then + fail=1 + fi fi fi if [ $encoding != 0 ]; then - md5="$(md5sum $@)" - cvt2utf convert --nobak "$@" &> /dev/null - if [ "$md5" != "$(md5sum $@)" ]; then - echo "$@: error: Non-UTF8 characters detected!" + if ! command -v cvt2utf &> /dev/null; then + if [ $cvt2utf_warning_once == 0 ]; then + echo -e "\ncvt2utf not found, run following command to install:" + echo " $ pip install cvt2utf" + cvt2utf_warning_once=1 + fi fail=1 + else + md5="$(md5sum $@)" + cvt2utf convert --nobak "$@" &> /dev/null + if [ "$md5" != "$(md5sum $@)" ]; then + if [ $cvt2utf_warning_once == 0 ]; then + echo "$@: error: Non-UTF8 characters detected!" + cvt2utf_warning_once=1 + fi + fail=1 + fi fi fi } diff --git a/tools/refresh.sh b/tools/refresh.sh index 5db1ccd140e96..22499116aa85f 100755 --- a/tools/refresh.sh +++ b/tools/refresh.sh @@ -78,9 +78,11 @@ while [ ! -z "$1" ]; do echo " The architecture directory under nuttx/boards/" echo " " echo " The chip family directory under nuttx/boards//" - echo " Note1: all configuration is refreshed if : equals all." - echo " Note2: all configuration of arch XYZ is refreshed if \"arch:\" is passed" - echo " Note3: all configuration of chip XYZ is refreshed if \"chip:\" is passed" + echo " " + echo " Note1: all configurations are refreshed if : is replaced with \"all\" keyword" + echo " Note2: all configurations of arch XYZ are refreshed if \"arch:\" is passed" + echo " Note3: all configurations of chip XYZ are refreshed if \"chip:\" is passed" + echo " Note4: all configurations of board XYZ are refreshed if \"board:\" is passed" exit 0 ;; * ) @@ -129,6 +131,14 @@ else CHIP=$chipname echo "Normalizing all boards in chip: ${CHIP} !" CONFIGS=(`find boards/*/${CHIP} -name defconfig | cut -d'/' -f4,6`) + else + if [[ "X${CONFIGS}" == "Xboard:"* ]]; then + IFS=: read -r atype boardname <<< "${CONFIGS}" + BOARD=$boardname + echo "Normalizing all configs in board: ${BOARD} !" + # ATTENTION: It assumes we don't have a board with same name in other arch or chip + CONFIGS=(`find boards/*/*/${boardname} -name defconfig | cut -d'/' -f4,6`) + fi fi fi fi