SAMA5D2: Add PIO driver. Still a work in progress

This commit is contained in:
Gregory Nutt
2015-09-12 09:58:18 -06:00
parent 7c62fcbe96
commit ac986987de
6 changed files with 1022 additions and 14 deletions
+2
View File
@@ -146,6 +146,7 @@
#if defined(ATSAMA5D2) || defined(ATSAMA5D3)
# define SAM_MATRIX_SCFG13_OFFSET 0x0074 /* Slave Configuration Register 13 */
# define SAM_MATRIX_SCFG14_OFFSET 0x0078 /* Slave Configuration Register 14 */
#endif
#ifdef ATSAMA5D3
# define SAM_MATRIX_SCFG15_OFFSET 0x007c /* Slave Configuration Register 15 */
@@ -185,6 +186,7 @@
# define SAM_MATRIX_PRBS13_OFFSET 0x00ec /* Priority Register B for Slave 13 */
# define SAM_MATRIX_PRAS14_OFFSET 0x00f0 /* Priority Register A for Slave 14 */
# define SAM_MATRIX_PRBS14_OFFSET 0x00f4 /* Priority Register B for Slave 14 */
#endif
#ifdef ATSAMA5D3
# define SAM_MATRIX_PRAS15_OFFSET 0x00f8 /* Priority Register A for Slave 15 */
-1
View File
@@ -332,5 +332,4 @@
* Public Functions
****************************************************************************************/
#endif /* SAMV7_NPIO > 0 */
#endif /* __ARCH_ARM_SRC_SAMA5_CHIP_SAMA5D2X_PIO_H */
+53
View File
@@ -0,0 +1,53 @@
/************************************************************************************
* arch/arm/src/sama5/sam_pio.c
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
/************************************************************************************
* Included Files
************************************************************************************/
/* chip.h holds the characteristics of the configured chip */
#include <nuttx/config.h>
#include <arch/sama5/chip.h>
/* Include the correct logic for the configured chip */
#if defined(ATSAMA5D2)
# include "sama5d2x_pio.c"
#elif defined(ATSAMA5D3) || defined(ATSAMA5D4)
# include "sama5d3x4x_pio.c"
#else
# error Unrecognized SAMA5 family
#endif
+8 -7
View File
@@ -68,15 +68,16 @@
* Public Types
************************************************************************************/
/* SAM_PION_VBASE will only be defined if the PIO register blocks are contiguous.
* If not defined, then we need to do a table lookup.
*/
/* Lookup for non-secure PIOs */
#ifndef SAM_PION_VBASE
extern const uintptr_t g_piobase[SAM_NPIO];
# define sam_pion_vbase(n) (g_piobase[(n)])
#else
# define sam_pion_vbase(n) SAM_PION_VBASE(n)
#define sam_pion_vbase(n) (g_piobase[(n)])
#ifdef ATSAMA5D2
/* Lookup for secrure PIOs */
extern const uintptr_t g_spiobase[SAM_NPIO];
# define sam_spion_vbase(n) (g_spiobase[(n)])
#endif
/************************************************************************************
File diff suppressed because it is too large Load Diff
+2 -6
View File
@@ -74,11 +74,8 @@
* Public Data
****************************************************************************/
/* SAM_PION_VBASE will only be defined if the PIO register blocks are
* contiguous. If not defined, then we need to do a table lookup.
*/
/* Lookup for (non-secure) PIOs */
#if !defined(SAM_PION_VBASE) && SAM_NPIO > 0
const uintptr_t g_piobase[SAM_NPIO] =
{
SAM_PIOA_VBASE
@@ -95,7 +92,6 @@ const uintptr_t g_piobase[SAM_NPIO] =
, SAM_PIOE_VBASE
#endif
};
#endif
/****************************************************************************
* Private Data
@@ -693,7 +689,7 @@ int sam_configpio(pio_pinset_t cfgset)
putreg32(PIO_WPMR_WPKEY, base + SAM_PIO_WPMR_OFFSET);
/* Put the pin in an intial state -- a vanilla input pint */
/* Put the pin in an intial state -- a vanilla input pin */
(void)sam_configinput(base, pin, MK_INPUT(cfgset));