ulp: add support for using lp timer with lp core on C6

This commit is contained in:
Marius Vikhammer
2023-04-26 13:58:19 +08:00
parent f5020d3f1b
commit 45fd8feba3
23 changed files with 504 additions and 55 deletions

View File

@@ -0,0 +1,36 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Sets the next wakeup alarm
*
* @note This only sets the alarm for a single wakeup. For periodic wakeups you will
* have to call this function again after each wakeup to configure the next time.
*
* @note If ulp_lp_core_cfg_t.lp_timer_sleep_duration_us is set the ulp will automatically set
* the next wakeup time after returning from main and override this value.
*
* @param sleep_duration_us Time to next wakeup in microseconds
*/
void ulp_lp_core_lp_timer_set_wakeup_time(uint64_t sleep_duration_us);
/**
* @brief Disables the lp timer alarm and clears any pending alarm interrupts
*
*/
void ulp_lp_core_lp_timer_disable(void);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,28 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
uint64_t sleep_duration_us; /* Configured sleep duration for periodic wakeup, if set the ulp will automatically schedule the next wakeup */
} ulp_lp_core_memory_shared_cfg_t;
/**
* @brief Returns a pointer to a struct shared between the main cpu and lp core,
* intended for sharing variables between the ulp component and ulp binary
*
* @return ulp_lp_core_memory_shared_cfg_t* Pointer to the shared config struct
*/
ulp_lp_core_memory_shared_cfg_t* ulp_lp_core_memory_shared_cfg_get(void);
#ifdef __cplusplus
}
#endif