NEORV32 Software Framework Documentation
The NEORV32 RISC-V Processor
Loading...
Searching...
No Matches
neorv32_aux.h File Reference

General auxiliary functions header file. More...

#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  date_t
 

Macros

Select minimum/maximum
#define neorv32_aux_min(a, b)
 
#define neorv32_aux_max(a, b)
 

Functions

AUX prototypes
uint64_t neorv32_aux_date2unixtime (date_t *date)
 
void neorv32_aux_unixtime2date (uint64_t unixtime, date_t *date)
 
uint64_t neorv32_aux_hexstr2uint64 (char *buffer, unsigned int length)
 
uint32_t neorv32_aux_xorshift32 (void)
 
void neorv32_aux_itoa (char *buffer, uint32_t num, uint32_t base)
 

Detailed Description

General auxiliary functions header file.

See also
https://stnolting.github.io/neorv32/sw/files.html

Macro Definition Documentation

◆ neorv32_aux_max

#define neorv32_aux_max ( a,
b )
Value:
({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a > _b ? _a : _b; })

◆ neorv32_aux_min

#define neorv32_aux_min ( a,
b )
Value:
({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })

Function Documentation

◆ neorv32_aux_date2unixtime()

uint64_t neorv32_aux_date2unixtime ( date_t * date)

Convert date to Unix time stamp.

Parameters
[in]datePointer to date and time struct (date_t).
Returns
Unix time since 00:00:00 UTC, January 1, 1970 in seconds.

◆ neorv32_aux_hexstr2uint64()

uint64_t neorv32_aux_hexstr2uint64 ( char * buffer,
unsigned int length )

Helper function to convert up to 16 hex chars string into uint64_t

Parameters
[in,out]bufferPointer to array of chars to convert into number.
[in]lengthLength of the conversion string.
Returns
Converted number (uint64_t).

◆ neorv32_aux_itoa()

void neorv32_aux_itoa ( char * buffer,
uint32_t num,
uint32_t base )

Simplified version of "itoa": convert number to string.

Parameters
[in,out]bufferPointer to array for the result string [33 chars].
[in]numNumber to convert.
[in]baseBase of number representation (2..16).

◆ neorv32_aux_unixtime2date()

void neorv32_aux_unixtime2date ( uint64_t unixtime,
date_t * date )

Convert Unix time stamp to date.

Parameters
[in]unixtimeUnix time since 00:00:00 UTC, January 1, 1970 in seconds.
[in,out]datePointer to date and time struct (date_t).

◆ neorv32_aux_xorshift32()

uint32_t neorv32_aux_xorshift32 ( void )

XORSHIFT pseudo random number generator.

Returns
Random number (uint32_t).