Xenomai  3.1
errnoLib.h
1 /*
2  * Copyright (C) 2008 Philippe Gerum <rpm@xenomai.org>.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13 
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17  *
18  * This file satisfies the references within the emulator code
19  * mimicking a VxWorks-like API built upon the copperplate library.
20  *
21  * VxWorks is a registered trademark of Wind River Systems, Inc.
22  */
23 
24 #ifndef _XENOMAI_VXWORKS_ERRNOLIB_H
25 #define _XENOMAI_VXWORKS_ERRNOLIB_H
26 
27 #include <errno.h>
28 #include <vxworks/taskLib.h>
29 
30 #define OK 0
31 #define ERROR (-1)
32 
33 #define WIND_TASK_ERR_BASE 0x00030000
34 #define WIND_MEM_ERR_BASE 0x00110000
35 #define WIND_SEM_ERR_BASE 0x00160000
36 #define WIND_OBJ_ERR_BASE 0x003d0000
37 #define WIND_MSGQ_ERR_BASE 0x00410000
38 #define WIND_INT_ERR_BASE 0x00430000
39 
40 #define S_objLib_OBJ_ID_ERROR (WIND_OBJ_ERR_BASE + 0x0001)
41 #define S_objLib_OBJ_UNAVAILABLE (WIND_OBJ_ERR_BASE + 0x0002)
42 #define S_objLib_OBJ_DELETED (WIND_OBJ_ERR_BASE + 0x0003)
43 #define S_objLib_OBJ_TIMEOUT (WIND_OBJ_ERR_BASE + 0x0004)
44 #define S_objLib_OBJ_NO_METHOD (WIND_OBJ_ERR_BASE + 0x0005)
45 
46 #define S_taskLib_NAME_NOT_FOUND (WIND_TASK_ERR_BASE + 0x0065)
47 #define S_taskLib_TASK_HOOK_TABLE_FULL (WIND_TASK_ERR_BASE + 0x0066)
48 #define S_taskLib_TASK_HOOK_NOT_FOUND (WIND_TASK_ERR_BASE + 0x0067)
49 #define S_taskLib_ILLEGAL_PRIORITY (WIND_TASK_ERR_BASE + 0x006d)
50 
51 #define S_semLib_INVALID_STATE (WIND_SEM_ERR_BASE + 0x0065)
52 #define S_semLib_INVALID_OPTION (WIND_SEM_ERR_BASE + 0x0066)
53 #define S_semLib_INVALID_QUEUE_TYPE (WIND_SEM_ERR_BASE + 0x0067)
54 #define S_semLib_INVALID_OPERATION (WIND_SEM_ERR_BASE + 0x0068)
55 
56 #define S_msgQLib_INVALID_MSG_LENGTH (WIND_MSGQ_ERR_BASE + 0x0001)
57 #define S_msgQLib_NON_ZERO_TIMEOUT_AT_INT_LEVEL (WIND_MSGQ_ERR_BASE + 0x0002)
58 #define S_msgQLib_INVALID_QUEUE_TYPE (WIND_MSGQ_ERR_BASE + 0x0003)
59 
60 #define S_intLib_NOT_ISR_CALLABLE (WIND_INT_ERR_BASE + 0x0001)
61 
62 #define S_memLib_NOT_ENOUGH_MEMORY (WIND_MEM_ERR_BASE + 0x0001)
63 #define S_memLib_INVALID_NBYTES (WIND_MEM_ERR_BASE + 0x0002)
64 
65 #ifdef __cplusplus
66 extern "C" {
67 #endif
68 
69 void printErrno(int status);
70 
71 STATUS errnoSet(int status);
72 
73 int errnoGet(void);
74 
75 int errnoOfTaskGet(TASK_ID task_id);
76 
77 STATUS errnoOfTaskSet(TASK_ID task_id, int status);
78 
79 #ifdef __cplusplus
80 }
81 #endif
82 
83 #endif /* !_XENOMAI_VXWORKS_ERRNOLIB_H */