blob: d078295b333f6267eb816195f5d73e828e15c02e [file] [log] [blame]
/**********************************************************************
* All Rights Reserved
*
* MARVELL CONFIDENTIAL
* Copyright 2012 Marvell International Ltd All Rights Reserved.
* The source code contained or described herein and all documents related to
* the source code ("Material") are owned by Marvell International Ltd or its
* suppliers or licensors. Title to the Material remains with Marvell International Ltd
* or its suppliers and licensors. The Material contains trade secrets and
* proprietary and confidential information of Marvell or its suppliers and
* licensors. The Material is protected by worldwide copyright and trade secret
* laws and treaty provisions. No part of the Material may be used, copied,
* reproduced, modified, published, uploaded, posted, transmitted, distributed,
* or disclosed in any way without Marvell's prior express written permission.
*
* No license under any patent, copyright, trade secret or other intellectual
* property right is granted to or conferred upon you by disclosure or delivery
* of the Materials, either expressly, by implication, inducement, estoppel or
* otherwise. Any license under such intellectual property rights must be
* express and approved by Marvell in writing.
*
**********************************************************************/
/*! \file gps_usr_api.h
\brief .
*/
#ifndef GPS_API
#define GPS_API
#ifdef __cplusplus
extern "C" {
#endif
#include "gps_types.h"
#define GPSAPP_PROTO_NONE 0
#define GPSAPP_PROTO_TSIP 2
#define GPSAPP_PROTO_NMEA 4
#define GPSAPP_PROTO_MLIP 8 // Marvell location interface protocol
#ifdef GPSAPP_PROTO_TSIP
#define GPS_TSIP_VERSION_MAJOR 1
#define GPS_TSIP_VERSION_MINOR 0
#endif
#define GPS_PE_SOCKET_ME_RECV_PORT 30000
#define GPS_PE_SOCKET_APP_RECV_PORT 30001
#define GPS_ME_SOCKET_RECV_PORT 30002
#define GPS_PE_MSGQ_IPC_KEY ((key_t)54321)
/* broadcast port is used to broadcast message to none special opened port*/
#define GPS_TSIP_MSG_BRODCAST_PORT (-2)
#define AGPS_APP_UDP_PORT 2
#define HSM_USRAPI_UDP_PORT 3
#define EE_APP_UDP_PORT 4
#define HSM_USRAPI_MLIP_UDP_PORT 5
#define DEMO_APP_UDP_PORT 6
#define GPS_HSM_INTENAL_EVENT_UDP_PORT 7
#define GPS_HSM_INTENAL_EVENT_SENDER_UDP_PORT 8
#define GPS_TSIP_MAX_INTERNAL_PORT 10
/*UDP message send from this port to another port*/
#define GPS_UDP_SEND_PORT 9
#define GPS_PE_EPTYPE_UDP 1
#define GPS_PE_EPTYPE_UART 2
#define GPS_PE_EPTYPE_IPC 3
#define GPS_USRAPI_MAXEP 32
#define GPS_USRAPI_LO_ADDR 0x7f000001
#define GPS_USRAPI_UNIX_ADDR 0x7f000000
#if defined(OS_LINUX) && defined(USE_UNIX_SOCKET_FOR_INTERNAL)
#define GPS_USRAPI_INT_ADDR GPS_USRAPI_UNIX_ADDR
#else
#define GPS_USRAPI_INT_ADDR GPS_USRAPI_LO_ADDR
#endif
#define GPS_USRAPI_IS_UNIX_ADDR(addr) (addr==GPS_USRAPI_UNIX_ADDR)
typedef struct
{
U32 epType;
union
{
struct
{
U32 userIp, sinanIp;
S32 userPort;
S32 remotePort;
} udp;
struct
{
U32 ipcKey;
} msg;
struct
{
U8 devName[64];
} uart;
} addr;
} gpsPeEndPtCfgT;
typedef struct gpsUsrApiHdrT
{
U16 type;
U16 length;
U16 source;
U16 dest;
} gpsUsrApiHdrT;
S16 gpsUsrApiPortRegister(gpsPeEndPtCfgT* ep, U32 port, U32 proto, U32 reportsOn);
S16 gpsUsrApiPortDeregister(U32 port);
S16 gpsUsrApiSend(U32 port, gpsUsrApiHdrT* apiBuffer);
S16 gpsUsrApiRecv(U32 port, gpsUsrApiHdrT* apiBuffer, S32 len);
S16 gpsUsrApiSetRecvTimeout(U32 port, S32 msecs);
#ifdef __cplusplus
};
#endif
#endif