-
Notifications
You must be signed in to change notification settings - Fork 7k
/
ulp_lp_core_utils.h
94 lines (81 loc) · 2.36 KB
/
ulp_lp_core_utils.h
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
85
86
87
88
89
90
91
92
93
94
/*
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
/**
* @brief Traverse all possible wake-up sources and update the wake-up cause so that
* ulp_lp_core_get_wakeup_cause can obtain the bitmap of the wake-up reasons.
*/
void ulp_lp_core_update_wakeup_cause(void);
/**
* @brief Get the wakeup source which caused LP_CPU to wakeup from sleep
*
* @return Wakeup cause in bit map, for the meaning of each bit, refer
* to the definition of wakeup source in lp_core_ll.h
*/
uint32_t ulp_lp_core_get_wakeup_cause(void);
/**
* @brief Wakeup main CPU from sleep or deep sleep.
*
* This raises a software interrupt signal, if the
* main CPU has configured the ULP as a wakeup source
* calling this function will make the main CPU to
* exit from sleep or deep sleep.
*/
void ulp_lp_core_wakeup_main_processor(void);
/**
* @brief Makes the co-processor busy wait for a certain number of microseconds
*
* @param us Number of microseconds to busy-wait for
*/
void ulp_lp_core_delay_us(uint32_t us);
/**
* @brief Makes the co-processor busy wait for a certain number of cycles
*
* @param cycles Number of cycles to busy-wait for
*/
void ulp_lp_core_delay_cycles(uint32_t cycles);
/**
* @brief Finishes the ULP program and powers down the ULP
* until next wakeup.
*
* @note This function does not return. After called it will
* fully reset the ULP.
*
* @note The program will automatically call this function when
* returning from main().
*
* @note To stop the ULP from waking up, call ulp_lp_core_lp_timer_disable()
* before halting.
*
*/
__attribute__((__noreturn__)) void ulp_lp_core_halt(void);
/**
* @brief The LP core puts itself to sleep and disables all wakeup sources.
*/
__attribute__((__noreturn__)) void ulp_lp_core_stop_lp_core(void);
/**
* @brief Enable the SW triggered interrupt from the PMU
*
* @note This is the same SW trigger interrupt that is used to wake up the LP CPU
*
* @param enable true to enable, false to disable
*
*/
void ulp_lp_core_sw_intr_enable(bool enable);
/**
* @brief Clear the interrupt status for the SW triggered interrupt from the PMU
*
*/
void ulp_lp_core_sw_intr_clear(void);
#ifdef __cplusplus
}
#endif