mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2024-10-01 01:45:38 -04:00
ccc3b16569
Introduce memcpy_s() and wordcpy_s() that takes the destination buffer size as an argument. Use assert() which aborts our program to an eternal loop if we hit problems. Sprinkle asserts elsewhere as well. Signed-off-by: Daniel Lublin <daniel@lublin.se>
23 lines
562 B
C
23 lines
562 B
C
/*
|
|
* Copyright (C) 2022 - Tillitis AB
|
|
* SPDX-License-Identifier: GPL-2.0-only
|
|
*/
|
|
|
|
#ifndef LIB_H
|
|
#define LIB_H
|
|
|
|
#include "types.h"
|
|
|
|
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);
|
|
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);
|
|
int memeq(void *dest, const void *src, unsigned n);
|
|
|
|
#endif
|