diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-07-07 14:16:29 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-07-07 14:16:29 -0600 |
commit | 19c86d37ae6e019942cf0a82f83bc93373d2e4ff (patch) | |
tree | a3c7ef9456d492afa730494af7f39d0b613568bd /nuttx | |
parent | 594be882b5d6b4c91bdb4e1901f5548a80f7737f (diff) | |
download | px4-nuttx-19c86d37ae6e019942cf0a82f83bc93373d2e4ff.tar.gz px4-nuttx-19c86d37ae6e019942cf0a82f83bc93373d2e4ff.tar.bz2 px4-nuttx-19c86d37ae6e019942cf0a82f83bc93373d2e4ff.zip |
SAMA5D3/4: Fix two issues associated with PIO interrupts
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/arch/arm/src/sama5/sam_pio.c | 34 | ||||
-rw-r--r-- | nuttx/arch/arm/src/sama5/sam_pio.h | 20 | ||||
-rw-r--r-- | nuttx/arch/arm/src/sama5/sam_pioirq.c | 10 |
3 files changed, 38 insertions, 26 deletions
diff --git a/nuttx/arch/arm/src/sama5/sam_pio.c b/nuttx/arch/arm/src/sama5/sam_pio.c index 94355c525..459b6ffee 100644 --- a/nuttx/arch/arm/src/sama5/sam_pio.c +++ b/nuttx/arch/arm/src/sama5/sam_pio.c @@ -66,6 +66,22 @@ ****************************************************************************/ /**************************************************************************** + * 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. + */ + +#ifndef SAM_PION_VBASE +const uintptr_t g_piobase[SAM_NPIO] = +{ + SAM_PIOA_VBASE, SAM_PIOB_VBASE, SAM_PIOC_VBASE, SAM_PIOD_VBASE, + SAM_PIOE_VBASE +}; +#endif + +/**************************************************************************** * Private Data ****************************************************************************/ /* Maps a port number to the standard port character */ @@ -115,20 +131,6 @@ static const bool g_piointerrupt[SAM_NPIO] = #endif }; -/* 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. - */ - -#ifndef SAM_PION_VBASE - static const uintptr_t g_piobase[SAM_NPIO] = - { - SAM_PIOA_VBASE, SAM_PIOB_VBASE, SAM_PIOC_VBASE, SAM_PIOD_VBASE, - SAM_PIOE_VBASE - }; - -# define SAM_PION_VBASE(n) (g_piobase[(n)]) -#endif - /**************************************************************************** * Private Function Prototypes ****************************************************************************/ @@ -146,7 +148,7 @@ static inline uintptr_t sam_piobase(pio_pinset_t cfgset) if (port < SAM_NPIO) { - return SAM_PION_VBASE(port); + return sam_pion_vbase(port); } else { @@ -730,7 +732,7 @@ int sam_dumppio(uint32_t pinset, const char *msg) /* Get the base address associated with the PIO port */ port = (pinset & PIO_PORT_MASK) >> PIO_PORT_SHIFT; - base = SAM_PION_VBASE(port); + base = sam_pion_vbase(port); /* The following requires exclusive access to the PIO registers */ diff --git a/nuttx/arch/arm/src/sama5/sam_pio.h b/nuttx/arch/arm/src/sama5/sam_pio.h index abaa6b2d0..255a6d5dc 100644 --- a/nuttx/arch/arm/src/sama5/sam_pio.h +++ b/nuttx/arch/arm/src/sama5/sam_pio.h @@ -51,11 +51,10 @@ ************************************************************************************/ /* Configuration ********************************************************************/ -#undef CONFIG_SAMA5_PIO_IRQ -#if defined(CONFIG_SAMA5_PIOA_IRQ) || defined(CONFIG_SAMA5_PIOB_IRQ) || \ - defined(CONFIG_SAMA5_PIOC_IRQ) || defined(CONFIG_SAMA5_PIOD_IRQ) || \ - defined(CONFIG_SAMA5_PIOD_IRQ) -# define CONFIG_SAMA5_PIO_IRQ 1 +#if !defined(CONFIG_SAMA5_PIOA_IRQ) && !defined(CONFIG_SAMA5_PIOB_IRQ) && \ + !defined(CONFIG_SAMA5_PIOC_IRQ) && !defined(CONFIG_SAMA5_PIOD_IRQ) && \ + !defined(CONFIG_SAMA5_PIOE_IRQ) && !defined(CONFIG_SAMA5_PIOF_IRQ) +# undef CONFIG_SAMA5_PIO_IRQ #endif #ifndef CONFIG_DEBUG @@ -216,6 +215,17 @@ typedef uint32_t pio_pinset_t; +/* 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. + */ + +#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) +#endif + /************************************************************************************ * Inline Functions ************************************************************************************/ diff --git a/nuttx/arch/arm/src/sama5/sam_pioirq.c b/nuttx/arch/arm/src/sama5/sam_pioirq.c index f48fc106d..019b9f6b1 100644 --- a/nuttx/arch/arm/src/sama5/sam_pioirq.c +++ b/nuttx/arch/arm/src/sama5/sam_pioirq.c @@ -87,14 +87,14 @@ static inline uint32_t sam_piobase(pio_pinset_t pinset) { int port = (pinset & PIO_PORT_MASK) >> PIO_PORT_SHIFT; - return SAM_PION_VBASE(port >> PIO_PORT_SHIFT); + return sam_pion_vbase(port >> PIO_PORT_SHIFT); } /**************************************************************************** * Name: sam_piopin * * Description: - * Returun the base address of the PIO register set + * Return the base address of the PIO register set * ****************************************************************************/ @@ -107,7 +107,7 @@ static inline int sam_piopin(pio_pinset_t pinset) * Name: sam_irqbase * * Description: - * Return pio information associated with this IRQ + * Return PIO information associated with this IRQ * ****************************************************************************/ @@ -169,10 +169,10 @@ static int sam_irqbase(int irq, uint32_t *base, int *pin) } /**************************************************************************** - * Name: sam_pioa/b/cinterrupt + * Name: sam_pioa/b/c/d/e/finterrupt * * Description: - * Receive PIOA/B/C interrupts + * Receive PIOA/B/C/D/E/F interrupts * ****************************************************************************/ |