@@ -100,54 +100,52 @@ rv/da_monitor.h
100100
101101This initial implementation presents three different types of monitor instances:
102102
103- - ``#define DECLARE_DA_MON_GLOBAL(name, type) ``
104- - ``#define DECLARE_DA_MON_PER_CPU(name, type) ``
105- - ``#define DECLARE_DA_MON_PER_TASK(name, type) ``
103+ - ``#define RV_MON_TYPE RV_MON_GLOBAL ``
104+ - ``#define RV_MON_TYPE RV_MON_PER_CPU ``
105+ - ``#define RV_MON_TYPE RV_MON_PER_TASK ``
106106
107- The first declares the functions for a global deterministic automata monitor,
108- the second for monitors with per-cpu instances, and the third with per-task
109- instances.
107+ The first sets up functions declaration for a global deterministic automata
108+ monitor, the second for monitors with per-cpu instances, and the third with
109+ per-task instances.
110110
111- In all cases, the 'name' argument is a string that identifies the monitor, and
112- the 'type' argument is the data type used by rvgen on the representation of
113- the model in C.
111+ In all cases, the C file must include the $(MODEL_NAME).h file (generated by
112+ ` rvgen `), for example, to define the per-cpu 'wip' monitor, the ` wip.c ` source
113+ file must include::
114114
115- For example, the wip model with two states and three events can be
116- stored in an 'unsigned char' type. Considering that the preemption control
117- is a per-cpu behavior, the monitor declaration in the 'wip.c' file is::
118-
119- DECLARE_DA_MON_PER_CPU(wip, unsigned char);
115+ #define RV_MON_TYPE RV_MON_PER_CPU
116+ #include "wip.h"
117+ #include <rv/da_monitor.h>
120118
121119The monitor is executed by sending events to be processed via the functions
122120presented below::
123121
124- da_handle_event_$(MONITOR_NAME) ($(event from event enum));
125- da_handle_start_event_$(MONITOR_NAME) ($(event from event enum));
126- da_handle_start_run_event_$(MONITOR_NAME) ($(event from event enum));
122+ da_handle_event ($(event from event enum));
123+ da_handle_start_event ($(event from event enum));
124+ da_handle_start_run_event ($(event from event enum));
127125
128- The function ``da_handle_event_$(MONITOR_NAME) () `` is the regular case where
126+ The function ``da_handle_event () `` is the regular case where
129127the event will be processed if the monitor is processing events.
130128
131129When a monitor is enabled, it is placed in the initial state of the automata.
132130However, the monitor does not know if the system is in the *initial state *.
133131
134- The ``da_handle_start_event_$(MONITOR_NAME) () `` function is used to notify the
132+ The ``da_handle_start_event () `` function is used to notify the
135133monitor that the system is returning to the initial state, so the monitor can
136134start monitoring the next event.
137135
138- The ``da_handle_start_run_event_$(MONITOR_NAME) () `` function is used to notify
136+ The ``da_handle_start_run_event () `` function is used to notify
139137the monitor that the system is known to be in the initial state, so the
140138monitor can start monitoring and monitor the current event.
141139
142140Using the wip model as example, the events "preempt_disable" and
143141"sched_waking" should be sent to monitor, respectively, via [2]::
144142
145- da_handle_event_wip (preempt_disable_wip);
146- da_handle_event_wip (sched_waking_wip);
143+ da_handle_event (preempt_disable_wip);
144+ da_handle_event (sched_waking_wip);
147145
148146While the event "preempt_enabled" will use::
149147
150- da_handle_start_event_wip (preempt_enable_wip);
148+ da_handle_start_event (preempt_enable_wip);
151149
152150To notify the monitor that the system will be returning to the initial state,
153151so the system and the monitor should be in sync.
0 commit comments