if CONFIG_SCHED_TICKLESS is defined, then the global variable g_system_timer does not exist

This commit is contained in:
Gregory Nutt 2014-08-06 18:26:16 -06:00
parent f0eb4235d1
commit 0452b1555b
3 changed files with 55 additions and 35 deletions

View File

@ -150,60 +150,66 @@ extern volatile int g_eventloop;
/* up_setjmp.S ************************************************************/ /* up_setjmp.S ************************************************************/
extern int up_setjmp(int *jb); int up_setjmp(int *jb);
extern void up_longjmp(int *jb, int val) noreturn_function; void up_longjmp(int *jb, int val) noreturn_function;
/* up_tickless.c **********************************************************/
#ifdef CONFIG_SCHED_TICKLESS
void up_timer_update(void);
#endif
/* up_devconsole.c ********************************************************/ /* up_devconsole.c ********************************************************/
extern void up_devconsole(void); void up_devconsole(void);
extern void up_registerblockdevice(void); void up_registerblockdevice(void);
/* up_deviceimage.c *******************************************************/ /* up_deviceimage.c *******************************************************/
extern char *up_deviceimage(void); char *up_deviceimage(void);
/* up_stdio.c *************************************************************/ /* up_stdio.c *************************************************************/
extern size_t up_hostread(void *buffer, size_t len); size_t up_hostread(void *buffer, size_t len);
extern size_t up_hostwrite(const void *buffer, size_t len); size_t up_hostwrite(const void *buffer, size_t len);
/* up_netdev.c ************************************************************/ /* up_netdev.c ************************************************************/
#ifdef CONFIG_NET #ifdef CONFIG_NET
extern unsigned long up_getwalltime( void ); unsigned long up_getwalltime( void );
#endif #endif
/* up_x11framebuffer.c ******************************************************/ /* up_x11framebuffer.c ******************************************************/
#ifdef CONFIG_SIM_X11FB #ifdef CONFIG_SIM_X11FB
extern int up_x11initialize(unsigned short width, unsigned short height, int up_x11initialize(unsigned short width, unsigned short height,
void **fbmem, unsigned int *fblen, unsigned char *bpp, void **fbmem, unsigned int *fblen, unsigned char *bpp,
unsigned short *stride); unsigned short *stride);
#ifdef CONFIG_FB_CMAP #ifdef CONFIG_FB_CMAP
extern int up_x11cmap(unsigned short first, unsigned short len, int up_x11cmap(unsigned short first, unsigned short len,
unsigned char *red, unsigned char *green, unsigned char *red, unsigned char *green,
unsigned char *blue, unsigned char *transp); unsigned char *blue, unsigned char *transp);
#endif #endif
#endif #endif
/* up_eventloop.c ***********************************************************/ /* up_eventloop.c ***********************************************************/
#if defined(CONFIG_SIM_X11FB) && defined(CONFIG_SIM_TOUCHSCREEN) #if defined(CONFIG_SIM_X11FB) && defined(CONFIG_SIM_TOUCHSCREEN)
extern void up_x11events(void); void up_x11events(void);
#endif #endif
/* up_eventloop.c ***********************************************************/ /* up_eventloop.c ***********************************************************/
#if defined(CONFIG_SIM_X11FB) && defined(CONFIG_SIM_TOUCHSCREEN) #if defined(CONFIG_SIM_X11FB) && defined(CONFIG_SIM_TOUCHSCREEN)
extern int up_buttonevent(int x, int y, int buttons); int up_buttonevent(int x, int y, int buttons);
#endif #endif
/* up_tapdev.c ************************************************************/ /* up_tapdev.c ************************************************************/
#if defined(CONFIG_NET) && !defined(__CYGWIN__) #if defined(CONFIG_NET) && !defined(__CYGWIN__)
extern void tapdev_init(void); void tapdev_init(void);
extern unsigned int tapdev_read(unsigned char *buf, unsigned int buflen); unsigned int tapdev_read(unsigned char *buf, unsigned int buflen);
extern void tapdev_send(unsigned char *buf, unsigned int buflen); void tapdev_send(unsigned char *buf, unsigned int buflen);
#define netdev_init() tapdev_init() #define netdev_init() tapdev_init()
#define netdev_read(buf,buflen) tapdev_read(buf,buflen) #define netdev_read(buf,buflen) tapdev_read(buf,buflen)
@ -213,9 +219,9 @@ extern void tapdev_send(unsigned char *buf, unsigned int buflen);
/* up_wpcap.c *************************************************************/ /* up_wpcap.c *************************************************************/
#if defined(CONFIG_NET) && defined(__CYGWIN__) #if defined(CONFIG_NET) && defined(__CYGWIN__)
extern void wpcap_init(void); void wpcap_init(void);
extern unsigned int wpcap_read(unsigned char *buf, unsigned int buflen); unsigned int wpcap_read(unsigned char *buf, unsigned int buflen);
extern void wpcap_send(unsigned char *buf, unsigned int buflen); void wpcap_send(unsigned char *buf, unsigned int buflen);
#define netdev_init() wpcap_init() #define netdev_init() wpcap_init()
#define netdev_read(buf,buflen) wpcap_read(buf,buflen) #define netdev_read(buf,buflen) wpcap_read(buf,buflen)
@ -225,9 +231,9 @@ extern void wpcap_send(unsigned char *buf, unsigned int buflen);
/* up_netdriver.c *********************************************************/ /* up_netdriver.c *********************************************************/
#ifdef CONFIG_NET #ifdef CONFIG_NET
extern int netdriver_init(void); int netdriver_init(void);
extern int netdriver_setmacaddr(unsigned char *macaddr); int netdriver_setmacaddr(unsigned char *macaddr);
extern void netdriver_loop(void); void netdriver_loop(void);
#endif #endif
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */

View File

@ -53,12 +53,15 @@
/* Efficient, direct access to OS global timer variables will be supported /* Efficient, direct access to OS global timer variables will be supported
* if the execution environment has direct access to kernel global data. * if the execution environment has direct access to kernel global data.
* The code in this execution context can access the kernel global data * The code in this execution context can access the kernel global data
* directly if: (1) this is an un-protected, non-kernel build, or (2) * directly if: (1) we are not running tick-less (in which case there is
* this code is being built for execution within the kernel. * no global timer data), (2) this is an un-protected, non-kernel build, or
* (2) this is a protectd build, but this code is being built for execution
* within the kernel space.
*/ */
#undef __HAVE_KERNEL_GLOBALS #undef __HAVE_KERNEL_GLOBALS
#if !defined(CONFIG_NUTTX_KERNEL) || defined(__KERNEL__) #if !defined(CONFIG_SCHED_TICKLESS) && \
(!defined(CONFIG_NUTTX_KERNEL) || defined(__KERNEL__))
# define __HAVE_KERNEL_GLOBALS 1 # define __HAVE_KERNEL_GLOBALS 1
#else #else
# define __HAVE_KERNEL_GLOBALS 0 # define __HAVE_KERNEL_GLOBALS 0
@ -85,12 +88,13 @@
#define USEC_PER_MSEC 1000 #define USEC_PER_MSEC 1000
#define NSEC_PER_USEC 1000 #define NSEC_PER_USEC 1000
/* The interrupt interval of the system timer is given by MSEC_PER_TICK. /* If CONFIG_SCHED_TICKLESS is not defined, then the interrupt interval of
* This is the expected number of milliseconds between calls from the * the system timer is given by MSEC_PER_TICK. This is the expected number
* processor-specific logic to sched_process_timer(). The default value * of milliseconds between calls from the processor-specific logic to
* of MSEC_PER_TICK is 10 milliseconds (100KHz). However, this default * sched_process_timer(). The default value of MSEC_PER_TICK is 10
* setting can be overridden by defining the interval in milliseconds as * milliseconds (100KHz). However, this default setting can be overridden
* CONFIG_MSEC_PER_TICK in the board configuration file. * by defining the interval in milliseconds as CONFIG_MSEC_PER_TICK in the
* board configuration file.
* *
* The following calculations are only accurate when (1) there is no * The following calculations are only accurate when (1) there is no
* truncation involved and (2) the underlying system timer is an even * truncation involved and (2) the underlying system timer is an even

View File

@ -80,11 +80,17 @@
* Public Variables * Public Variables
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_SCHED_TICKLESS
#ifdef CONFIG_SYSTEM_TIME64 #ifdef CONFIG_SYSTEM_TIME64
volatile uint64_t g_system_timer; volatile uint64_t g_system_timer;
uint64_t g_tickbias;
#else #else
volatile uint32_t g_system_timer; volatile uint32_t g_system_timer;
#endif
#endif
#ifdef CONFIG_SYSTEM_TIME64
uint64_t g_tickbias;
#else
uint32_t g_tickbias; uint32_t g_tickbias;
#endif #endif
@ -182,7 +188,9 @@ static void clock_inittime(void)
/* (Re-)initialize the time value to match the RTC */ /* (Re-)initialize the time value to match the RTC */
clock_basetime(&g_basetime); clock_basetime(&g_basetime);
#ifndef CONFIG_SCHED_TICKLESS
g_system_timer = 0; g_system_timer = 0;
#endif
g_tickbias = 0; g_tickbias = 0;
} }
@ -262,9 +270,11 @@ void clock_synchronize(void)
* *
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_SCHED_TICKLESS
void clock_timer(void) void clock_timer(void)
{ {
/* Increment the per-tick system counter */ /* Increment the per-tick system counter */
g_system_timer++; g_system_timer++;
} }
#endif