nuttx/arch
Adam Feuer 65a866fbe2 support for SAMA5D27 SDMMC peripheral
- MMC and SD Card driver
- ported from imxrt_usdhc.c

Squashed commit of the following:

commit 46cbe18ad6a6e41ec2727d839f86f5670577878a
Author: Adam Feuer <adam@starcat.io>
Date:   Wed Jul 15 10:28:02 2020 -0700

    nxstyle change - Public Function Prototypes

    - instead of Public Functions

commit 486b7b62e83a78ae15b114e34846900d8fef8248
Author: Adam Feuer <adam@starcat.io>
Date:   Wed Jul 15 10:06:51 2020 -0700

    nxstyle changes

commit 28280d585a40aac99fd0e538295828ea013739b7
Author: Adam Feuer <adam@starcat.io>
Date:   Wed Jul 15 10:06:29 2020 -0700

    removing unused enum value

commit 7da6ba437e7e023d348e63c497732fea985a2d1b
Author: Adam Feuer <adam@starcat.io>
Date:   Tue Jul 14 21:17:49 2020 -0700

    CI build error fixes

    - unused vars
    - incorrect method calls

commit 145a73449b9d1eaed8a6cbf47cb53fb5b7a551f6
Author: Adam Feuer <adam@starcat.io>
Date:   Tue Jul 14 17:29:56 2020 -0700

    adding #defines to prevent unused var warning

commit 47ed2c08235816caded26a019cf33899daed1621
Author: Adam Feuer <adam@starcat.io>
Date:   Tue Jul 14 16:29:07 2020 -0700

    removing obsolete config values

commit b43f129c03a8bb8dc57ae6984d124ce9e9306196
Author: Adam Feuer <adam@starcat.io>
Date:   Tue Jul 14 09:58:42 2020 -0700

    removed obsolete config setting

commit 23e3af846ac24cac928442c7af86c5d0ef183ad3
Merge: 8b47330fe5 6f6d61eec4
Author: Adam Feuer <adam@starcat.io>
Date:   Tue Jul 14 09:53:12 2020 -0700

    Merge remote-tracking branch 'upstream/master' into feature/sama5d27-sdmmc-support

commit 8b47330fe5bb49bbd1991f2f3e2c69bdfb833d2c
Author: Adam Feuer <adam@starcat.io>
Date:   Tue Jul 14 09:51:56 2020 -0700

    replaced license headers with Apache License 2.0

commit 865e69b9a84d077ab9e05c2056dc7a515222c6c7
Author: Adam Feuer <adam@starcat.io>
Date:   Thu Jul 9 18:38:01 2020 -0700

    SAMA5D2x SDMMC peripheral support (SD Card driver)

    - reading and writing at 25 MHz and 50Mhz
    - UHS_SDR50, UHS_DDR50, and UHS_SDR104 are supported
    - ported from imxrt_usdhc.c
    - only tested on SAMA5D27

    Squashed commit of the following:

    commit e3122baef2feaeb32bb00798ae56310b2cc5c448
    Author: Adam Feuer <adam@starcat.io>
    Date:   Thu Jul 9 18:30:03 2020 -0700

        added sdmmcnsh defconfig and basic docs

    commit 12a290d7465a0a006473ba67893bf891a7bcea83
    Author: Adam Feuer <adam@starcat.io>
    Date:   Thu Jul 9 17:50:06 2020 -0700

        nxstyle changes

    commit 33409c0f63c328dc200150ba883327cadf0300b2
    Author: Adam Feuer <adam@starcat.io>
    Date:   Thu Jul 9 16:15:00 2020 -0700

        add short delay to in recvshortcrc

        - to allow SDMMC to respond

    commit 3be7a7fb6f79900042d1fdbef72810f364ac5f62
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Thu Jul 9 10:54:59 2020 -0700

        added SDR50 and SDR104 SDMMC bus modes

    commit 2888408866548ca53e582ea1525178a7733617b4
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Thu Jul 9 10:54:25 2020 -0700

        comment formatting cleanup

    commit 06cf2c39193971155eaa6f9c89a39a88b53964a8
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Thu Jul 9 10:34:01 2020 -0700

        removed unneeded comment

    commit ac89b69231bdf19563754865fda93d4bbbb4488d
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Thu Jul 9 10:30:23 2020 -0700

        code cleanup

        - removing custinfo() logging
        - remove duplicate #defines
        - move var declarations to the beginning of methods

    commit bcd4abec7935ee9023ab72edfb02685dbeee243c
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Wed Jul 8 16:34:31 2020 -0700

        handle SDMA Boundary Pause interrupt (DMAINT)

        - SDMMC_INT_DINT
        - add to waitints
        - add handler to sam_interrupt

    commit e9da026c1270e999df520ee2c60487195799f58c
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Tue Jul 7 16:07:34 2020 -0700

        Kconfig setting for SDMMC bus speed

        - 25 and 50 MHz
        - 50 MHz is the default

    commit 9edc636b7f18f981d653f85970c3af0b80801778
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Mon Jul 6 21:55:51 2020 -0700

        added HSEN bit change for high speed mode

        - above 26 MHz

    commit b8e91c95b0f7b2f8220f02b1eb42b6134e0660d0
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Mon Jul 6 21:28:03 2020 -0700

        added calloc to fix bug

        - not sure why this works.

    commit 1ceaf2f8487fe39d4d6fb21adecd57e4c4992e07
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Mon Jul 6 21:25:47 2020 -0700

        removing spurious typo characters

    commit 14ba51743bcca35686b07a76f5af17bcce078a5f
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Sat Jul 4 18:10:46 2020 -0700

        nxstyle changes

    commit d8af26df47b7840117de0d3a44ec548b3a72bc2b
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Sat Jul 4 17:01:11 2020 -0700

        nxstyle changes

    commit 0ae532bd62d02c5ac36aa2192f31fa1f7f1cde99
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Sat Jul 4 16:37:17 2020 -0700

        remove long lines in comments - nxstyle

    commit 3d025a84f8e9ddb7f7a4570504118d782dd5574c
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Sat Jul 4 16:36:52 2020 -0700

        removed custinfo logging

    commit 366b5d9d241a42d693583679cb49aa7bf25615aa
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Sat Jul 4 16:35:08 2020 -0700

        removed custinfo logging

    commit c74396e4a4943873c7de5b6ffee193787c39baef
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Sat Jul 4 16:34:36 2020 -0700

        fixed typo

    commit 7f51e99d7f4c1e5e0bf71a84fd0b2467157fea59
    Merge: c40f8c1039 2481b1bfd5
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Sat Jul 4 15:33:06 2020 -0700

        Merge remote-tracking branch 'upstream/master' into feature/sama5d27-sdmmc-support

    commit c40f8c10390ecefeb3a113046edd6740b07ab31b
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Thu Jul 2 22:08:20 2020 -0700

        SDMMC support for SAMA5D27
2020-07-16 23:39:37 +01:00
..
arm support for SAMA5D27 SDMMC peripheral 2020-07-16 23:39:37 +01:00
avr Fixed AVR build issues 2020-07-16 15:41:40 -03:00
hc build: Move the toolchain library setting to the common place 2020-07-16 15:38:08 -03:00
mips build: Move the toolchain library setting to the common place 2020-07-16 15:38:08 -03:00
misoc build: Move the toolchain library setting to the common place 2020-07-16 15:38:08 -03:00
or1k build: Move the toolchain library setting to the common place 2020-07-16 15:38:08 -03:00
renesas build: Move the toolchain library setting to the common place 2020-07-16 15:38:08 -03:00
risc-v build: Move the toolchain library setting to the common place 2020-07-16 15:38:08 -03:00
sim Fix nxstyle warnings 2020-07-13 00:46:55 -05:00
x86 build: Move the toolchain library setting to the common place 2020-07-16 15:38:08 -03:00
x86_64 build: Move the toolchain library setting to the common place 2020-07-16 15:38:08 -03:00
xtensa build: Move the toolchain library setting to the common place 2020-07-16 15:38:08 -03:00
z16 Fix note driver initialization 2020-07-13 00:46:55 -05:00
z80 build: Move the toolchain library setting to the common place 2020-07-16 15:38:08 -03:00
Kconfig CONFIG_SCHED_INSTRUMENTATION_SYSCALL should not available if the architecture does not support the required system hook note hooks. 2020-06-16 14:04:53 -03:00
README.txt arch/README.txt: Various improvements to the text 2020-04-17 15:16:43 -06:00

Architecture-Specific Code
^^^^^^^^^^^^^^^^^^^^^^^^^^
Table of Contents
^^^^^^^^^^^^^^^^^

  o Architecture-Specific Code
  o Summary of Files
  o Supported Architectures
  o Configuring NuttX

Architecture-Specific Code
^^^^^^^^^^^^^^^^^^^^^^^^^^

The NuttX configuration consists of:

o Processor architecture specific files.  These are the files contained
  in the arch/<arch-name>/ directory discussed in this README.

o Chip/SoC specific files.  Each processor architecture is embedded in
  chip or System-on-a-Chip (SoC) architecture.  The full chip
  architecture includes the processor architecture plus chip-specific
  interrupt logic, general purpose I/O (GPIO) logic, and specialized,
  internal peripherals (such as UARTs, USB, etc.).

  These chip-specific files are contained within chip-specific
  sub-directories in the arch/<arch-name>/ directory and are selected
  via the CONFIG_ARCH_name selection

o Board specific files.  In order to be usable, the chip must be
  contained in a board environment.  The board configuration defines
  additional properties of the board including such things as peripheral
  LEDs, external peripherals (such as network, USB, etc.).

  These board-specific configuration files can be found in the
  boards/<arch>/<chip>/<board> sub-directories.

This README will address the processor architecture specific files that
are contained in the arch/<arch-name>/ directory.  The file
include/nuttx/arch.h identifies all of the APIs that must be provided by
this architecture specific logic.  (It also includes
arch/<arch-name>/arch.h as described below).

Directory Structure
^^^^^^^^^^^^^^^^^^^

The arch/ directory contains architecture-specific logic.  The complete
board port is defined by the architecture-specific code in this
directory plus the board-specific configurations in the config/
subdirectory.  Each architecture must provide a subdirectory <arch-name>
under arch/ with the following characteristics:


        <arch-name>/
        |-- include/
        |   |--<chip-name>/
        |   |  `-- (chip-specific header files)
        |   |--<other-chips>/
        |   |-- arch.h
        |   |-- irq.h
        |   `-- types.h
        `-- src/
            |--<chip-name>/
            |  `-- (chip-specific source files)
            |--<other-chips>/
            |-- Makefile
            `-- (architecture-specific source files)

Summary of Files
^^^^^^^^^^^^^^^^

include/<chip-name>/
  This sub-directory contains chip-specific header files.

include/arch.h
  This is a hook for any architecture specific definitions that may be
  needed by the system.  It is included by include/nuttx/arch.h

include/types.h
  This provides architecture/toolchain-specific definitions for standard
  types.  This file should typedef:

    _int8_t, _uint8_t, _int16_t, _uint16_t, _int32_t, _uint32_t

  and if the architecture supports 64-bit integers:

    _int24_t, _uint24_t, _int64_t, _uint64_t

  NOTE that these type names have a leading underscore character.  This
  file will be included (indirectly) by include/stdint.h and typedef'ed
  to the final name without the underscore character.  This roundabout
  way of doings things allows the stdint.h to be removed from the
  include/ directory in the event that the user prefers to use the
  definitions provided by their toolchain header files.

    irqstate_t

  Must be defined to the size required to hold the interrupt
  enable/disable state.

  This file will be included by include/sys/types.h and be made
  available to all files.

include/irq.h
  This file needs to define some architecture-specific functions
  (usually inline if the compiler supports inlining) and structures.
  These include:

  - struct xcptcontext.  This structure represents the saved context of
    a thread.

  - irqstate_t up_irq_save(void) -- Used to disable all interrupts.

  - void upirq_restore(irqstate_t flags) -- Used to restore interrupt
    enables to the same state as before up_irq_save was called.

  NOTE: These interfaces are not available to application code but can
  only be used within the operating system code.  And, in general, these
  functions should *never* be called directly, not unless you know
  absolutely well what you are doing.  Rather you should typically use
  the wrapper functions enter_critical_section() and
  leave_critical_section() as prototyped in include/nuttx/irq.h.

  This file must also define NR_IRQS, the total number of IRQs supported
  by the board.

src/<chip-name>/
  This sub-directory contains chip-specific source files.

src/Makefile
  This makefile will be executed to build the targets src/libup.a and
  src/up_head.o.  The up_head.o file holds the entry point into the
  system (power-on reset entry point, for example).  It will be used in
  the final link with libup.a and other system archives to generate the
  final executable.

Supported Architectures
^^^^^^^^^^^^^^^^^^^^^^^
NOTE: nuttx/Documentation/NuttX.html for current information about the
state of these MCU ports.

arch/sim - Linux/Cygwin simulation
    A user-mode port of NuttX to the x86 Linux platform is available.
    The purpose of this port is primarily to support OS feature
    development.  This port does not support interrupts or a real timer
    (and hence no round robin scheduler).  Otherwise, it is complete.

arch/arm - ARM-based micro-controllers
    This directory holds common ARM architectures.  At present, this
    includes the following subdirectories:

    Architecture Support
      arch/arm/include and arch/arm/src/common
      arch/arm/src/arm and arch/arm/include/arm
      arch/arm/src/armv7-a and arch/arm/include/armv6-m
      arch/arm/src/armv7-a and arch/arm/include/armv7-a
      arch/arm/src/armv7-m and arch/arm/include/armv7-m
      arch/arm/src/armv7-r and arch/arm/include/armv7-r

    MCU support
      arch/arm/include/a1x and arch/arm/src/a1x
      arch/arm/include/am335x and arch/arm/src/am335x
      arch/arm/include/c5471 and arch/arm/src/c5471
      arch/arm/include/cxd56xx and arch/arm/src/cxd56xx
      arch/arm/include/dm320 and arch/arm/src/dm320
      arch/arm/include/efm32 and arch/arm/src/efm32
      arch/arm/include/imx1 and arch/arm/src/imx1
      arch/arm/include/imx6 and arch/arm/src/imx6
      arch/arm/include/imxrt and arch/arm/src/imxrt
      arch/arm/include/kinetis and arch/arm/src/kinetis
      arch/arm/include/kl and arch/arm/src/kl
      arch/arm/include/lc823450 and arch/arm/src/lc823450
      arch/arm/include/lpc17xx_40xx and arch/arm/src/lpc17xx_40xx
      arch/arm/include/lpc214x and arch/arm/src/lpc214x
      arch/arm/include/lpc2378 and arch/arm/src/lpc2378
      arch/arm/include/lpc31xx and arch/arm/src/lpc31xx
      arch/arm/include/lpc43xx and arch/arm/src/lpc43xx
      arch/arm/include/lpc54xx and arch/arm/src/lpc54xx
      arch/arm/include/max326xx and arch/arm/src/max326xx
      arch/arm/include/moxart and arch/arm/src/moxart
      arch/arm/include/nrf52 and arch/arm/src/nrf52
      arch/arm/include/nuc1xx and arch/arm/src/nuc1xx
      arch/arm/include/s32k1xx and arch/arm/src/s32k1xx
      arch/arm/include/sam34 and arch/arm/src/sam34
      arch/arm/include/sama5 and arch/arm/src/sama5
      arch/arm/include/samd2l2 and arch/arm/src/samd2l2
      arch/arm/include/samd5e5 and arch/arm/src/samd5e5
      arch/arm/include/samv7 and arch/arm/src/samv7
      arch/arm/include/stm32 and arch/arm/src/stm32
      arch/arm/include/stm32f0l0g0 and arch/arm/src/stm32f0l0g0
      arch/arm/include/stm32f7 and arch/arm/src/stm32f7
      arch/arm/include/stm32h7 and arch/arm/src/stm32h7
      arch/arm/include/stm32l4 and arch/arm/src/stm32l4
      arch/arm/include/str71x and arch/arm/src/str71x
      arch/arm/include/tiva and arch/arm/src/tiva
      arch/arm/include/tms570 and arch/arm/src/tms570
      arch/arm/include/xmc4 and arch/arm/src/xmc4

arch/avr
    This directory is dedicated to ports to the Atmel AVR (8-bit) and
    AVR32 (32-bit) MCU families.  STATUS:  Under development.

    Architecture Support
      arch/avr/include/avr and arch/avr/src/avr
      arch/avr/include/avr32 and arch/avr/src/avr32

    MCU support
      arch/avr/include/atmega and arch/avr/src/atmega
      arch/avr/include/at90usb and arch/avr/src/at90usb
      arch/avr/include/at32uc3 and arch/avr/src/at32uc3
      arch/avr/include/xmega and arch/avr/src/xmega

arch/hc
    This directory is dedicated to ports to the Freescale HC family.

    arch/arm/include/m9s12 and arch/arm/src/m9s12

arch/mips
    This directory is dedicated to ports to the MIPS family.

    Architecture Support
      arch/mips/include/mips32 and arch/mips/src/mips32

    MCU support
      arch/mips/include/pic32mx and arch/mips/src/pic32mx
      arch/mips/include/pic32mz and arch/mips/src/pic32mz

arch/misoc
    This directory is dedicated to ports to the Misoc family.

    MCU support
      arch/misoc/include/lm32 and arch/misoc/src/lm32
      arch/misoc/include/minerva and arch/misoc/src/minerva

arch/renesas - Support for Renesas and legacy Hitachi microcontrollers.
    This include SuperH and M16C.

    Architecture Support
      arch/renesas/include and arch/renesas/src/common

    MCU support
      arch/renesas/include/m16c and arch/renesas/src/m16c
      arch/renesas/include/rx65n and arch/renesas/src/rx65n
      arch/renesas/include/sh1 and arch/renesas/src/sh1

arch/or1k
    This directory is dedicated to ports to OpenRISC architectures.

    arch/or1k/include/mor1k and arch/or1k/src/mor1k

arch/risc-v
    This directory is dedicated to ports to the RISC-V family.

    Architecture Support
      arch/risc-v/include/rv32im

    MCU support
      arch/risc-v/include/fe310 and arch/risc-v/src/fe310
      arch/risc-v/include/gap8 and arch/risc-v/src/gap8
      arch/risc-v/include/k210 and arch/risc-v/src/k210
      arch/risc-v/include/litex and arch/risc-v/src/litex
      arch/risc-v/include/nr5m100 and arch/risc-v/src/nr5m100
      arch/risc-v/include/rv32im and arch/risc-v/src/rv32im
      arch/risc-v/include/rv64gc and arch/risc-v/src/rv64gc

arch/x86 - Intel x86 architectures
    This directory holds related, 32- and 64-bit architectures from
    Intel.  At present, this includes the following subdirectories:

    Architecture Support
      arch/x86/include and arch/x86/src/common

    MCU support
      arch/x86/include/i486 and arch/x86/src/i486
      arch/x86/include/qemu and arch/x86/src/qemu

arch/x86_64 - Intel x86 64-bit architectures
    This directory holds related 64-bit architectures from Intel.  At
    present, this includes the following subdirectories:

    Architecture Support
      arch/x86_64/include and arch/x86_64/src/common

    MCU support
      arch/x86_64/include/intel64 and arch/x86_64/src/intel64
      arch/x86_64/include/qemu and arch/x86_64/src/qemu

arch/xtensa
    Implementations based on the Cadence® Tensilica® Xtensa® processors,
    such as the Xtensa LX6 dataplane processing units (DPUs).  At
    present, this includes the following subdirectories:

    Common XTENSA support:
      arch/xtensa/include and arch/xtensa/src/common

    LX6 DPU support:
      arch/xtensa/include/lx6 and arch/xtensa/xtensa/lx6

    Espressif ESP32 implementation of the LX6 DPU:
      arch/xtensa/include/esp32 and arch/xtensa/xtensa/esp32

arch/z16 - ZiLOG 16-bit processors
    This directory holds related, 16-bit architectures from ZiLOG.  At
    present, this includes the following subdirectories:

    Architecture Support
      arch/z16/include and arch/z16/src/common

    MCU support
      arch/z16/include/z16f and arch/z16/src/z16f

arch/z80 - ZiLOG 8-bit microcontrollers
    This directory holds related, 8-bit architectures from ZiLOG.  At
    present, this includes the following subdirectories:

    Architecture Support
      arch/z80/include and arch/z80/src/common

    MCU support
      arch/z80/include/ez80 and arch/z80/src/ez80
      arch/z80/include/z80 and arch/z80/src/z180
      arch/z80/include/z8 and arch/z80/src/z8
      arch/z80/include/z80 and arch/z80/src/z80