os-workshop

same materials and sample source for RV32 OS projects
git clone http://frotz.net/git/os-workshop.git
Log | Files | Refs

debug-io.c (425B)


      1 // Copyright 2022, Brian Swetland <swetland@frotz.net>
      2 // Licensed under the Apache License, Version 2.0.
      3 
      4 #include <stdio.h>
      5 #include <stdarg.h>
      6 
      7 #include <hw/debug.h>
      8 
      9 void xputs(const char* s) {
     10 	while (*s != 0) {
     11 		xputc(*s++);
     12 	}
     13 }
     14 
     15 int xgetc(void) {
     16 	return -1;
     17 }
     18 
     19 void xprintf(const char* fmt, ...) {
     20 	char msg[128];
     21 	va_list ap;
     22 	va_start(ap, fmt);
     23 	vsnprintf(msg, sizeof(msg), fmt, ap);
     24 	va_end(ap);
     25 	xputs(msg);
     26 }
     27