-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.H
executable file
·88 lines (61 loc) · 2.32 KB
/
utils.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
File : utils.H
Author : Riccardo Bettati
Modified : 09/02/12
Description : Various definitions (NULL/BOOL/TRUE/FALSE) and
utility functions (e.g. abort, memory and
string functions).
*/
#ifndef _utils_h_
#define _utils_h_
/*---------------------------------------------------------------*/
/* GENERAL CONSTANTS */
/*---------------------------------------------------------------*/
#ifndef NULL
# define NULL 0
#endif
#ifdef BOOLEAN
# undef BOOLEAN
#endif
#define BOOLEAN int
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
/*---------------------------------------------------------------*/
/* ABORT */
/*---------------------------------------------------------------*/
void abort();
/* Stop execution. */
/*---------------------------------------------------------------*/
/* SIMPLE MEMORY OPERATIONS */
/*---------------------------------------------------------------*/
void *memcpy(void *dest, const void *src, int count);
/* Copy _count bytes from _src to _dest. (No check for uverlapping) */
void *memset(void *dest, char val, int count);
/* Set _count bytes to value _val, starting from location _dest. */
unsigned short *memsetw(unsigned short *dest, unsigned short val, int count);
/* Same as above, but operations are 16-bit wide. */
/*---------------------------------------------------------------*/
/* SIMPLE STRING OPERATIONS (STRINGS ARE NULL-TERMINATED) */
/*---------------------------------------------------------------*/
int strlen(const char * _str);
/* Determine the length of null-terminated string. */
void strcpy(char * _dst, char * _src);
/* Copy null-terminated string from _src to _dst. */
void int2str(int _num, char * _str);
/* Convert int to null-terminated string. */
void uint2str(unsigned int _num, char * _str);
/* Convert unsigned int to null-terminated string. */
/*---------------------------------------------------------------*/
/* PORT I/O OPERATIONS */
/*---------------------------------------------------------------*/
char inportb (unsigned short _port);
unsigned short inportw (unsigned short _port);
/* Read data from input port _port.*/
void outportb (unsigned short _port, char _data);
void outportw (unsigned short _port, unsigned short _data);
/* Write _data to output port _port.*/
#endif