-
Notifications
You must be signed in to change notification settings - Fork 92
/
edbg.h
32 lines (26 loc) · 1.04 KB
/
edbg.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2013-2022, Alex Taradov <[email protected]>. All rights reserved.
#ifndef _EDBG_H_
#define _EDBG_H_
/*- Includes ----------------------------------------------------------------*/
#include <assert.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdbool.h>
/*- Definitions -------------------------------------------------------------*/
#define ARRAY_SIZE(x) ((int)(sizeof(x) / sizeof(0[x])))
/*- Prototypes --------------------------------------------------------------*/
void verbose(char *fmt, ...);
void message(char *fmt, ...);
void warning(char *fmt, ...);
void check(bool cond, char *fmt, ...);
void error_exit(char *fmt, ...);
void sleep_ms(int ms);
void perror_exit(char *text);
int round_up(int value, int multiple);
void *buf_alloc(int size);
void buf_free(void *buf);
int load_file(char *name, uint8_t *data, int size);
void save_file(char *name, uint8_t *data, int size);
uint8_t *mem_find(uint8_t *haystack, int haystack_size, uint8_t *needle, int needle_size);
#endif // _EDBG_H_