hc
2024-08-12 233ab1bd4c5697f5cdec94e60206e8c6ac609b4c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * Copyright (C) 2013 Spreadtrum Communications Inc.
 *
 * Filename : sdio_dev.h
 * Abstract : This file is a implementation for itm sipc command/event function
 *
 * Authors    : QI.SUN
 *
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */
#ifndef __MEM_PD_MGR__
#define __MEM_PD_MGR__
 
#include <marlin_platform.h>
 
#define MEM_PD_MGR_HEADER "[mem_pd]"
 
#define MEM_PD_MGR_ERR(fmt, args...)    \
   pr_err(MEM_PD_MGR_HEADER fmt "\n", ## args)
#define MEM_PD_MGR_INFO(fmt, args...)    \
   pr_info(MEM_PD_MGR_HEADER fmt "\n", ## args)
#define MEM_PD_MGR_DBG(fmt, args...)    \
   pr_debug(MEM_PD_MGR_HEADER fmt "\n", ## args)
 
/* cp2 create thread status */
#define THREAD_CREATE 1
#define THREAD_DELETE 0
 
struct mem_pd_debug_t {
   unsigned int mem_pd_open_bt;
   unsigned int mem_pd_open_wifi;
   unsigned int mem_pd_close_bt;
   unsigned int mem_pd_close_wifi;
};
 
struct mem_pd_t {
   struct mutex mem_pd_lock;
   struct completion wifi_open_completion;
   struct completion wifi_cls_cpl;
   struct completion bt_open_completion;
   struct completion bt_close_completion;
   struct completion save_bin_completion;
   unsigned int wifi_state;
   unsigned int bt_state;
   unsigned int cp_version;
   unsigned int bin_save_done;
   char *wifi_mem;
   char *bt_mem;
   char *wifi_clear;
   char *bt_clear;
   struct mem_pd_debug_t mem_pd_debug;
   unsigned int cp_mem_all_off;
};
 
struct mem_pd_meminfo_t {
   unsigned int wifi_begin_addr;
   unsigned int wifi_end_addr;
   unsigned int wifi_size;
   unsigned int bt_begin_addr;
   unsigned int bt_end_addr;
   unsigned int bt_size;
   unsigned int wifi_iram_mask;
   unsigned int wifi_dram_mask;
   unsigned int bt_iram_mask;
   unsigned int bt_dram_mask;
   unsigned int chip_id;
};
 
unsigned int mem_pd_wifi_state(void);
int mem_pd_poweroff_deinit(void);
int mem_pd_mgr(int subsys, int val);
int mem_pd_save_bin(void);
int mem_pd_init(void);
int mem_pd_exit(void);
unsigned int marlin_get_wcn_chipid(void);
#endif