diff options
author | Jonny Svärd <jonny.svaerd@arm.com> | 2020-10-06 14:18:28 +0200 |
---|---|---|
committer | Jonny Svärd <jonny.svaerd@arm.com> | 2020-10-09 14:23:21 +0200 |
commit | 44398c86f932b96911dd1558e2b66726943fcf46 (patch) | |
tree | c2ff3e24735c511f07dd902ebb7430602bec17d9 /applications/message_process/src | |
parent | dc28b13e8bf4e5e7a788f289739e6301494c43a1 (diff) | |
download | ethos-u-core-software-44398c86f932b96911dd1558e2b66726943fcf46.tar.gz |
Add a Mailbox interface
Change-Id: If68e70709c496849cb781af5f7288fa3f7ddcdb5
Diffstat (limited to 'applications/message_process/src')
-rw-r--r-- | applications/message_process/src/message_process.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/applications/message_process/src/message_process.cc b/applications/message_process/src/message_process.cc index 4333640..4533455 100644 --- a/applications/message_process/src/message_process.cc +++ b/applications/message_process/src/message_process.cc @@ -100,10 +100,6 @@ bool QueueImpl::write(const Vec *vec, size_t length) { SCB_CleanDCache(); #endif - // TODO replace with mailbox driver APIs - volatile uint32_t *set = reinterpret_cast<volatile uint32_t *>(0x41A00014); - *set = 0x1; - return true; } @@ -132,9 +128,12 @@ bool QueueImpl::skip(uint32_t length) { MessageProcess::MessageProcess(ethosu_core_queue &in, ethosu_core_queue &out, + Mailbox::Mailbox &mbox, ::InferenceProcess::InferenceProcess &_inferenceProcess) : queueIn(in), - queueOut(out), inferenceProcess(_inferenceProcess) {} + queueOut(out), mailbox(mbox), inferenceProcess(_inferenceProcess) { + mailbox.registerCallback(mailboxCallback, reinterpret_cast<void *>(this)); +} void MessageProcess::run() { while (true) { @@ -238,6 +237,7 @@ void MessageProcess::sendPong() { if (!queueOut.write(ETHOSU_CORE_MSG_PONG)) { printf("Failed to write pong.\n"); } + mailbox.sendMessage(); } void MessageProcess::sendInferenceRsp(uint64_t userArg, vector<DataPtr> &ofm, bool failed) { @@ -259,5 +259,12 @@ void MessageProcess::sendInferenceRsp(uint64_t userArg, vector<DataPtr> &ofm, bo if (!queueOut.write(ETHOSU_CORE_MSG_INFERENCE_RSP, rsp)) { printf("Failed to write inference.\n"); } + mailbox.sendMessage(); } + +void MessageProcess::mailboxCallback(void *userArg) { + MessageProcess *_this = reinterpret_cast<MessageProcess *>(userArg); + _this->handleIrq(); +} + } // namespace MessageProcess |