blob: f145c1423bb0aeb21c9a3991f14a328b5974af5b (
plain)
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
32
33
34
35
36
|
#ifndef PCIBX_UTILS_H_
#define PCIBX_UTILS_H_
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#define pcibx_stringify_1(x) #x
#define pcibx_stringify(x) pcibx_stringify_1(x)
#ifdef ATTRIBUTE_FORMAT
# undef ATTRIBUTE_FORMAT
#endif
#ifdef __GNUC__
# define ATTRIBUTE_FORMAT(t, a, b) __attribute__((format(t, a, b)))
#else
# define ATTRIBUTE_FORMAT(t, a, b) /* nothing */
#endif
int prinfo(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
int prerror(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
void internal_error(const char *message);
#define internal_error_on(condition) \
do { \
if (condition) \
internal_error(pcibx_stringify(condition)); \
} while (0)
void * malloce(size_t size);
void * realloce(void *ptr, size_t newsize);
void udelay(unsigned int usecs);
void msleep(unsigned int msecs);
#endif /* PCIBX_UTILS_H_ */
|