Remove unused directories and files in video_in_hal
[staging/basesystem.git] / service / vehicle / positioning_base_library / library / include / WPF_STD_private.h
1 /*
2  * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /**
18  * @file WPF_STD_private.h
19  * @brief Header file for system standard definitions
20  */
21
22 #ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_WPF_STD_PRIVATE_H_
23 #define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_WPF_STD_PRIVATE_H_
24
25 /*---------------------------------------------------------------------------------*
26  * Incluce                                                                         *
27  *---------------------------------------------------------------------------------*/
28 #include <vehicle_service/positioning_base_library.h>
29
30 /* _CWORD64_ non-OS managed areas */
31 #define SDRAM__CWORD64__NOTOS_AREA 0x00000000
32 #define SDRAM__CWORD64__NOTOS_AREA_SIZE 0x0
33
34 #define BLVER_SIZE           0x00000008    /* BootLoader version information area size */
35 #define FROM_FIX_VER_SIZE    BLVER_SIZE    /* Mask(BootLoder)Version size    */
36
37 /* Start address of the _CWORD64_ non-OS management area */
38 #define TOP_ADDR_NOTOS      SDRAM__CWORD64__NOTOS_AREA
39 /* Size of the non-OS management area  */
40 #define NOTOS_SISE            SDRAM__CWORD64__NOTOS_AREA_SIZE
41
42 /* Reserved(32KB)Unavailable */
43 #define SRAMDRAM_RESERVE2_SIZE    0x00008000
44
45 #define WINAPI
46
47 #define STATUS_WAIT_0              ((DWORD)0x00000000L)
48 #define STATUS_ABANDONED_WAIT_0 ((DWORD)0x00000080L)
49 #define STATUS_TIMEOUT             ((DWORD)0x00000102L)
50 #define WAIT_TIMEOUT            STATUS_TIMEOUT
51 #define WAIT_OBJECT_0            ((STATUS_WAIT_0) + 0)
52 #define WAIT_ABANDONED            ((STATUS_ABANDONED_WAIT_0) + 0)
53 #define WAIT_FAILED                ((DWORD)0xFFFFFFFF)
54
55 #define SHARED_MEMORY_DIRECTORY        ("/tmp/shm/navigation/")
56
57 #define _pb_strcmp(pleft, pright)((strcmp(pleft, pright) == 0) ?(0) :(-1))
58
59 /* For heap allocation method control */
60 #define HEAP_ZERO_MEMORY            (0x00000008)
61
62 #define EV_RXCHAR           0x0001
63 #define EV_ERROR              0x0080
64
65 #define EV_DSR              0x0010
66
67 /* Systems API External Public Functions Prototype Definitions */
68 #define VUP_DISC_PATHNAME           _T("/Z01")                      /* VUP DISC paths */
69 #define VUP_USB_PATHNAME            _T("/U")                        /* VUP USB paths */
70 #define VUP_PATHNAME_SYSTEM         _T("/agl/system")               /* Storage path name */
71 #define VUP_FNAME_TOP               _T("/NA_D0_")                   /* VUPFile name(front) */
72 #define VUP_FNAME_BTM               _T(".bin")                      /* VUPFile name(rear) */
73 #define VUP_FNAME_FORCEVUP          _T("/forcevup.dat")             /* Forced VUP file name */
74
75 #define FROM_VARI_VER_SIZE  8
76 #define WRITE_FLAG_ON       0x01        /* Write permission status for the file */
77 #define FSNOACCESS          0x00        /* File system access disabled state */
78 #define VUP_GETNAME_MEDIA_DISC      0x01        /* VUP media:disc */
79
80 /* Function Code(Normal completion) */
81 #define RET_RCVMSG    1   /* Receive only message      */
82 #define RET_RCVSIG    2   /* Receive only signal         */
83 #define RET_RCVBOTH   3   /* Receive both messages and signals   */
84 #define RET_NOMSG   4   /* No received message */
85 /* User-side signal handling return values */
86 #define RET_QUE     5   /* Queue a signal */
87 #define RET_NOTQUE    6   /* Do not queue signals */
88 #define RET_PROCDOWN  7   /* Detect DOWN of children */
89 #define RET_SLEEP 100
90
91 /* Error code system  */
92 #define RET_OSERROR   (-127)  /* OS System call error  */
93 /* Actual error in _sys_GetOSErrorCode() */
94 /* Code can be retrieved     */
95 #define RET_ERRNOTRDY (-3)  /* Specified port ID and semaphore ID are not created.*/
96 #define RET_ERRPROC   (-4)  /* Error in API processing      */
97 #define RET_ERRTIMEOUT  (-5)  /* Timeout with Processing Not Complete  */
98 /*     (D type API only)   */
99 #define RET_ERRMSGFULL  (-6)  /* Message table full */
100 #define RET_ERROVERFLW  (-7)  /* Receive message is larger than the receive buffer size */
101 #define RET_ERRINIT   (-8)
102 #define RET_ERRREGQUE (-9)
103
104 #define RET_EV_NONE   (-20) /* No specified event */
105 #define RET_EV_MAX    (-21) /* Event value exceeds the specified maximum value */
106 #define RET_EV_MIN    (-22) /* The event value is less than the specified minimum value. */
107
108 #define SAPI_EVSET_RELATE   2
109
110
111 /*---------------------------------------------------------------------------------*
112  * Typedef declaration                                                             *
113  *---------------------------------------------------------------------------------*/
114
115 /*---------------------------------------------------------------------------------*
116  * Struct declaration                                                              *
117  *---------------------------------------------------------------------------------*/
118 typedef struct FileTime {
119     DWORD dw_low_date_time;
120     DWORD dw_high_date_time;
121 } FILETIME;
122 typedef FILETIME *PFILETIME;
123 typedef FILETIME *LPFILETIME;
124
125 typedef struct Overlapped {
126     ULONG_PTR internal;
127     ULONG_PTR internal_high;
128     union {
129         struct {
130             DWORD offset;
131             DWORD offset_high;
132         };
133
134         PVOID pointer;
135     };
136
137     HANDLE  h_event;
138 } OVERLAPPED;
139 typedef OVERLAPPED *LPOVERLAPPED;
140
141 typedef struct ComStat {
142     DWORD f_cts_hold : 1;
143     DWORD f_dsr_hold : 1;
144     DWORD f_rlsd_hold : 1;
145     DWORD f_x_off_hold : 1;
146     DWORD f_x_off_sent : 1;
147     DWORD f_eof : 1;
148     DWORD f_txim : 1;
149     DWORD f_reserved : 25;
150     DWORD cb_in_que;
151     DWORD cb_out_que;
152 } COMSTAT;
153 typedef COMSTAT *LPCOMSTAT;
154
155 typedef struct Dcb {
156     DWORD dcb_length;      /* sizeof(DCB)                     */
157     DWORD baud_rate;       /* Baudrate at which running       */
158     DWORD f_binary: 1;     /* Binary Mode (skip EOF check)    */
159     DWORD f_parity: 1;     /* Enable parity checking          */
160     DWORD f_out_x_cts_flow: 1; /* CTS handshaking on output       */
161     DWORD f_out_x_dsr_flow: 1; /* DSR handshaking on output       */
162     DWORD f_dtr_control: 2; /* DTR Flow control                */
163     DWORD f_dsr_sensitivity: 1; /* DSR Sensitivity              */
164     DWORD f_tx_continue_on_x_off: 1; /* Continue TX when Xoff sent */
165     DWORD f_out_x: 1;       /* Enable output X-ON/X-OFF        */
166     DWORD f_in_x: 1;        /* Enable input X-ON/X-OFF         */
167     DWORD f_error_char: 1;  /* Enable Err Replacement          */
168     DWORD f_null: 1;       /* Enable Null stripping           */
169     DWORD f_rts_control: 2; /* Rts Flow control                */
170     DWORD f_abort_on_error: 1; /* Abort all reads and writes on Error */
171     DWORD f_dummy2: 17;    /* Reserved                        */
172     WORD w_reserved;       /* Not currently used              */
173     WORD x_on_lim;          /* Transmit X-ON threshold         */
174     WORD x_off_lim;         /* Transmit X-OFF threshold        */
175     BYTE byte_size;        /* Number of bits/byte, 4-8        */
176     BYTE parity;          /* 0-4=None,Odd,Even,Mark,Space    */
177     BYTE stop_bits;        /* 0,1,2 = 1, 1.5, 2               */
178     char x_on_char;         /* Tx and Rx X-ON character        */
179     char x_off_char;        /* Tx and Rx X-OFF character       */
180     char error_char;       /* Error replacement char          */
181     char eof_char;         /* End of Input character          */
182     char evt_char;         /* Received Event character        */
183     WORD w_reserved1;      /* Fill for now.                   */
184 } DCB;
185 typedef DCB *LPDCB;
186
187 typedef struct CommTimeouts {
188     DWORD read_interval_timeout;          /* Maximum time between read chars. */
189     DWORD read_total_timeout_multiplier;   /* Multiplier of characters.        */
190     DWORD read_total_timeout_constant;     /* Constant in milliseconds.        */
191     DWORD write_total_timeout_multiplier;  /* Multiplier of characters.        */
192     DWORD write_total_timeout_constant;    /* Constant in milliseconds.        */
193 } COMMTIMEOUTS;
194 typedef COMMTIMEOUTS *LPCOMMTIMEOUTS;
195
196 typedef struct {
197     DWORD            size;                            /* Allocated shared memory size                */
198     DWORD            phy_addr;                        /* Physical address                            */
199     HANDLE           h_map;                            /*  +8: Handle of file mapping object.    */
200     void*            p_memory;                        /* Shared Memory Mapped Address            */
201     DWORD            owner;                            /* +16: Owner flag.                        */
202     HANDLE           h_heap;                            /* +20: Handle of heap for oneself.        */
203 } SHARED_MEMORY;
204
205 typedef DWORD (WINAPI *PTHREAD_START_ROUTINE)(
206     LPVOID lpThreadParameter
207 );
208 typedef PTHREAD_START_ROUTINE     LPTHREAD_START_ROUTINE;
209
210 /* Program version storage */
211 typedef struct {
212     u_int8  mask_ver[ FROM_FIX_VER_SIZE ];      /* BootLoader programming versions */
213     u_int8  flash_ver1[ FROM_VARI_VER_SIZE ];   /* NK1 programming versions */
214     u_int8  flash_ver2[ FROM_VARI_VER_SIZE ];   /* NK2 programming versions */
215     u_int8  flash_ver3[ FROM_VARI_VER_SIZE ];   /* NK3 programming versions */
216 } T_SYS_PRGVER;
217
218 /* Device information storage */
219 typedef struct {
220     u_int8  _CWORD31__no[ _CWORD31__NO_SIZE ];        /* _CWORD31_ product number */
221     u_int8  reserve1[ RESERVE1_SIZE ];          /* RESERVE1 */
222     u_int8  helpnet_id[ HELPNET_ID_SIZE ];      /* HELPNET ID */
223     u_int8  reserve2[ RESERVE2_SIZE ];          /* RESERVE2 */
224     u_int8  date[ DATE_SIZE ];                  /* Manufacturing date and time */
225 } T_SYS_DEVINFO;
226
227 /* Structure for storing display information */
228 typedef struct {
229     int     i_width_size;                 /* Width */
230     int     i_height_size;                /* Height */
231 } DISPLAY_INFO;
232
233 /* System error notification message structure */
234 typedef struct {
235     T_APIMSG_MSGBUF_HEADER bhead;   /* Message buffer header */
236     PNO             pno;            /* Process No.  */
237     u_int8          dummy[2];       /* Dummy       */
238     int32           errcode;        /* Error code */
239 } T_SYS_SYSTEMERROR;
240
241
242 /*---------------------------------------------------------------------------------*
243  * Prototype Declaration                                                           *
244  *---------------------------------------------------------------------------------*/
245 /* Configuration Functions  (_pbCommon.cpp)  */
246 void    PbReset(void);                                      /* Soft reset process */
247
248 /* Message Sending/Receiving Functions   (_pbMsg.cpp)   */
249 RET_API PbDeleteMsg(PNO pno);
250
251 /* SRAM Control Functions (_pbSram.cpp)   */
252 RET_API PbSramFil32(u_int8 id, u_int32 off, u_int8 pat, u_int32 size);
253 RET_API PbSramRd32(u_int8 id, u_int32 off, void *pbuf, u_int32 size);
254 RET_API PbSramSz32(u_int8 id, u_int32 *psize);
255
256 /* DRAM Control Functions (_pbDram.cpp)  */
257 RET_API PbDramWt32(u_int8 id, void *pbuf, u_int32 off, u_int32 size);
258
259 /* Semaphore(_pbSem.cpp) */
260 RET_API PbDeleteSemaphore(SemID sem_id);
261 DWORD   PbDeleteMutex(HANDLE h_mutex);
262 DWORD   PbMutexLock(HANDLE h_mutex, DWORD timeout);
263 BOOL    PbMutexUnlock(HANDLE h_mutex);
264
265 /* Shared Memory Access Functions(_pbMem.cpp) */
266 RET_API PbDeleteShareData(char* area_name);
267 /* Accessing Physical Memory Area Allocation Data */
268 RET_API PbAccessPhysicalMem(u_int32 addr, void **mem_ptr, u_int32 size, u_int32 mode);
269 /* Releases access to the physical memory area allocation data. */
270 RET_API PbFreePhysicalMem(u_int32 addr, void *mem_ptr, u_int32 size);
271
272 LPVOID  PbProcessHeapAlloc(DWORD dw_flags, SIZE_T dw_bytes);    /* Allocating Memory from the Process Heap            */
273 BOOL    PbProcessHeapFree(DWORD dw_flags, LPVOID lp_mem);       /* Free Memory Allocated from Process Heap      */
274
275 /* Functions Related to Analysis Support Functions(_pbOther.cpp) */
276 uint32_t PbGetTid(void);
277 uint32_t PbGetLocalTid(void);
278
279 /* Other Functions(_pbMisc.cpp) */
280 RET_API PbMilliSecSleep(u_int32 ul_mill_time);                  /* Sleeping of the calling process */
281
282 /* TODO As defined in _pbCSection--> */
283 VOID PbDeleteCriticalSection(LPCRITICAL_SECTION lp_critical_section);
284 VOID PbEnterCriticalSection(LPCRITICAL_SECTION lp_critical_section);
285 VOID PbInitializeCriticalSection(LPCRITICAL_SECTION lp_critical_section);
286 VOID PbLeaveCriticalSection(LPCRITICAL_SECTION lp_critical_section);
287
288 BOOL PbSystemTimeToFileTime(CONST SYSTEMTIME *lp_system_time, LPFILETIME lp_file_time);
289
290
291 /* Memory copy Bus release support */
292 void*  Memset64pSync(void* dest, int c, size_t count);
293
294 #endif  // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_WPF_STD_PRIVATE_H_
295