Notice: We have migrated to GitLab launching 2024-05-01 see here: https://gitlab.rtems.org/

Ticket #2772: system.h

File system.h, 1.9 KB (added by Kuan-Hsun Chen, on 08/05/16 at 16:37:43)

Example system file

Line 
1/**
2 * @file sprmsched01/system.h
3 *
4 * @brief sprmsched01 example header
5 */
6
7/*
8 *  COPYRIGHT (c) 1989-2007.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  COPYRIGHT (c) 2016 Kuan-Hsun Chen, TU Dortmund University (TUDo).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.com/license/LICENSE.
16 */
17
18 
19#include <inttypes.h>
20#include <rtems.h>
21
22#include <tmacros.h>
23
24/* function prototypes */
25
26rtems_task Init(
27  rtems_task_argument argument
28);
29
30rtems_task Task_1(
31  rtems_task_argument argument
32);
33
34rtems_task Task_2(
35  rtems_task_argument argument
36);
37
38/*
39 *  Keep the names and IDs in global variables so another task can use them.
40 */
41
42extern rtems_id   Task_id[ 2 ];         /* array of task ids */
43extern rtems_name Task_name[ 2 ];       /* array of task names */
44extern uint32_t tick_per_second;        /* time reference */
45extern int testnumber;                  /* stop condition */
46
47/* configuration information */
48
49#include <bsp.h> /* for device driver prototypes */
50
51#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
52#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
53#define CONFIGURE_MICROSECONDS_PER_TICK     1000   // NB: 10 and lower gives system failure for erc32 simulator
54#define CONFIGURE_MAXIMUM_TASKS             3
55#define CONFIGURE_MAXIMUM_SEMAPHORES        1
56#define CONFIGURE_MAXIMUM_PRIORITY          15
57#define CONFIGURE_EXTRA_TASK_STACKS         (20 * RTEMS_MINIMUM_STACK_SIZE)
58#define CONFIGURE_MAXIMUM_PERIODS           3
59
60#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
61
62#include <rtems/confdefs.h>
63
64/*
65 *  Macro to loop/simulate the execution time.
66 */
67
68
69#define LOOP(_et, taskID){ \
70  \
71  int start = 0; \
72  int now = 0; \
73  start = rtems_clock_get_ticks_since_boot();\
74  while(1){\
75        \
76    now = rtems_clock_get_ticks_since_boot();\
77          if(now-start >= _et){\
78                break;\
79    }\
80 }\
81}
82/* end of include file */