apps/: Replace irqsave() with enter_critical_section(); replace irqrestore() with leave_critical_section()
This commit is contained in:
parent
5642e02f77
commit
d5c3bae6cd
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* examples/buttons/buttons_main.c
|
* 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>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -52,6 +52,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <nuttx/irq.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -477,7 +478,7 @@ int buttons_main(int argc, char *argv[])
|
|||||||
* output from an interrupt handler.
|
* output from an interrupt handler.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = irqsave();
|
flags = enter_critical_section();
|
||||||
|
|
||||||
/* Use lowsyslog() for compatibility with interrupt handler
|
/* Use lowsyslog() for compatibility with interrupt handler
|
||||||
* output.
|
* output.
|
||||||
@ -486,7 +487,7 @@ int buttons_main(int argc, char *argv[])
|
|||||||
lowsyslog(LOG_INFO, "POLL SET:%02x:\n", newset);
|
lowsyslog(LOG_INFO, "POLL SET:%02x:\n", newset);
|
||||||
show_buttons(g_oldset, newset);
|
show_buttons(g_oldset, newset);
|
||||||
g_oldset = newset;
|
g_oldset = newset;
|
||||||
irqrestore(flags);
|
leave_critical_section(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sleep a little... but not long. This will determine how fast we
|
/* Sleep a little... but not long. This will determine how fast we
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <netinet/ether.h>
|
#include <netinet/ether.h>
|
||||||
|
|
||||||
|
#include <nuttx/irq.h>
|
||||||
#include <nuttx/clock.h>
|
#include <nuttx/clock.h>
|
||||||
#include <nuttx/net/net.h>
|
#include <nuttx/net/net.h>
|
||||||
#include <nuttx/net/netdev.h>
|
#include <nuttx/net/netdev.h>
|
||||||
@ -174,9 +175,9 @@ static uint16_t g_pingid = 0;
|
|||||||
#if defined(HAVE_PING) || defined(HAVE_PING6)
|
#if defined(HAVE_PING) || defined(HAVE_PING6)
|
||||||
static uint16_t ping_newid(void)
|
static uint16_t ping_newid(void)
|
||||||
{
|
{
|
||||||
irqstate_t save = irqsave();
|
irqstate_t save = enter_critical_section();
|
||||||
uint16_t ret = ++g_pingid;
|
uint16_t ret = ++g_pingid;
|
||||||
irqrestore(save);
|
leave_critical_section(save);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_PING || HAVE_PINg */
|
#endif /* HAVE_PING || HAVE_PINg */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user