Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
d7020e_srp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
d7020e
d7020e_srp
Commits
03cb7333
Commit
03cb7333
authored
8 years ago
by
Henrik Tjäder
Browse files
Options
Downloads
Patches
Plain Diff
Fixed the macro and formatted main
parent
8877d8a0
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/SRP_wcet.h
+7
-6
7 additions, 6 deletions
include/SRP_wcet.h
src/main.c
+67
-56
67 additions, 56 deletions
src/main.c
with
74 additions
and
62 deletions
include/SRP_wcet.h
+
7
−
6
View file @
03cb7333
...
@@ -44,14 +44,15 @@ typedef struct locks
...
@@ -44,14 +44,15 @@ typedef struct locks
}
locks
;
}
locks
;
uint32_t
event_count
=
0
;
#define MAX_NUM_LOCKS 10
int
event_count
=
0
;
/* Create array containing structs of type locks */
/* Create array containing structs of type locks */
#define MAX_NUM_LOCKS 10
locks
eventlist
[
MAX_NUM_LOCKS
];
locks
eventlist
[
MAX_NUM_LOCKS
];
//#define TRACE_EVENT(event, el)({eventlist[event_count].time = DWT->CYCCNT; eventlist[event_count].action = event; eventlist[event_count].elem = el; event_count+=1;})
#define TRACE_EVENT(event, el)({})
#define TRACE_EVENT(event, el)({
eventlist[event_count].time = DWT->CYCCNT; eventlist[event_count].action = event; eventlist[event_count].elem = el; event_count+=1;
})
// #define Ceiling(R) (R##_Ceiling)
// #define Ceiling(R) (R##_Ceiling)
...
@@ -64,8 +65,8 @@ locks eventlist[MAX_NUM_LOCKS];
...
@@ -64,8 +65,8 @@ locks eventlist[MAX_NUM_LOCKS];
// #define BARRIER_UNLOCK { }
// #define BARRIER_UNLOCK { }
#define JOB_REQUEST(J) { }
#define JOB_REQUEST(J) { }
#define LOCK(
R
) TRACE_EVENT(L,
#R
);
#define LOCK(
X
) TRACE_EVENT(L,
X
);
#define UNLOCK(
R
) TRACE_EVENT(R,
#R
);
#define UNLOCK(
X
) TRACE_EVENT(R,
X
);
// #define SETPRIO(J) { }
// #define SETPRIO(J) { }
// #define ENABLE(J) { }
// #define ENABLE(J) { }
...
...
This diff is collapsed.
Click to expand it.
src/main.c
+
67
−
56
View file @
03cb7333
...
@@ -31,23 +31,30 @@
...
@@ -31,23 +31,30 @@
static
int
state
;
static
int
state
;
void
work
(
int
i
)
{
void
work
(
int
i
)
{
volatile
int
k
=
0
;
volatile
int
k
=
0
;
for
(
int
j
=
0
;
j
<
100
*
i
;
j
++
)
for
(
int
j
=
0
;
j
<
100
*
i
;
j
++
)
{
k
++
;
k
++
;
}
}
}
TASK
(
j1
)
{
TASK
(
j1
)
{
LOCK
(
r2
);
LOCK
(
r2
);
JOB_REQUEST
(
j2
);
// job execution request for j2
JOB_REQUEST
(
j2
);
// job execution request for j2
if
(
state
>
0
)
if
(
state
>
0
)
{
work
(
10
);
work
(
10
);
}
else
else
{
work
(
5
);
work
(
5
);
}
/*
LOCK
(
r1
);
LOCK
(
r1
);
#ifdef enable_itm
#ifdef enable_itm
trace_printf
(
"j1_r1_locked, before job request j2
\n
"
);
trace_printf
(
"j1_r1_locked, before job request j2
\n
"
);
...
@@ -57,11 +64,11 @@ TASK(j1) {
...
@@ -57,11 +64,11 @@ TASK(j1) {
trace_printf
(
"j1_r1_locked, after job request j2
\n
"
);
trace_printf
(
"j1_r1_locked, after job request j2
\n
"
);
#endif
#endif
UNLOCK
(
r1
);
UNLOCK
(
r1
);
*/
UNLOCK
(
r2
);
UNLOCK
(
r2
);
}
}
TASK
(
j2
)
{
TASK
(
j2
)
{
#ifdef enable_itm
#ifdef enable_itm
trace_printf
(
"j2_enter
\n
"
);
trace_printf
(
"j2_enter
\n
"
);
#endif
#endif
...
@@ -75,14 +82,18 @@ TASK(j2) {
...
@@ -75,14 +82,18 @@ TASK(j2) {
#endif
#endif
}
}
int
main
()
{
int
main
()
{
#ifdef enable_itm
#ifdef enable_itm
trace_printf
(
"
\n
Init
\n
"
);
trace_printf
(
"
\n
Init
\n
"
);
#endif
#endif
#ifndef KLEE
#ifndef KLEE
dwt_enable
();
DWT
->
CYCCNT
=
0
;
#ifndef KLEE_WCET
#ifndef KLEE_WCET
SETPRIO
(
j1
);
// Set HW priorities
SETPRIO
(
j1
);
// Set HW priorities
SETPRIO
(
j2
);
SETPRIO
(
j2
);
SETPRIO
(
j3
);
SETPRIO
(
j3
);
...
@@ -96,17 +107,17 @@ int main() {
...
@@ -96,17 +107,17 @@ int main() {
BREAKPOINT
;
BREAKPOINT
;
while
(
1
)
;
while
(
1
)
;
return
0
;
return
0
;
/* The case when NOT running WCET benchmark nor KLEE-analysis */
#else
#else
dwt_enable
();
DWT
->
CYCCNT
=
0
;
event_count
=
0
;
TRACE_EVENT
(
S
,
j1
);
TRACE_EVENT
(
S
,
j1
);
EXTI1_IRQHandler
();
EXTI1_IRQHandler
();
TRACE_EVENT
(
E
,
j1
);
TRACE_EVENT
(
E
,
j1
);
#endif
finish_execution
();
finish_execution
();
terminate_execution
();
terminate_execution
();
#endif
#elif (JOB == 1)
#elif (JOB == 1)
// check task 1
// check task 1
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment