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
|
/*
* Copyright c Realtek Semiconductor Corporation, 2002
* All rights reserved.
*
* Program : Header File for RTL utilities
* Abstract :
* Author :
* $Id: rtl_utils.h,v 1.1.1.1 2007-11-12 13:27:50 alva_zhang Exp $
*/
#ifndef __RTL_UTILS_H__
#define __RTL_UTILS_H__
#include "rtl_types.h"
void __strlowerncpy(char *dst, const char *src, int32 len);
int8 *_strncpy(int8 *dst0, const int8 *src0, int32 count);
int _strncasecmp(const char *s1, const char *s2, unsigned int n);
int32 _strncmp(const int8 *s1, const int8 *s2, int32 n);
void rtl8651_memcpy(void *dst,void*src,int32 len);
int32 isPowerOf2(uint32 number, uint32 *exponent);
int32 IpStrToAscii(const int8 *cp, uint32 *addr);
void IntToAscii(int32 n, int8 s[]);
int AsciiToInt( char **s);
uint8 charToInt(char c);
int32 ether_aton_r(int8 *a, ether_addr_t *eth);
int32 ether_ntoa_r(ether_addr_t *n, uint8 *a);
int8 *inet_ntoa_r(ipaddr_t ipaddr, int8 *p);
void memDump (void *start, uint32 size, int8 * strHeader);
int32 memComp( void* _p1, void *_p2, int32 len, uint8* strHeader );
uint8* strtomac(ether_addr_t *mac, int8 *str);
#define PROFILING_START(x) do{}while(0)
#define PROFILING_END(x) do{}while(0)
/*===================================================================
* ONE's COMPLEMENT OPERATION
* All the operands and return value are 'host-order'.
* Please notice the endian problem.
*===================================================================*/
/* One's Complement ADD */
inline static uint16 OCADD( uint16 a, uint16 b )
{
uint32 t; /* temp */
t = ((a)&0xffff)+((b)&0xffff);
t = (t&0xffff)+(t>>16);
return (uint16)t;
}
/* One's Complement NEGtive */
inline static uint16 OCNEG( uint16 a )
{
return (~a)&0xffff;
}
/* One's Complement SUBtract */
inline static uint16 OCSUB( uint16 a, uint16 b )
{
return OCADD( a, OCNEG(b) );
}
ipaddr_t convPrefix(int prefixLen);
#if defined(RTL8389_MODEL_USER)
/* User mode, compiler use STDINC, said that, bezro is defined. */
#else
/* Not user mode, we need define. */
#ifndef bzero
#define bzero( p, s ) memset( p, 0, s )
#endif
#endif
#endif /* __RTL_UTILS_H__ */
|