Compare commits
2 commits
f5a32db7a3
...
e30cc4c3d0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e30cc4c3d0 | ||
|
|
ee6c75d905 |
1 changed files with 13 additions and 6 deletions
|
|
@ -1,16 +1,23 @@
|
||||||
#include <uart.h>
|
|
||||||
#include <mini-printf.h>
|
#include <mini-printf.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <uart.h>
|
||||||
|
|
||||||
int stdout_puts(char *s, int len, void *unused) {
|
/** Helper routine to put characters into our uart device */
|
||||||
|
static int stdout_puts(char *s, int len, void *unused) {
|
||||||
(void)unused;
|
(void)unused;
|
||||||
// Example: UART write loop
|
for (int i = 0; i < len; i++) uart_putc(s[i]);
|
||||||
for (int i = 0; i < len; i++) {
|
|
||||||
uart_putc(s[i]); // <-- your low-level "put char" routine
|
|
||||||
}
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Printf-like functionality for the kernel.
|
||||||
|
*
|
||||||
|
* %% - print '%',
|
||||||
|
* %c - character,
|
||||||
|
* %s - string,
|
||||||
|
* %d, %u - decimal integer,
|
||||||
|
* %x, %X - hex integer,
|
||||||
|
*/
|
||||||
int kprintf(const char *restrict fmt, ...) {
|
int kprintf(const char *restrict fmt, ...) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue