4 * Copyright 2001-2009 Texas Instruments, Inc. - http://www.ti.com/
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 /****************************************************************************/
21 /* MODULE: cu_osapi.h */
24 /****************************************************************************/
28 #include "cu_ostypes.h"
36 #define OSAL_SUCCESS 0
37 #define OSAL_FAILURE 1
38 #define OS_GETINPUTSTRING_CONTINUE TRUE+1
41 #define max(a,b) ((a>b)?a:b)
43 /* replaces IFNAMSIZ in Linux */
44 #define IF_NAME_SIZE 16
47 * TODO : supp declares its OS abstarction with primitive types, so these must
48 * be specifically declared here, and only if they weren't defined before by someone
52 typedef unsigned char u8;
53 typedef unsigned short u16;
54 typedef unsigned long u32;
55 typedef unsigned long long u64;
70 enum { CU_MSG_DEBUG, CU_MSG_INFO1, CU_MSG_WARNING, CU_MSG_ERROR, CU_MSG_INFO2};
72 /****************************************************************************************
74 ****************************************************************************************/
75 PVOID os_MemoryCAlloc(U32 Number, U32 Size);
76 PVOID os_MemoryAlloc(U32 Size);
77 VOID os_MemoryFree(PVOID pMemPtr);
78 PVOID os_memset(PVOID s, U8 c, U32 n);
79 PVOID os_memcpy(PVOID dest, const PVOID src, U32 n);
80 S32 os_memcmp(const PVOID s1, const PVOID s2, S32 n);
82 /****************************************************************************************
84 ****************************************************************************************/
85 PVOID os_fopen (const PS8 path, os_fopen_mode_e mode);
86 S32 os_fclose (PVOID stream);
87 S32 os_getFileSize (PVOID file);
88 PS8 os_fgets (PS8 s, S32 size, PVOID stream);
89 S32 os_fread (PVOID ptr, S32 size, S32 nmemb, PVOID stream);
90 S32 os_fwrite (PVOID ptr, S32 size, S32 nmemb, PVOID stream);
92 /****************************************************************************************
94 ****************************************************************************************/
95 PS8 os_strcpy(PS8 dest, const PS8 src);
96 PS8 os_strncpy(PS8 dest, const PS8 src, S32 n);
97 S32 os_strcmp(const PS8 s1, const PS8 s2);
98 S32 os_strncmp(const PS8 s1, const PS8 s2, U32 n);
99 S32 os_sscanf(const PS8 str, const PS8 format, ...);
100 S32 os_sprintf(PS8 str, const PS8 format, ...);
101 PS8 os_strcat(PS8 dest, const PS8 src);
102 U32 os_strlen(const PS8 s);
103 PS8 os_strchr(const PS8 s, S32 c);
104 S32 os_strtol(const PS8 nptr, PPS8 endptr, S32 base);
105 U32 os_strtoul(const PS8 nptr, PPS8 endptr, S32 base);
106 S32 os_tolower(S32 c);
107 S32 os_isupper(S32 c);
108 S32 os_toupper(S32 c);
109 S32 os_atoi(const PS8 str);
111 /****************************************************************************************
113 ****************************************************************************************/
114 S32 os_Printf(const PS8 buffer);
115 VOID os_error_printf(S32 debug_level, const PS8 arg_list ,...);
117 /****************************************************************************************
118 * Miscelanous OS API *
119 ****************************************************************************************/
120 S32 os_getInputString(PS8 inbuf, S32 len);
121 VOID os_Catch_CtrlC_Signal(PVOID SignalCB);
123 VOID os_OsSpecificCmdParams(S32 argc, PS8* argv);
124 VOID os_InitOsSpecificModules(VOID);
125 VOID os_DeInitOsSpecificModules(VOID);
126 TI_SIZE_T os_get_last_error(VOID);
128 #endif /* _CUOSAPI_H_ */