ssekar15 opened a new pull request, #22297:
URL: https://github.com/apache/nuttx/pull/22297

   ## Summary
   
   The TriCore port has no way to configure a port pin other than the private 
pin code of the UART driver, so neither boards nor drivers can use GPIOs. This 
adds a small GPIO interface for the AURIX ports in src/common/aurix: a pin set 
that describes a pin and its configuration, tricore_gpio_config, 
tricore_gpio_write and tricore_gpio_read, with the TC3xx and TC4xx 
implementations, and a lower half that registers a pin as /dev/gpioN.
   
   The UART driver now sets up its pins through the interface, with the same 
port registers after boot as before, and the two Lite Kit boards register their 
user LEDs as /dev/gpio0 and /dev/gpio1 when CONFIG_DEV_GPIO is set. The 
interface is also what the Ethernet support will use for its pins.
   
   ## Dependency
   
   Depends on #22224 and #22244 (TC375 and TC4D7 Lite Kit boards), whose boards 
register their LEDs here.
   
   ## Impact
   
   TriCore only.
   - arch/tricore: new tricore_gpio.h in src/common/aurix and tc3x_gpio.c and
     tc4x_gpio.c, always built; tricore_gpio_lower.c, built with
     CONFIG_DEV_GPIO. The UART pins are pin sets in the chip headers.
   - boards: a2g-tc375-lite and a3g-tc4d7-lite register their LEDs with
     CONFIG_DEV_GPIO; the defconfigs are unchanged.
   - Documentation: the LEDs in the two Lite Kit board pages.
   
   ## Testing
   
   I confirm that changes are verified on local setup and works as intended:
   
   * Build Host(s): Linux x86_64, Debian GNU/Linux 12 (bookworm)
   * Toolchains: AURIX GCC 11.3.1 (tricore-elf-gcc), TASKING VX-toolset v6.4r1 
(TC3x), TASKING SmartCode v10.4r1 (TC4x)
   * Build systems: make, cmake (Ninja)
   * Target(s): a2g-tc375-lite:nsh, a3g-tc4d7-lite:nsh, a2g-tc397-5v-tft:nsh,  
triboard_tc4x9_com:nsh
   * Hardware: AURIX Lite Kit V2.0 (TC375), AURIX Lite Kit V1.0 (TC4D7),  
TriBoard TC397 V2.0, TriBoard TC4x7 COM V3.0
   * Each commit passes tools/checkpatch.sh and builds all four boards with GCC 
and TASKING; the defconfigs stay normalized.
   
   Build results (tip):
   
   | Board | GCC make | GCC cmake | TASKING make | TASKING cmake |
   |---|---|---|---|---|
   | a2g-tc375-lite:nsh | pass | pass | pass | pass |
   | a3g-tc4d7-lite:nsh | pass | pass | pass | pass |
   | a2g-tc397-5v-tft:nsh | pass | pass | pass | pass |
   | triboard_tc4x9_com:nsh | pass | pass | pass | pass |
   
   The two Lite Kit boards also build with GCC and TASKING with 
CONFIG_DEV_GPIO, CONFIG_EXAMPLES_GPIO and CONFIG_BOARD_LATE_INITIALIZE.
   
   Runtime, ostest with GCC on the nsh configuration:
   
   | Board | GCC |
   |---|---|
   | AURIX Lite Kit TC375 (a2g-tc375-lite:nsh) | pass |
   | AURIX Lite Kit TC4D7 (a3g-tc4d7-lite:nsh) | pass |
   
   ```
   nsh> uname -a
   NuttX 10.4.0 335b88b5dfc Nov 23 2026 14:08:15 tricore a2g-tc375-lite
   nsh> ostest
   ...
   ostest_main: Exiting with status 0
   ```
   
   LEDs with the gpio example (CONFIG_DEV_GPIO, CONFIG_EXAMPLES_GPIO), on both
   Lite Kits:
   
   ```
   nsh> ls /dev
   /dev:
    console
    gpio0
    gpio1
    null
    ttyS0
    zero
   nsh> gpio -o 0 /dev/gpio0
   Driver: /dev/gpio0
     Output pin:    Value=1
     Writing:       Value=0
     Verify:        Value=0
   nsh> gpio -o 1 /dev/gpio0
   Driver: /dev/gpio0
     Output pin:    Value=0
     Writing:       Value=1
     Verify:        Value=1
   ```
   
   The port registers of the LED pins follow, TC375 P00.5/P00.6 and TC4D7 
P03.9/P03.10 (OUT, IN):
   
   | Step | TC375 P00 | TC4D7 P03 |
   |---|---|---|
   | boot, LEDs off
   | /dev/gpio0 = 0, LED1 on
   | /dev/gpio1 = 0, LED2 on
   | both = 1, LEDs off
   
   with the pins as GPIO outputs: P00 IOCR4 10808010 on the TC375, P03 DRVCFG9 
and DRVCFG10 00000001 on the TC4D7.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to