mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 03:45:50 +08:00
Fix STM32 F2/F4 SDIO clocking; Clean-up files in sched/ directory
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4940 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -2981,7 +2981,12 @@
|
|||||||
|
|
||||||
* configs/lpc4330-xplorer/up_nsh.c: Add support for a basic SPIFI block
|
* configs/lpc4330-xplorer/up_nsh.c: Add support for a basic SPIFI block
|
||||||
driver for use by NSH. Does not work! Crashes on first SPIFI write.
|
driver for use by NSH. Does not work! Crashes on first SPIFI write.
|
||||||
* configs/lpc4330-xplorer/*/defconfig: Calibrate delay loops (this is
|
* configs/stm3220g-eval/include/board.h and configs/stm3240g-eval/include/board.h:
|
||||||
based on the current "slow" 72MHz M4 clock and will need to be
|
The SDIOCLK frequency in the F2 and F4 derives for PLL48CLK and not HCLK
|
||||||
re-calibrated when this is increased).
|
so that the SDIOCLK input frequency should always be 48MHz.
|
||||||
|
* sched/os_internal.h, sched_setupidlefiles.c, sched_setuptaskfiles.c, and
|
||||||
|
sched_setupidlefiles.c: Detangle some conditional compilation. Allow for
|
||||||
|
a perverse configuration that has socket descriptors and streams but no file
|
||||||
|
descriptors (sure, why not?).
|
||||||
|
* sched/: Stylistic clean-up of all files. Some of these files are pretty old
|
||||||
|
and do not follow current NuttX coding standards in detail.
|
||||||
|
|||||||
@@ -34,17 +34,19 @@
|
|||||||
*
|
*
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
#ifndef __ARCH_BOARD_BOARD_H
|
#ifndef __CONFIGS_STM3220G_EVAL_INCLUDE_BOARD_H
|
||||||
#define __ARCH_BOARD_BOARD_H
|
#define __CONFIGS_STM3220G_EVAL_INCLUDE_BOARD_H
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#ifndef __ASSEMBLY__
|
#ifndef __ASSEMBLY__
|
||||||
# include <stdint.h>
|
# include <stdint.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "stm32_rcc.h"
|
#include "stm32_rcc.h"
|
||||||
#include "stm32_sdio.h"
|
#include "stm32_sdio.h"
|
||||||
#include "stm32_internal.h"
|
#include "stm32_internal.h"
|
||||||
@@ -168,29 +170,29 @@
|
|||||||
* to service FIFOs in interrupt driven mode. These values have not been
|
* to service FIFOs in interrupt driven mode. These values have not been
|
||||||
* tuned!!!
|
* tuned!!!
|
||||||
*
|
*
|
||||||
* HCLK=72MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(178+2)=400 KHz
|
* SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(118+2)=400 KHz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SDIO_INIT_CLKDIV (178 << SDIO_CLKCR_CLKDIV_SHIFT)
|
#define SDIO_INIT_CLKDIV (118 << SDIO_CLKCR_CLKDIV_SHIFT)
|
||||||
|
|
||||||
/* DMA ON: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(2+2)=18 MHz
|
/* DMA ON: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(1+2)=16 MHz
|
||||||
* DMA OFF: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(3+2)=14.4 MHz
|
* DMA OFF: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(2+2)=12 MHz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_SDIO_DMA
|
#ifdef CONFIG_SDIO_DMA
|
||||||
# define SDIO_MMCXFR_CLKDIV (2 << SDIO_CLKCR_CLKDIV_SHIFT)
|
# define SDIO_MMCXFR_CLKDIV (1 << SDIO_CLKCR_CLKDIV_SHIFT)
|
||||||
#else
|
#else
|
||||||
# define SDIO_MMCXFR_CLKDIV (3 << SDIO_CLKCR_CLKDIV_SHIFT)
|
# define SDIO_MMCXFR_CLKDIV (2 << SDIO_CLKCR_CLKDIV_SHIFT)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* DMA ON: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(1+2)=24 MHz
|
/* DMA ON: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(0+2)= 24 MHz
|
||||||
* DMA OFF: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(3+2)=14.4 MHz
|
* DMA OFF: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(2+2)= 12 MHz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_SDIO_DMA
|
#ifdef CONFIG_SDIO_DMA
|
||||||
# define SDIO_SDXFR_CLKDIV (1 << SDIO_CLKCR_CLKDIV_SHIFT)
|
# define SDIO_SDXFR_CLKDIV (0 << SDIO_CLKCR_CLKDIV_SHIFT)
|
||||||
#else
|
#else
|
||||||
# define SDIO_SDXFR_CLKDIV (3 << SDIO_CLKCR_CLKDIV_SHIFT)
|
# define SDIO_SDXFR_CLKDIV (2 << SDIO_CLKCR_CLKDIV_SHIFT)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Ethernet *************************************************************************/
|
/* Ethernet *************************************************************************/
|
||||||
@@ -531,4 +533,4 @@ EXTERN void stm3220g_lcdclear(uint16_t color);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
#endif /* __ARCH_BOARD_BOARD_H */
|
#endif /* __CONFIGS_STM3220G_EVAL_INCLUDE_BOARD_H */
|
||||||
|
|||||||
@@ -518,8 +518,8 @@ CONFIG_DEBUG_I2C=n
|
|||||||
CONFIG_DEBUG_INPUT=n
|
CONFIG_DEBUG_INPUT=n
|
||||||
CONFIG_DEBUG_DMA=n
|
CONFIG_DEBUG_DMA=n
|
||||||
|
|
||||||
CONFIG_HAVE_CXX=n
|
CONFIG_HAVE_CXX=y
|
||||||
CONFIG_HAVE_CXXINITIALIZE=n
|
CONFIG_HAVE_CXXINITIALIZE=y
|
||||||
CONFIG_MM_REGIONS=1
|
CONFIG_MM_REGIONS=1
|
||||||
CONFIG_ARCH_LOWPUTC=y
|
CONFIG_ARCH_LOWPUTC=y
|
||||||
CONFIG_RR_INTERVAL=200
|
CONFIG_RR_INTERVAL=200
|
||||||
@@ -813,7 +813,6 @@ CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
|
|||||||
CONFIG_MMCSD_MMCSUPPORT=n
|
CONFIG_MMCSD_MMCSUPPORT=n
|
||||||
CONFIG_MMCSD_HAVECARDDETECT=n
|
CONFIG_MMCSD_HAVECARDDETECT=n
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# TCP/IP and UDP support via uIP
|
# TCP/IP and UDP support via uIP
|
||||||
#
|
#
|
||||||
@@ -1342,8 +1341,8 @@ CONFIG_STM32_ILI9325_DISABLE=n
|
|||||||
#
|
#
|
||||||
# Settings for examples/uip
|
# Settings for examples/uip
|
||||||
#
|
#
|
||||||
CONFIG_EXAMPLE_UIP_IPADDR==(192<<24|168<<16|21<<8|15)
|
CONFIG_EXAMPLE_UIP_IPADDR=(10<<24|0<<16|0<<8|2)
|
||||||
CONFIG_EXAMPLE_UIP_DRIPADDR=(192<<24|168<<16|21<<8|10)
|
CONFIG_EXAMPLE_UIP_DRIPADDR=(10<<24|0<<16|0<<8|1)
|
||||||
CONFIG_EXAMPLE_UIP_NETMASK=(255<<24|255<<16|255<<8|0)
|
CONFIG_EXAMPLE_UIP_NETMASK=(255<<24|255<<16|255<<8|0)
|
||||||
CONFIG_EXAMPLE_UIP_DHCPC=n
|
CONFIG_EXAMPLE_UIP_DHCPC=n
|
||||||
|
|
||||||
@@ -1352,10 +1351,10 @@ CONFIG_EXAMPLE_UIP_DHCPC=n
|
|||||||
CONFIG_EXAMPLE_NETTEST_SERVER=n
|
CONFIG_EXAMPLE_NETTEST_SERVER=n
|
||||||
CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
|
CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
|
||||||
CONFIG_EXAMPLE_NETTEST_NOMAC=y
|
CONFIG_EXAMPLE_NETTEST_NOMAC=y
|
||||||
CONFIG_EXAMPLE_NETTEST_IPADDR==(192<<24|168<<16|21<<8|15)
|
CONFIG_EXAMPLE_NETTEST_IPADDR=(10<<24|0<<16|0<<8|2)
|
||||||
CONFIG_EXAMPLE_NETTEST_DRIPADDR=(192<<24|168<<16|21<<8|10)
|
CONFIG_EXAMPLE_NETTEST_DRIPADDR=(10<<24|0<<16|0<<8|1)
|
||||||
CONFIG_EXAMPLE_NETTEST_NETMASK=(255<<24|255<<16|255<<8|0)
|
CONFIG_EXAMPLE_NETTEST_NETMASK=(255<<24|255<<16|255<<8|0)
|
||||||
CONFIG_EXAMPLE_NETTEST_CLIENTIP=(192<<24|168<<16|21<<8|10)
|
CONFIG_EXAMPLE_NETTEST_CLIENTIP=(10<<24|0<<16|0<<8|1)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Settings for examples/ostest
|
# Settings for examples/ostest
|
||||||
@@ -1410,12 +1409,12 @@ CONFIG_NSH_DISABLEBG=n
|
|||||||
CONFIG_NSH_ROMFSETC=n
|
CONFIG_NSH_ROMFSETC=n
|
||||||
CONFIG_NSH_CONSOLE=y
|
CONFIG_NSH_CONSOLE=y
|
||||||
CONFIG_NSH_TELNET=y
|
CONFIG_NSH_TELNET=y
|
||||||
CONFIG_NSH_ARCHINIT=n
|
CONFIG_NSH_ARCHINIT=y
|
||||||
CONFIG_NSH_IOBUFFER_SIZE=512
|
CONFIG_NSH_IOBUFFER_SIZE=512
|
||||||
CONFIG_NSH_DHCPC=n
|
CONFIG_NSH_DHCPC=n
|
||||||
CONFIG_NSH_NOMAC=y
|
CONFIG_NSH_NOMAC=y
|
||||||
CONFIG_NSH_IPADDR=(192<<24|168<<16|13<<8|161)
|
CONFIG_NSH_IPADDR=(10<<24|0<<16|0<<8|2)
|
||||||
CONFIG_NSH_DRIPADDR=(192<<24|168<<16|13<<8|1)
|
CONFIG_NSH_DRIPADDR=(10<<24|0<<16|0<<8|1)
|
||||||
CONFIG_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
|
CONFIG_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
|
||||||
CONFIG_NSH_ROMFSMOUNTPT="/etc"
|
CONFIG_NSH_ROMFSMOUNTPT="/etc"
|
||||||
CONFIG_NSH_INITSCRIPT="init.d/rcS"
|
CONFIG_NSH_INITSCRIPT="init.d/rcS"
|
||||||
|
|||||||
@@ -80,6 +80,10 @@ ifeq ($(CONFIG_WATCHDOG),y)
|
|||||||
CONFIGURED_APPS += examples/watchdog
|
CONFIGURED_APPS += examples/watchdog
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_INPUT_STMPE811),y)
|
||||||
|
CONFIGURED_APPS += examples/touchscreen
|
||||||
|
endif
|
||||||
|
|
||||||
# Uncomment examples/ftpc to include the FTP client example
|
# Uncomment examples/ftpc to include the FTP client example
|
||||||
# Uncomment examples/ftpd to include the FTP daemon example
|
# Uncomment examples/ftpd to include the FTP daemon example
|
||||||
|
|
||||||
@@ -87,3 +91,12 @@ ifeq ($(CONFIG_NET),y)
|
|||||||
#CONFIGURED_APPS += examples/ftpc
|
#CONFIGURED_APPS += examples/ftpc
|
||||||
#CONFIGURED_APPS += examples/ftpd
|
#CONFIGURED_APPS += examples/ftpd
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Uncomment to select a graphics example
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_NX),y)
|
||||||
|
#CONFIGURED_APPS += examples/nx
|
||||||
|
#CONFIGURED_APPS += examples/nxhello
|
||||||
|
#CONFIGURED_APPS += examples/nximage
|
||||||
|
#CONFIGURED_APPS += examples/nxlines
|
||||||
|
endif
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -167,29 +167,29 @@
|
|||||||
* to service FIFOs in interrupt driven mode. These values have not been
|
* to service FIFOs in interrupt driven mode. These values have not been
|
||||||
* tuned!!!
|
* tuned!!!
|
||||||
*
|
*
|
||||||
* HCLK=72MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(178+2)=400 KHz
|
* SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(118+2)=400 KHz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SDIO_INIT_CLKDIV (178 << SDIO_CLKCR_CLKDIV_SHIFT)
|
#define SDIO_INIT_CLKDIV (118 << SDIO_CLKCR_CLKDIV_SHIFT)
|
||||||
|
|
||||||
/* DMA ON: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(2+2)=18 MHz
|
/* DMA ON: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(1+2)=16 MHz
|
||||||
* DMA OFF: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(3+2)=14.4 MHz
|
* DMA OFF: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(2+2)=12 MHz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_SDIO_DMA
|
#ifdef CONFIG_SDIO_DMA
|
||||||
# define SDIO_MMCXFR_CLKDIV (2 << SDIO_CLKCR_CLKDIV_SHIFT)
|
# define SDIO_MMCXFR_CLKDIV (1 << SDIO_CLKCR_CLKDIV_SHIFT)
|
||||||
#else
|
#else
|
||||||
# define SDIO_MMCXFR_CLKDIV (3 << SDIO_CLKCR_CLKDIV_SHIFT)
|
# define SDIO_MMCXFR_CLKDIV (2 << SDIO_CLKCR_CLKDIV_SHIFT)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* DMA ON: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(1+2)=24 MHz
|
/* DMA ON: HSDIOCLK=48MHz, SDIO_CK=SDIOCLK/(0+2)=24 MHz
|
||||||
* DMA OFF: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(3+2)=14.4 MHz
|
* DMA OFF: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(2+2)=12 MHz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_SDIO_DMA
|
#ifdef CONFIG_SDIO_DMA
|
||||||
# define SDIO_SDXFR_CLKDIV (1 << SDIO_CLKCR_CLKDIV_SHIFT)
|
# define SDIO_SDXFR_CLKDIV (0 << SDIO_CLKCR_CLKDIV_SHIFT)
|
||||||
#else
|
#else
|
||||||
# define SDIO_SDXFR_CLKDIV (3 << SDIO_CLKCR_CLKDIV_SHIFT)
|
# define SDIO_SDXFR_CLKDIV (2 << SDIO_CLKCR_CLKDIV_SHIFT)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Ethernet *************************************************************************/
|
/* Ethernet *************************************************************************/
|
||||||
|
|||||||
@@ -541,7 +541,7 @@ CONFIG_START_MONTH=12
|
|||||||
CONFIG_START_DAY=6
|
CONFIG_START_DAY=6
|
||||||
CONFIG_GREGORIAN_TIME=n
|
CONFIG_GREGORIAN_TIME=n
|
||||||
CONFIG_JULIAN_TIME=n
|
CONFIG_JULIAN_TIME=n
|
||||||
CONFIG_DEV_CONSOLE=y
|
CONFIG_DEV_CONSOLE=n
|
||||||
CONFIG_DEV_LOWCONSOLE=n
|
CONFIG_DEV_LOWCONSOLE=n
|
||||||
CONFIG_MUTEX_TYPES=n
|
CONFIG_MUTEX_TYPES=n
|
||||||
CONFIG_PRIORITY_INHERITANCE=n
|
CONFIG_PRIORITY_INHERITANCE=n
|
||||||
@@ -1268,7 +1268,7 @@ CONFIG_NSH_NESTDEPTH=3
|
|||||||
CONFIG_NSH_DISABLESCRIPT=n
|
CONFIG_NSH_DISABLESCRIPT=n
|
||||||
CONFIG_NSH_DISABLEBG=n
|
CONFIG_NSH_DISABLEBG=n
|
||||||
CONFIG_NSH_ROMFSETC=n
|
CONFIG_NSH_ROMFSETC=n
|
||||||
CONFIG_NSH_CONSOLE=y
|
CONFIG_NSH_CONSOLE=n
|
||||||
CONFIG_NSH_TELNET=y
|
CONFIG_NSH_TELNET=y
|
||||||
CONFIG_NSH_ARCHINIT=y
|
CONFIG_NSH_ARCHINIT=y
|
||||||
CONFIG_NSH_IOBUFFER_SIZE=512
|
CONFIG_NSH_IOBUFFER_SIZE=512
|
||||||
|
|||||||
+1
-1
@@ -80,7 +80,7 @@
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: atexit
|
* Name: atexit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Registers a function to be called at program exit.
|
* Registers a function to be called at program exit.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* clock_abstime2ticks.c
|
* clock_abstime2ticks.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Function: clock_abstime2ticks
|
* Name: clock_abstime2ticks
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Convert an absolute timespec delay to system timer ticks.
|
* Convert an absolute timespec delay to system timer ticks.
|
||||||
@@ -95,8 +95,8 @@ int clock_abstime2ticks(clockid_t clockid, FAR const struct timespec *abstime,
|
|||||||
struct timespec reltime;
|
struct timespec reltime;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Convert the timespec to clock ticks. NOTE: Here we use
|
/* Convert the timespec to clock ticks. NOTE: Here we use internal knowledge
|
||||||
* internal knowledge that CLOCK_REALTIME is defined to be zero!
|
* that CLOCK_REALTIME is defined to be zero!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ret = clock_gettime(clockid, &currtime);
|
ret = clock_gettime(clockid, &currtime);
|
||||||
@@ -105,15 +105,13 @@ int clock_abstime2ticks(clockid_t clockid, FAR const struct timespec *abstime,
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The relative time to wait is the absolute time minus the
|
/* The relative time to wait is the absolute time minus the current time. */
|
||||||
* current time.
|
|
||||||
*/
|
|
||||||
|
|
||||||
reltime.tv_nsec = (abstime->tv_nsec - currtime.tv_nsec);
|
reltime.tv_nsec = (abstime->tv_nsec - currtime.tv_nsec);
|
||||||
reltime.tv_sec = (abstime->tv_sec - currtime.tv_sec);
|
reltime.tv_sec = (abstime->tv_sec - currtime.tv_sec);
|
||||||
|
|
||||||
/* Check if we were supposed to borrow from the seconds to
|
/* Check if we were supposed to borrow from the seconds to borrow from the
|
||||||
* borrow from the seconds
|
* seconds
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (reltime.tv_nsec < 0)
|
if (reltime.tv_nsec < 0)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* sched/clock_getres.c
|
* sched/clock_getres.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: clock_getres
|
* Name: clock_getres
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Clock Functions based on POSIX APIs
|
* Clock Functions based on POSIX APIs
|
||||||
@@ -98,7 +98,7 @@ int clock_getres(clockid_t clock_id, struct timespec *res)
|
|||||||
if (clock_id != CLOCK_REALTIME)
|
if (clock_id != CLOCK_REALTIME)
|
||||||
{
|
{
|
||||||
sdbg("Returning ERROR\n");
|
sdbg("Returning ERROR\n");
|
||||||
*get_errno_ptr() = EINVAL;
|
set_errno(EINVAL);
|
||||||
ret = ERROR;
|
ret = ERROR;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: clock_gettime
|
* Name: clock_gettime
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Clock Functions based on POSIX APIs
|
* Clock Functions based on POSIX APIs
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* sched/clock_gettimeofday.c
|
* sched/clock_gettimeofday.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -38,10 +38,11 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
|
#include <sys/time.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include "clock_internal.h"
|
#include "clock_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -77,7 +78,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: gettimeofday
|
* Name: gettimeofday
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Get the current time
|
* Get the current time
|
||||||
@@ -107,5 +108,6 @@ int gettimeofday(struct timeval *tp, void *tzp)
|
|||||||
tp->tv_sec = ts.tv_sec;
|
tp->tv_sec = ts.tv_sec;
|
||||||
tp->tv_usec = ts.tv_nsec / NSEC_PER_USEC;
|
tp->tv_usec = ts.tv_nsec / NSEC_PER_USEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ struct timespec g_basetime;
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: clock_basetime
|
* Name: clock_basetime
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Get the initial time value from the best source available.
|
* Get the initial time value from the best source available.
|
||||||
@@ -170,7 +170,7 @@ static inline void clock_basetime(FAR struct timespec *tp)
|
|||||||
#endif /* CONFIG_RTC */
|
#endif /* CONFIG_RTC */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: clock_inittime
|
* Name: clock_inittime
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Get the initial time value from the best source available.
|
* Get the initial time value from the best source available.
|
||||||
@@ -191,7 +191,7 @@ static void clock_inittime(void)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: clock_initialize
|
* Name: clock_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Perform one-time initialization of the timing facilities.
|
* Perform one-time initialization of the timing facilities.
|
||||||
@@ -212,7 +212,7 @@ void clock_initialize(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: clock_synchronize
|
* Name: clock_synchronize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Synchronize the system timer to a hardware RTC. This operation is
|
* Synchronize the system timer to a hardware RTC. This operation is
|
||||||
@@ -253,12 +253,12 @@ void clock_synchronize(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: clock_timer
|
* Name: clock_timer
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function must be called once every time the real
|
* This function must be called once every time the real time clock
|
||||||
* time clock interrupt occurs. The interval of this
|
* interrupt occurs. The interval of this clock interrupt must be
|
||||||
* clock interrupt must be MSEC_PER_TICK
|
* MSEC_PER_TICK
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|||||||
+12
-12
@@ -1,8 +1,8 @@
|
|||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* clock_internal.h
|
* sched/clock_internal.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -33,8 +33,8 @@
|
|||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
#ifndef __CLOCK_INTERNAL_H
|
#ifndef __SCHED_CLOCK_INTERNAL_H
|
||||||
#define __CLOCK_INTERNAL_H
|
#define __SCHED_CLOCK_INTERNAL_H
|
||||||
|
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
@@ -79,13 +79,13 @@ extern struct timespec g_basetime;
|
|||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
extern void weak_function clock_initialize(void);
|
void weak_function clock_initialize(void);
|
||||||
extern void weak_function clock_timer(void);
|
void weak_function clock_timer(void);
|
||||||
|
|
||||||
extern int clock_abstime2ticks(clockid_t clockid,
|
int clock_abstime2ticks(clockid_t clockid,
|
||||||
FAR const struct timespec *abstime,
|
FAR const struct timespec *abstime,
|
||||||
FAR int *ticks);
|
FAR int *ticks);
|
||||||
extern int clock_time2ticks(FAR const struct timespec *reltime, FAR int *ticks);
|
int clock_time2ticks(FAR const struct timespec *reltime, FAR int *ticks);
|
||||||
extern int clock_ticks2time(int ticks, FAR struct timespec *reltime);
|
int clock_ticks2time(int ticks, FAR struct timespec *reltime);
|
||||||
|
|
||||||
#endif /* __CLOCK_INTERNAL_H */
|
#endif /* __SCHED_CLOCK_INTERNAL_H */
|
||||||
|
|||||||
@@ -81,7 +81,7 @@
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: clock_settime
|
* Name: clock_settime
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Clock Functions based on POSIX APIs
|
* Clock Functions based on POSIX APIs
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* sched/clock_systimer.c
|
* sched/clock_systimer.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: clock_systimer
|
* Name: clock_systimer
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return the current value of the 32-bit system timer counter
|
* Return the current value of the 32-bit system timer counter
|
||||||
@@ -85,7 +85,7 @@ uint32_t clock_systimer(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: clock_systimer64
|
* Name: clock_systimer64
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return the current value of the 64-bit system timer counter
|
* Return the current value of the 64-bit system timer counter
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* clock_ticks2time.c
|
* clock_ticks2time.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Function: clock_ticks2time
|
* Name: clock_ticks2time
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Convert the system time tick value to a relative time.
|
* Convert the system time tick value to a relative time.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* sched/clock_time2ticks.c
|
* sched/clock_time2ticks.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Function: clock_time2ticks
|
* Name: clock_time2ticks
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Convert a timespec delay to system timer ticks. This function is suitable
|
* Convert a timespec delay to system timer ticks. This function is suitable
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* sched/env_clearenv.c
|
* sched/env_clearenv.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: clearenv
|
* Name: clearenv
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* The clearenv() function clears the environment of all name-value pairs
|
* The clearenv() function clears the environment of all name-value pairs
|
||||||
|
|||||||
+3
-2
@@ -2,7 +2,7 @@
|
|||||||
* sched/env_dup.c
|
* sched/env_dup.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: env_dup
|
* Name: env_dup
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Copy the internal environment structure of a task. This is the action
|
* Copy the internal environment structure of a task. This is the action
|
||||||
@@ -122,6 +122,7 @@ int env_dup(FAR _TCB *ptcb)
|
|||||||
ptcb->envp = envp;
|
ptcb->envp = envp;
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
* eched/env_dupenv.c
|
* eched/env_dupenv.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: dupenv
|
* Name: dupenv
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Copy the internal environment structure of a task. This is the action
|
* Copy the internal environment structure of a task. This is the action
|
||||||
|
|||||||
+8
-4
@@ -2,7 +2,7 @@
|
|||||||
* sched/env_findvar.c
|
* sched/env_findvar.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: env_cmpname
|
* Name: env_cmpname
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static bool env_cmpname(const char *pszname, const char *peqname)
|
static bool env_cmpname(const char *pszname, const char *peqname)
|
||||||
@@ -69,6 +69,7 @@ static bool env_cmpname(const char *pszname, const char *peqname)
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +78,7 @@ static bool env_cmpname(const char *pszname, const char *peqname)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: env_findvar
|
* Name: env_findvar
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Search the provided environment structure for the variable of the
|
* Search the provided environment structure for the variable of the
|
||||||
@@ -109,7 +110,9 @@ FAR char *env_findvar(environ_t *envp, const char *pname)
|
|||||||
|
|
||||||
/* Search for a name=value string with matching name */
|
/* Search for a name=value string with matching name */
|
||||||
|
|
||||||
for (ptr = envp->ev_env; ptr < end && !env_cmpname( pname, ptr); ptr += (strlen(ptr) + 1));
|
for (ptr = envp->ev_env;
|
||||||
|
ptr < end && !env_cmpname( pname, ptr);
|
||||||
|
ptr += (strlen(ptr) + 1));
|
||||||
|
|
||||||
/* Check for success */
|
/* Check for success */
|
||||||
|
|
||||||
@@ -118,6 +121,7 @@ FAR char *env_findvar(environ_t *envp, const char *pname)
|
|||||||
ret = ptr;
|
ret = ptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-4
@@ -2,7 +2,7 @@
|
|||||||
* env_getenv.c
|
* env_getenv.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: getenv
|
* Name: getenv
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* The getenv() function searches the environment list for a string that
|
* The getenv() function searches the environment list for a string that
|
||||||
@@ -91,7 +91,6 @@ FAR char *getenv(const char *name)
|
|||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Get a reference to the thread-private environ in the TCB.*/
|
/* Get a reference to the thread-private environ in the TCB.*/
|
||||||
|
|
||||||
sched_lock();
|
sched_lock();
|
||||||
@@ -126,7 +125,7 @@ FAR char *getenv(const char *name)
|
|||||||
errout_with_lock:
|
errout_with_lock:
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
errout:
|
errout:
|
||||||
*get_errno_ptr() = ret;
|
set_errno(ret);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* env_getenvironptr.c
|
* env_getenvironptr.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: get_environ_ptr
|
* Name: get_environ_ptr
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return a pointer to the thread specific environ variable.
|
* Return a pointer to the thread specific environ variable.
|
||||||
@@ -75,9 +75,9 @@ FAR char **get_environ_ptr( void )
|
|||||||
{
|
{
|
||||||
#if 1
|
#if 1
|
||||||
|
|
||||||
/* Type of internal representation of environment is incompatible with
|
/* Type of internal representation of environment is incompatible with
|
||||||
* char ** return value.
|
* char ** return value.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* sched/env_internal.h
|
* sched/env_internal.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
* sched/env_putenv.c
|
* sched/env_putenv.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: putenv
|
* Name: putenv
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* The putenv() function adds or changes the value of environment variables.
|
* The putenv() function adds or changes the value of environment variables.
|
||||||
|
|||||||
+8
-5
@@ -2,7 +2,7 @@
|
|||||||
* sched/env_clearenv.c
|
* sched/env_clearenv.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -55,12 +55,12 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: env_release
|
* Name: env_release
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* The env_release() function clears the environment of all name-value pairs
|
* The env_release() function clears the environment of all name-value
|
||||||
* and sets the value of the external variable environ to NULL.
|
* pairs and sets the value of the external variable environ to NULL.
|
||||||
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* ptcb Identifies the TCB containing the environment structure
|
* ptcb Identifies the TCB containing the environment structure
|
||||||
*
|
*
|
||||||
@@ -75,6 +75,7 @@
|
|||||||
int env_release(FAR _TCB *ptcb)
|
int env_release(FAR _TCB *ptcb)
|
||||||
{
|
{
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
|
|
||||||
if (!ptcb)
|
if (!ptcb)
|
||||||
{
|
{
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
@@ -111,8 +112,10 @@ int env_release(FAR _TCB *ptcb)
|
|||||||
|
|
||||||
ptcb->envp = NULL;
|
ptcb->envp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* sched/env_removevar.c
|
* sched/env_removevar.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: env_removevar
|
* Name: env_removevar
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Remove the referenced name=value pair from the environment
|
* Remove the referenced name=value pair from the environment
|
||||||
@@ -109,6 +109,7 @@ int env_removevar(environ_t *envp, char *pvar)
|
|||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -2,7 +2,7 @@
|
|||||||
* sched/env_setenv.c
|
* sched/env_setenv.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: setenv
|
* Name: setenv
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* The setenv() function adds the variable name to the environment with the
|
* The setenv() function adds the variable name to the environment with the
|
||||||
@@ -148,8 +148,8 @@ int setenv(const char *name, const char *value, int overwrite)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get the size of the new name=value string. The +2 is for the '=' and for
|
/* Get the size of the new name=value string. The +2 is for the '=' and for
|
||||||
* null terminator
|
* null terminator
|
||||||
*/
|
*/
|
||||||
|
|
||||||
varlen = strlen(name) + strlen(value) + 2;
|
varlen = strlen(name) + strlen(value) + 2;
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -2,7 +2,7 @@
|
|||||||
* sched/env_share.c
|
* sched/env_share.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -43,6 +43,7 @@
|
|||||||
|
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "os_internal.h"
|
#include "os_internal.h"
|
||||||
#include "env_internal.h"
|
#include "env_internal.h"
|
||||||
|
|
||||||
@@ -55,7 +56,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: env_share
|
* Name: env_share
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Increment the reference count on the internal environment structure of
|
* Increment the reference count on the internal environment structure of
|
||||||
@@ -106,6 +107,7 @@ int env_share(FAR _TCB *ptcb)
|
|||||||
ptcb->envp = envp;
|
ptcb->envp = envp;
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* sched/env_unsetenv.c
|
* sched/env_unsetenv.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: unsetenv
|
* Name: unsetenv
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* The unsetenv() function deletes the variable name from the environment.
|
* The unsetenv() function deletes the variable name from the environment.
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
* sched/errno_get.c
|
* sched/errno_get.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: get_errno
|
* Name: get_errno
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return the value of the thread specific errno. This function is only
|
* Return the value of the thread specific errno. This function is only
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* sched/errno_getptr.c
|
* sched/errno_getptr.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -61,7 +61,7 @@ static int g_irqerrno;
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: get_errno_ptr
|
* Name: get_errno_ptr
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return a pointer to the thread specific errno.
|
* Return a pointer to the thread specific errno.
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
* sched/errno_set.c
|
* sched/errno_set.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: set_errno
|
* Name: set_errno
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Set the value of the thread specific errno. This function is only
|
* Set the value of the thread specific errno. This function is only
|
||||||
|
|||||||
+3
-1
@@ -43,7 +43,9 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/fs/fs.h>
|
#include <nuttx/fs/fs.h>
|
||||||
|
|
||||||
#include "os_internal.h"
|
#include "os_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -75,7 +77,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: exit
|
* Name: exit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* The exit() function causes normal process termination and the value of
|
* The exit() function causes normal process termination and the value of
|
||||||
|
|||||||
+6
-5
@@ -2,7 +2,7 @@
|
|||||||
* sched/getpid.c
|
* sched/getpid.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -40,6 +40,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
|
|
||||||
#include "os_internal.h"
|
#include "os_internal.h"
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -76,9 +77,9 @@
|
|||||||
|
|
||||||
pid_t getpid(void)
|
pid_t getpid(void)
|
||||||
{
|
{
|
||||||
/* Return the task ID from the TCB at the head of the
|
/* Return the task ID from the TCB at the head of the
|
||||||
* ready-to-run task list
|
* ready-to-run task list
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return ((FAR _TCB*)g_readytorun.head)->pid;
|
return ((FAR _TCB*)g_readytorun.head)->pid;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -38,7 +38,9 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <nuttx/irq.h>
|
#include <nuttx/irq.h>
|
||||||
|
|
||||||
#include "irq_internal.h"
|
#include "irq_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -69,8 +71,8 @@
|
|||||||
* Name: irq_attach
|
* Name: irq_attach
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Configure the IRQ subsystem so that IRQ number 'irq'
|
* Configure the IRQ subsystem so that IRQ number 'irq' is dispatched to
|
||||||
* is dispatched to 'isr'
|
* 'isr'
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -123,5 +125,3 @@ int irq_attach(int irq, xcpt_t isr)
|
|||||||
return OK;
|
return OK;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* sched/irq_dispatch.c
|
* sched/irq_dispatch.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -73,9 +73,9 @@
|
|||||||
* Name: irq_dispatch
|
* Name: irq_dispatch
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function must be called from the achitecture-
|
* This function must be called from the achitecture-specific logic in
|
||||||
* specific logic in order to dispaly an interrupt to
|
* order to dispatch an interrupt to the appropriate, registered handling
|
||||||
* the appropriate, registered handling logic.
|
* logic.
|
||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* sched/irq_initialize.c
|
* sched/irq_initialize.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008, 2010 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2008, 2010 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/irq.h>
|
#include <nuttx/irq.h>
|
||||||
|
|
||||||
#include "irq_internal.h"
|
#include "irq_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -69,7 +70,7 @@ FAR xcpt_t g_irqvector[NR_IRQS+1];
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: irq_initialize
|
* Name: irq_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Configure the IRQ subsystem
|
* Configure the IRQ subsystem
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* sched/irq_internal.h
|
* sched/irq_internal.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -33,8 +33,8 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef __IRQ_INTERNAL_H
|
#ifndef __SCHED_IRQ_INTERNAL_H
|
||||||
#define __IRQ_INTERNAL_H
|
#define __SCHED_IRQ_INTERNAL_H
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
@@ -79,5 +79,5 @@ EXTERN int irq_unexpected_isr(int irq, FAR void *context);
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __IRQ_INTERNAL_H */
|
#endif /* __SCHED_IRQ_INTERNAL_H */
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* sched/irq_unexpectedisr.c
|
* sched/irq_unexpectedisr.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -38,8 +38,11 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <nuttx/irq.h>
|
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <nuttx/irq.h>
|
||||||
|
|
||||||
#include "os_internal.h"
|
#include "os_internal.h"
|
||||||
#include "irq_internal.h"
|
#include "irq_internal.h"
|
||||||
|
|
||||||
@@ -68,11 +71,11 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: irq_unexpected_isr
|
* Name: irq_unexpected_isr
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* An interrupt has been received for an IRQ that was
|
* An interrupt has been received for an IRQ that was never registered
|
||||||
* never registered with the system.
|
* with the system.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* sched/kmm_addregion.c
|
* sched/kmm_addregion.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -84,7 +84,7 @@ typedef void (*kmaddregion_t)(FAR void*, size_t);
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: kmm_addregion
|
* Name: kmm_addregion
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This is a simple redirection to the user-space mm_addregion()
|
* This is a simple redirection to the user-space mm_addregion()
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* sched/kmm_initialize.c
|
* sched/kmm_initialize.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -84,7 +84,7 @@ typedef void (*kminitialize_t)(FAR void*, size_t);
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: kmm_initialize
|
* Name: kmm_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This is a simple redirection to the user-space mm_initialize()
|
* This is a simple redirection to the user-space mm_initialize()
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
* sched/kmm_kfree.c
|
* sched/kmm_kfree.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -84,7 +84,7 @@ typedef void (*kfree_t)(FAR void *);
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: kfree
|
* Name: kfree
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This is a simple redirection to the user-space free() function.
|
* This is a simple redirection to the user-space free() function.
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
* sched/kmm_kmalloc.c
|
* sched/kmm_kmalloc.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -84,7 +84,7 @@ typedef FAR void *(*kmalloc_t)(size_t);
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: kmalloc
|
* Name: kmalloc
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This is a simple redirection to the user-space malloc() function.
|
* This is a simple redirection to the user-space malloc() function.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* sched/kmm_krealloc.c
|
* sched/kmm_krealloc.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -84,7 +84,7 @@ typedef FAR void *(*krealloc_t)(FAR void*, size_t);
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: krealloc
|
* Name: krealloc
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This is a simple redirection to the user-space realloc() function.
|
* This is a simple redirection to the user-space realloc() function.
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
* sched/kmm_kzalloc.c
|
* sched/kmm_kzalloc.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -84,7 +84,7 @@ typedef FAR void *(*kzalloc_t)(size_t);
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: kzalloc
|
* Name: kzalloc
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This is a simple redirection to the user-space zalloc() function.
|
* This is a simple redirection to the user-space zalloc() function.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* sched/kmm_semaphore.c
|
* sched/kmm_semaphore.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -86,7 +86,7 @@ typedef void (*kmgivesemaphore_t)(void);
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: kmm_trysemaphore
|
* Name: kmm_trysemaphore
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This is a simple redirection to the user-space mm_trysemaphore()
|
* This is a simple redirection to the user-space mm_trysemaphore()
|
||||||
@@ -112,7 +112,7 @@ int kmm_trysemaphore(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: kmm_givesemaphore
|
* Name: kmm_givesemaphore
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This is a simple redirection to the user-space mm_givesemaphore()
|
* This is a simple redirection to the user-space mm_givesemaphore()
|
||||||
|
|||||||
+36
-38
@@ -1,8 +1,8 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* sched/mq_close.c
|
* sched/mq_close.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -31,71 +31,69 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <mqueue.h>
|
#include <mqueue.h>
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
|
|
||||||
#include "os_internal.h"
|
#include "os_internal.h"
|
||||||
#include "mq_internal.h"
|
#include "mq_internal.h"
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Type Declarations
|
* Private Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Variables
|
* Private Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: mq_desfree
|
* Name: mq_desfree
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Deallocate a message queue descriptor but returning it
|
* Deallocate a message queue descriptor but returning it to the free list
|
||||||
* to the free liest
|
|
||||||
*
|
*
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* mqdes - message queue descriptor to free
|
* mqdes - message queue descriptor to free
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define mq_desfree(mqdes) sq_addlast((FAR sq_entry_t*)mqdes, &g_desfree)
|
#define mq_desfree(mqdes) sq_addlast((FAR sq_entry_t*)mqdes, &g_desfree)
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: mq_close
|
* Name: mq_close
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function is used to indicate that the calling task
|
* This function is used to indicate that the calling task is finished
|
||||||
* is finished with the specified message queued mqdes.
|
* with the specified message queued mqdes. The mq_close() deallocates
|
||||||
* The mq_close() deallocates any system resources
|
* any system resources allocated by the system for use by this task for
|
||||||
* allocated by the system for use by this task for its
|
* its message queue.
|
||||||
* message queue.
|
|
||||||
*
|
*
|
||||||
* If the calling task has attached a notification to the
|
* If the calling task has attached a notification to the message queue
|
||||||
* message queue via this mqdes, this attachment will be
|
* via this mqdes, this attachment will be removed and the message queue
|
||||||
* removed and the message queue is available for another
|
* is available for another process to attach a notification.
|
||||||
* process to attach a notification.
|
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* mqdes - Message queue descriptor.
|
* mqdes - Message queue descriptor.
|
||||||
@@ -105,12 +103,12 @@
|
|||||||
* otherwise, -1 (ERROR).
|
* otherwise, -1 (ERROR).
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
* - The behavior of a task that is blocked on either a mq_send()
|
* - The behavior of a task that is blocked on either a mq_send() or
|
||||||
* or mq_receive is undefined when mq_close() is called.
|
* mq_receive() is undefined when mq_close() is called.
|
||||||
* - The results of using this message queue descriptor after a
|
* - The results of using this message queue descriptor after a successful
|
||||||
* a successful return from mq_close() is undefined.
|
* return from mq_close() is undefined.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int mq_close(mqd_t mqdes)
|
int mq_close(mqd_t mqdes)
|
||||||
{
|
{
|
||||||
|
|||||||
+10
-7
@@ -2,7 +2,7 @@
|
|||||||
* sched/mq_descreate.c
|
* sched/mq_descreate.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* 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
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -39,19 +39,21 @@
|
|||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdarg.h> /* va_list */
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <mqueue.h>
|
#include <mqueue.h>
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
|
#include <queue.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
|
#include <nuttx/kmalloc.h>
|
||||||
|
|
||||||
#include "os_internal.h"
|
#include "os_internal.h"
|
||||||
#include "sig_internal.h"
|
#include "sig_internal.h"
|
||||||
|
|
||||||
#include <queue.h>
|
|
||||||
#include <nuttx/kmalloc.h>
|
|
||||||
#include "mq_internal.h"
|
#include "mq_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -75,7 +77,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: mq_desalloc
|
* Name: mq_desalloc
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Allocate a message queue descriptor.
|
* Allocate a message queue descriptor.
|
||||||
@@ -117,7 +119,7 @@ static mqd_t mq_desalloc(void)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: mq_descreate
|
* Name: mq_descreate
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Create a message queue descriptor for the specified TCB
|
* Create a message queue descriptor for the specified TCB
|
||||||
@@ -128,7 +130,8 @@ static mqd_t mq_desalloc(void)
|
|||||||
* oflags - access rights for the descriptor
|
* oflags - access rights for the descriptor
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
*
|
* On success, the message queue descriptor is returned. NULL is returned
|
||||||
|
* on a failure to allocate.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user