summaryrefslogtreecommitdiffstats
path: root/AlsaSound/HardAbsLayer
diff options
context:
space:
mode:
authorFulup Ar Foll <fulup@iot.bzh>2017-03-09 15:58:04 +0100
committerFulup Ar Foll <fulup@iot.bzh>2017-03-09 15:58:04 +0100
commit5cb52e556fed8eb0cf74d1052fe413fbb7406b0e (patch)
tree80965e8ad49b5191b200b6bbb1241c4718a0c000 /AlsaSound/HardAbsLayer
parenta237499e8c2e2a045ae3eea0b9a4aaac12032e81 (diff)
Syncup Status with Microchip
Diffstat (limited to 'AlsaSound/HardAbsLayer')
-rw-r--r--AlsaSound/HardAbsLayer/CMakeLists.txt23
-rw-r--r--AlsaSound/HardAbsLayer/IntelHda/CMakeLists.txt36
-rw-r--r--AlsaSound/HardAbsLayer/IntelHda/IntelHdaBinding.c82
-rw-r--r--AlsaSound/HardAbsLayer/IntelHda/IntelHdaLib.c138
-rw-r--r--AlsaSound/HardAbsLayer/IntelHda/IntelHdaLib.h49
5 files changed, 0 insertions, 328 deletions
diff --git a/AlsaSound/HardAbsLayer/CMakeLists.txt b/AlsaSound/HardAbsLayer/CMakeLists.txt
deleted file mode 100644
index e24a9d9..0000000
--- a/AlsaSound/HardAbsLayer/CMakeLists.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-###########################################################################
-# Copyright 2015, 2016, 2017 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.
-###########################################################################
-
-PROJECT(hadware-abstraction-layer C)
-
-
-ADD_SUBDIRECTORY(IntelHda)
-
diff --git a/AlsaSound/HardAbsLayer/IntelHda/CMakeLists.txt b/AlsaSound/HardAbsLayer/IntelHda/CMakeLists.txt
deleted file mode 100644
index 0d3f344..0000000
--- a/AlsaSound/HardAbsLayer/IntelHda/CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-###########################################################################
-# Copyright 2015, 2016, 2017 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.
-###########################################################################
-
-
-INCLUDE_DIRECTORIES(${include_dirs})
-
-##################################################
-# Inte-HDA sound card Hardware Abstraction Layer
-##################################################
-ADD_LIBRARY(intel-hda-hal MODULE IntelHdaBinding.c IntelHdaLib.c)
-
-SET_TARGET_PROPERTIES(intel-hda-hal PROPERTIES
- PREFIX ""
- LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/export.map"
-)
-
-TARGET_LINK_LIBRARIES(intel-hda-hal ${link_libraries})
-INSTALL(TARGETS intel-hda-hal
- LIBRARY DESTINATION ${binding_install_dir})
-
-
diff --git a/AlsaSound/HardAbsLayer/IntelHda/IntelHdaBinding.c b/AlsaSound/HardAbsLayer/IntelHda/IntelHdaBinding.c
deleted file mode 100644
index 0452314..0000000
--- a/AlsaSound/HardAbsLayer/IntelHda/IntelHdaBinding.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.
- */
-
-#define _GNU_SOURCE
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <netdb.h>
-#include <fcntl.h>
-#include <math.h>
-#include <sys/time.h>
-#include <sys/types.h>
-
-#include "IntelHdaLib.h"
-
-PUBLIC const struct afb_binding_interface *afbIface;
-
-STATIC void localping(struct afb_req request) {
- json_object *query = afb_req_json(request);
- afb_req_success(request, query, NULL);
-}
-
-/*
- * array of the verbs exported to afb-daemon
- */
-STATIC const struct afb_verb_desc_v1 binding_verbs[] = {
- /* VERB'S NAME SESSION MANAGEMENT FUNCTION TO CALL SHORT DESCRIPTION */
- { .name= "ping" , .session= AFB_SESSION_NONE, .callback= localping, .info= "Ping Binding" },
- { .name= "setvolume", .session= AFB_SESSION_NONE, .callback= intelHdaSetVol, .info= "Set Volume" },
- { .name= "getvolume", .session= AFB_SESSION_NONE, .callback= intelHdaGetVol, .info= "Get Volume" },
- { .name= "subscribe", .session= AFB_SESSION_NONE, .callback= intelHdaSubscribe, .info= "Subscribe AudioBinding Events" },
- { .name= NULL } /* marker for end of the array */
-};
-
-/*
- * description of the binding for afb-daemon
- */
-STATIC const struct afb_binding binding_description = {
- /* description conforms to VERSION 1 */
- .type= AFB_BINDING_VERSION_1,
- .v1= {
- .prefix= "intel-hda",
- .info= "Hardware Abstraction Layer for IntelHDA sound card",
- .verbs = binding_verbs
- }
-};
-
-// This receive all event this binding subscribe to
-PUBLIC void afbBindingV1ServiceEvent(const char *evtname, struct json_object *object) {
-
- NOTICE (afbIface, "afbBindingV1ServiceEvent evtname=%s [msg=%s]", evtname, json_object_to_json_string(object));
-}
-
-// this is call when after all bindings are loaded
-PUBLIC int afbBindingV1ServiceInit(struct afb_service service) {
-
- return (intelHdaInit(service, binding_description.v1.prefix));
-};
-
-/*
- * activation function for registering the binding called by afb-daemon
- */
-PUBLIC const struct afb_binding *afbBindingV1Register(const struct afb_binding_interface *itf) {
- afbIface= itf;
- return &binding_description; /* returns the description of the binding */
-}
-
diff --git a/AlsaSound/HardAbsLayer/IntelHda/IntelHdaLib.c b/AlsaSound/HardAbsLayer/IntelHda/IntelHdaLib.c
deleted file mode 100644
index ad4fcf4..0000000
--- a/AlsaSound/HardAbsLayer/IntelHda/IntelHdaLib.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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.
- *
- * reference:
- * amixer contents; amixer controls;
- * http://www.tldp.org/HOWTO/Alsa-sound-6.html
- */
-#define _GNU_SOURCE // needed for vasprintf
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <netdb.h>
-#include <fcntl.h>
-#include <math.h>
-#include <sys/time.h>
-#include <sys/types.h>
-
-#include "IntelHdaLib.h"
-#include "AlsaMixerHal.h"
-
-static struct afb_service srvitf;
-
-// Normalise Intel-HDA numid
-static AlsaHalMapT alsaCtlsMap[]= { // check with amixer -D hw:xx controls; amixer -D "hw:3" cget numid=xx
- /* ACTION(enum) NUMID(int) IFACE(enum) VALUES(int) MinVal(int) MaxVal(int) Step(int) ACL=READ|WRITE|RW INFO=comment */
- { .action=Master_Playback_Volume, .numid=16, .group=OUTVOL, .values=1, .minval=0, .maxval= 87 , .step=0, .acl=RW, .info= "Master Playback Volume" },
- { .action=PCM_Playback_Volume , .numid=27, .group=PCMVOL, .values=2, .minval=0, .maxval= 255, .step=0, .acl=RW, .info= "PCM Playback Volume" },
- { .action=PCM_Playback_Switch , .numid=17, .group=SWITCH, .values=1, .minval=0, .maxval= 1 , .step=0, .acl=RW, .info= "Master Playback Switch" },
- { .action=Capture_Volume , .numid=12, .group=INVOL , .values=2, .minval=0, .maxval= 31 , .step=0, .acl=RW, .info= "Capture Volume" },
- { .numid=0 } /* marker for end of the array */
-} ;
-
-// Warning: Longname is used to locate board on the system
-static AlsaHalSndT alsaSndCard = {
- .longname= "HDA Intel PCH",
- .info = "Hardware Abstraction Layer for IntelHDA sound card",
- .ctls = alsaCtlsMap,
-};
-
-
-// This callback is fired when afb_service_call for api/alsacore/subctl returns
-STATIC void alsaSubcribeCB (void *handle, int iserror, struct json_object *result) {
- struct afb_req request = afb_req_unstore(handle);
- struct json_object *x, *resp = NULL;
- const char *info = NULL;
-
- if (result) {
- INFO (afbIface, "result=[%s]\n", json_object_to_json_string (result));
- if (json_object_object_get_ex(result, "request", &x) && json_object_object_get_ex(x, "info", &x))
- info = json_object_get_string(x);
- if (!json_object_object_get_ex(result, "response", &resp)) resp = NULL;
- }
-
- // push message respond
- if (iserror) afb_req_fail_f(request, "Fail", info);
- else afb_req_success(request, resp, info);
-
- // free calling request
- afb_req_unref(request);
-}
-
-// Create and subscribe to alsacore ctl events
-PUBLIC void intelHdaMonitor(struct afb_req request) {
-
- // save request in session as it might be used after return by callback
- struct afb_req *handle = afb_req_store(request);
-
- // push request to low level binding
- if (!handle) afb_req_fail(request, "error", "out of memory");
- else afb_service_call(srvitf, "alsacore", "subctl", json_object_get(afb_req_json(request)), alsaSubcribeCB, handle);
-
- // success/failure messages return from callback
-}
-
-// Subscribe to AudioBinding events
-PUBLIC void intelHdaSubscribe (struct afb_req request) {
- const char *devid = afb_req_value(request, "devid");
- if (devid == NULL) {
- afb_req_fail_f (request, "devid-missing", "devid=hw:xxx missing");
- }
-
-}
-
-
-// Call when all bindings are loaded and ready to accept request
-PUBLIC void intelHdaGetVol(struct afb_req request) {
-
- // Should call here Hardware Alsa Abstraction Layer for corresponding Sound Card
- afb_req_success (request, NULL, NULL);
- return;
-
-}
-
-PUBLIC void intelHdaSetVol(struct afb_req request) {
- const char *arg;
- char *pcm;
-
- arg = afb_req_value(request, "vol");
- if (arg == NULL) {
- afb_req_fail_f (request, "argument-missing", "vol=[0,100] missing");
- goto ExitOnError;
- }
-
- arg = afb_req_value(request, "pcm");
- if (arg == NULL) pcm="Master";
-
- // Should call here Hardware Alsa Abstraction Layer for corresponding Sound Card
- afb_req_success (request, NULL, NULL);
- return;
-
- ExitOnError:
- return;
-
-}
-
-
-// this function is call after all binder are loaded and initialised
-PUBLIC int intelHdaInit (struct afb_service service, const char *cardname) {
- srvitf = service;
-
- // API prefix is used as sndcard halname
- alsaSndCard.halname= cardname;
- return 0;
-} \ No newline at end of file
diff --git a/AlsaSound/HardAbsLayer/IntelHda/IntelHdaLib.h b/AlsaSound/HardAbsLayer/IntelHda/IntelHdaLib.h
deleted file mode 100644
index edf9474..0000000
--- a/AlsaSound/HardAbsLayer/IntelHda/IntelHdaLib.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * AlsaLibMapping -- provide low level interface with AUDIO lib (extracted from alsa-json-gateway code)
- * Copyright (C) 2015,2016,2017, 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.
- */
-
-
-// few coding convention
-typedef int BOOL;
-#ifndef PUBLIC
- #define PUBLIC
-#endif
-#ifndef FALSE
- #define FALSE 0
-#endif
-#ifndef TRUE
- #define TRUE 1
-#endif
-#define STATIC static
-
-#ifndef AUDIOLIBMAPPING_H
-#define AUDIOLIBMAPPING_H
-
-#include <json-c/json.h>
-#include <afb/afb-binding.h>
-#include <afb/afb-service-itf.h>
-
-// import from AlsaAfbBinding
-extern const struct afb_binding_interface *afbIface;
-
-// import from AlsaAfbMapping
-PUBLIC void intelHdaSetVol (struct afb_req request);
-PUBLIC void intelHdaGetVol(struct afb_req request);
-PUBLIC void intelHdaSubscribe(struct afb_req request);
-PUBLIC int intelHdaInit (struct afb_service service, const char *cardname);
-
-#endif /* AUDIOLIBMAPPING_H */
-