summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2012-07-09 11:56:40 -0500
committerJoel Sherrill <joel.sherrill@oarcorp.com>2012-07-09 11:56:40 -0500
commitfac44e12519e401415af7989b80f8a80f7b7de0f (patch)
treed9a99fb3818efc5f371d012ceb24bf8f6af83ed2
parentMerge branch 'master' of ssh://git.rtems.org/data/git/rtems (diff)
parentbsps/lm32: PR2045: Add mic boost option (diff)
downloadrtems-fac44e12519e401415af7989b80f8a80f7b7de0f.tar.bz2
Merge branch 'master' of ssh://git.rtems.org/data/git/rtems
-rw-r--r--c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c24
-rw-r--r--cpukit/libblock/src/bdbuf.c15
2 files changed, 28 insertions, 11 deletions
diff --git a/c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c b/c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c
index 48625809e6..4f7b57e09f 100644
--- a/c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c
+++ b/c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c
@@ -314,6 +314,7 @@ static rtems_status_code ioctl_read_channel(void *buf,
unsigned int chan, int mono)
{
unsigned int *val = (unsigned int *)buf;
+ int mic_boost;
int codec;
int left, right;
@@ -326,12 +327,14 @@ static rtems_status_code ioctl_read_channel(void *buf,
return RTEMS_SUCCESSFUL;
}
if (mono) {
- right = left = 100-(((codec & 0x1f) + 1)*100)/32;
+ left = 100-(((codec & 0x1f) + 1)*100)/32;
+ mic_boost = (codec & (1 << 6)) >> 6;
+ *val = left | mic_boost << 8;
} else {
right = 100-(((codec & 0x1f) + 1)*100)/32;
left = 100-((((codec & 0x1f00) >> 8) + 1)*100)/32;
+ *val = left | (right << 8);
}
- *val = left | (right << 8);
return RTEMS_SUCCESSFUL;
}
@@ -339,21 +342,23 @@ static rtems_status_code ioctl_write_channel(void *buf,
unsigned int chan, int mono)
{
unsigned int *val = (unsigned int *)buf;
+ int mic_boost;
int left, right;
int codec;
rtems_status_code sc;
left = *val & 0xff;
left = (left*32)/100 - 1;
- if(left < 0)
+ if (left < 0)
left = 0;
- if (mono)
+ if (mono) {
+ mic_boost = *val >> 8;
right = 31;
- else {
+ } else {
right = (*val >> 8) & 0xff;
right = (right*32)/100 - 1;
- if(right < 0)
+ if (right < 0)
right = 0;
}
@@ -363,6 +368,13 @@ static rtems_status_code ioctl_write_channel(void *buf,
else
codec = (31-left) | ((31-right) << 8);
+ if (mono) {
+ if (mic_boost)
+ codec |= (1 << 6);
+ else
+ codec &= ~(1 << 6);
+ }
+
if (!write_cr(chan, codec))
sc = RTEMS_UNSATISFIED;
else
diff --git a/cpukit/libblock/src/bdbuf.c b/cpukit/libblock/src/bdbuf.c
index 5b66656499..f5da0fcc36 100644
--- a/cpukit/libblock/src/bdbuf.c
+++ b/cpukit/libblock/src/bdbuf.c
@@ -2039,17 +2039,22 @@ static void
rtems_bdbuf_check_read_ahead_trigger (rtems_disk_device *dd,
rtems_blkdev_bnum block)
{
- if (dd->read_ahead.trigger == block
+ if (bdbuf_cache.read_ahead_task != 0
+ && dd->read_ahead.trigger == block
&& !rtems_bdbuf_is_read_ahead_active (dd))
{
rtems_status_code sc;
rtems_chain_control *chain = &bdbuf_cache.read_ahead_chain;
+ if (rtems_chain_is_empty (chain))
+ {
+ sc = rtems_event_send (bdbuf_cache.read_ahead_task,
+ RTEMS_BDBUF_READ_AHEAD_WAKE_UP);
+ if (sc != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_RA_WAKE_UP);
+ }
+
rtems_chain_append_unprotected (chain, &dd->read_ahead.node);
- sc = rtems_event_send (bdbuf_cache.read_ahead_task,
- RTEMS_BDBUF_READ_AHEAD_WAKE_UP);
- if (sc != RTEMS_SUCCESSFUL)
- rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_RA_WAKE_UP);
}
}