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

5
Last change on this file since f3b29236 was f3b29236, checked in by Sebastian Huber <sebastian.huber@…>, on 09/18/17 at 06:22:38

bsps: Clock_driver_support_install_isr()

Remove old ISR parameter since is not used by the clock driver shell.
Make an implementation optional.

Update #3139.

  • Property mode set to 100644
File size: 1.3 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
14volatile bool clock_driver_enabled;
15
16#define Clock_driver_support_initialize_hardware() \
17  do { \
18    clock_driver_enabled = true; \
19  } while (0)
20
21#define Clock_driver_support_shutdown_hardware() \
22  do { \
23    clock_driver_enabled = false; \
24  } while (0)
25
26#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
27
28#include "clockdrv_shell.h"
29
30/*
31 * If this is defined, then the BSP has defined a delay of some sort so
32 * time passage appears somewhat correctly. Otherwise, it runs extremely
33 * fast with no delays.
34 */
35#ifndef BSP_CLOCK_DRIVER_DELAY
36#define BSP_CLOCK_DRIVER_DELAY()
37#endif
38
39/*
40 *  Since there is no interrupt on this simulator, let's just
41 *  fake time passing.  This will not let preemption from an
42 *  interrupt work but is enough for many tests.
43 */
44void *clock_driver_sim_idle_body(
45  uintptr_t   ignored
46)
47{
48  for( ; ; ) {
49    if ( clock_driver_enabled ) {
50      Per_CPU_Control *cpu = _Thread_Dispatch_disable();
51      _ISR_Nest_level++;
52      rtems_clock_tick();
53      _ISR_Nest_level--;
54      _Thread_Dispatch_enable( cpu );
55      BSP_CLOCK_DRIVER_DELAY();
56    }
57  }
58  return 0;   /* to avoid warning */
59}
Note: See TracBrowser for help on using the repository browser.