Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
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
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
cm-projects
RIOT
Commits
a860087f
Commit
a860087f
authored
11 years ago
by
Ludwig Knüpfer
Browse files
Options
Downloads
Patches
Plain Diff
native board uart0 import
parent
cbe8feb3
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
native/board_init.c
+3
-0
3 additions, 0 deletions
native/board_init.c
native/include/board.h
+5
-0
5 additions, 0 deletions
native/include/board.h
native/native-uart0.c
+44
-0
44 additions, 0 deletions
native/native-uart0.c
with
52 additions
and
0 deletions
native/board_init.c
+
3
−
0
View file @
a860087f
...
...
@@ -21,6 +21,9 @@
*/
void
board_init
()
{
#ifdef MODULE_UART0
_native_init_uart0
();
#endif
LED_GREEN_OFF
();
LED_RED_ON
();
puts
(
"RIOT native board initialized."
);
...
...
This diff is collapsed.
Click to expand it.
native/include/board.h
+
5
−
0
View file @
a860087f
...
...
@@ -22,3 +22,8 @@ void LED_RED_OFF(void);
void
LED_RED_ON
(
void
);
void
LED_RED_TOGGLE
(
void
);
#ifdef MODULE_UART0
#include
<sys/select.h>
extern
fd_set
_native_uart_rfds
;
extern
void
_native_handle_uart0_input
(
void
);
#endif
This diff is collapsed.
Click to expand it.
native/native-uart0.c
0 → 100644
+
44
−
0
View file @
a860087f
#include
<err.h>
#include
<stdio.h>
#include
<unistd.h>
#include
<sys/select.h>
#include
"cpu.h"
#include
"debug.h"
#include
"board_uart0.h"
fd_set
_native_uart_rfds
;
static
inline
int
uart0_puts
(
char
*
astring
,
int
length
)
{
return
puts
(
astring
);
}
void
_native_handle_uart0_input
()
{
char
buf
[
42
];
int
nread
;
_native_in_syscall
=
0
;
_native_in_isr
=
1
;
nread
=
read
(
0
,
buf
,
sizeof
(
buf
));
if
(
nread
==
-
1
)
{
err
(
1
,
"_native_handle_uart0_input(): read()"
);
}
for
(
int
pos
=
0
;
pos
<
nread
;
pos
++
)
{
uart0_handle_incoming
(
buf
[
pos
]);
}
uart0_notify_thread
();
_native_in_isr
=
0
;
cpu_switch_context_exit
();
}
void
_native_init_uart0
()
{
/* Watch stdin (fd 0) to see when it has input. */
FD_ZERO
(
&
_native_uart_rfds
);
FD_SET
(
0
,
&
_native_uart_rfds
);
puts
(
"RIOT native uart0 initialized."
);
}
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