Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RISC-V Lab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue 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
Juan Nicolas Pardo Martin
RISC-V Lab
Commits
f181c361
Commit
f181c361
authored
8 months ago
by
hsu10
Browse files
Options
Downloads
Patches
Plain Diff
gpt version
parent
b736c90b
Branches
xu
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sw/rlight/main.c
+14
-14
14 additions, 14 deletions
src/sw/rlight/main.c
with
14 additions
and
14 deletions
src/sw/rlight/main.c
+
14
−
14
View file @
f181c361
...
...
@@ -3,7 +3,7 @@
#define REGA 0x10000000
#define REGB 0x10000004
#define REGC 0x10000008
static
void
delay_cycles
(
int
n_cycles
)
{
REG32
(
RV_TIMER_CTRL
(
0
))
=
(
1
<<
RV_TIMER_CTRL_ACTIVE0_LSB
);
...
...
@@ -11,20 +11,20 @@ static void delay_cycles(int n_cycles) {
while
(
REG32
(
RV_TIMER_TIMER_V_LOWER0
(
0
))
<
n_cycles
);
}
int
main
(
void
)
{
// Implement tests here.
// Example:
void
test_mode
(
int
mode
,
int
param
,
int
delay
)
{
printf
(
"Testing mode %d with parameter %d
\n
"
,
mode
,
param
);
REG32
(
REGA
)
=
mode
;
// Set mode
REG32
(
REGB
)
=
param
;
// Set parameter N
delay_cycles
(
delay
);
printf
(
"REGC state: 0x%08x
\n
"
,
REG32
(
REGC
));
// Read LED state
}
printf
(
"REGA 0x%08x
\n
"
,
REG32
(
REGA
));
REG32
(
REGA
)
=
0x12345678
;
printf
(
"REGA 0x%08x
\n
"
,
REG32
(
REGA
));
delay_cycles
(
2
);
int
main
(
void
)
{
// Test different modes
test_mode
(
1
,
10
,
50
);
// Mode 1, Parameter N=10, Delay for 50 cycles
test_mode
(
2
,
20
,
100
);
// Mode 2, Parameter N=20, Delay for 100 cycles
test_mode
(
0
,
15
,
75
);
// Ping-Pong Mode, Parameter N=15, Delay for 75 cycles
test_mode
(
3
,
5
,
25
);
// Stop Mode, Parameter N=5, Delay for 25 cycles
REG32
(
REGB
)
=
0xFFFFFF01
;
printf
(
"REGB 0x%08x
\n
"
,
REG32
(
REGB
));
delay_cycles
(
10
);
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