diff options
author | Hans Chen | 2018-07-17 18:22:03 -0500 |
---|---|---|
committer | android-build-merger | 2018-07-17 18:22:03 -0500 |
commit | 2fd891939bed9f4b8076a7c2d39ff637d699f95d (patch) | |
tree | 9265803f93ea9b86f1d05ca1497a50c286f71fa0 /tests | |
parent | 456c9ebbcf0e36418fbc0a095d604bbb7f3a445a (diff) | |
parent | 58d52f70b30d4c6d9b55fe03981f8a5292947eeb (diff) | |
download | platform-hardware-interfaces-2fd891939bed9f4b8076a7c2d39ff637d699f95d.tar.gz platform-hardware-interfaces-2fd891939bed9f4b8076a7c2d39ff637d699f95d.tar.xz platform-hardware-interfaces-2fd891939bed9f4b8076a7c2d39ff637d699f95d.zip |
Modified ITestMsgQ hal service interface
am: 58d52f70b3
Change-Id: Iaea0a9ebef6ff4ef5a2cb0beedafd05376d0c09c
Diffstat (limited to 'tests')
-rw-r--r-- | tests/msgq/1.0/ITestMsgQ.hal | 10 | ||||
-rw-r--r-- | tests/msgq/1.0/default/TestMsgQ.cpp | 29 | ||||
-rw-r--r-- | tests/msgq/1.0/default/TestMsgQ.h | 2 |
3 files changed, 19 insertions, 22 deletions
diff --git a/tests/msgq/1.0/ITestMsgQ.hal b/tests/msgq/1.0/ITestMsgQ.hal index 350e26d9..112270a9 100644 --- a/tests/msgq/1.0/ITestMsgQ.hal +++ b/tests/msgq/1.0/ITestMsgQ.hal | |||
@@ -24,14 +24,14 @@ interface ITestMsgQ { | |||
24 | 24 | ||
25 | /** | 25 | /** |
26 | * This method requests the service to set up a synchronous read/write | 26 | * This method requests the service to set up a synchronous read/write |
27 | * wait-free FMQ with the client as reader. | 27 | * wait-free FMQ using the input descriptor with the client as reader. |
28 | * | ||
29 | * @param mqDesc This structure describes the FMQ that was set up by the | ||
30 | * client. Server uses this descriptor to set up a FMQ object at its end. | ||
28 | * | 31 | * |
29 | * @return ret True if the setup is successful. | 32 | * @return ret True if the setup is successful. |
30 | * @return mqDesc This structure describes the FMQ that was | ||
31 | * set up by the service. Client can use it to set up the FMQ at its end. | ||
32 | */ | 33 | */ |
33 | configureFmqSyncReadWrite() | 34 | configureFmqSyncReadWrite(fmq_sync<uint16_t> mqDesc) generates(bool ret); |
34 | generates(bool ret, fmq_sync<uint16_t> mqDesc); | ||
35 | 35 | ||
36 | /** | 36 | /** |
37 | * This method requests the service to return an MQDescriptor to | 37 | * This method requests the service to return an MQDescriptor to |
diff --git a/tests/msgq/1.0/default/TestMsgQ.cpp b/tests/msgq/1.0/default/TestMsgQ.cpp index 6fd4fc6b..ba665c92 100644 --- a/tests/msgq/1.0/default/TestMsgQ.cpp +++ b/tests/msgq/1.0/default/TestMsgQ.cpp | |||
@@ -24,24 +24,21 @@ namespace V1_0 { | |||
24 | namespace implementation { | 24 | namespace implementation { |
25 | 25 | ||
26 | // Methods from ::android::hardware::tests::msgq::V1_0::ITestMsgQ follow. | 26 | // Methods from ::android::hardware::tests::msgq::V1_0::ITestMsgQ follow. |
27 | Return<void> TestMsgQ::configureFmqSyncReadWrite(configureFmqSyncReadWrite_cb _hidl_cb) { | 27 | Return<bool> TestMsgQ::configureFmqSyncReadWrite( |
28 | static constexpr size_t kNumElementsInQueue = 1024; | 28 | const android::hardware::MQDescriptorSync<uint16_t>& mqDesc) { |
29 | mFmqSynchronized.reset(new (std::nothrow) MessageQueueSync( | 29 | mFmqSynchronized.reset(new (std::nothrow) MessageQueueSync(mqDesc)); |
30 | kNumElementsInQueue, true /* configureEventFlagWord */)); | ||
31 | if ((mFmqSynchronized == nullptr) || (mFmqSynchronized->isValid() == false)) { | 30 | if ((mFmqSynchronized == nullptr) || (mFmqSynchronized->isValid() == false)) { |
32 | _hidl_cb(false /* ret */, MessageQueueSync::Descriptor()); | 31 | return false; |
33 | } else { | ||
34 | /* | ||
35 | * Initialize the EventFlag word with bit FMQ_NOT_FULL. | ||
36 | */ | ||
37 | auto evFlagWordPtr = mFmqSynchronized->getEventFlagWord(); | ||
38 | if (evFlagWordPtr != nullptr) { | ||
39 | std::atomic_init(evFlagWordPtr, | ||
40 | static_cast<uint32_t>(ITestMsgQ::EventFlagBits::FMQ_NOT_FULL)); | ||
41 | } | ||
42 | _hidl_cb(true /* ret */, *mFmqSynchronized->getDesc()); | ||
43 | } | 32 | } |
44 | return Void(); | 33 | /* |
34 | * Initialize the EventFlag word with bit FMQ_NOT_FULL. | ||
35 | */ | ||
36 | auto evFlagWordPtr = mFmqSynchronized->getEventFlagWord(); | ||
37 | if (evFlagWordPtr != nullptr) { | ||
38 | std::atomic_init(evFlagWordPtr, | ||
39 | static_cast<uint32_t>(ITestMsgQ::EventFlagBits::FMQ_NOT_FULL)); | ||
40 | } | ||
41 | return true; | ||
45 | } | 42 | } |
46 | 43 | ||
47 | Return<void> TestMsgQ::getFmqUnsyncWrite(bool configureFmq, getFmqUnsyncWrite_cb _hidl_cb) { | 44 | Return<void> TestMsgQ::getFmqUnsyncWrite(bool configureFmq, getFmqUnsyncWrite_cb _hidl_cb) { |
diff --git a/tests/msgq/1.0/default/TestMsgQ.h b/tests/msgq/1.0/default/TestMsgQ.h index 86e4ac40..f9fcddd4 100644 --- a/tests/msgq/1.0/default/TestMsgQ.h +++ b/tests/msgq/1.0/default/TestMsgQ.h | |||
@@ -55,7 +55,7 @@ struct TestMsgQ : public ITestMsgQ { | |||
55 | TestMsgQ() : mFmqSynchronized(nullptr), mFmqUnsynchronized(nullptr) {} | 55 | TestMsgQ() : mFmqSynchronized(nullptr), mFmqUnsynchronized(nullptr) {} |
56 | 56 | ||
57 | // Methods from ::android::hardware::tests::msgq::V1_0::ITestMsgQ follow. | 57 | // Methods from ::android::hardware::tests::msgq::V1_0::ITestMsgQ follow. |
58 | Return<void> configureFmqSyncReadWrite(configureFmqSyncReadWrite_cb _hidl_cb) override; | 58 | Return<bool> configureFmqSyncReadWrite(const MQDescriptorSync<uint16_t>& mqDesc) override; |
59 | Return<void> getFmqUnsyncWrite(bool configureFmq, getFmqUnsyncWrite_cb _hidl_cb) override; | 59 | Return<void> getFmqUnsyncWrite(bool configureFmq, getFmqUnsyncWrite_cb _hidl_cb) override; |
60 | Return<bool> requestWriteFmqSync(int32_t count) override; | 60 | Return<bool> requestWriteFmqSync(int32_t count) override; |
61 | Return<bool> requestReadFmqSync(int32_t count) override; | 61 | Return<bool> requestReadFmqSync(int32_t count) override; |