Developer World
Spresense SDK Library v1.4.2-3df2e9d
audio_object_common_api.h
Go to the documentation of this file.
1 /****************************************************************************
2  * modules/include/audio/audio_object_common_api.h
3  *
4  * Copyright 2018 Sony Semiconductor Solutions Corporation
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in
14  * the documentation and/or other materials provided with the
15  * distribution.
16  * 3. Neither the name of Sony Semiconductor Solutions Corporation nor
17  * the names of its contributors may be used to endorse or promote
18  * products derived from this software without specific prior written
19  * permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *
34  ****************************************************************************/
35 
36 #ifndef __MODULES_INCLUDE_AUDIO_AUDIO_OBJECT_COMMON_API_H
37 #define __MODULES_INCLUDE_AUDIO_AUDIO_OBJECT_COMMON_API_H
38 
53 /****************************************************************************
54  * Included Files
55  ****************************************************************************/
56 
57 #include <stdint.h>
58 #include <stdbool.h>
59 #include <string.h>
60 #include <stdlib.h>
61 #include "memutils/message/MsgPacket.h"
62 
63 /****************************************************************************
64  * Pre-processor Definitions
65  ****************************************************************************/
66 
67 enum AudioObjReplyType_e
68 {
69  AS_OBJ_REPLY_TYPE_REQ = 0,
70  AS_OBJ_REPLY_TYPE_EVT,
71  AS_OBJ_REPLY_TYPE_FREE,
72 };
73 
74 /****************************************************************************
75  * Public Types
76  ****************************************************************************/
77 
79 {
80  uint32_t id;
81  AudioObjReplyType_e type;
82  uint8_t module_id;
83  uint32_t result;
85  AudioObjReply():
86  id(0xFFFFFFFF),
87  type(AS_OBJ_REPLY_TYPE_FREE),
88  module_id(0xFF),
89  result(0xFFFFFFFF)
90  {}
91 
92  AudioObjReply(uint32_t arg_id,
93  AudioObjReplyType_e arg_type,
94  uint8_t arg_module_id,
95  uint32_t arg_result):
96  id(arg_id),
97  type(arg_type),
98  module_id(arg_module_id),
99  result(arg_result)
100  {}
101 };
102 
103 /****************************************************************************
104  * Public Data
105  ****************************************************************************/
106 
107 /****************************************************************************
108  * Inline Functions
109  ****************************************************************************/
110 
111 /****************************************************************************
112  * Public Function Prototypes
113  ****************************************************************************/
114 
125 template <typename T>
126 bool AS_ReceiveObjectReply(MsgQueId msgq_id,
127  T *reply);
128 
129 /* Default template cannot use at C++99 */
130 
131 bool AS_ReceiveObjectReply(MsgQueId msgq_id,
132  AudioObjReply *reply);
133 
146 template <typename T>
147 bool AS_ReceiveObjectReply(MsgQueId msgq_id,
148  uint32_t ms,
149  T *reply);
150 
151 bool AS_ReceiveObjectReply(MsgQueId msgq_id,
152  uint32_t ms,
153  AudioObjReply *reply);
154 
155 #endif /* __MODULES_INCLUDE_AUDIO_AUDIO_OBJECT_COMMON_API_H */
156 
uint32_t result
Definition: audio_object_common_api.h:83
uint8_t module_id
Definition: audio_object_common_api.h:82
uint32_t id
Definition: audio_object_common_api.h:80
Definition: audio_object_common_api.h:78
AudioObjReplyType_e type
Definition: audio_object_common_api.h:81
bool AS_ReceiveObjectReply(MsgQueId msgq_id, T *reply)
Wait until an asynchronous event is received from the object layer.