FreeRTOS port on GAP8/RISC-V
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
printf.h File Reference

Macros

#define printf
 
#define sprintf
 
#define snprintf
 
#define vsnprintf
 
#define vprintf
 
#define _PRINTF_H_
 
#define printf
 
#define sprintf
 
#define snprintf
 
#define vsnprintf
 
#define vprintf
 

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,...)
 

Macro Definition Documentation

#define _PRINTF_H_
#define printf

Tiny printf implementation You have to implement putchar if you use printf() To avoid conflicts with the regular printf() API it is overridden by macro defines and internal underscore-appended functions like printf() are used

Parameters
formatA string that specifies the format of the output
Returns
The number of characters that are written into the array, not counting the terminating null character

Referenced by __malloc_dump(), __os_native_api_mutex_init(), __os_native_api_sem_init(), __os_native_kickoff(), __pi_octospi_ospi_config_set(), __pi_rtc_datetime_check(), __pi_rtc_handler(), __pi_spi_open(), __pi_uart_error_handler(), __pi_xip_open(), __pi_xip_set_page_config(), _isr_default(), helloworld(), main(), pi_fc_l1_malloc_dump(), pi_fll_frequency_set(), pi_l2_malloc(), pi_l2_malloc_dump(), pmp_exception_handler(), pmsis_event_kernel_init(), pmsis_event_kernel_main(), vPrvAssertFailed(), xip_data_exception_handler(), xip_insn_exception_handler(), and xip_irq_handler().

#define printf
#define snprintf
#define snprintf

Tiny snprintf/vsnprintf implementation

Parameters
bufferA pointer to the buffer where to store the formatted string
countThe maximum number of characters to store in the buffer, including a terminating null character
formatA string that specifies the format of the output
vaA value identifying a variable arguments list
Returns
The number of characters that COULD have been written into the buffer, not counting the terminating null character. A value equal or larger than count indicates truncation. Only when the returned value is non-negative and less than count, the string has been completely written.

Referenced by TEST_CASE().

#define sprintf
#define sprintf

Tiny sprintf implementation Due to security reasons (buffer overflow) YOU SHOULD CONSIDER USING (V)SNPRINTF INSTEAD!

Parameters
bufferA pointer to the buffer where to store the formatted string. MUST be big enough to store the output!
formatA string that specifies the format of the output
Returns
The number of characters that are WRITTEN into the buffer, not counting the terminating null character

Referenced by TEST_CASE().

#define vprintf

Tiny vprintf implementation

Parameters
formatA string that specifies the format of the output
vaA value identifying a variable arguments list
Returns
The number of characters that are WRITTEN into the buffer, not counting the terminating null character
#define vprintf

Referenced by vprintf_builder_1().

#define vsnprintf
#define vsnprintf

Function Documentation

void __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.

Referenced by printf_(), and puts().

void __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.

Referenced by printf_(), and puts().

void _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 tfp_putc().

int 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 printf_ ( const char *  format,
  ... 
)
int snprintf_ ( char *  buffer,
size_t  count,
const char *  format,
  ... 
)

References _out_buffer(), and _vsnprintf().

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

References _out_buffer(), and _vsnprintf().

int vprintf_ ( const char *  format,
va_list  va 
)

References _out_char(), and _vsnprintf().

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

References _out_buffer(), and _vsnprintf().