FreeRTOS port on GAP8/RISC-V
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
test Namespace Reference

Data Structures

struct  out_fct_wrap_type
 

Typedefs

typedef void(* out_fct_type )(char character, void *buffer, size_t idx, size_t maxlen)
 

Functions

void __io_lock ()
 
void __io_unlock ()
 
void _putchar (char character)
 
int printf_ (const char *format,...)
 
int sprintf_ (char *buffer, const char *format,...)
 
int snprintf_ (char *buffer, size_t count, const char *format,...)
 
int vsnprintf_ (char *buffer, size_t count, const char *format, va_list va)
 
int vprintf_ (const char *format, va_list va)
 
int fctprintf (void(*out)(char character, void *arg), void *arg, const char *format,...)
 
static void _out_buffer (char character, void *buffer, size_t idx, size_t maxlen)
 
static void _out_null (char character, void *buffer, size_t idx, size_t maxlen)
 
static void _out_char (char character, void *buffer, size_t idx, size_t maxlen)
 
static void _out_fct (char character, void *buffer, size_t idx, size_t maxlen)
 
static unsigned int _strnlen_s (const char *str, size_t maxsize)
 
static bool _is_digit (char ch)
 
static unsigned int _atoi (const char **str)
 
static size_t _out_rev (out_fct_type out, char *buffer, size_t idx, size_t maxlen, const char *buf, size_t len, unsigned int width, unsigned int flags)
 
static size_t _ntoa_format (out_fct_type out, char *buffer, size_t idx, size_t maxlen, char *buf, size_t len, bool negative, unsigned int base, unsigned int prec, unsigned int width, unsigned int flags)
 
static size_t _ntoa_long (out_fct_type out, char *buffer, size_t idx, size_t maxlen, unsigned long value, bool negative, unsigned long base, unsigned int prec, unsigned int width, unsigned int flags)
 
static size_t _ntoa_long_long (out_fct_type out, char *buffer, size_t idx, size_t maxlen, unsigned long long value, bool negative, unsigned long long base, unsigned int prec, unsigned int width, unsigned int flags)
 
static size_t _etoa (out_fct_type out, char *buffer, size_t idx, size_t maxlen, double value, unsigned int prec, unsigned int width, unsigned int flags)
 
static size_t _ftoa (out_fct_type out, char *buffer, size_t idx, size_t maxlen, double value, unsigned int prec, unsigned int width, unsigned int flags)
 
static int _vsnprintf (out_fct_type out, char *buffer, const size_t maxlen, const char *format, va_list va)
 

Typedef Documentation

typedef void(* test::out_fct_type)(char character, void *buffer, size_t idx, size_t maxlen)

Function Documentation

void test::__io_lock ( )

Lock the printf to avoid collision when multiple threads/cores try to output strings/characters. This function can implement a mutex, semaphore or whatever lock.

Note
PRINTF_ENABLE_LOCK should be defined in order to activate lock function.
void test::__io_unlock ( )

Unlock the printf, release the lock, semaphore or mutex used to lock printf. This function releases the mutex, semaphore or whatever lock used previously.

Note
PRINTF_ENABLE_LOCK should be defined in order to activate unlock function.
static unsigned int test::_atoi ( const char **  str)
static
static size_t test::_etoa ( out_fct_type  out,
char *  buffer,
size_t  idx,
size_t  maxlen,
double  value,
unsigned int  prec,
unsigned int  width,
unsigned int  flags 
)
static
static size_t test::_ftoa ( out_fct_type  out,
char *  buffer,
size_t  idx,
size_t  maxlen,
double  value,
unsigned int  prec,
unsigned int  width,
unsigned int  flags 
)
static
static bool test::_is_digit ( char  ch)
inlinestatic
static size_t test::_ntoa_format ( out_fct_type  out,
char *  buffer,
size_t  idx,
size_t  maxlen,
char *  buf,
size_t  len,
bool  negative,
unsigned int  base,
unsigned int  prec,
unsigned int  width,
unsigned int  flags 
)
static
static size_t test::_ntoa_long ( out_fct_type  out,
char *  buffer,
size_t  idx,
size_t  maxlen,
unsigned long  value,
bool  negative,
unsigned long  base,
unsigned int  prec,
unsigned int  width,
unsigned int  flags 
)
static
static size_t test::_ntoa_long_long ( out_fct_type  out,
char *  buffer,
size_t  idx,
size_t  maxlen,
unsigned long long  value,
bool  negative,
unsigned long long  base,
unsigned int  prec,
unsigned int  width,
unsigned int  flags 
)
static
static void test::_out_buffer ( char  character,
void *  buffer,
size_t  idx,
size_t  maxlen 
)
inlinestatic
static void test::_out_char ( char  character,
void *  buffer,
size_t  idx,
size_t  maxlen 
)
inlinestatic
static void test::_out_fct ( char  character,
void *  buffer,
size_t  idx,
size_t  maxlen 
)
inlinestatic
static void test::_out_null ( char  character,
void *  buffer,
size_t  idx,
size_t  maxlen 
)
inlinestatic
static size_t test::_out_rev ( out_fct_type  out,
char *  buffer,
size_t  idx,
size_t  maxlen,
const char *  buf,
size_t  len,
unsigned int  width,
unsigned int  flags 
)
static
void test::_putchar ( char  character)

Output a character to a custom device like UART, used by the printf() function This function is declared here only. You have to write your custom implementation somewhere

Parameters
characterCharacter to output

References printf_buffer, printf_idx, and tfp_putc().

Referenced by _out_char().

static unsigned int test::_strnlen_s ( const char *  str,
size_t  maxsize 
)
inlinestatic
static int test::_vsnprintf ( out_fct_type  out,
char *  buffer,
const size_t  maxlen,
const char *  format,
va_list  va 
)
static
int test::fctprintf ( void(*)(char character, void *arg)  out,
void *  arg,
const char *  format,
  ... 
)

printf with output function You may use this as dynamic alternative to printf() with its fixed _putchar() output

Parameters
outAn output function which takes one character and an argument pointer
argAn argument pointer for user data passed to output function
formatA string that specifies the format of the output
Returns
The number of characters that are sent to the output function, not counting the terminating null character

References _out_fct(), and _vsnprintf().

Referenced by TEST_CASE().

int test::printf_ ( const char *  format,
  ... 
)
int test::snprintf_ ( char *  buffer,
size_t  count,
const char *  format,
  ... 
)

References _out_buffer(), and _vsnprintf().

int test::sprintf_ ( char *  buffer,
const char *  format,
  ... 
)

References _out_buffer(), and _vsnprintf().

int test::vprintf_ ( const char *  format,
va_list  va 
)

References _out_char(), and _vsnprintf().

int test::vsnprintf_ ( char *  buffer,
size_t  count,
const char *  format,
va_list  va 
)

References _out_buffer(), and _vsnprintf().