NEORV32 Software Framework Documentation
The NEORV32 RISC-V Processor
Loading...
Searching...
No Matches
neorv32_aux.h
Go to the documentation of this file.
1// ================================================================================ //
2// The NEORV32 RISC-V Processor - https://github.com/stnolting/neorv32 //
3// Copyright (c) NEORV32 contributors. //
4// Copyright (c) 2020 - 2024 Stephan Nolting. All rights reserved. //
5// Licensed under the BSD-3-Clause license, see LICENSE for details. //
6// SPDX-License-Identifier: BSD-3-Clause //
7// ================================================================================ //
8
15#ifndef neorv32_aux_h
16#define neorv32_aux_h
17
18#include <stdint.h>
19
20
21/**********************************************************************/
25#define neorv32_aux_min(a, b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
26#define neorv32_aux_max(a, b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a > _b ? _a : _b; })
30/**********************************************************************/
33typedef struct {
34 uint16_t year;
35 uint8_t month;
36 uint8_t day;
37 uint8_t weekday;
38 uint8_t hours;
39 uint8_t minutes;
40 uint8_t seconds;
41} date_t;
42
43
44/**********************************************************************/
48uint64_t neorv32_aux_date2unixtime(date_t* date);
49void neorv32_aux_unixtime2date(uint64_t unixtime, date_t* date);
50uint64_t neorv32_aux_hexstr2uint64(char *buffer, unsigned int length);
51uint32_t neorv32_aux_xorshift32(void);
52void neorv32_aux_itoa(char *buffer, uint32_t num, uint32_t base);
56#endif // neorv32_aux_h
uint64_t neorv32_aux_hexstr2uint64(char *buffer, unsigned int length)
Definition neorv32_aux.c:151
void neorv32_aux_unixtime2date(uint64_t unixtime, date_t *date)
Definition neorv32_aux.c:85
uint64_t neorv32_aux_date2unixtime(date_t *date)
Definition neorv32_aux.c:28
void neorv32_aux_itoa(char *buffer, uint32_t num, uint32_t base)
Definition neorv32_aux.c:214
uint32_t neorv32_aux_xorshift32(void)
Definition neorv32_aux.c:195
Definition neorv32_aux.h:33
uint8_t seconds
Definition neorv32_aux.h:40
uint8_t month
Definition neorv32_aux.h:35
uint8_t minutes
Definition neorv32_aux.h:39
uint8_t hours
Definition neorv32_aux.h:38
uint8_t weekday
Definition neorv32_aux.h:37
uint8_t day
Definition neorv32_aux.h:36
uint16_t year
Definition neorv32_aux.h:34