Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RTEMS-build-workflows
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thanassis Tsiodras
RTEMS-build-workflows
Commits
b03d8134
Commit
b03d8134
authored
Oct 26, 2018
by
Thanassis Tsiodras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
POSIX API.
parent
d5521483
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
80 deletions
+47
-80
GAISLER/src/init.c
GAISLER/src/init.c
+30
-69
GAISLER/src/system.h
GAISLER/src/system.h
+9
-5
GAISLER/src/task1.c
GAISLER/src/task1.c
+4
-3
GAISLER/src/task2.c
GAISLER/src/task2.c
+3
-2
GAISLER/src/version.h
GAISLER/src/version.h
+1
-1
No files found.
GAISLER/src/init.c
View file @
b03d8134
...
@@ -2,92 +2,53 @@
...
@@ -2,92 +2,53 @@
* Example initialization file - spawns 2 native FPU tasks
* Example initialization file - spawns 2 native FPU tasks
*
*
*/
*/
#define CONFIGURE_INIT
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <pthread.h>
#define TASKS 4
#define TASKS 4
#define DEFINE_VARS
#define DEFINE_VARS
#include "system.h"
#include <stdio.h>
void
*
POSIX_Init
(
void
);
#include <stdlib.h>
#define CONFIGURE_INIT
#include "system.h"
rtems_task
Init
(
rtems_task_argument
argument
)
void
*
POSIX_Init
(
)
{
{
rtems_status_code
status
;
int
status
;
rtems_name
Task_name
[
TASKS
];
/* task names */
rtems_id
Task_id
[
TASKS
];
/* task ids */
int
i
;
int
i
;
pthread_t
children
[
TASKS
];
#ifdef MEMCHECK
#ifdef MEMCHECK
memcheck
();
memcheck
();
#endif
#endif
all_OK
=
1
;
int
all_OK
=
1
;
g_init_task_id
=
rtems_task_self
();
for
(
i
=
0
;
i
<
TASKS
;
i
++
)
for
(
i
=
0
;
i
<
TASKS
;
i
++
)
{
{
// Initialize Task name
status
=
pthread_create
(
Task_name
[
i
]
=
rtems_build_name
(
'T'
,
'T'
,
"0"
+
i
/
10
,
"0"
+
i
%
10
);
&
children
[
i
],
NULL
,
// Create Task
(
i
%
2
)
==
0
?
&
Task1_EntryPoint
:
&
Task2_EntryPoint
,
status
=
rtems_task_create
(
(
void
*
)
i
);
Task_name
[
i
],
(
void
)
status
;
(
rtems_task_priority
)
2
,
RTEMS_MINIMUM_STACK_SIZE
,
#if CONFIGURE_SMP_MAXIMUM_PROCESSORS == 1 || CONFIGURE_MAXIMUM_PROCESSORS == 1
// LEON2 system - emulate SMP via Linux/Windows-like
// handling of tasks with same priority (i.e. pre-emption)
RTEMS_DEFAULT_MODES
|
RTEMS_TIMESLICE
,
#else
// LEON3/LEON4 system - use full SMP
RTEMS_DEFAULT_MODES
,
#endif
#if __RTEMS_MAJOR__ == 5
// Currently, RCCrc3 has a bug - it needs floating point support
// for all tasks, even those that don't use the FPU - otherwise
// as soon as the FPU task dies, the binary dies as well.
RTEMS_FLOATING_POINT
,
#else
(
i
%
2
)
==
0
?
RTEMS_FLOATING_POINT
:
RTEMS_DEFAULT_ATTRIBUTES
,
#endif
&
Task_id
[
i
]);
if
(
status
!=
RTEMS_SUCCESSFUL
)
{
printf
(
"[MAIN] Failed to rtems_task_create... status:%0x
\n
"
,
status
);
rtems_task_delete
(
RTEMS_SELF
);
}
// Start Task
status
=
rtems_task_start
(
Task_id
[
i
],
(
i
%
2
)
==
0
?
Task1_EntryPoint
:
Task2_EntryPoint
,
i
);
}
}
// To give coverage code the opportunity to work, wait for children tasks
// To give coverage code the opportunity to work, wait for children tasks
// to die first. RTEMS events are used for synchronization.
// to die first. RTEMS events are used for synchronization.
{
printf
(
"[MAIN] Waiting for testing tasks to complete...
\n
"
);
puts
(
"[MAIN] Waiting for testing tasks to complete..."
);
rtems_option
options
=
(
RTEMS_EVENT_ANY
|
RTEMS_WAIT
);
for
(
i
=
0
;
i
<
TASKS
;
i
++
)
{
rtems_event_set
in
=
0
;
pthread_join
(
children
[
i
],
NULL
);
for
(
i
=
0
;
i
<
TASKS
;
i
++
)
printf
(
"[MAIN] Thread completed.
\n
"
);
in
|=
(
RTEMS_EVENT_0
<<
i
);
rtems_event_set
out
;
rtems_event_set
non_completed
=
in
;
while
(
non_completed
)
{
status
=
rtems_event_receive
(
in
,
options
,
RTEMS_NO_TIMEOUT
,
&
out
);
if
(
status
==
RTEMS_SUCCESSFUL
)
{
non_completed
&=
~
out
;
printf
(
"[MAIN] Task completed.
\n
"
);
fflush
(
stdout
);
}
}
printf
(
"[MAIN] All testing tasks completed.
\n
"
);
if
(
!
all_OK
)
printf
(
"[MAIN] Some tests failed... :-(
\n
"
);
else
printf
(
"[MAIN] All tests passed! :-)
\n
"
);
fflush
(
stdout
);
fflush
(
stdout
);
}
}
printf
(
"[MAIN] All testing tasks completed.
\n
"
);
if
(
!
all_OK
)
printf
(
"[MAIN] Some tests failed... :-(
\n
"
);
else
printf
(
"[MAIN] All tests passed! :-)
\n
"
);
fflush
(
stdout
);
exit
(
0
);
exit
(
0
);
}
}
GAISLER/src/system.h
View file @
b03d8134
...
@@ -3,17 +3,21 @@
...
@@ -3,17 +3,21 @@
#include <rtems.h>
#include <rtems.h>
rtems_task
Init
(
rtems_task_argument
argument
);
void
*
POSIX_Init
(
void
);
rtems_task
Task1_EntryPoint
(
rtems_task_argument
argument
);
void
*
Task1_EntryPoint
(
void
*
argument
);
rtems_task
Task2_EntryPoint
(
rtems_task_argument
argument
);
void
*
Task2_EntryPoint
(
void
*
argument
);
void
task_begin
(
int
task_no
);
void
task_begin
(
int
task_no
);
void
task_end
(
int
task_no
);
void
task_end
(
int
task_no
);
void
memcheck
(
void
);
void
memcheck
(
void
);
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 64
#define CONFIGURE_MAXIMUM_TASKS 64
#define CONFIGURE_TICKS_PER_TIMESLICE 100
#define CONFIGURE_TICKS_PER_TIMESLICE 100
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
//#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_MAXIMUM_POSIX_THREADS 20
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#if __RTEMS_MAJOR__ < 5
#if __RTEMS_MAJOR__ < 5
...
...
GAISLER/src/task1.c
View file @
b03d8134
#include "system.h"
#include "system.h"
#include <stdio.h>
#include <stdio.h>
rtems_task
Task1_EntryPoint
(
rtems_task_argument
argument
)
void
*
Task1_EntryPoint
(
void
*
argument
)
{
{
int
task_no
=
(
int
)
argument
;
int
task_no
=
(
int
)
argument
;
task_begin
(
task_no
);
task_begin
(
task_no
);
...
@@ -31,7 +31,7 @@ rtems_task Task1_EntryPoint(rtems_task_argument argument)
...
@@ -31,7 +31,7 @@ rtems_task Task1_EntryPoint(rtems_task_argument argument)
fflush
(
stdout
);
fflush
(
stdout
);
all_OK
=
0
;
all_OK
=
0
;
task_end
(
task_no
);
task_end
(
task_no
);
return
;
return
NULL
;
}
}
if
(
target
!=
result
)
{
if
(
target
!=
result
)
{
printf
(
printf
(
...
@@ -40,10 +40,11 @@ rtems_task Task1_EntryPoint(rtems_task_argument argument)
...
@@ -40,10 +40,11 @@ rtems_task Task1_EntryPoint(rtems_task_argument argument)
fflush
(
stdout
);
fflush
(
stdout
);
all_OK
=
0
;
all_OK
=
0
;
task_end
(
task_no
);
task_end
(
task_no
);
return
;
return
NULL
;
}
}
}
}
printf
(
"[TASK %d] Computed the correct floating point result.
\n
"
,
task_no
);
printf
(
"[TASK %d] Computed the correct floating point result.
\n
"
,
task_no
);
fflush
(
stdout
);
fflush
(
stdout
);
task_end
(
task_no
);
task_end
(
task_no
);
return
NULL
;
}
}
GAISLER/src/task2.c
View file @
b03d8134
#include "system.h"
#include "system.h"
#include <stdio.h>
#include <stdio.h>
rtems_task
Task2_EntryPoint
(
rtems_task_argument
argument
)
void
*
Task2_EntryPoint
(
void
*
argument
)
{
{
int
task_no
=
(
int
)
argument
;
int
task_no
=
(
int
)
argument
;
task_begin
(
task_no
);
task_begin
(
task_no
);
...
@@ -21,9 +21,10 @@ rtems_task Task2_EntryPoint(rtems_task_argument argument)
...
@@ -21,9 +21,10 @@ rtems_task Task2_EntryPoint(rtems_task_argument argument)
fflush
(
stdout
);
fflush
(
stdout
);
all_OK
=
0
;
all_OK
=
0
;
task_end
(
task_no
);
task_end
(
task_no
);
return
;
return
NULL
;
}
}
printf
(
"[TASK %d] Computed the correct integer result.
\n
"
,
task_no
);
printf
(
"[TASK %d] Computed the correct integer result.
\n
"
,
task_no
);
fflush
(
stdout
);
fflush
(
stdout
);
task_end
((
int
)
argument
);
task_end
((
int
)
argument
);
return
NULL
;
}
}
GAISLER/src/version.h
View file @
b03d8134
#ifndef __VERSION_H__
#ifndef __VERSION_H__
#define __VERSION_H__
#define __VERSION_H__
const
char
version
[]
=
"1.1
04 (940a750
)"
;
const
char
version
[]
=
"1.1
12 (d552148
)"
;
#endif
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment