blob: 062e40a5bda901404457fec09d53f24e762c2f4b [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001#ifndef __HAL2FLP_INTERFACE_H__
2#define __HAL2FLP_INTERFACE_H__
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <stdio.h>
9#include <stdlib.h>
10#include <string.h>
11#include <stdint.h>
12#include <hardware/fused_location.h>
13
14//======================================================
15// FLP -> FLP HAL
16//======================================================
17#define FLP_TO_MNL "flp_to_mnl"
18#define MNL_TO_FLP "mnl_to_flp"
19
20/*****************************************************************************
21 * FLP Return Value for APIs
22 *****************************************************************************/
23#define MTK_FLP_SUCCESS (0)
24#define MTK_FLP_ERROR (-1)
25#define MTK_FLP_TIMEOUT (-2)
26
27#ifndef MTK_FLP_TRUE
28#define MTK_FLP_TRUE (1)
29#endif
30
31#ifndef MTK_FLP_FALSE
32#define MTK_FLP_FALSE (0)
33#endif
34
35#define HAL_FLP_BUFF_SIZE (1 * 1024)
36
37#ifdef __aarch64__
38#define MTK_64_PLATFORM
39#endif
40
41
42/*************************************************
43 Message Table for MTK FLP
44*************************************************/
45typedef enum{
46 MTK_FLP_MSG_SYS_FLPD_RESET_NTF = 100,
47
48 //HAL messages
49 MTK_FLP_MSG_HAL_INIT_CMD = 200,
50 MTK_FLP_MSG_HAL_START_CMD,
51 MTK_FLP_MSG_HAL_STOP_CMD,
52 MTK_FLP_MSG_HAL_STOP_RSP,
53 MTK_FLP_MSG_HAL_SET_OPTION_CMD,
54 MTK_FLP_MSG_HAL_INJECT_LOC_CMD,
55 MTK_FLP_MSG_HAL_DIAG_INJECT_DATA_NTF,
56 MTK_FLP_MSG_HAL_DIAG_REPORT_DATA_NTF,
57
58 MTK_FLP_MSG_HSB_REPORT_LOC_NTF = 300,
59 MTK_FLP_MSG_OFL_REPORT_LOC_NTF,
60
61 MTK_FLP_MSG_HAL_GEOFENCE_CALLBACK_NTF = 400,
62 MTK_FLP_MSG_HAL_REQUEST_LOC_NTF,
63 MTK_FLP_MSG_HAL_FLUSH_LOC_NTF,
64 MTK_FLP_MSG_HAL_REPORT_STATUS_NTF,
65 MTK_FLP_MSG_OFL_GEOFENCE_CALLBACK_NTF, //for Offload geofence use
66 MTK_FLP_MSG_OFL_GEOFENCE_CMD,
67
68 MTK_FLP_MSG_DC_START_CMD = 500,
69 MTK_FLP_MSG_DC_STOP_CMD,
70 MTK_FLP_MSG_CONN_SCREEN_STATUS, //for AP to connsys screen on/off status exchange
71 MTK_FLP_MSG_END,
72}MTK_FLP_MSG_TYPE;
73
74typedef enum {
75 MTK_FLP_IDLE_MODE = -1,
76 MTK_FLP_BATCH_SLEEP_ON_FIFO_FULL = 0,
77 MTK_FLP_BATCH_WAKE_ON_FIFO_FULL = 1,
78} MTK_FLP_BATCH_MODE_T;
79
80typedef struct {
81 int type;
82 int length;
83} MTK_FLP_MSG_T;
84
85typedef struct {
86 double max_power_allocation_mW;
87 unsigned int sources_to_use;
88 int flags;
89 int64_t period_ns;
90} MTK_FLP_BATCH_OPTION_T;
91
92
93typedef FlpDiagnosticCallbacks (*FlpDiagCB)();
94typedef void (* timer_callback)();
95
96int mnl2flphal_flp_init();
97int isflp_thread_exist() ;
98void flphal2mnl_flp_init();
99int flphal2mnl_flp_start(int id, FlpBatchOptions* options);
100int flphal2mnl_flp_reboot_done_ntf();
101int flphal2mnl_update_batching_options(int id, FlpBatchOptions* options);
102int flphal2mnl_stop_batching(int id) ;
103void flphal2mnl_get_batched_location(int last_n_locations);
104int flphal2mnl_inject_location(FlpLocation* location);
105int flphal2mnl_diag_inject_data(char* data, int length);
106void flphal2mnl_flush_batched_locations() ;
107int flp_send2mnl(const char* buff, int len);
108
109
110#ifdef __cplusplus
111}
112#endif
113
114#endif