blob: 8a2303c456ee1ac8d2987eff3808e1926fd263ec [file] [log] [blame]
Phil Burk828bea52017-01-03 17:22:09 -08001/*
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
Phil Burk5ed503c2017-02-01 09:38:15 -080017#ifndef BINDING_AAUDIOSERVICEDEFINITIONS_H
18#define BINDING_AAUDIOSERVICEDEFINITIONS_H
Phil Burk828bea52017-01-03 17:22:09 -080019
20#include <stdint.h>
21#include <utils/RefBase.h>
22#include <binder/TextOutput.h>
23#include <binder/IInterface.h>
24
Phil Burk5ed503c2017-02-01 09:38:15 -080025#include <aaudio/AAudio.h>
Phil Burk828bea52017-01-03 17:22:09 -080026
27using android::NO_ERROR;
28using android::IBinder;
29
Phil Burk204a1632017-01-03 17:23:43 -080030namespace android {
31
Phil Burk11e8d332017-05-24 09:59:02 -070032enum aaudio_service_commands_t {
33 REGISTER_CLIENT = IBinder::FIRST_CALL_TRANSACTION,
34 OPEN_STREAM,
Phil Burk204a1632017-01-03 17:23:43 -080035 CLOSE_STREAM,
36 GET_STREAM_DESCRIPTION,
37 START_STREAM,
38 PAUSE_STREAM,
Phil Burk71f35bb2017-04-13 16:05:07 -070039 STOP_STREAM,
Phil Burk204a1632017-01-03 17:23:43 -080040 FLUSH_STREAM,
41 REGISTER_AUDIO_THREAD,
Phil Burkdec33ab2017-01-17 14:48:16 -080042 UNREGISTER_AUDIO_THREAD
Phil Burk204a1632017-01-03 17:23:43 -080043};
44
Phil Burk11e8d332017-05-24 09:59:02 -070045enum aaudio_client_commands_t {
46 ON_STREAM_CHANGE = IBinder::FIRST_CALL_TRANSACTION
47};
48
Phil Burk204a1632017-01-03 17:23:43 -080049} // namespace android
50
Phil Burk5ed503c2017-02-01 09:38:15 -080051namespace aaudio {
Phil Burk828bea52017-01-03 17:22:09 -080052
Phil Burk3316d5e2017-02-15 11:23:01 -080053typedef int32_t aaudio_handle_t;
54
55#define AAUDIO_HANDLE_INVALID ((aaudio_handle_t) -1)
56
Phil Burk828bea52017-01-03 17:22:09 -080057// This must be a fixed width so it can be in shared memory.
58enum RingbufferFlags : uint32_t {
59 NONE = 0,
60 RATE_ISOCHRONOUS = 0x0001,
61 RATE_ASYNCHRONOUS = 0x0002,
62 COHERENCY_DMA = 0x0004,
63 COHERENCY_ACQUIRE_RELEASE = 0x0008,
64 COHERENCY_AUTO = 0x0010,
65};
66
67// This is not passed through Binder.
68// Client side code will convert Binder data and fill this descriptor.
69typedef struct RingBufferDescriptor_s {
70 uint8_t* dataAddress; // offset from read or write block
71 int64_t* writeCounterAddress;
72 int64_t* readCounterAddress;
73 int32_t bytesPerFrame; // index is in frames
74 int32_t framesPerBurst; // for ISOCHRONOUS queues
75 int32_t capacityInFrames; // zero if unused
76 RingbufferFlags flags;
77} RingBufferDescriptor;
78
79// This is not passed through Binder.
80// Client side code will convert Binder data and fill this descriptor.
81typedef struct EndpointDescriptor_s {
82 // Set capacityInFrames to zero if Queue is unused.
83 RingBufferDescriptor upMessageQueueDescriptor; // server to client
84 RingBufferDescriptor downMessageQueueDescriptor; // client to server
Phil Burk87c9f642017-05-17 07:22:39 -070085 RingBufferDescriptor dataQueueDescriptor; // playback or capture
Phil Burk828bea52017-01-03 17:22:09 -080086} EndpointDescriptor;
87
Phil Burk5ed503c2017-02-01 09:38:15 -080088} // namespace aaudio
Phil Burk828bea52017-01-03 17:22:09 -080089
Phil Burk5ed503c2017-02-01 09:38:15 -080090#endif //BINDING_AAUDIOSERVICEDEFINITIONS_H