aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAnton Moberg <anton.moberg@arm.com>2021-03-24 14:08:22 +0100
committerAnton Moberg <anton.moberg@arm.com>2021-04-12 10:01:52 +0200
commit0a6142904a712a1f1c9ce16bb364c3e9d2434dd2 (patch)
tree19a72b883f5c765528d853bb515fecb514c75d50 /include
parentdfed5fd24699246811300a05ebc421a978e52149 (diff)
downloadethos-u-core-driver-0a6142904a712a1f1c9ce16bb364c3e9d2434dd2.tar.gz
Clock request disabled when PMU enabled
Currently clock request is enabled, which means NPU will only request clock when working. When NPU is going into idle it will no longer request clock and thus PMU won't be clocked either, and thus affect the cycle counter. Added: enum for request clients (PMU or INFERENCE). Added: clock_request added to driver struct (bit 0: PMU, bit 1: INFERENCE) which keeps track of which client requests clock. Added: power_request added to driver struct (bit 0: PMU, bit 1: INFERENCE) which keeps track of which client requests power. Added set_clock_and_power_request(...) updates clock_request and power_request depending on which client calls it. Sets clock and power if both PMU and INFERENCE requests it. Added: Call set_clock_and_power_request(...) from PMU. Changed: replace ethosu_set_clock_and_power(...) with set_clock_and_power_request(...) in ethosu_init and ethosu_invoke Change-Id: Ie7d8aee639d4abbf879b05e9a82035d7c0d40d40
Diffstat (limited to 'include')
-rw-r--r--include/ethosu_driver.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/ethosu_driver.h b/include/ethosu_driver.h
index 16f0a25..4089932 100644
--- a/include/ethosu_driver.h
+++ b/include/ethosu_driver.h
@@ -49,6 +49,8 @@ struct ethosu_driver
bool reserved;
volatile bool irq_triggered;
void *semaphore;
+ uint8_t clock_request;
+ uint8_t power_request;
};
struct ethosu_version_id
@@ -81,6 +83,12 @@ struct ethosu_version
struct ethosu_version_config cfg;
};
+enum ethosu_request_clients
+{
+ ETHOSU_PMU_REQUEST = 0,
+ ETHOSU_INFERENCE_REQUEST = 1,
+};
+
/******************************************************************************
* Variables
******************************************************************************/
@@ -169,6 +177,14 @@ struct ethosu_driver *ethosu_reserve_driver(void);
void ethosu_release_driver(struct ethosu_driver *drv);
/**
+ * Set clock and power request bits
+ */
+enum ethosu_error_codes set_clock_and_power_request(struct ethosu_driver *drv,
+ enum ethosu_request_clients client,
+ enum ethosu_clock_q_request clock_request,
+ enum ethosu_power_q_request power_request);
+
+/**
* Static inline for backwards-compatibility
*/
static inline int ethosu_invoke_v2(const void *custom_data_ptr,