Skip to content

Commit

Permalink
Remove libc dependency (sio_printf)
Browse files Browse the repository at this point in the history
sio_printf (from libkernel) depends on vsnprintf (libc). But we must be
able to use libkernel without libc.
  • Loading branch information
rickgaiser committed Jan 4, 2021
1 parent 5cf101e commit a744144
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 25 deletions.
4 changes: 1 addition & 3 deletions common/sbus/src/sif2cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ This file contains all common code for both EE and IOP SIF management.
#define SIF2_XFER_RECV (0)
#define SIF2_XFER_SEND (1)

extern int sio_printf(const char *format, ...);

static u32 _sif2_req_type = 0;
static u32 _sif2_req_addr = 0;
static u32 _sif2_req_size = 0;
Expand Down Expand Up @@ -107,7 +105,7 @@ void _sif2_irq_exec(void)
else
{
#ifdef _EE
sio_printf("unknown command: %d!\n", cid);
//printf("unknown command: %d!\n", cid);
#endif
}
}
Expand Down
2 changes: 1 addition & 1 deletion ee/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ GLUE_OBJS += SyncDCache.o iSyncDCache.o InvalidDCache.o iInvalidDCache.o
### SIO objects

SIO_OBJS = sio_init.o sio_putc.o sio_getc.o sio_write.o sio_read.o sio_puts.o \
sio_gets.o sio_getc_block.o sio_flush.o sio_putsn.o sio_printf.o
sio_gets.o sio_getc_block.o sio_flush.o sio_putsn.o

### Config objects

Expand Down
3 changes: 0 additions & 3 deletions ee/kernel/include/sio.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ char *sio_gets(char *str);
/** Flushes the input buffer. */
void sio_flush(void);

/** standard printf function to sio */
int sio_printf(const char *format, ...);

#ifdef __cplusplus
}
#endif
Expand Down
18 changes: 0 additions & 18 deletions ee/kernel/src/sio.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,21 +185,3 @@ void sio_flush()
_lb(SIO_RXFIFO);
}
#endif

#ifdef F_sio_printf
#define SIO_PRINTF_STR_MAX 4096
int sio_printf(const char *format, ...)
{
static char buf[SIO_PRINTF_STR_MAX];
va_list args;
int size;

va_start(args, format);
size = vsnprintf(buf, PS2LIB_STR_MAX, format, args);
va_end(args);

sio_write(buf, size);

return size;
}
#endif

0 comments on commit a744144

Please sign in to comment.