Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
triazo
/
kernel
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
3
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5113d83c
authored
Nov 02, 2015
by
triazo
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Give printing functions to half word, byte
parent
3e410fcd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
src/serial.c
src/serial.h
src/serial.c
View file @
5113d83c
...
@@ -39,6 +39,22 @@ void serial_writestring(char* s)
...
@@ -39,6 +39,22 @@ void serial_writestring(char* s)
}
}
const
char
*
hexchars
=
"0123456789abcdef"
;
const
char
*
hexchars
=
"0123456789abcdef"
;
void
serial_hexbyte
(
uint8_t
x
)
{
for
(
int
i
=
1
;
i
>=
0
;
i
--
)
{
serial_writechar
(
hexchars
[
x
>>
i
*
4
&
0xf
]);
}
}
void
serial_hexhword
(
uint16_t
x
)
{
for
(
int
i
=
3
;
i
>=
0
;
i
--
)
{
serial_writechar
(
hexchars
[
x
>>
i
*
4
&
0xf
]);
}
}
void
serial_hexword
(
uint32_t
x
)
void
serial_hexword
(
uint32_t
x
)
{
{
for
(
int
i
=
7
;
i
>=
0
;
i
--
)
for
(
int
i
=
7
;
i
>=
0
;
i
--
)
...
...
src/serial.h
View file @
5113d83c
...
@@ -21,6 +21,8 @@ void serial_writechar(char a);
...
@@ -21,6 +21,8 @@ void serial_writechar(char a);
void
serial_writestring
(
char
*
s
);
void
serial_writestring
(
char
*
s
);
// Function to write a 4 byte word toserial in hex
// Function to write a 4 byte word toserial in hex
void
serial_hexbyte
(
uint8_t
x
);
void
serial_hexhword
(
uint16_t
x
);
void
serial_hexword
(
uint32_t
x
);
void
serial_hexword
(
uint32_t
x
);
void
serial_hexqword
(
uint64_t
x
);
void
serial_hexqword
(
uint64_t
x
);
void
serial_hexstring
(
void
*
s
,
uint32_t
n
);
void
serial_hexstring
(
void
*
s
,
uint32_t
n
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment