aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonny Svärd <jonny.svaerd@arm.com>2021-06-01 18:40:45 +0200
committerKristofer Jonsson <kristofer.jonsson@arm.com>2021-06-08 14:54:57 +0000
commitc5941c40cce587814bed52a3645cb72150e6c755 (patch)
tree6e96bacf6714120c852a22567825d58035017576
parentf821c61fddd0193b6333a76f39904d201f30b7e6 (diff)
downloadethos-u-core-platform-c5941c40cce587814bed52a3645cb72150e6c755.tar.gz
Remove hardcoded Ethos-U driver instance
Adjust to updated Ethos-U driver Change-Id: Ie374c29bec2baee4717634588b22f6db419ad9a3
-rw-r--r--applications/driver_unit_tests/command_stream.cpp12
-rw-r--r--applications/driver_unit_tests/command_stream.hpp2
-rw-r--r--targets/corstone-300/target.cpp6
3 files changed, 10 insertions, 10 deletions
diff --git a/applications/driver_unit_tests/command_stream.cpp b/applications/driver_unit_tests/command_stream.cpp
index e099b73..2de1ae8 100644
--- a/applications/driver_unit_tests/command_stream.cpp
+++ b/applications/driver_unit_tests/command_stream.cpp
@@ -102,7 +102,7 @@ CommandStream::CommandStream(const DataPointer &_commandStream,
drv(ethosu_reserve_driver()),
commandStream(_commandStream), basePointers(_basePointers), pmu(drv, _pmuEvents) {
// Disable clock gating, else the NPU PMU will be clock gated and report too few cycles
- ethosu_set_clock_and_power(&drv->dev, ETHOSU_CLOCK_Q_DISABLE, ETHOSU_POWER_Q_DISABLE);
+ ethosu_dev_set_clock_and_power(&drv->dev, ETHOSU_CLOCK_Q_DISABLE, ETHOSU_POWER_Q_DISABLE);
// Use simplified driver setup
ethosu_set_power_mode(drv, true);
@@ -115,16 +115,16 @@ CommandStream::~CommandStream() {
int CommandStream::run(size_t repeat) {
// Base pointer array
- uint64_t baseAddress[ETHOSU_DRIVER_BASEP_INDEXES];
- size_t baseAddressSize[ETHOSU_DRIVER_BASEP_INDEXES];
- for (size_t i = 0; i < ETHOSU_DRIVER_BASEP_INDEXES; i++) {
+ uint64_t baseAddress[ETHOSU_BASEP_INDEXES];
+ size_t baseAddressSize[ETHOSU_BASEP_INDEXES];
+ for (size_t i = 0; i < ETHOSU_BASEP_INDEXES; i++) {
baseAddress[i] = reinterpret_cast<uint64_t>(basePointers[i].data);
baseAddressSize[i] = reinterpret_cast<size_t>(basePointers[i].size);
}
while (repeat-- > 0) {
int error = ethosu_invoke(
- drv, commandStream.data, commandStream.size, baseAddress, baseAddressSize, ETHOSU_DRIVER_BASEP_INDEXES);
+ drv, commandStream.data, commandStream.size, baseAddress, baseAddressSize, ETHOSU_BASEP_INDEXES);
if (error != 0) {
printf("Inference failed. error=%d\n", error);
@@ -134,7 +134,7 @@ int CommandStream::run(size_t repeat) {
// Wait for interrupt
while (true) {
uint16_t status;
- ethosu_get_status_mask(&drv->dev, &status);
+ ethosu_dev_get_status_mask(&drv->dev, &status);
// Return if NPU raise error status
if (status & 0xcc) {
diff --git a/applications/driver_unit_tests/command_stream.hpp b/applications/driver_unit_tests/command_stream.hpp
index 4a0b602..2004b03 100644
--- a/applications/driver_unit_tests/command_stream.hpp
+++ b/applications/driver_unit_tests/command_stream.hpp
@@ -74,7 +74,7 @@ private:
* CommandStream
****************************************************************************/
-using BasePointers = std::array<DataPointer, ETHOSU_DRIVER_BASEP_INDEXES>;
+using BasePointers = std::array<DataPointer, ETHOSU_BASEP_INDEXES>;
class CommandStream {
public:
diff --git a/targets/corstone-300/target.cpp b/targets/corstone-300/target.cpp
index 2344995..541d4a5 100644
--- a/targets/corstone-300/target.cpp
+++ b/targets/corstone-300/target.cpp
@@ -60,7 +60,7 @@ __attribute__((aligned(16), section(".bss.ethosu_scratch"))) uint8_t ethosu_scra
#endif
#ifdef ETHOSU
-struct ethosu_driver *ethosu0_driver = &ethosu_drv;
+struct ethosu_driver ethosu0_driver;
#endif
static uintptr_t ethosu_ta_base_addrs[ETHOSU_NPU_COUNT][ETHOSU_NPU_TA_COUNT] = {
@@ -135,7 +135,7 @@ void HardFault_Handler() {
#ifdef ETHOSU
void ethosuIrqHandler() {
- ethosu_irq_handler(ethosu0_driver);
+ ethosu_irq_handler(&ethosu0_driver);
}
#endif
@@ -158,7 +158,7 @@ void targetSetup() {
#ifdef ETHOSU
// Initialize Ethos-U NPU driver
- if (ethosu_init(ethosu0_driver,
+ if (ethosu_init(&ethosu0_driver,
reinterpret_cast<void *>(ETHOSU_BASE_ADDRESS),
ethosu_scratch,
ETHOSU_FAST_MEMORY_SIZE,