Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor uart #13585

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

Refactor uart #13585

wants to merge 21 commits into from

Commits on Apr 25, 2024

  1. serial - refactor serial resource handling

    - port related resources (tx/rx/inverted,dma)
      - are stored sequentially, with space in place of ports that are not
      enabled (RESOURCE_UART_COUNT + RESOURCE_LPUART_COUNT +
         RESOURCE_SOFTSERIAL_COUNT)
      - RESOURCE_UART_OFFSET, RESOURCE_LPUART_OFFSET, RESOURCE_SOFTSERIAL_OFFSET
      - resource entries are pointing into this array (UART, LPUART, SOFTSERIAL)
        - both pins and DMA
        - inverter is supproted only for UART + LPUART (makes sense only
         for UART, to be removed)
      - softSerialPinConfig is removed, it is no longer necessary
    - serialResourceIndex(identifier) is used universally to get correct
       index into resource array
    - unified handling of resources where possible
    - serialOwnerTxRx() + serialOwnerIndex() are used for displaying resources
       correctly to user.
    - serialType(identifier) implemented
      - serialOwnerTxRx / serialOwnerIndex are trivial with it
      - large switch() statemens are greatly simplified
    ledvinap committed Apr 25, 2024
    Configuration menu
    Copy the full SHA
    2b907fb View commit details
    Browse the repository at this point in the history
  2. serial - merge code duplicated in all UART implementations

    - drivers/serial_uart_hw.c contains merged serialUART code.
      Code did not match exactly. Obvious cases are fixed, more complicated
      use #ifs
    - pin inversion unified
    - uartOpen is refactored a bit
    ledvinap committed Apr 25, 2024
    Configuration menu
    Copy the full SHA
    f78b10c View commit details
    Browse the repository at this point in the history
  3. serial - refactor uartDevice

    - use 'compressed' enum from uartDeviceIdx_e. Only enabled ports are
       in this enum.
    - uartDeviceIdx directly indexes uartDevice (no search necessary, no
        wasted space)
    - use `serialPortIdentifier_e identifier;` for uartHardware
    - for DMA remap, define only entries for enabled ports (uartDeviceIdx_e
       does not exist disabled port)
    ledvinap committed Apr 25, 2024
    Configuration menu
    Copy the full SHA
    595b140 View commit details
    Browse the repository at this point in the history
  4. serial - apply changes to inverter

    New implementation is trivial
    ledvinap committed Apr 25, 2024
    Configuration menu
    Copy the full SHA
    343ed89 View commit details
    Browse the repository at this point in the history
  5. serial - HAL - rxIrq, txIrq replaces by irqn

    There is only one IRQ for serial
    ledvinap committed Apr 25, 2024
    Configuration menu
    Copy the full SHA
    c962202 View commit details
    Browse the repository at this point in the history
  6. serial - serial_post.h

    Generated code to normalize target configuration.
    jinja2 template is used to generate header file. Port handling is
    unified a lot.
    
    SERIAL_<type><n>_USED 0/1 - always defined, value depends on target configuration
    SERIAL_<type>_MASK        - bitmask of used ports or given type. <port>1 is BIT(0)
    SERIAL_<type>_COUNT       - number of enabled ports of given type
    SERIAL_<type>_MAX         - <index of highest used port> + 1, 0 when no port is enabled
    ledvinap committed Apr 25, 2024
    Configuration menu
    Copy the full SHA
    fbb7dec View commit details
    Browse the repository at this point in the history
  7. targets - remove automatically calculated valued from configs

    serial_post.h generated it
    ledvinap committed Apr 25, 2024
    Configuration menu
    Copy the full SHA
    34d43b9 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    462dd65 View commit details
    Browse the repository at this point in the history
  9. serial - change LPUART to UART_LP1 in places

    LPUART is mostly handled as another UART port, this change reflects it
    ledvinap committed Apr 25, 2024
    Configuration menu
    Copy the full SHA
    904ad98 View commit details
    Browse the repository at this point in the history
  10. serial - use ARRAYLEN / ARRAYEND in some places

    replaces constant that may not match actual array size
    ledvinap committed Apr 25, 2024
    Configuration menu
    Copy the full SHA
    d842fd5 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    5114ae9 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    90cdcd9 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    fac6a13 View commit details
    Browse the repository at this point in the history
  14. serial - suspicious code

    ledvinap committed Apr 25, 2024
    Configuration menu
    Copy the full SHA
    b430fa7 View commit details
    Browse the repository at this point in the history
  15. serial - unittests

    ledvinap committed Apr 25, 2024
    Configuration menu
    Copy the full SHA
    a822a09 View commit details
    Browse the repository at this point in the history
  16. serial - cleanup

    ledvinap committed Apr 25, 2024
    Configuration menu
    Copy the full SHA
    a672e42 View commit details
    Browse the repository at this point in the history
  17. serial - simpler port names

    Is this useful ?
    ledvinap committed Apr 25, 2024
    Configuration menu
    Copy the full SHA
    92f7399 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    eb65300 View commit details
    Browse the repository at this point in the history
  19. serial - fix unittests

    include serial_post.h, some ports are defined, so normalization will
    work fine
    ledvinap committed Apr 25, 2024
    Configuration menu
    Copy the full SHA
    e825d9a View commit details
    Browse the repository at this point in the history

Commits on Apr 27, 2024

  1. Configuration menu
    Copy the full SHA
    a9ba3a4 View commit details
    Browse the repository at this point in the history

Commits on May 24, 2024

  1. Configuration menu
    Copy the full SHA
    2af8488 View commit details
    Browse the repository at this point in the history