mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-20 04:58:29 +00:00
apps/: Replace irqsave() with enter_critical_section(); replace irqrestore() with leave_critical_section()
This commit is contained in:
parent
5642e02f77
commit
d5c3bae6cd
2 changed files with 7 additions and 5 deletions
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* examples/buttons/buttons_main.c
|
||||
*
|
||||
* Copyright (C) 2011, 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011, 2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -52,6 +52,7 @@
|
|||
#include <unistd.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -477,7 +478,7 @@ int buttons_main(int argc, char *argv[])
|
|||
* output from an interrupt handler.
|
||||
*/
|
||||
|
||||
flags = irqsave();
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Use lowsyslog() for compatibility with interrupt handler
|
||||
* output.
|
||||
|
|
@ -486,7 +487,7 @@ int buttons_main(int argc, char *argv[])
|
|||
lowsyslog(LOG_INFO, "POLL SET:%02x:\n", newset);
|
||||
show_buttons(g_oldset, newset);
|
||||
g_oldset = newset;
|
||||
irqrestore(flags);
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
/* Sleep a little... but not long. This will determine how fast we
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@
|
|||
#include <netinet/in.h>
|
||||
#include <netinet/ether.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/net/netdev.h>
|
||||
|
|
@ -174,9 +175,9 @@ static uint16_t g_pingid = 0;
|
|||
#if defined(HAVE_PING) || defined(HAVE_PING6)
|
||||
static uint16_t ping_newid(void)
|
||||
{
|
||||
irqstate_t save = irqsave();
|
||||
irqstate_t save = enter_critical_section();
|
||||
uint16_t ret = ++g_pingid;
|
||||
irqrestore(save);
|
||||
leave_critical_section(save);
|
||||
return ret;
|
||||
}
|
||||
#endif /* HAVE_PING || HAVE_PINg */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue