Changeset 033443c in rtems


Ignore:
Timestamp:
Jun 2, 2016, 11:25:26 AM (3 years ago)
Author:
Alexander Krutwig <alexander.krutwig@…>
Branches:
master
Children:
2f3d804
Parents:
15f0f9b
git-author:
Alexander Krutwig <alexander.krutwig@…> (06/02/16 11:25:26)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/06/16 10:57:08)
Message:

bsp/atsam: Support QSPI flash

Location:
c/src/lib/libbsp/arm/atsam
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/atsam/Makefile.am

    r15f0f9b r033443c  
    1919project_lib_DATA += startup/linkcmds.intsram
    2020project_lib_DATA += startup/linkcmds.sdram
     21project_lib_DATA += startup/linkcmds.qspiflash
    2122
    2223###############################################################################
  • c/src/lib/libbsp/arm/atsam/README

    r15f0f9b r033443c  
    4242(default 0x00200000).
    4343
     44Use ATSAM_MEMORY_QSPIFLASH_SIZE=XYZ to set the size of QSPI flash in bytes
     45(default 0x00200000).
     46
    4447The pins may be configured by the application at link-time.  See
    4548<bsp/pin-config.h>.
  • c/src/lib/libbsp/arm/atsam/configure.ac

    r15f0f9b r033443c  
    7878ATSAM_LINKCMD([ATSAM_MEMORY_INTSRAM_SIZE],[size of internal SRAM in bytes],[${INTSRAM}])
    7979ATSAM_LINKCMD([ATSAM_MEMORY_SDRAM_SIZE],[size of external SDRAM in bytes],[0x00200000])
     80ATSAM_LINKCMD([ATSAM_MEMORY_QSPIFLASH_SIZE],[size of QSPI flash in bytes],[0x00200000])
    8081
    8182AC_CONFIG_FILES([
  • c/src/lib/libbsp/arm/atsam/libraries/libchip/source/qspi.c

    r15f0f9b r033443c  
    212212}
    213213
     214static void do_copy(uint8_t *dst, const uint8_t *src, size_t n, bool aligned)
     215{
     216        if (aligned) {
     217                while (n > 3) {
     218                        *(uint32_t *)dst = *(uint32_t *)src;
     219                        dst += 4;
     220                        src += 4;
     221                        n -= 4;
     222                }
     223        }
     224
     225        while (n > 0) {
     226                *dst = *src;
     227                ++dst;
     228                ++src;
     229                --n;
     230        }
     231}
     232
     233static void copy_to_io(void *dst, const void *src, size_t n)
     234{
     235        do_copy(dst, src, n, ((uintptr_t)dst) % 4 == 0);
     236}
     237
     238static void copy_from_io(void *dst, const void *src, size_t n)
     239{
     240        do_copy(dst, src, n, ((uintptr_t)src) % 4 == 0);
     241}
     242
    214243/*----------------------------------------------------------------------------
    215244 *        Exported functions
     
    722751                          && (ReadWrite <= WriteAccess)) ? true : false);
    723752
    724         if (ReadWrite == WriteAccess)
    725                 memcpy(pQspiMem, pBuffer.pDataTx , pBuffer.TxDataSize);
    726         else
    727                 memcpy(pBuffer.pDataRx, pQspiMem, pBuffer.RxDataSize);
    728 
     753        if (ReadWrite == WriteAccess) {
     754                copy_to_io(pQspiMem, pBuffer.pDataTx , pBuffer.TxDataSize);
     755        } else {
     756                copy_from_io(pBuffer.pDataRx, pQspiMem, pBuffer.RxDataSize);
     757        }
    729758        memory_sync();
    730759        QSPI_EndTransfer(pQspid->pQspiHw);
  • c/src/lib/libbsp/arm/atsam/preinstall.am

    r15f0f9b r033443c  
    5353TMPINSTALL_FILES += $(PROJECT_LIB)/linkcmds.sdram
    5454
     55$(PROJECT_LIB)/linkcmds.qspiflash: startup/linkcmds.qspiflash $(PROJECT_LIB)/$(dirstamp)
     56        $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds.qspiflash
     57TMPINSTALL_FILES += $(PROJECT_LIB)/linkcmds.qspiflash
     58
    5559$(PROJECT_INCLUDE)/tm27.h: ../../shared/include/tm27.h $(PROJECT_INCLUDE)/$(dirstamp)
    5660        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/tm27.h
  • c/src/lib/libbsp/arm/atsam/startup/linkcmds.memory.in

    r15f0f9b r033443c  
    66        NOCACHE   : ORIGIN = 0x20400000 + @ATSAM_MEMORY_INTSRAM_SIZE@ - 2 * @ATSAM_MEMORY_TCM_SIZE@ - 4K, LENGTH = 4K
    77        SDRAM     : ORIGIN = 0x70000000, LENGTH = @ATSAM_MEMORY_SDRAM_SIZE@
     8        QSPIFLASH  : ORIGIN = 0x80000000, LENGTH = @ATSAM_MEMORY_QSPIFLASH_SIZE@
    89}
Note: See TracChangeset for help on using the changeset viewer.