Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FlightOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Armin Luntzer
FlightOS
Commits
605c3857
Commit
605c3857
authored
6 years ago
by
Armin Luntzer
Browse files
Options
Downloads
Patches
Plain Diff
main: add dummy IRQ demo and twiddle() dummy indicator
parent
22619d0a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
init/main.c
+47
-2
47 additions, 2 deletions
init/main.c
with
47 additions
and
2 deletions
init/main.c
+
47
−
2
View file @
605c3857
...
...
@@ -18,9 +18,7 @@
#include
<kernel/printk.h>
#include
<modules-image.h>
#ifdef CONFIG_MPPB
#include
<asm/processor.h>
#endif
/* for our demo */
#include
"xentium_demo.h"
...
...
@@ -39,6 +37,27 @@
#endif
/* GCC_VERSION */
#include
<kernel/irq.h>
irqreturn_t
dummy
(
unsigned
int
irq
,
void
*
userdata
)
{
return
0
;
}
/**
* @brief do something useless
*/
static
void
twiddle
(
void
)
{
static
int
i
;
const
char
cursor
[]
=
{
'/'
,
'-'
,
'\\'
,
'|'
};
printk
(
"%c
\b\b
"
,
cursor
[
i
]);
i
=
(
i
+
1
)
%
ARRAY_SIZE
(
cursor
);
}
/**
...
...
@@ -118,6 +137,32 @@ int kernel_main(void)
/* run the demo */
xen_demo
();
#endif
printk
(
MSG
"Boot complete, spinning idly.
\n
"
);
{
#define GR712_IRL1_GPTIMER_2 10
#define LEON3_TIMER_EN 0x00000001
/* enable counting */
#define LEON3_TIMER_RL 0x00000002
/* reload at 0 */
#define LEON3_TIMER_LD 0x00000004
/* load counter */
#define LEON3_TIMER_IE 0x00000008
/* irq enable */
struct
gptimer_unit
*
mtu
=
(
struct
gptimer_unit
*
)
0x80000300
;
irq_request
(
8
,
ISR_PRIORITY_NOW
,
dummy
,
NULL
);
mtu
->
scaler_reload
=
5
;
mtu
->
timer
[
0
].
reload
=
10000000
/
(
mtu
->
scaler_reload
+
1
);
mtu
->
timer
[
0
].
value
=
mtu
->
timer
[
0
].
reload
;
mtu
->
timer
[
0
].
ctrl
=
LEON3_TIMER_LD
|
LEON3_TIMER_EN
|
LEON3_TIMER_RL
|
LEON3_TIMER_IE
;
}
while
(
1
)
{
twiddle
();
cpu_relax
();
}
return
0
;
}
...
...
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