XenevaOS
Loading...
Searching...
No Matches
util.h
Go to the documentation of this file.
1//
2// util.h
3//
4// USPi - An USB driver for Raspberry Pi written in C
5// Copyright (C) 2014 R. Stange <rsta2@o2online.de>
6//
7// This program is free software: you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program. If not, see <http://www.gnu.org/licenses/>.
19//
20#ifndef _uspi_util_h
21#define _uspi_util_h
22
23#include "uspios.h"
24#include "uspi/types.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#ifdef USPI_PROVIDE_MEM_FUNCTIONS
31 #define memset uspi_memset
32 #define memcpy uspi_memcpy
33 #define memcmp uspi_memcmp
34#endif
35
36#ifdef USPI_PROVIDE_STR_FUNCTIONS
37 #define strlen uspi_strlen
38 #define strcmp uspi_strcmp
39 #define strcpy uspi_strcpy
40 #define strncpy uspi_strncpy
41 #define strcat uspi_strcat
42#endif
43
44void *memset (void *pBuffer, int nValue, size_t nLength);
45
46void *memcpy (void *pDest, const void *pSrc, size_t nLength);
47
48int memcmp (const void *pBuffer1, const void *pBuffer2, size_t nLength);
49
50size_t strlen (const char *pString);
51
52int strcmp (const char *pString1, const char *pString2);
53
54char *strcpy (char *pDest, const char *pSrc);
55
56char *strncpy (char *pDest, const char *pSrc, size_t nMaxLen);
57
58char *strcat (char *pDest, const char *pSrc);
59
60int uspi_char2int (char chValue); // with sign extension
61
62u16 uspi_le2be16 (u16 usValue);
63
64u32 uspi_le2be32 (u32 ulValue);
65
66#ifdef __cplusplus
67}
68#endif
69
70#endif
uint16_t u16
Definition kernel.h:21
uint32_t u32
Definition kernel.h:22
u16 uspi_le2be16(u16 usValue)
Definition util.c:188
void * memset(void *pBuffer, int nValue, size_t nLength)
char * strcat(char *pDest, const char *pSrc)
Definition utclib.c:678
char * strcpy(char *pDest, const char *pSrc)
Definition utclib.c:498
char * strncpy(char *pDest, const char *pSrc, size_t nMaxLen)
Definition string.cpp:115
int uspi_char2int(char chValue)
Definition util.c:176
int memcmp(const void *pBuffer1, const void *pBuffer2, size_t nLength)
Definition string.cpp:47
size_t strlen(const char *pString)
Definition utclib.c:379
u32 uspi_le2be32(u32 ulValue)
Definition util.c:194
int strcmp(const char *pString1, const char *pString2)
Definition utclib.c:579
void * memcpy(void *pDest, const void *pSrc, size_t nLength)