blob: d078295b333f6267eb816195f5d73e828e15c02e [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001/**********************************************************************
2* All Rights Reserved
3*
4* MARVELL CONFIDENTIAL
5* Copyright 2012 Marvell International Ltd All Rights Reserved.
6* The source code contained or described herein and all documents related to
7* the source code ("Material") are owned by Marvell International Ltd or its
8* suppliers or licensors. Title to the Material remains with Marvell International Ltd
9* or its suppliers and licensors. The Material contains trade secrets and
10* proprietary and confidential information of Marvell or its suppliers and
11* licensors. The Material is protected by worldwide copyright and trade secret
12* laws and treaty provisions. No part of the Material may be used, copied,
13* reproduced, modified, published, uploaded, posted, transmitted, distributed,
14* or disclosed in any way without Marvell's prior express written permission.
15*
16* No license under any patent, copyright, trade secret or other intellectual
17* property right is granted to or conferred upon you by disclosure or delivery
18* of the Materials, either expressly, by implication, inducement, estoppel or
19* otherwise. Any license under such intellectual property rights must be
20* express and approved by Marvell in writing.
21*
22**********************************************************************/
23
24
25/*! \file gps_usr_api.h
26 \brief .
27
28*/
29
30#ifndef GPS_API
31#define GPS_API
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37
38
39#include "gps_types.h"
40
41#define GPSAPP_PROTO_NONE 0
42#define GPSAPP_PROTO_TSIP 2
43#define GPSAPP_PROTO_NMEA 4
44#define GPSAPP_PROTO_MLIP 8 // Marvell location interface protocol
45
46#ifdef GPSAPP_PROTO_TSIP
47#define GPS_TSIP_VERSION_MAJOR 1
48#define GPS_TSIP_VERSION_MINOR 0
49#endif
50
51#define GPS_PE_SOCKET_ME_RECV_PORT 30000
52#define GPS_PE_SOCKET_APP_RECV_PORT 30001
53#define GPS_ME_SOCKET_RECV_PORT 30002
54
55#define GPS_PE_MSGQ_IPC_KEY ((key_t)54321)
56
57 /* broadcast port is used to broadcast message to none special opened port*/
58#define GPS_TSIP_MSG_BRODCAST_PORT (-2)
59#define AGPS_APP_UDP_PORT 2
60#define HSM_USRAPI_UDP_PORT 3
61#define EE_APP_UDP_PORT 4
62#define HSM_USRAPI_MLIP_UDP_PORT 5
63#define DEMO_APP_UDP_PORT 6
64#define GPS_HSM_INTENAL_EVENT_UDP_PORT 7
65#define GPS_HSM_INTENAL_EVENT_SENDER_UDP_PORT 8
66#define GPS_TSIP_MAX_INTERNAL_PORT 10
67
68 /*UDP message send from this port to another port*/
69#define GPS_UDP_SEND_PORT 9
70
71
72#define GPS_PE_EPTYPE_UDP 1
73#define GPS_PE_EPTYPE_UART 2
74#define GPS_PE_EPTYPE_IPC 3
75
76#define GPS_USRAPI_MAXEP 32
77
78#define GPS_USRAPI_LO_ADDR 0x7f000001
79#define GPS_USRAPI_UNIX_ADDR 0x7f000000
80
81#if defined(OS_LINUX) && defined(USE_UNIX_SOCKET_FOR_INTERNAL)
82#define GPS_USRAPI_INT_ADDR GPS_USRAPI_UNIX_ADDR
83#else
84#define GPS_USRAPI_INT_ADDR GPS_USRAPI_LO_ADDR
85#endif
86
87#define GPS_USRAPI_IS_UNIX_ADDR(addr) (addr==GPS_USRAPI_UNIX_ADDR)
88
89 typedef struct
90 {
91 U32 epType;
92 union
93 {
94 struct
95 {
96 U32 userIp, sinanIp;
97 S32 userPort;
98 S32 remotePort;
99 } udp;
100 struct
101 {
102 U32 ipcKey;
103 } msg;
104 struct
105 {
106 U8 devName[64];
107 } uart;
108 } addr;
109 } gpsPeEndPtCfgT;
110
111 typedef struct gpsUsrApiHdrT
112 {
113 U16 type;
114 U16 length;
115 U16 source;
116 U16 dest;
117 } gpsUsrApiHdrT;
118
119 S16 gpsUsrApiPortRegister(gpsPeEndPtCfgT* ep, U32 port, U32 proto, U32 reportsOn);
120 S16 gpsUsrApiPortDeregister(U32 port);
121 S16 gpsUsrApiSend(U32 port, gpsUsrApiHdrT* apiBuffer);
122 S16 gpsUsrApiRecv(U32 port, gpsUsrApiHdrT* apiBuffer, S32 len);
123 S16 gpsUsrApiSetRecvTimeout(U32 port, S32 msecs);
124
125
126#ifdef __cplusplus
127};
128#endif
129
130#endif
131