os-workshop

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

debug-printf.c (440B)


      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 xprintf(const char* fmt, ...) {
     10 	char msg[128];
     11 	va_list ap;
     12 	va_start(ap, fmt);
     13 	vsnprintf(msg, sizeof(msg), fmt, ap);
     14 	va_end(ap);
     15 	xputs(msg);
     16 }
     17 
     18 void vxprintf(const char* fmt, va_list ap) {
     19 	char msg[128];
     20 	vsnprintf(msg, sizeof(msg), fmt, ap);
     21 	xputs(msg);
     22 }
     23