Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs452Trainee
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tom Feng
cs452Trainee
Commits
46067b85
Commit
46067b85
authored
6 years ago
by
Tom Feng
Browse files
Options
Downloads
Patches
Plain Diff
before switch back to k1
parent
4090909f
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/ts7200.h
+7
-0
7 additions, 0 deletions
include/ts7200.h
src/developing/Makefile
+1
-1
1 addition, 1 deletion
src/developing/Makefile
src/developing/main.c
+74
-3
74 additions, 3 deletions
src/developing/main.c
with
82 additions
and
4 deletions
include/ts7200.h
+
7
−
0
View file @
46067b85
...
...
@@ -82,3 +82,10 @@
#define UART_HDLCSTS_OFFSET 0x21c
#define VIC1_BASE 0x800B0000
#define VIC2_BASE 0x800C0000
#define IRQ_STATUS 0x0
#define INT_ENABLE 0x10
#define SFT_INT 0x18
#define SFT_INT_CLR 0x1C
#define PRT_OFFSET 0x20
This diff is collapsed.
Click to expand it.
src/developing/Makefile
+
1
−
1
View file @
46067b85
...
...
@@ -34,7 +34,7 @@ bwio.o: bwio.s
$(
AS
)
$(
ASFLAGS
)
-o
bwio.o bwio.s
main.elf
:
main.o
$(
LD
)
$(
LDFLAGS
)
-o
$@
main.o
-l
timer
-lbwio
-lgcc
$(
LD
)
$(
LDFLAGS
)
-o
$@
main.o
-l
cs
-lbwio
-lgcc
bwio.a
:
bwio.o
$(
AR
)
$(
ARFLAGS
)
$@
bwio.o
...
...
This diff is collapsed.
Click to expand it.
src/developing/main.c
+
74
−
3
View file @
46067b85
#include
<bwio.h>
#include
<context-switch.h>
#include
<types.h>
#include
<t
imer
.h>
#include
<t
s7200
.h>
int
GenSWI
(){
bwprintf
(
COM2
,
"got into GenSWI
\n\r
"
);
return
0
;
//asm volatile("swi 2\n\t");
}
int
GenHWI
(){
int
a
=
*
(
int
*
)(
VIC1_BASE
);
bwprintf
(
COM2
,
"before generate hwi, %d
\n\r
"
,
a
);
*
(
int
*
)(
VIC1_BASE
+
PRT_OFFSET
)
=
(
1
<<
4
);
*
(
int
*
)(
VIC1_BASE
+
INT_ENABLE
)
=
(
1
<<
4
);
*
(
int
*
)(
VIC1_BASE
+
SFT_INT
)
=
(
1
<<
4
);
bwprintf
(
COM2
,
"after write to sft interrupt slot %d
\n\r
"
,
a
);
asm
volatile
(
"swi 0
\n\t
"
);
}
void
EnableInter
(){
int
a
=
*
(
int
*
)(
VIC1_BASE
);
*
(
int
*
)(
VIC1_BASE
+
INT_ENABLE
)
=
a
;
}
void
hwi
(){
asm
volatile
(
"stmfd sp!, {r0,r1}
\n\t
"
"mrs r0, spsr
\n\t
"
"stmfd sp!, {r0,lr}
\n\t
"
"swi 100
\n\t
"
"ldmfd sp!, {r0,lr}
\n\t
"
"msr spsr, r0
\n\t
"
"ldmfd sp!, {r0,r1}
\n\t
"
"bl EnableInter
\n\t
"
"subs pc, lr, #4
\n\t
"
);
}
void
SetSHWI
(){
asm
volatile
(
"mov r0, #0x38
\n\t
"
"ldr r1, =hwi
\n\t
"
"add r1, r1, #0x218000
\n\t
"
"str r1, [r0]
\n\t
"
"mov r0, #0x28
\n\t
"
"ldr r1, =kerent
\n\t
"
"add r1, r1, #0x218000
\n\t
"
"str r1, [r0]
\n\t
"
);
}
int
main
(){
Clock
C
;
ClockInit
(
&
C
);
SetSHWI
();
bwprintf
(
COM2
,
"handler set up
\n\r
"
);
TD
task
;
task
.
TaskID
=
0
;
task
.
TaskState
=
Ready
;
task
.
TaskPriority
=
Prio0
;
task
.
sp
=
(
int
*
)(
0x1e00000
);
task
.
RetVal
=
22
;
task
.
ParentID
=
0
;
void
*
func
=
(
void
*
)
&
GenHWI
;
task
.
lr
=
(
int
*
)(
func
+
0x218000
);
task
.
spsr
=
0x600000d0
;
int
b
;
int
count
=
0
;
while
(
1
){
kerxit
(
&
task
);
register
int
a
asm
(
"r0"
);
b
=
a
;
if
(
b
==
0
)
break
;
if
(
b
==
100
){
count
++
;
bwprintf
(
COM2
,
"Count: %d
\n\r
"
);
if
(
Count
>=
100
)
break
;
}
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