Martijn Coenen | cbe590c | 2016-08-30 11:27:56 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Hridya Valsaraju | 3e32003 | 2016-08-08 11:12:30 -0700 | [diff] [blame] | 17 | package android.hardware.tests.msgq@1.0; |
| 18 | |
| 19 | interface ITestMsgQ { |
Hridya Valsaraju | 710e4a3 | 2016-12-15 09:14:13 -0800 | [diff] [blame] | 20 | enum EventFlagBits : uint32_t { |
Devin Moore | 44e0d47 | 2024-07-12 01:20:35 +0000 | [diff] [blame] | 21 | FMQ_NOT_FULL = 1 << 0, |
| 22 | FMQ_NOT_EMPTY = 1 << 1, |
Hridya Valsaraju | 710e4a3 | 2016-12-15 09:14:13 -0800 | [diff] [blame] | 23 | }; |
| 24 | |
Andreas Huber | 3e4acb8 | 2017-03-28 14:40:58 -0700 | [diff] [blame] | 25 | /** |
Hridya Valsaraju | b435845 | 2016-10-14 16:48:01 -0700 | [diff] [blame] | 26 | * This method requests the service to set up a synchronous read/write |
Hans Chen | 58d52f7 | 2018-07-14 17:23:45 -0700 | [diff] [blame] | 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. |
Hridya Valsaraju | b435845 | 2016-10-14 16:48:01 -0700 | [diff] [blame] | 31 | * |
| 32 | * @return ret True if the setup is successful. |
Hridya Valsaraju | 9d9672c | 2016-09-21 17:47:06 -0700 | [diff] [blame] | 33 | */ |
Devin Moore | 7a26802 | 2020-09-22 17:20:54 +0000 | [diff] [blame] | 34 | configureFmqSyncReadWrite(fmq_sync<int32_t> mqDesc) generates(bool ret); |
Hridya Valsaraju | 3e32003 | 2016-08-08 11:12:30 -0700 | [diff] [blame] | 35 | |
Andreas Huber | 3e4acb8 | 2017-03-28 14:40:58 -0700 | [diff] [blame] | 36 | /** |
Hridya Valsaraju | c3db9c8 | 2017-02-13 14:38:26 -0800 | [diff] [blame] | 37 | * This method requests the service to return an MQDescriptor to |
| 38 | * an unsynchronized FMQ set up by the server. If 'configureFmq' is |
| 39 | * true, then the server sets up a new unsynchronized FMQ. This |
| 40 | * method is to be used to test multiple reader processes. |
Hridya Valsaraju | b435845 | 2016-10-14 16:48:01 -0700 | [diff] [blame] | 41 | * |
Hridya Valsaraju | c3db9c8 | 2017-02-13 14:38:26 -0800 | [diff] [blame] | 42 | * @param configureFmq The server sets up a new unsynchronized FMQ if |
| 43 | * this parameter is true. |
Devin Moore | 17365e5 | 2021-01-18 16:11:20 -0800 | [diff] [blame] | 44 | * @param userFd True to initialize the message queue with a user supplied |
| 45 | * file descriptor for the ring buffer. |
| 46 | * False to let the message queue use a single FD for everything. |
Hridya Valsaraju | c3db9c8 | 2017-02-13 14:38:26 -0800 | [diff] [blame] | 47 | * |
| 48 | * @return ret True if successful. |
| 49 | * @return mqDesc This structure describes the unsynchronized FMQ that was |
Hridya Valsaraju | b435845 | 2016-10-14 16:48:01 -0700 | [diff] [blame] | 50 | * set up by the service. Client can use it to set up the FMQ at its end. |
Hridya Valsaraju | 9d9672c | 2016-09-21 17:47:06 -0700 | [diff] [blame] | 51 | */ |
Devin Moore | 17365e5 | 2021-01-18 16:11:20 -0800 | [diff] [blame] | 52 | getFmqUnsyncWrite(bool configureFmq, bool userFd) generates(bool ret, fmq_unsync<int32_t> mqDesc); |
Hridya Valsaraju | 3e32003 | 2016-08-08 11:12:30 -0700 | [diff] [blame] | 53 | |
Andreas Huber | 3e4acb8 | 2017-03-28 14:40:58 -0700 | [diff] [blame] | 54 | /** |
Hridya Valsaraju | b435845 | 2016-10-14 16:48:01 -0700 | [diff] [blame] | 55 | * This method request the service to write into the synchronized read/write |
| 56 | * flavor of the FMQ. |
| 57 | * |
| 58 | * @param count Number to messages to write. |
| 59 | * |
| 60 | * @return ret True if the write operation was successful. |
Hridya Valsaraju | 9d9672c | 2016-09-21 17:47:06 -0700 | [diff] [blame] | 61 | */ |
Hridya Valsaraju | b435845 | 2016-10-14 16:48:01 -0700 | [diff] [blame] | 62 | requestWriteFmqSync(int32_t count) generates(bool ret); |
| 63 | |
Andreas Huber | 3e4acb8 | 2017-03-28 14:40:58 -0700 | [diff] [blame] | 64 | /** |
Hridya Valsaraju | b435845 | 2016-10-14 16:48:01 -0700 | [diff] [blame] | 65 | * This method request the service to read from the synchronized read/write |
| 66 | * FMQ. |
| 67 | * |
| 68 | * @param count Number to messages to read. |
| 69 | * |
| 70 | * @return ret True if the read operation was successful. |
| 71 | */ |
| 72 | requestReadFmqSync(int32_t count) generates(bool ret); |
| 73 | |
Andreas Huber | 3e4acb8 | 2017-03-28 14:40:58 -0700 | [diff] [blame] | 74 | /** |
Hridya Valsaraju | b435845 | 2016-10-14 16:48:01 -0700 | [diff] [blame] | 75 | * This method request the service to write into the unsynchronized flavor |
| 76 | * of FMQ. |
| 77 | * |
| 78 | * @param count Number to messages to write. |
| 79 | * |
| 80 | * @return ret True if the write operation was successful. |
| 81 | */ |
| 82 | requestWriteFmqUnsync(int32_t count) generates(bool ret); |
| 83 | |
Andreas Huber | 3e4acb8 | 2017-03-28 14:40:58 -0700 | [diff] [blame] | 84 | /** |
Hridya Valsaraju | b435845 | 2016-10-14 16:48:01 -0700 | [diff] [blame] | 85 | * This method request the service to read from the unsynchronized flavor of |
| 86 | * FMQ. |
| 87 | * |
| 88 | * @param count Number to messages to read. |
| 89 | * |
| 90 | * @return ret Will be True if the read operation was successful. |
| 91 | */ |
| 92 | requestReadFmqUnsync(int32_t count) generates(bool ret); |
| 93 | |
Andreas Huber | 3e4acb8 | 2017-03-28 14:40:58 -0700 | [diff] [blame] | 94 | /** |
Hridya Valsaraju | 710e4a3 | 2016-12-15 09:14:13 -0800 | [diff] [blame] | 95 | * This method requests the service to trigger a blocking read. |
| 96 | * |
| 97 | * @param count Number of messages to read. |
| 98 | * |
| 99 | */ |
| 100 | oneway requestBlockingRead(int32_t count); |
Hridya Valsaraju | 9ba9244 | 2017-01-04 16:19:36 -0800 | [diff] [blame] | 101 | |
Andreas Huber | 3e4acb8 | 2017-03-28 14:40:58 -0700 | [diff] [blame] | 102 | /** |
Hridya Valsaraju | 586bed1 | 2017-01-13 20:58:17 -0800 | [diff] [blame] | 103 | * This method requests the service to trigger a blocking read using |
| 104 | * default Event Flag notification bits defined by the MessageQueue class. |
| 105 | * |
| 106 | * @param count Number of messages to read. |
| 107 | * |
| 108 | */ |
| 109 | oneway requestBlockingReadDefaultEventFlagBits(int32_t count); |
| 110 | |
Andreas Huber | 3e4acb8 | 2017-03-28 14:40:58 -0700 | [diff] [blame] | 111 | /** |
Hridya Valsaraju | 9ba9244 | 2017-01-04 16:19:36 -0800 | [diff] [blame] | 112 | * This method requests the service to repeatedly trigger blocking reads. |
| 113 | * |
| 114 | * @param count Number of messages to read in a single blocking read. |
| 115 | * @param numIter Number of blocking reads to trigger. |
| 116 | * |
| 117 | */ |
| 118 | oneway requestBlockingReadRepeat(int32_t count, int32_t numIter); |
| 119 | |
Hridya Valsaraju | 3e32003 | 2016-08-08 11:12:30 -0700 | [diff] [blame] | 120 | }; |