Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
ch32v003fun
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
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
Andreas Horn
ch32v003fun
Commits
157f092e
Commit
157f092e
authored
1 year ago
by
CNLohr
Browse files
Options
Downloads
Patches
Plain Diff
Fix #255 - Force the DMDATA0 to 0x00 after successfully reading data out in a poll.
parent
0c138b89
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
ch32v003fun/ch32v003fun.c
+6
-9
6 additions, 9 deletions
ch32v003fun/ch32v003fun.c
with
6 additions
and
9 deletions
ch32v003fun/ch32v003fun.c
+
6
−
9
View file @
157f092e
...
...
@@ -895,7 +895,7 @@ int putchar(int c)
void
handle_debug_input
(
int
numbytes
,
uint8_t
*
data
)
__attribute__
((
weak
));
void
handle_debug_input
(
int
numbytes
,
uint8_t
*
data
)
{
}
static
void
internal_handle_input
(
uint32_t
*
dmdata0
)
static
void
internal_handle_input
(
volatile
uint32_t
*
dmdata0
)
{
uint32_t
dmd0
=
*
dmdata0
;
int
bytes
=
(
dmd0
&
0x3f
)
-
4
;
...
...
@@ -908,11 +908,12 @@ static void internal_handle_input( uint32_t * dmdata0 )
void
poll_input
()
{
uint32_t
lastdmd
=
(
*
DMDATA0
)
;
if
(
!
(
lastdmd
&
0x80
)
)
volatile
uint32_t
*
dmdata0
=
(
volatile
uint32_t
*
)
DMDATA0
;
if
(
((
*
dmdata0
)
&
0x80
)
==
0
)
{
internal_handle_input
(
(
uint32_t
*
)
DMDATA0
);
*
DMDATA0
=
0x84
;
// Negative
internal_handle_input
(
dmdata0
);
// Should be 0x80 or so, but for some reason there's a bug that retriggers.
*
dmdata0
=
0x00
;
}
}
...
...
@@ -980,10 +981,6 @@ int putchar(int c)
if
(
timeout
--
==
0
)
return
0
;
// Simply seeking input.
lastdmd
=
(
*
DMDATA0
);
if
(
lastdmd
)
internal_handle_input
(
(
uint32_t
*
)
DMDATA0
);
while
(
(
lastdmd
=
(
*
DMDATA0
))
&
0x80
)
if
(
timeout
--
==
0
)
return
0
;
if
(
lastdmd
)
internal_handle_input
(
(
uint32_t
*
)
DMDATA0
);
*
DMDATA0
=
0x85
|
((
const
char
)
c
<<
8
);
return
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