From 3d5816a07c22dd6c655a60000fb0f175d613e484 Mon Sep 17 00:00:00 2001 From: fulup Date: Wed, 5 Jul 2017 22:31:54 +0200 Subject: Added a POC for ALSA/HAL plugin --- HAL-afb/HAL-plugin/HalPlug.h | 92 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 HAL-afb/HAL-plugin/HalPlug.h (limited to 'HAL-afb/HAL-plugin/HalPlug.h') 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 + * + * 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 +#include +#include + +#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; + + -- cgit 1.2.3-korg