blob: 5d4b91d967b47bac72c1f893914d26af1b1b5108 [file] [log] [blame]
b.liu4e243dc2023-11-27 11:20:00 +08001#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4#include <stdlib.h>
5#include <pthread.h>
6
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12#define MAX_LOCK_NUM 128
13
14#define E_READ -2
15#define E_WRITE -3
16#define E_TABLE_FULL -4
17#define E_LOCK_EXIST -5
18#define E_INPUT_ERROR -6
19
20typedef enum
21{
22 E_QL_LPM_FALLING = 0, /* Falling, Means wakeupin falling to wakeup the module, or wakeupout falling to wakeup mcu
23. */
24 E_QL_LPM_RISING = 1, /* Rising, Means wakeupin rising to wakeup the module, or wakeupout rising to wakeup mcu.
25*/
26}qser_lpm_edge_t;
27
28typedef int qser_lpm_pin_t;
29
30
31typedef struct{
32 qser_lpm_pin_t wakeupin_pin;
33 qser_lpm_edge_t wakeupin_edge;
34}qser_lpm_wakeupin_data_t;
35
36typedef struct{
37 qser_lpm_pin_t wakeupout_pin;
38 qser_lpm_edge_t wakeupout_edge;
39}qser_lpm_wakeupout_data_t;
40
41
42typedef void (*qser_lpm_Handler_t)
43(
44 qser_lpm_edge_t lpm_edge
45);
46
47typedef struct{
48 qser_lpm_wakeupin_data_t wakeupin;
49 qser_lpm_wakeupout_data_t wakeupout;
50}qser_pm_cfg_t;
51
52
53typedef struct
54{
55 char lock_name[MAX_LOCK_NUM][64];
b.liu8583dce2024-04-03 13:30:08 +080056 int lock_pid[MAX_LOCK_NUM];
b.liu4e243dc2023-11-27 11:20:00 +080057} LOCK_TABLE;
58
59int read_lock_table(void);
60int qser_lpm_init(qser_lpm_Handler_t qser_lpm_handler, qser_pm_cfg_t *qser_lpm_cfg);
61int qser_lpm_deinit(void);
62int qser_autosuspend_enable(char enable);
63int qser_wakelock_create(const char *name, size_t len);
64int qser_wakelock_lock(int fd);
65int qser_wakelock_unlock(int fd);
66int qser_wakelock_destroy(int fd);
b.liu8583dce2024-04-03 13:30:08 +080067
68int qser_whitelist_set(char *whitelist);
69int qser_whitelist_get(char *whitelist);
b.liu4e243dc2023-11-27 11:20:00 +080070
71
72#ifdef __cplusplus
73}
74#endif
75