aboutsummaryrefslogtreecommitdiffstats
path: root/HAL-afb/HAL-plugin/HalPlug.h
diff options
context:
space:
mode:
authorfulup <fulup.arfoll@iot.bzh>2017-07-05 22:31:54 +0200
committerfulup <fulup.arfoll@iot.bzh>2017-07-05 22:31:54 +0200
commit3d5816a07c22dd6c655a60000fb0f175d613e484 (patch)
treee96ebc4d7fc38c79d2aae61fde0f5789f4219c9c /HAL-afb/HAL-plugin/HalPlug.h
parent85a4c0a1e0f666505cf2a2922c12e78b3c83c062 (diff)
Added a POC for ALSA/HAL plugin
Diffstat (limited to 'HAL-afb/HAL-plugin/HalPlug.h')
-rw-r--r--HAL-afb/HAL-plugin/HalPlug.h92
1 files changed, 92 insertions, 0 deletions
diff --git a/HAL-afb/HAL-plugin/HalPlug.h b/HAL-afb/HAL-plugin/HalPlug.h
new file mode 100644
index 0000000..5e3da6f
--- /dev/null
+++ b/HAL-afb/HAL-plugin/HalPlug.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2016 "IoT.bzh"
+ * Author Fulup Ar Foll <fulup@iot.bzh>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * AfbCallBack (snd_ctl_hal_t *handle, int numid, void **response);
+ * AfbHalInit is mandatory and called with numid=0
+ *
+ * Syntaxe in .asoundrc file
+ * CrlLabel { cb MyFunctionName name "My_Second_Control" }
+ */
+
+
+#include <alsa/asoundlib.h>
+#include <alsa/control_external.h>
+#include <linux/soundcard.h>
+
+#ifndef SOUND_HAL_MAX_CTLS
+#define SOUND_HAL_MAX_CTLS 255
+#endif
+
+
+typedef enum {
+ CTLCB_INIT ,
+ CTLCB_CLOSE ,
+ CTLCB_ELEM_COUNT ,
+ CTLCB_ELEM_LIST ,
+ CTLCB_FIND_ELEM ,
+ CTLCB_FREE_KEY ,
+ CTLCB_GET_ATTRIBUTE ,
+ CTLCB_GET_INTEGER_INFO ,
+ CTLCB_GET_INTEGER64_INFO ,
+ CTLCB_GET_ENUMERATED_INFO ,
+ CTLCB_GET_ENUMERATED_NAME ,
+ CTLCB_READ_INTEGER ,
+ CTLCB_READ_INTEGER64 ,
+ CTLCB_READ_ENUMERATED ,
+ CTLCB_READ_BYTES ,
+ CTLCB_READ_IEC958 ,
+ CTLCB_WRITE_INTEGER ,
+ CTLCB_WRITE_INTEGER64 ,
+ CTLCB_WRITE_ENUMERATED ,
+ CTLCB_WRITE_BYTES ,
+ CTLCB_WRITE_IEC958 ,
+ CTLCB_SUBSCRIBE_EVENTS ,
+ CTLCB_READ_EVENT ,
+ CTLCB_POLL_DESCRIPTORS_COUNT ,
+ CTLCB_POLL_DESCRIPTORS
+} snd_ctl_action_t;
+
+typedef struct {
+ int ctlNumid;
+ const char *ctlName;
+} snd_ctl_conf_t;
+
+typedef struct {
+ int type;
+ int acc;
+ unsigned count;
+} snd_ctl_get_attrib_t;
+
+typedef struct {
+ int imin;
+ int imax;
+ int istep;
+} snd_ctl_get_int_info_t;
+
+typedef int(*snd_ctl_cb_t)(void *handle, snd_ctl_action_t action, snd_ctl_ext_key_t key, void *response);
+
+typedef struct snd_ctl_hal {
+ snd_ctl_ext_t ext;
+ char *devid;
+ snd_ctl_t *ctlDev;
+ unsigned int ctlsCount;
+ void *dlHandle;
+ snd_ctl_conf_t ctls[SOUND_HAL_MAX_CTLS];
+ snd_ctl_elem_info_t *infos[SOUND_HAL_MAX_CTLS];
+ snd_ctl_cb_t cbs[SOUND_HAL_MAX_CTLS];
+} snd_ctl_hal_t;
+
+