glue_fur.c
上传用户:super_houu
上传日期:2008-09-21
资源大小:4099k
文件大小:2k
源码类别:

DVD

开发平台:

Others

  1. #include "playcorenav_sacdglue_fur.h"
  2. #include "playcoresampsamp_gen.h"
  3. #include "kerneluitronrtos.h"
  4. static SAMP(UInt16) furBase = 0x0000;
  5. static SAMP(UInt16) furIhBase = 0x0000;
  6. SAMP(UInt16) SAMP(FUR_ReadMem)(SAMP(UInt32) addr)
  7. {
  8.   SAMP(UInt16) val;
  9.   int i;
  10.   STATUS_REG srValue = InterruptDisable();
  11.   if (((addr>>7)&0xFFFF) != furBase)
  12.   {
  13.     /* Save base-address */
  14.     furBase = (SAMP(UInt16))((addr>>7)&0xFFFF);
  15.     /* Activate H_A_sel and put base-address on data bus */
  16.     SACD_Write16(0x80, furBase);
  17.   }
  18.   /* Read data */
  19.   val = SACD_Read16(addr&0x7E);
  20.   /* Wait at least Twait (30 sys_clk cycles) */
  21.   /* #error insert required delay here */
  22.   /* Is needed because no wait signal is present */
  23.   for(i = 0; i < 8; i++);
  24.   /* Read data again */
  25.   val = SACD_Read16(0x80);
  26.   set_SR(srValue);
  27.   return val;
  28. }
  29. void SAMP(FUR_WriteMem)(SAMP(UInt32) addr, SAMP(UInt16) val)
  30. {
  31.   int i;
  32.   STATUS_REG srValue = InterruptDisable();
  33.   if (((addr>>7)&0xFFFF) != furBase)
  34.   {
  35.     /* Save base-address */
  36.     furBase = (SAMP(UInt16))((addr>>7)&0xFFFF);
  37.     /* Activate H_A_sel and put base-address on data bus */
  38.     SACD_Write16(0x80, furBase);
  39.   }
  40.   /* Write data */
  41.   SACD_Write16(addr&0x7E, val);
  42.   /* Wait at least Twait (30 sys_clk cycles) */
  43.   /* #error insert required delay here */
  44.   for(i = 0; i < 8; i++);
  45.   set_SR(srValue);
  46. }
  47. SAMP(UInt16) SAMP(FUR_ReadReg)(SAMP(UInt32) addr)
  48. {
  49.   SAMP(UInt16) val;
  50.   val = SAMP(FUR_ReadMem)(addr);
  51.   return ((val<<8)|(val>>8));
  52. }
  53. void SAMP(FUR_WriteReg)(SAMP(UInt32) addr, SAMP(UInt16) val)
  54. {
  55.   val = ((val<<8)|(val>>8));
  56.   SAMP(FUR_WriteMem)(addr, val);
  57. }
  58. void SAMP(FUR_IhEnter)(void)
  59. {
  60.   furIhBase = furBase;
  61. }
  62. void SAMP(FUR_IhExit)(void)
  63. {
  64.   furBase = furIhBase;
  65.   /* Activate H_A_sel and put base-address on data bus */
  66.   SACD_Write16(0x80, furBase);
  67. }