source: rtems/testsuites/rhealstone/rhilatency/ilatency.c @ e1598a6

4.115
Last change on this file since e1598a6 was e1598a6, checked in by Sebastian Huber <sebastian.huber@…>, on 04/04/14 at 08:56:36

score: Static scheduler configuration

Do not allocate the scheduler control structures from the workspace.
This is a preparation step for configuration of clustered/partitioned
schedulers on SMP.

  • Property mode set to 100644
File size: 2.7 KB
Line 
1/* Copyright 2014 Daniel Ramirez (javamonn@gmail.com)
2 *
3 * This file's license is 2-clause BSD as in this distribution's LICENSE.2 file.
4 */
5
6/*
7 *  WARNING!!!!!!!!!
8 *
9 *  THIS TEST USES INTERNAL RTEMS VARIABLES!!!
10 */
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#define CONFIGURE_INIT
17#include <timesys.h>
18#include <rtems/score/schedulerpriorityimpl.h>
19#include <rtems/timerdrv.h>
20#include <coverhd.h>
21
22/* configuration information */
23#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
24#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
25#define CONFIGURE_MAXIMUM_TASKS              2
26#define CONFIGURE_TICKS_PER_TIMESLICE        0
27#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
28#define CONFIGURE_SCHEDULER_PRIORITY
29
30#include <rtems/confdefs.h>
31
32#include <bsp.h>
33
34#define _RTEMS_TMTEST27
35#include <tm27.h>
36
37#define BENCHMARKS 50000
38
39rtems_task Task_1(
40  rtems_task_argument argument
41);
42
43uint32_t   Interrupt_nest;
44uint32_t   timer_overhead;
45uint32_t   Interrupt_enter_time;
46
47rtems_isr Isr_handler(
48  rtems_vector_number vector
49);
50
51rtems_task Init(
52  rtems_task_argument argument
53)
54{
55  rtems_status_code status;
56  rtems_id Task_id;
57
58  Print_Warning();
59
60  puts( "*** START OF RHILATENCY ***" );
61
62  if (
63    _Scheduler_Table[ 0 ].Operations.initialize
64      != _Scheduler_priority_Initialize
65  ) {
66    puts( "  Error ==> " );
67    puts( "Test only supported for deterministic priority scheduler\n" );
68    rtems_test_exit( 0 );
69  }
70
71#define LOW_PRIORITY (RTEMS_MAXIMUM_PRIORITY - 1u)
72  status = rtems_task_create(
73    rtems_build_name( 'T', 'A', '1', ' ' ),
74    LOW_PRIORITY,
75    RTEMS_MINIMUM_STACK_SIZE,
76    RTEMS_DEFAULT_MODES,
77    RTEMS_DEFAULT_ATTRIBUTES,
78    &Task_id
79  );
80  directive_failed( status, "rtems_task_create Task_1" );
81
82  status = rtems_task_start( Task_id, Task_1, 0 );
83  directive_failed( status, "rtems_task_start Task_1" );
84
85  benchmark_timer_initialize();
86  benchmark_timer_read();
87  benchmark_timer_initialize();
88  timer_overhead = benchmark_timer_read();
89
90  status = rtems_task_delete( RTEMS_SELF );
91  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
92}
93
94rtems_task Task_1(
95  rtems_task_argument argument
96)
97{
98  Install_tm27_vector( Isr_handler ) ;
99  Interrupt_nest = 0;
100
101  /* Benchmark code */
102  benchmark_timer_initialize();
103  /* goes to Isr_handler */
104  Cause_tm27_intr();
105
106  put_time(
107    "Rhealstone: Interrupt Latency",
108    Interrupt_enter_time,
109    1,                             /* Only Rhealstone that isn't an average */
110    timer_overhead,
111    0
112  );
113
114  puts( "*** END OF RHILATENCY ***" );
115  rtems_test_exit( 0 );
116}
117
118rtems_isr Isr_handler(
119  rtems_vector_number vector
120)
121{
122  /* See how long it took system to recognize interrupt */
123  Interrupt_enter_time = benchmark_timer_read();
124  Clear_tm27_intr();
125}
Note: See TracBrowser for help on using the repository browser.