summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames O'Shannessy <james.oshannessy@fiberdyne.com.au>2018-09-21 16:14:14 +1000
committerMark Farrugia <mark.farrugia@fiberdyne.com.au>2018-10-26 17:27:29 +1100
commitbc249f293cab17c0dcde886fccc26deb0dfca33c (patch)
tree153e023cf4e7777bdb4b15af7890f631cc07e9f7
parentb46cfdf55851280f0c90c7b54ba041932ddfa397 (diff)
Current state of loopback.
Committing debug changes and loopback changes Signed-off-by: James O'Shannessy <james.oshannessy@fiberdyne.com.au>
-rw-r--r--alsa-pcm.c22
-rw-r--r--core.h11
-rw-r--r--loopback/loopback.c34
3 files changed, 40 insertions, 27 deletions
diff --git a/alsa-pcm.c b/alsa-pcm.c
index 0f623f6..4fd4323 100644
--- a/alsa-pcm.c
+++ b/alsa-pcm.c
@@ -10,8 +10,7 @@
#include "core.h"
#include "alsa.h"
-#define DINFO(fmt, args...) \
- printk(KERN_INFO "[CORE] %d:%s " fmt "\n", __LINE__, __func__, ##args)
+#define AP_LOGNAME "CORE"
#define DO_AUDIOPATH_CB(callback, substream, ...) \
do { \
@@ -89,7 +88,7 @@ static int configure_pcm(struct snd_pcm_substream *substream)
*/
static int pcm_open(struct snd_pcm_substream *substream)
{
- DINFO("");
+ DINFO(AP_LOGNAME, "");
// Setup the pcm device based on the configuration assigned
CHK_ERR_V(configure_pcm(substream), "Failed to setup pcm device");
@@ -109,7 +108,7 @@ static int pcm_open(struct snd_pcm_substream *substream)
*/
static int pcm_close(struct snd_pcm_substream *substream)
{
- DINFO("");
+ DINFO(AP_LOGNAME, "");
// Do additional Audio Path 'close' callback
DO_AUDIOPATH_CB(close, substream);
@@ -134,6 +133,8 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,
struct avirt_audiopath *audiopath;
struct avirt_alsa_dev_group *group;
+ DINFO(AP_LOGNAME, "");
+
group = avirt_alsa_get_dev_group(substream->stream);
CHK_NULL(group);
@@ -173,6 +174,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,
*/
static int pcm_hw_free(struct snd_pcm_substream *substream)
{
+ DINFO(AP_LOGNAME, "");
CHK_ERR(snd_pcm_lib_free_vmalloc_buffer(substream));
// Do additional Audio Path 'hw_free' callback
@@ -196,7 +198,7 @@ static int pcm_prepare(struct snd_pcm_substream *substream)
struct avirt_alsa_dev_group *group;
struct snd_pcm_runtime *runtime = substream->runtime;
- DINFO("");
+ DINFO(AP_LOGNAME, "");
group = avirt_alsa_get_dev_group(substream->stream);
CHK_NULL(group);
@@ -226,7 +228,7 @@ static int pcm_trigger(struct snd_pcm_substream *substream, int cmd)
{
struct avirt_alsa_dev_group *group;
- DINFO("");
+ DINFO(AP_LOGNAME, "");
group = avirt_alsa_get_dev_group(substream->stream);
CHK_NULL(group);
@@ -264,6 +266,8 @@ static snd_pcm_uframes_t pcm_pointer(struct snd_pcm_substream *substream)
{
struct avirt_alsa_dev_group *group;
+ DINFO(AP_LOGNAME, "");
+
group = avirt_alsa_get_dev_group(substream->stream);
CHK_NULL(group);
@@ -290,6 +294,8 @@ static int pcm_get_time_info(
{
struct avirt_alsa_dev_group *group;
+ DINFO(AP_LOGNAME, "");
+
group = avirt_alsa_get_dev_group(substream->stream);
CHK_NULL(group);
@@ -323,6 +329,7 @@ static int pcm_copy_user(struct snd_pcm_substream *substream, int channel,
//offset = frames_to_bytes(runtime, pos);
// Do additional Audio Path 'copy_user' callback
+ DINFO(AP_LOGNAME, "");
DO_AUDIOPATH_CB(copy_user, substream, channel, pos, src, count);
return 0;
@@ -344,6 +351,7 @@ static int pcm_copy_user(struct snd_pcm_substream *substream, int channel,
static int pcm_copy_kernel(struct snd_pcm_substream *substream, int channel,
unsigned long pos, void *buf, unsigned long count)
{
+ DINFO(AP_LOGNAME, "");
DO_AUDIOPATH_CB(copy_kernel, substream, channel, pos, buf, count);
return 0;
}
@@ -359,6 +367,7 @@ static int pcm_copy_kernel(struct snd_pcm_substream *substream, int channel,
*/
int pcm_ack(struct snd_pcm_substream *substream)
{
+ DINFO(AP_LOGNAME, "");
DO_AUDIOPATH_CB(ack, substream);
return 0;
}
@@ -366,6 +375,7 @@ int pcm_ack(struct snd_pcm_substream *substream)
static int pcm_silence(struct snd_pcm_substream *substream, int channel,
snd_pcm_uframes_t pos, snd_pcm_uframes_t count)
{
+ DINFO(AP_LOGNAME, "");
DO_AUDIOPATH_CB(fill_silence, substream, channel, pos, count);
return 0;
}
diff --git a/core.h b/core.h
index 1cf7c95..6e3b651 100644
--- a/core.h
+++ b/core.h
@@ -12,6 +12,17 @@
#include <sound/pcm.h>
+#define DINFO(ap, fmt, args...) \
+ printk(KERN_INFO "[%s] %d:%s " fmt "\n", ap, __LINE__, __func__, ##args)
+
+#define DERROR(ap, fmt, args...) \
+ printk(KERN_ERR "[%s] %d:%s " fmt "\n", AP_LOGNAME, __LINE__, \
+ __func__, ##args)
+
+#define DPRINT(ap, fmt, args...) \
+ printk(KERN_DEBUG "[%s] %d:%s " fmt "\n", AP_LOGNAME, __LINE__, \
+ __func__, ##args)
+
/**
* PCM buffer complete callback
*
diff --git a/loopback/loopback.c b/loopback/loopback.c
index 215ed5d..a925eaa 100644
--- a/loopback/loopback.c
+++ b/loopback/loopback.c
@@ -18,17 +18,9 @@ MODULE_LICENSE("GPL v2");
#define AP_LOGNAME "LOOPAP"
-#define DERROR(fmt, args...) \
- printk(KERN_ERR "[%s] %d:%s " fmt "\n", AP_LOGNAME, __LINE__, \
- __func__, ##args)
-
-#define DINFO(fmt, args...) \
- printk(KERN_INFO "[%s] %d:%s " fmt "\n", AP_LOGNAME, __LINE__, \
- __func__, ##args)
-
-#define DPRINT(fmt, args...) \
- printk(KERN_DEBUG "[%s] %d:%s " fmt "\n", AP_LOGNAME, __LINE__, \
- __func__, ##args)
+#define AP_INFOK(fmt, args...) DINFO(AP_LOGNAME, fmt, ##args)
+#define AP_PRINTK(fmt, args...) DPRINT(AP_LOGNAME, fmt, ##args)
+#define AP_ERRORK(fmt, args...) DERROR(AP_LOGNAME, fmt, ##args)
static struct avirt_coreinfo *coreinfo;
@@ -192,8 +184,8 @@ static int loopback_pcm_open(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct loopback_pcm *dpcm = runtime->private_data;
- DINFO("Open\n%s\nrate: %d\nch: %d", substream->pcm->name, runtime->rate,
- runtime->channels);
+ AP_INFOK("Open\n%s\nrate: %d\nch: %d", substream->pcm->name,
+ runtime->rate, runtime->channels);
err = systimer_create(substream);
if (err < 0)
@@ -207,7 +199,7 @@ static int loopback_pcm_close(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct loopback_pcm *dpcm = runtime->private_data;
- DINFO("Close");
+ AP_INFOK("Close");
systimer_free(substream);
return 0;
@@ -216,14 +208,14 @@ static int loopback_pcm_close(struct snd_pcm_substream *substream)
static snd_pcm_uframes_t
loopback_pcm_pointer(struct snd_pcm_substream *substream)
{
- DINFO("Pointer");
+ AP_INFOK("Pointer");
return systimer_pointer(substream);
}
static int loopback_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
{
- DINFO("Trigger");
+ AP_INFOK("Trigger");
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
@@ -241,8 +233,8 @@ static int loopback_pcm_prepare(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct loopback_pcm *dpcm = runtime->private_data;
- DINFO("Prepare");
- DINFO("Runtime\nrate: %d\nch: %d", runtime->rate, runtime->channels);
+ AP_INFOK("Prepare");
+ AP_INFOK("Runtime\nrate: %d\nch: %d", runtime->rate, runtime->channels);
return systimer_prepare(substream);
}
@@ -288,11 +280,11 @@ static int __init loopback_init(void)
{
int err = 0;
- DINFO("init()\n");
+ AP_INFOK("init()\n");
err = avirt_register_audiopath(&loopbackap_module, &coreinfo);
if ((err < 0) || (!coreinfo)) {
- DERROR("%s: coreinfo is NULL!\n", __func__);
+ AP_ERRORK("%s: coreinfo is NULL!\n", __func__);
return err;
}
@@ -301,7 +293,7 @@ static int __init loopback_init(void)
static void __exit loopback_exit(void)
{
- DINFO("exit()\n");
+ AP_INFOK("exit()\n");
avirt_deregister_audiopath(&loopbackap_module);
}