Changeset c5ba8ba in rtems


Ignore:
Timestamp:
Jul 9, 2012, 8:44:47 AM (7 years ago)
Author:
Xiangfu Liu <xiangfu@…>
Branches:
4.11, master
Children:
c65afce4, fac44e12
Parents:
5b29a08
git-author:
Xiangfu Liu <xiangfu@…> (07/09/12 08:44:47)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/09/12 08:44:47)
Message:

bsps/lm32: PR2045: Add mic boost option

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c

    r5b29a08 rc5ba8ba  
    315315{
    316316  unsigned int *val = (unsigned int *)buf;
     317  int mic_boost;
    317318  int codec;
    318319  int left, right;
     
    327328  }
    328329  if (mono) {
    329     right = left = 100-(((codec & 0x1f) + 1)*100)/32;
     330    left = 100-(((codec & 0x1f) + 1)*100)/32;
     331    mic_boost = (codec & (1 << 6)) >> 6;
     332    *val = left | mic_boost << 8;
    330333  } else {
    331334    right = 100-(((codec & 0x1f) + 1)*100)/32;
    332335    left = 100-((((codec & 0x1f00) >> 8) + 1)*100)/32;
    333   }
    334   *val = left | (right << 8);
     336    *val = left | (right << 8);
     337  }
    335338  return RTEMS_SUCCESSFUL;
    336339}
     
    340343{
    341344  unsigned int *val = (unsigned int *)buf;
     345  int mic_boost;
    342346  int left, right;
    343347  int codec;
     
    346350  left = *val & 0xff;
    347351  left = (left*32)/100 - 1;
    348   if(left < 0)
     352  if (left < 0)
    349353    left = 0;
    350354
    351   if (mono)
     355  if (mono) {
     356    mic_boost = *val >> 8;
    352357    right = 31;
    353   else {
     358  } else {
    354359    right = (*val >> 8) & 0xff;
    355360    right = (right*32)/100 - 1;
    356     if(right < 0)
     361    if (right < 0)
    357362      right = 0;
    358363  }
     
    363368  else
    364369    codec = (31-left) | ((31-right) << 8);
     370
     371  if (mono) {
     372    if (mic_boost)
     373      codec |= (1 << 6);
     374    else
     375      codec &= ~(1 << 6);
     376  }
    365377
    366378  if (!write_cr(chan, codec))
Note: See TracChangeset for help on using the changeset viewer.