mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2024-12-24 23:19:32 -05:00
fw: Hide HTIF functions better when using NOCONSOLE
We define macros for them that expand to nothing or to a constant to avoid any extra function calls to dummy functions when running on real hardware with no console. Signed-off-by: Daniel Lublin <daniel@lublin.se>
This commit is contained in:
parent
3a7ec9b9a0
commit
cc032d9883
@ -7,33 +7,7 @@
|
||||
#include "assert.h"
|
||||
#include "types.h"
|
||||
|
||||
#if NOCONSOLE
|
||||
void htif_putc(int ch)
|
||||
{
|
||||
}
|
||||
|
||||
void htif_lf()
|
||||
{
|
||||
}
|
||||
|
||||
void htif_puthex(uint8_t c)
|
||||
{
|
||||
}
|
||||
|
||||
void htif_putinthex(const uint32_t n)
|
||||
{
|
||||
}
|
||||
|
||||
int htif_puts(const char *s)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void htif_hexdump(uint8_t *buf, int len)
|
||||
{
|
||||
}
|
||||
|
||||
#else
|
||||
#ifndef NOCONSOLE
|
||||
struct {
|
||||
uint32_t arr[2];
|
||||
} volatile tohost __attribute__((section(".htif")));
|
||||
|
@ -8,12 +8,22 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef NOCONSOLE
|
||||
#define htif_putc(ch)
|
||||
#define htif_lf()
|
||||
#define htif_puthex(c)
|
||||
#define htif_putinthex(n)
|
||||
#define htif_puts(s) ((int)0)
|
||||
#define htif_hexdump(buf, len)
|
||||
#else
|
||||
void htif_putc(int ch);
|
||||
void htif_lf();
|
||||
void htif_puthex(uint8_t c);
|
||||
void htif_putinthex(const uint32_t n);
|
||||
int htif_puts(const char *s);
|
||||
void htif_hexdump(uint8_t *buf, int len);
|
||||
#endif
|
||||
|
||||
void *memset(void *dest, int c, unsigned n);
|
||||
void memcpy_s(void *dest, size_t destsize, const void *src, size_t n);
|
||||
void wordcpy_s(void *dest, size_t destsize, const void *src, size_t n);
|
||||
|
Loading…
Reference in New Issue
Block a user