source: rtems/c/src/lib/libbsp/shared/clock_driver_simidle.c @ f2e0f8e

5
Last change on this file since f2e0f8e was ccd5434, checked in by Sebastian Huber <sebastian.huber@…>, on 01/07/16 at 08:55:45

score: Introduce Thread_Entry_information

This avoids potential dead code in _Thread_Handler(). It gets rid of
the dangerous function pointer casts.

Update #2514.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 *  Instantiate the clock driver shell.
3 *
4 *  Since there is no clock source on the simulator, we fake
5 *  it with a special IDLE task.
6 */
7
8#include <rtems.h>
9#include <rtems/score/percpu.h>
10#include <rtems/score/threaddispatch.h>
11
12#define CLOCK_VECTOR 0
13
14#define Clock_driver_support_at_tick()
15
16#define Clock_driver_support_install_isr( _new, _old ) \
17  do { _old = 0; } while(0)
18
19volatile bool clock_driver_enabled;
20
21#define Clock_driver_support_initialize_hardware() \
22  do { \
23    clock_driver_enabled = true; \
24  } while (0)
25
26#define Clock_driver_support_shutdown_hardware() \
27  do { \
28    clock_driver_enabled = false; \
29  } while (0)
30
31#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
32
33#include "clockdrv_shell.h"
34
35/*
36 * If this is defined, then the BSP has defined a delay of some sort so
37 * time passage appears somewhat correctly. Otherwise, it runs extremely
38 * fast with no delays.
39 */
40#ifndef BSP_CLOCK_DRIVER_DELAY
41#define BSP_CLOCK_DRIVER_DELAY()
42#endif
43
44/*
45 *  Since there is no interrupt on this simulator, let's just
46 *  fake time passing.  This will not let preemption from an
47 *  interrupt work but is enough for many tests.
48 */
49void *clock_driver_sim_idle_body(
50  uintptr_t   ignored
51)
52{
53  for( ; ; ) {
54    if ( clock_driver_enabled ) {
55      _Thread_Disable_dispatch();
56      _ISR_Nest_level++;
57        rtems_clock_tick();
58      _ISR_Nest_level--;
59      _Thread_Enable_dispatch();
60      BSP_CLOCK_DRIVER_DELAY();
61    }
62  }
63  return 0;   /* to avoid warning */
64}
Note: See TracBrowser for help on using the repository browser.