Skip to content

Commit

Permalink
Fix some cloned errors in SAM GPIO interrupt setup
Browse files Browse the repository at this point in the history
  • Loading branch information
gregory-nutt committed Jul 7, 2014
1 parent c4674b2 commit befcb1c
Show file tree
Hide file tree
Showing 31 changed files with 158 additions and 101 deletions.
2 changes: 1 addition & 1 deletion Documentation/NfsHowto.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ <h1>Table of Contents</h1>
ret = mount(NULL, mountpoint, string &quot;nfs&quot;, 0, (FAR void *)&data);
</pre></ul>
<p>
NOTE that: (1) the block driver paramter is <code>NULL</code>.
NOTE that: (1) the block driver parameter is <code>NULL</code>.
The <code>mount()</code> is smart enough to know that no block driver is needed with the NFS file system.
(2) The NFS file system is identified with the simple string &quot;nfs&quot;
(3) A reference to <code>struct nfs_args</code> is passed as an NFS-specific argument.
Expand Down
2 changes: 1 addition & 1 deletion Documentation/NuttShell.html
Original file line number Diff line number Diff line change
Expand Up @@ -1988,7 +1988,7 @@ <h1>Table of Contents</h1>
<p>
<b>Synopsis</b>.
The <code>mount</code> command performs one of two different operations.
If no paramters are provided on the command line after the <code>mount</code> command, then the <code>mount</code> command will enumerate all of the current mountpoints on the console.
If no parameters are provided on the command line after the <code>mount</code> command, then the <code>mount</code> command will enumerate all of the current mountpoints on the console.
</p>
<p>
If the mount parameters are provied on the command after the <code>mount</code> command, then the <code>mount</code> command will mount a file system in the NuttX pseudo-file system.
Expand Down
2 changes: 1 addition & 1 deletion Documentation/NuttXCCodingStandard.html
Original file line number Diff line number Diff line change
Expand Up @@ -1665,7 +1665,7 @@ <h2>3.1 <a name="funcheaders">Function Headers</a></h2>
<li>
<b><code> * Input Parameters:</code></b> followed by a description of the of each input parameter beginning on the second line.
Each input parameter begins on a separator line indented by two additional spaces.
The description needs to include (1) the name of the input paramters, and (2) a short description of the input parameter.
The description needs to include (1) the name of the input parameters, and (2) a short description of the input parameter.
</li>
<li>
<b><code> * Returned Value:</code></b> followed by a description of the of returned value(s) beginning on the second line.
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/sama5/sam_udphs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1567,7 +1567,7 @@ static void sam_req_rddisable(uint8_t epno)
* 'inflight' field to hold the maximum size of the transfer; but
* 'inflight' is not used with FIFO transfers.
*
* When the transfer completes, the 'recvsize' paramter must be the
* When the transfer completes, the 'recvsize' parameter must be the
* size of the transfer that just completed. For the case of DMA,
* that is the size of the DMA transfer that has just been written to
* memory; for the FIFO transfer, recvsize is the number of bytes
Expand Down
2 changes: 1 addition & 1 deletion configs/cloudctrl/src/up_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
* Setup to receive an interrupt-level callback if an overcurrent condition is
* detected.
*
* Input paramter:
* Input Parameter:
* handler - New overcurrent interrupt handler
*
* Returned value:
Expand Down
2 changes: 1 addition & 1 deletion configs/mikroe-stm32f4/src/up_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
* Setup to receive an interrupt-level callback if an overcurrent condition is
* detected.
*
* Input paramter:
* Input Parameter:
* handler - New overcurrent interrupt handler
*
* Returned value:
Expand Down
2 changes: 1 addition & 1 deletion configs/olimex-stm32-p207/src/up_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ int stm32_usbhost_initialize(void)
* Setup to receive an interrupt-level callback if an overcurrent condition is
* detected.
*
* Input paramter:
* Input Parameter:
* handler - New overcurrent interrupt handler
*
* Returned value:
Expand Down
11 changes: 7 additions & 4 deletions configs/sam3u-ek/src/up_buttons.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ static xcpt_t g_irqbutton2;
****************************************************************************/

#if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
static xcpt_t board_button_irqx(int irq, xcpt_t irqhandler, xcpt_t *store)
static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
xcpt_t irqhandler, xcpt_t *store)
{
xcpt_t oldhandler;
irqstate_t flags;
Expand All @@ -100,7 +101,7 @@ static xcpt_t board_button_irqx(int irq, xcpt_t irqhandler, xcpt_t *store)
{
/* Configure the interrupt */

sam_gpioirq(irq);
sam_gpioirq(pinset);
(void)irq_attach(irq, irqhandler);
sam_gpioirqenable(irq);
}
Expand Down Expand Up @@ -185,11 +186,13 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
{
if (id == BUTTON1)
{
return board_button_irqx(IRQ_BUTTON1, irqhandler, &g_irqbutton1);
return board_button_irqx(GPIO_BUTTON1, IRQ_BUTTON1,
irqhandler, &g_irqbutton1);
}
else if (id == BUTTON2)
{
return board_button_irqx(IRQ_BUTTON2, irqhandler, &g_irqbutton2);
return board_button_irqx(GPIO_BUTTON2, IRQ_BUTTON2,
irqhandler, &g_irqbutton2);
}
else
{
Expand Down
37 changes: 21 additions & 16 deletions configs/sam4e-ek/src/sam_buttons.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ static xcpt_t g_irq_tamp;
****************************************************************************/

#if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
static xcpt_t board_button_irqx(int irq, xcpt_t irqhandler, xcpt_t *store)
static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
xcpt_t irqhandler, xcpt_t *store)
{
xcpt_t oldhandler;
irqstate_t flags;
Expand All @@ -102,7 +103,7 @@ static xcpt_t board_button_irqx(int irq, xcpt_t irqhandler, xcpt_t *store)
{
/* Configure the interrupt */

sam_gpioirq(irq);
sam_gpioirq(pinset);
(void)irq_attach(irq, irqhandler);
sam_gpioirqenable(irq);
}
Expand Down Expand Up @@ -130,10 +131,10 @@ static xcpt_t board_button_irqx(int irq, xcpt_t irqhandler, xcpt_t *store)
* Name: board_button_initialize
*
* Description:
* board_button_initialize() must be called to initialize button resources. After
* that, board_buttons() may be called to collect the current state of all
* buttons or board_button_irq() may be called to register button interrupt
* handlers.
* board_button_initialize() must be called to initialize button resources.
* After that, board_buttons() may be called to collect the current state
* of all buttons or board_button_irq() may be called to register button
* interrupt handlers.
*
****************************************************************************/

Expand All @@ -145,16 +146,16 @@ void board_button_initialize(void)
(void)sam_configgpio(GPIO_TAMP);
}

/************************************************************************************
/****************************************************************************
* Name: board_buttons
*
* Description:
* After board_button_initialize() has been called, board_buttons() may be called to collect
* the state of all buttons. board_buttons() returns an 8-bit bit set with each bit
* associated with a button. See the BUTTON* definitions above for the meaning of
* each bit in the returned value.
* After board_button_initialize() has been called, board_buttons() may be
* called to collect the state of all buttons. board_buttons() returns an
* 8-bit bit set with each bit associated with a button. See the BUTTON*
* definitions above for the meaning of each bit in the returned value.
*
************************************************************************************/
****************************************************************************/

uint8_t board_buttons(void)
{
Expand Down Expand Up @@ -192,16 +193,20 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
switch (id)
{
case BUTTON_SCROLLUP:
return board_button_irqx(IRQ_SCROLLUP, irqhandler, &g_irq_scrollup);
return board_button_irqx(GPIO_SCROLLUP, IRQ_SCROLLUP,
irqhandler, &g_irq_scrollup);

case BUTTON_SCROLLDOWN:
return board_button_irqx(IRQ_SCROLLDWN, irqhandler, &g_irq_scrolldown);
return board_button_irqx(GPIO_SCROLLDWN, IRQ_SCROLLDWN,
irqhandler, &g_irq_scrolldown);

case BUTTON_WAKU:
return board_button_irqx(IRQ_WAKU, irqhandler, &g_irq_waku);
return board_button_irqx(GPIO_WAKU, IRQ_WAKU,
irqhandler, &g_irq_waku);

case BUTTON_TAMP:
return board_button_irqx(IRQ_WAKU, irqhandler, &g_irq_tamp);
return board_button_irqx(GPIO_TAMP, IRQ_WAKU,
irqhandler, &g_irq_tamp);

default:
return NULL;
Expand Down
24 changes: 12 additions & 12 deletions configs/sam4l-xplained/src/sam_buttons.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ static xcpt_t g_irqsw0;
* Name: board_button_initialize
*
* Description:
* board_button_initialize() must be called to initialize button resources. After
* that, board_buttons() may be called to collect the current state of all
* buttons or board_button_irq() may be called to register button interrupt
* handlers.
* board_button_initialize() must be called to initialize button resources.
* After that, board_buttons() may be called to collect the current state
* of all buttons or board_button_irq() may be called to register button
* interrupt handlers.
*
****************************************************************************/

Expand All @@ -88,16 +88,16 @@ void board_button_initialize(void)
(void)sam_configgpio(GPIO_SW0);
}

/************************************************************************************
/****************************************************************************
* Name: board_buttons
*
* Description:
* After board_button_initialize() has been called, board_buttons() may be called to collect
* the state of all buttons. board_buttons() returns an 8-bit bit set with each bit
* associated with a button. See the BUTTON* definitions above for the meaning of
* each bit in the returned value.
* After board_button_initialize() has been called, board_buttons() may be
* called to collect the state of all buttons. board_buttons() returns an
* 8-bit bit set with each bit associated with a button. See the BUTTON*
* definitions above for the meaning of each bit in the returned value.
*
************************************************************************************/
****************************************************************************/

uint8_t board_buttons(void)
{
Expand All @@ -111,7 +111,7 @@ uint8_t board_buttons(void)
* This function may be called to register an interrupt handler that will
* be called when a button is depressed or released. The ID value is one
* of the BUTTON* definitions provided above. The previous interrupt
* handler address isreturned (so that it may restored, if so desired).
* handler address is returned (so that it may restored, if so desired).
*
* Configuration Notes:
* Configuration CONFIG_AVR32_GPIOIRQ must be selected to enable the
Expand Down Expand Up @@ -148,7 +148,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
{
/* Configure the interrupt */

sam_gpioirq(IRQ_SW0);
sam_gpioirq(GPIO_SW0);
(void)irq_attach(IRQ_SW0, irqhandler);
sam_gpioirqenable(IRQ_SW0);
}
Expand Down
22 changes: 11 additions & 11 deletions configs/sam4s-xplained-pro/src/sam_buttons.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ static xcpt_t g_irqsw0;
* Name: board_button_initialize
*
* Description:
* board_button_initialize() must be called to initialize button resources. After
* that, board_buttons() may be called to collect the current state of all
* buttons or board_button_irq() may be called to register button interrupt
* handlers.
* board_button_initialize() must be called to initialize button resources.
* After that, board_buttons() may be called to collect the current state
* of all buttons or board_button_irq() may be called to register button
* interrupt handlers.
*
****************************************************************************/

Expand All @@ -87,16 +87,16 @@ void board_button_initialize(void)
(void)sam_configgpio(GPIO_SW0);
}

/************************************************************************************
/****************************************************************************
* Name: board_buttons
*
* Description:
* After board_button_initialize() has been called, board_buttons() may be called to collect
* the state of all buttons. board_buttons() returns an 8-bit bit set with each bit
* associated with a button. See the BUTTON* definitions above for the meaning of
* each bit in the returned value.
* After board_button_initialize() has been called, board_buttons() may be
* called to collect the state of all buttons. board_buttons() returns an
* 8-bit bit set with each bit associated with a button. See the BUTTON*
* definitions above for the meaning of each bit in the returned value.
*
************************************************************************************/
****************************************************************************/

uint8_t board_buttons(void)
{
Expand Down Expand Up @@ -147,7 +147,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
{
/* Configure the interrupt */

sam_gpioirq(IRQ_SW0);
sam_gpioirq(GPIO_SW0);
(void)irq_attach(IRQ_SW0, irqhandler);
sam_gpioirqenable(IRQ_SW0);
}
Expand Down
24 changes: 12 additions & 12 deletions configs/sam4s-xplained/src/sam_buttons.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ static xcpt_t g_irqbp2;
* Name: board_button_initialize
*
* Description:
* board_button_initialize() must be called to initialize button resources. After
* that, board_buttons() may be called to collect the current state of all
* buttons or board_button_irq() may be called to register button interrupt
* handlers.
* board_button_initialize() must be called to initialize button resources.
* After that, board_buttons() may be called to collect the current state
* of all buttons or board_button_irq() may be called to register button
* interrupt handlers.
*
****************************************************************************/

Expand All @@ -86,16 +86,16 @@ void board_button_initialize(void)
(void)sam_configgpio(GPIO_BP2);
}

/************************************************************************************
/****************************************************************************
* Name: board_buttons
*
* Description:
* After board_button_initialize() has been called, board_buttons() may be called to collect
* the state of all buttons. board_buttons() returns an 8-bit bit set with each bit
* associated with a button. See the BUTTON* definitions above for the meaning of
* each bit in the returned value.
* After board_button_initialize() has been called, board_buttons() may be
* called to collect the state of all buttons. board_buttons() returns an
* 8-bit bit set with each bit associated with a button. See the BUTTON*
* definitions above for the meaning of each bit in the returned value.
*
************************************************************************************/
****************************************************************************/

uint8_t board_buttons(void)
{
Expand All @@ -109,7 +109,7 @@ uint8_t board_buttons(void)
* This function may be called to register an interrupt handler that will
* be called when a button is depressed or released. The ID value is one
* of the BUTTON* definitions provided above. The previous interrupt
* handler address isreturned (so that it may restored, if so desired).
* handler address is returned (so that it may restored, if so desired).
*
* Configuration Notes:
* Configuration CONFIG_AVR32_GPIOIRQ must be selected to enable the
Expand Down Expand Up @@ -146,7 +146,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
{
/* Configure the interrupt */

sam_gpioirq(IRQ_BP2);
sam_gpioirq(GPIO_BP2);
(void)irq_attach(IRQ_BP2, irqhandler);
sam_gpioirqenable(IRQ_BP2);
}
Expand Down
22 changes: 18 additions & 4 deletions configs/sama5d3-xplained/src/sam_buttons.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ uint8_t board_buttons(void)
* This function may be called to register an interrupt handler that will
* be called when a button is depressed or released. The ID value is one
* of the BUTTON* definitions provided above. The previous interrupt
* handler address isreturned (so that it may restored, if so desired).
* handler address is returned (so that it may restored, if so desired).
*
* Configuration Notes:
* Configuration CONFIG_SAMA5_PIO_IRQ must be selected to enable the
Expand Down Expand Up @@ -155,11 +155,25 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
oldhandler = g_irquser1;
g_irquser1 = irqhandler;

/* Are we attaching or detaching? */

if (irqhandler != NULL)
{
/* Configure the interrupt */

sam_pioirq(PIO_USER);
(void)irq_attach(IRQ_USER1, irqhandler);
sam_pioirqenable(IRQ_USER1);
}
else
{
/* Disable and detach the interrupt */

sam_pioirqdisable(IRQ_USER1);
(void)irq_detach(IRQ_USER1);
}
/* Configure the interrupt */

sam_pioirq(IRQ_USER1);
(void)irq_attach(IRQ_USER1, irqhandler);
sam_pioirqenable(IRQ_USER1);
irqrestore(flags);
}

Expand Down
Loading

0 comments on commit befcb1c

Please sign in to comment.