You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.5 KiB

/*
* Copyright (c) Hisilicon Technologies Co., Ltd. 2014-2020. All rights reserved.
* Description: stdio
* Author: SmartMedia_BSP
* Create: 2014-06-04
*/
#ifndef STDIOH
#define STDIOH
#include <platform.h>
#include <stddef.h>
#ifdef CONFIG_PRINT
extern int printf(const char *cfmt, ...);
extern int getchar(void);
extern int getc(void);
extern void putchar(unsigned int c);
extern void putc(unsigned int c);
extern int tstchar(void);
extern int isbreak(void);
extern int puts(const char *s);
# include <early_uart.h>
# define early_printf(_cfmt, args...) uart_early_printf(_cfmt, ##args)
# define early_puts(_ss) uart_early_puts(_ss)
#else
/* getchar/putchar/tstchar is need for bootstrap */
extern int getchar(void);
extern void putchar(unsigned int c);
extern int tstchar(void);
# define printf(_cfmt, ...)
# define getc()
# define putc(_c)
# define puts(_s)
# define isbreak() 0
# define early_printf(_cfmt, args...)
# define early_puts(_ss)
# define uart_early_puts(ss)
# define uart_early_put_hex(hex)
# define uart_early_putc(chr)
#endif
#ifdef CONFIG_SUPPORT_TOOLPLATFORM
extern int printf_to_toolplatform(const char *cfmt, ...);
/* printf message for tool */
#define PR_TOOL printf_to_toolplatform
#else
#define PR_TOOL
#endif
char *u64tohstr(const uint64 size, char *unit);
char *u32tohstr(const uint32 size, char *unit);
char *u32tohhstr(uint32 size);
char *u64tohhstr(uint64 size);
char *ultohstr(unsigned long long size);
#endif /* STDIOH */