tools.h
1.87 KB
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
86
87
#ifndef _TOOLS_H_
#define _TOOLS_H_
//#include "datadef.h"
//void delay(WORD num);
void dword_endian_convertion (unsigned long *l);
void word_endian_convertion (U16 *w);
U32 dword_endian_conv (U8 *l);
U16 word_endian_conv (U8 *w);
void oem_to_unicode (U8 *oem_buf, U16 *unicode_buf);
void oem_to_n_unicode (U8 *oem_buf, U16 *unicode_buf, U16 n);
void convert_unicode_to_normal (U16 *buf);
void convert_European_to_English(U16 * buf, I16 wlen);
U8 convert_int2str(U32 number, U8 *buf);
void itoa( U16 val, U8 *string );
void _unicode_to_oem (U16 *buf, U8 *d);
/*sample rate conversion*/
long sacro (long, long *, long *, long);
void random_set_seed (U16 seed);
void random_set_base (U16 base);
U16 random (void);
U16 random_track (U16 max_track);
void random_start (U16 s);
#define Interrupt_Disable asm (" move sr,d0"); \
asm (" ori.l #0x0700,d0"); \
asm (" move d0,sr")
#define Interrupt_Enable asm (" move sr,d0"); \
asm (" andi.l #0xf8ff,d0"); \
asm (" move d0,sr")
extern const U16 Russian_Uni_2_OEM_table[][3];
#ifndef max
#define max(a,b) (a>b? a : b)
#endif
#ifndef min
#define min(a,b) (a<b? a : b)
#endif
#ifndef NELEMS
#define NELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
#endif
#ifndef Asc2Hex
#define Asc2Hex(n) (((n) >= 'A') ? ((n) + 10 - 'A') : ((n) - '0'))
#endif
#ifndef Hex2Asc
#define Hex2Asc(n) ((BYTE) (((n) > 9) ? ((n) - 10 + 'A') : ((n) + '0')))
#endif
#define ABS_DIFF(a,b) ((a)>(b)? ((a)-(b)) :(( b) - (a)) )
#ifndef ABS
#define ABS(x) ((x)<0)?(0-(x)) : (x)
#endif
U32 U32_endian_buf(U8 *buf);
U16 U16_endian_buf(U8 *buf);
void unicode_to_English_oem( U16 *lfn_name, U16 n, U8 *oem_name);
void unicode_to_English_oem_n( U16 *lfn_name, U8 *oem_name, U16 n);
void endian_convert_u16_from_big_to_little(U16 *buf, U16 len);
void dump_init(U8 *p);
void dump_write(U8 *buf,U32 len);
U32 get_dump_size(void);
#endif //_TOOLS_H_