443 lines
20 KiB
C
443 lines
20 KiB
C
//
|
|
// MODULE : ZAC3.C
|
|
// PURPOSE : Zoran AC3 specific code
|
|
// AUTHOR : JBS Yadawa
|
|
// CREATED : 7/20/96
|
|
//
|
|
//
|
|
// Copyright (C) 1996 SGS-THOMSON Microelectronics
|
|
//
|
|
//
|
|
// REVISION HISTORY :
|
|
//
|
|
// DATE :
|
|
//
|
|
// COMMENTS :
|
|
//
|
|
|
|
#include "common.h"
|
|
#include "strmini.h"
|
|
#include "stdefs.h"
|
|
#include "board.h"
|
|
#include "debug.h"
|
|
#include "i20reg.h"
|
|
#include "bt856.h"
|
|
#include "memio.h"
|
|
#include "zac3.h"
|
|
#include "sti3520a.h" //ckw
|
|
|
|
#define POSTOFFICEREG 0x200
|
|
#define SPIDO 0x07 //ckw
|
|
#define SPIDI 0x06 //ckw
|
|
#define SPICLK 0x05
|
|
#define SPIENA 0x04
|
|
#define PARAMSIZE 9
|
|
|
|
static void NEARAPI SPIStart(void);
|
|
static void NEARAPI SPIStop(void);
|
|
static BYTE NEARAPI SPISendByte(BYTE data);
|
|
|
|
BYTE CfgParams[PARAMSIZE] = {AC3_CFG, 0xD0,0x08,0x89,0x09,0x14,0x02,0x02,0x06}; //ckw
|
|
BYTE AC3Params[PARAMSIZE] = {AC3_AC3, 0x10,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF}; //ckw
|
|
#define NUMCODE 2501
|
|
BYTE AC3MCode[NUMCODE] = {
|
|
0x90, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x02, 0x56, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
|
|
0xB8, 0x0C, 0x00, 0x00, 0xB0, 0x3C, 0x38, 0x0D, 0x00, 0x5D, 0x32, 0x10, 0x0F, 0xF5, 0x3B,
|
|
0x80, 0x00, 0x00, 0x34, 0x3D, 0x03, 0xFB, 0x00, 0x03, 0xCD, 0x82, 0x38, 0x8D, 0x00, 0x00,
|
|
0x3A, 0x80, 0x02, 0x52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B0, 0x00, 0x01, 0x3C, 0x1D, 0x00, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x3A, 0xDE, 0x16, 0x12, 0x3A, 0xFD, 0x00, 0x69, 0x00, 0x03, 0xEB, 0xC1, 0x3A, 0xDD,
|
|
0x01, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB2, 0xEC, 0x2C, 0x00, 0x08, 0x00, 0x3A,
|
|
0xDD, 0x00, 0x83, 0x3C, 0x1E, 0x16, 0x12, 0x3B, 0x80, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
|
|
0x3A, 0xDE, 0x16, 0x12, 0x3A, 0xFD, 0x00, 0x74, 0x00, 0x03, 0xEB, 0xC1, 0x34, 0x00, 0x0F,
|
|
0xC5, 0x2C, 0x00, 0x08, 0x00, 0x3C, 0x1D, 0x01, 0x91, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0D,
|
|
0x00, 0x11, 0x32, 0x10, 0x0F, 0xF8, 0x00, 0x00, 0xB8, 0x0C, 0x38, 0x00, 0x03, 0x80, 0x30,
|
|
0x00, 0x0D, 0xCB, 0x2E, 0x15, 0x00, 0x00, 0x30, 0x00, 0x0F, 0x8D, 0x00, 0x00, 0xC0, 0x3C,
|
|
0x38, 0x00, 0x06, 0x00, 0x32, 0x10, 0x0F, 0x81, 0x3A, 0xDD, 0x01, 0x91, 0x34, 0x00, 0x0D,
|
|
0xC6, 0x2C, 0x30, 0x00, 0x07, 0x3C, 0x6D, 0x00, 0x89, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00,
|
|
0x00, 0x00, 0x32, 0x10, 0x0D, 0xCA, 0x34, 0x00, 0x0D, 0xCA, 0x00, 0x40, 0x00, 0x00, 0x3C,
|
|
0x6D, 0x00, 0xCD, 0x00, 0x00, 0xB4, 0x6C, 0x00, 0x00, 0xB4, 0x2C, 0x3A, 0xDD, 0x01, 0xB1,
|
|
0x3A, 0xFD, 0x00, 0x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34, 0x10, 0x0D, 0xCE, 0x16, 0x43, 0xD3, 0x02, 0x3C, 0x1D, 0x01, 0x2C, 0x16, 0x53, 0xD4,
|
|
0x03, 0x30, 0x20, 0x0D, 0xCE, 0x34, 0x0D, 0x03, 0xD8, 0x2C, 0x00, 0x00, 0x07, 0x2C, 0x30,
|
|
0x00, 0x02, 0x3C, 0x3D, 0x01, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x18, 0xD0, 0x00, 0x00, 0x30,
|
|
0x20, 0x0D, 0xCE, 0x38, 0x00, 0x00, 0x02, 0x32, 0x10, 0x0D, 0xE3, 0x38, 0x07, 0xFF, 0xFF,
|
|
0x32, 0x10, 0x0D, 0xE7, 0x38, 0x0E, 0x2B, 0xA9, 0x32, 0x10, 0x0D, 0xE0, 0x38, 0x0E, 0x2B,
|
|
0xAF, 0x32, 0x10, 0x0D, 0xE1, 0x38, 0x0E, 0x2B, 0xB5, 0x32, 0x10, 0x0D, 0xE2, 0x34, 0x00,
|
|
0x0D, 0xE8, 0x00, 0x40, 0x00, 0x00, 0x3C, 0x6D, 0x01, 0x32, 0x34, 0x00, 0x0D, 0xC4, 0x38,
|
|
0x80, 0x0D, 0xDB, 0x06, 0x00, 0x00, 0x00, 0x34, 0x10, 0x0F, 0xFC, 0x00, 0x48, 0x00, 0x00,
|
|
0x3C, 0x6D, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x38, 0x10, 0x00, 0x03, 0x38, 0x0F, 0xFF,
|
|
0xFF, 0x34, 0x90, 0x0D, 0xC1, 0x35, 0x10, 0x0D, 0xFD, 0x34, 0x20, 0x0D, 0xCA, 0x00, 0x52,
|
|
0x82, 0x0A, 0x3C, 0x6D, 0x01, 0x40, 0x39, 0x10, 0x00, 0x00, 0x2C, 0xA8, 0x00, 0x00, 0x00,
|
|
0x03, 0xE0, 0x8C, 0x36, 0xD0, 0x0F, 0x8B, 0x3A, 0xFD, 0x01, 0x43, 0x00, 0x03, 0xEB, 0xC1,
|
|
0x36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 0x71,
|
|
0x00, 0x03, 0xEB, 0xC1, 0x3A, 0xDE, 0x18, 0xE5, 0x3A, 0xFD, 0x01, 0x74, 0x00, 0x03, 0xEB,
|
|
0xC1, 0x34, 0x00, 0x0D, 0xCA, 0x2C, 0x30, 0x00, 0x05, 0x3C, 0x5D, 0x01, 0x7A, 0x12, 0x03,
|
|
0xD0, 0x01, 0x30, 0x00, 0x0D, 0xCA, 0x30, 0x10, 0x0D, 0xCA, 0x38, 0x00, 0x00, 0x08, 0x32,
|
|
0x1D, 0x03, 0xD4, 0x34, 0x00, 0x0D, 0xC6, 0x2C, 0x10, 0x05, 0x00, 0x34, 0x20, 0x0D, 0xC5,
|
|
0x34, 0x10, 0x0D, 0xC4, 0x00, 0x4B, 0xD0, 0xC1, 0x3C, 0x1D, 0x01, 0x85, 0x0C, 0x50, 0x00,
|
|
0x00, 0x18, 0x80, 0x00, 0x00, 0x2C, 0x10, 0x40, 0x00, 0x32, 0x1D, 0x03, 0xD5, 0x38, 0x0D,
|
|
0x03, 0xD4, 0x32, 0x10, 0x0F, 0xFB, 0x34, 0x10, 0x0F, 0xC5, 0x2C, 0x40, 0x10, 0x00, 0x3C,
|
|
0x1D, 0x01, 0x91, 0x34, 0x00, 0x0D, 0xC4, 0x00, 0x40, 0x00, 0x00, 0x3C, 0x1D, 0x01, 0x91,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x7C, 0x00, 0x00, 0xB0, 0x7C, 0x00, 0x03, 0xF0,
|
|
0x2D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x0F, 0xC5, 0x00, 0x00,
|
|
0xD1, 0x61, 0x3C, 0x1D, 0x01, 0xAE, 0x34, 0x0D, 0x03, 0xD9, 0x2C, 0x00, 0x07, 0x00, 0x2E,
|
|
0x30, 0x00, 0x04, 0x2C, 0x10, 0x00, 0x10, 0x32, 0x1D, 0x03, 0xDD, 0x34, 0x00, 0x0D, 0xC1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D, 0xDF,
|
|
0x38, 0x00, 0x00, 0x00, 0x32, 0x10, 0x0D, 0xE0, 0x38, 0x80, 0x0D, 0xDB, 0xB0, 0x03, 0xD2,
|
|
0x01, 0x3A, 0xDE, 0x19, 0x92, 0x3A, 0xFD, 0x01, 0xD1, 0x00, 0x03, 0xEB, 0xC1, 0x00, 0x43,
|
|
0xC5, 0x91, 0x34, 0x90, 0x0F, 0x87, 0x3C, 0x6D, 0x02, 0x13, 0x38, 0x00, 0x00, 0x01, 0x32,
|
|
0x10, 0x0D, 0xC6, 0xBD, 0xB0, 0x00, 0x00, 0x30, 0x90, 0x0D, 0xC1, 0x38, 0x00, 0x00, 0x05,
|
|
0x32, 0x10, 0x0D, 0xDB, 0x30, 0x90, 0x0D, 0xDC, 0x34, 0x00, 0x0F, 0x88, 0x32, 0x10, 0x0D,
|
|
0xDD, 0x31, 0x60, 0x0D, 0xDE, 0x34, 0x00, 0x0D, 0xF2, 0x32, 0x10, 0x0D, 0xDF, 0x38, 0x80,
|
|
0x0D, 0xDB, 0xB0, 0x03, 0xD0, 0x41, 0x36, 0xDE, 0x00, 0x41, 0x3A, 0xFD, 0x01, 0xE5, 0x00,
|
|
0x03, 0xEB, 0xC1, 0x39, 0x80, 0x00, 0x02, 0x30, 0x00, 0x0D, 0xC6, 0x00, 0x43, 0x60, 0x02,
|
|
0x3C, 0x6D, 0x02, 0x10, 0x39, 0x80, 0x00, 0x03, 0x34, 0x00, 0x0D, 0xF5, 0x30, 0x20, 0x0D,
|
|
0xCB, 0x00, 0x43, 0xD0, 0x06, 0x3C, 0x1D, 0x01, 0xF1, 0x00, 0x03, 0x60, 0x01, 0x30, 0x10,
|
|
0x0D, 0xC9, 0x13, 0xB0, 0x00, 0x00, 0x39, 0x10, 0x00, 0x00, 0x39, 0x80, 0x00, 0x04, 0x00,
|
|
0x02, 0xA0, 0x07, 0x30, 0x7D, 0x03, 0xD8, 0x00, 0x00, 0x80, 0x00, 0x38, 0x9D, 0x03, 0xD9,
|
|
0x3E, 0x00, 0x00, 0x04, 0x00, 0x06, 0x51, 0xCF, 0x34, 0x00, 0x0D, 0xFD, 0x22, 0x13, 0xC5,
|
|
0x91, 0x34, 0x90, 0x0D, 0xC1, 0x0D, 0x90, 0x00, 0x00, 0x00, 0x03, 0xC0, 0x99, 0x38, 0x15,
|
|
0x00, 0x00, 0x34, 0x20, 0x0D, 0xCB, 0x42, 0x98, 0x80, 0x08, 0x00, 0x00, 0x00, 0x00, 0x30,
|
|
0x90, 0x0D, 0xC0, 0x34, 0x00, 0x0D, 0xC1, 0x3A, 0xDD, 0x02, 0x1A, 0x3A, 0xFD, 0x02, 0x07,
|
|
0x00, 0x03, 0xEB, 0xC1, 0xB0, 0xC0, 0x00, 0x00, 0x3C, 0x4D, 0x02, 0x0C, 0x00, 0x00, 0x00,
|
|
0x00, 0x30, 0x00, 0x0F, 0x8D, 0x00, 0x00, 0xC0, 0x3C, 0x39, 0x10, 0x00, 0x00, 0x00, 0x03,
|
|
0xF0, 0x2D, 0x31, 0x10, 0x0D, 0xC4, 0x30, 0xF0, 0x0D, 0xC3, 0x3A, 0xDD, 0x02, 0x14, 0x34,
|
|
0x00, 0x0D, 0xC1, 0x32, 0x10, 0x0D, 0xC0, 0x30, 0x90, 0x0D, 0xC0, 0x38, 0x00, 0x03, 0x80,
|
|
0x32, 0x10, 0x0D, 0xCB, 0x39, 0x10, 0x00, 0x00, 0x00, 0x03, 0xF0, 0x2D, 0x38, 0x00, 0x00,
|
|
0x01, 0x32, 0x10, 0x0D, 0xC4, 0x00, 0x00, 0xC4, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
|
|
0xC3, 0x81, 0x34, 0x20, 0x0F, 0x8D, 0xB0, 0x40, 0xB4, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x3C,
|
|
0x2D, 0x02, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xC5, 0x81, 0xA2, 0x00, 0x00, 0x00,
|
|
0x00, 0x03, 0xF0, 0x2D, 0xA0, 0x90, 0x00, 0x00, 0xB0, 0x48, 0x00, 0x00, 0x34, 0x3D, 0x03,
|
|
0xF2, 0x00, 0x00, 0xD0, 0x03, 0x3C, 0x6D, 0x02, 0x53, 0x38, 0x20, 0x0F, 0x3B, 0x30, 0x20,
|
|
0x0D, 0xE9, 0x00, 0x00, 0xB0, 0x03, 0x30, 0x3D, 0x03, 0xF2, 0x00, 0x03, 0xE0, 0x01, 0x00,
|
|
0x03, 0xE0, 0x41, 0x38, 0xB0, 0x0F, 0x3B, 0x3A, 0x80, 0x00, 0x12, 0x3A, 0xAD, 0x02, 0x35,
|
|
0x38, 0x30, 0x00, 0x00, 0x00, 0x03, 0xE0, 0xDA, 0x00, 0x03, 0xE0, 0xDA, 0x39, 0xA0, 0x00,
|
|
0x03, 0x38, 0xAD, 0x03, 0xF0, 0x38, 0xCD, 0x03, 0xE3, 0x3A, 0x80, 0x00, 0x03, 0x3A, 0xAD,
|
|
0x02, 0x4F, 0x38, 0xB0, 0x0F, 0x3B, 0x00, 0x03, 0xF8, 0x81, 0x2E, 0x6F, 0xFF, 0xEC, 0x00,
|
|
0x03, 0xCD, 0xA5, 0x00, 0x03, 0xF4, 0x80, 0x2E, 0x2F, 0xFF, 0xEC, 0x00, 0x03, 0xCD, 0xA1,
|
|
0x3A, 0x80, 0x00, 0x04, 0x3A, 0xAD, 0x02, 0x4E, 0x38, 0x4F, 0xF0, 0x00, 0x2E, 0x20, 0x00,
|
|
0x08, 0x00, 0x03, 0xC8, 0x43, 0x17, 0x18, 0x00, 0x00, 0x2E, 0x60, 0x00, 0x08, 0x00, 0x03,
|
|
0xC9, 0x45, 0x17, 0x28, 0x00, 0x00, 0x2F, 0x7F, 0xFF, 0xF4, 0x00, 0x03, 0xC1, 0x5B, 0x38,
|
|
0x50, 0x00, 0x00, 0x00, 0x01, 0xD6, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xD6, 0x1D,
|
|
0x00, 0x03, 0xF0, 0x01, 0x00, 0x03, 0xF0, 0x00, 0x00, 0x03, 0xF0, 0x2D, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x03, 0xE0, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00,
|
|
0x00, 0x01, 0x2F, 0x2F, 0x00, 0x21, 0x00, 0x00, 0x00, 0x2F, 0x00, 0x2F, 0x21, 0x00, 0x00,
|
|
0x03, 0x04, 0x01, 0x09, 0x0A, 0x07, 0x0E, 0x0F, 0x10, 0x0D, 0x11, 0x00, 0x0D, 0x03, 0xF4,
|
|
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x91, 0xA2, 0xB3, 0xC5, 0x01, 0x45, 0x67,
|
|
0x00, 0x00, 0x0D, 0x03, 0xFB, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0xE9, 0xEF,
|
|
0xC6, 0x30, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
|
|
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
|
|
|
|
};
|
|
static void NEARAPI SPIStart(void)
|
|
{
|
|
BoardWriteGPIOReg(SPICLK, FALSE);
|
|
Delay(100);
|
|
|
|
BoardWriteGPIOReg(SPIENA, FALSE);
|
|
Delay(100);
|
|
}
|
|
|
|
static void NEARAPI SPIStop(void)
|
|
{
|
|
Delay(100);
|
|
BoardWriteGPIOReg(SPIENA, TRUE);
|
|
}
|
|
|
|
|
|
static BYTE NEARAPI SPISendByte(BYTE data)
|
|
{
|
|
BYTE Val;
|
|
int i;
|
|
|
|
Val = data;
|
|
for(i=0; i<8; i++)
|
|
{
|
|
BoardWriteGPIOReg(SPICLK, TRUE);
|
|
Delay(100); //ckw
|
|
BoardWriteGPIOReg(SPIDO, (Val & 0x80 ? TRUE : FALSE)); //ckw
|
|
Delay(100);
|
|
BoardWriteGPIOReg(SPICLK, FALSE);
|
|
Delay(100);
|
|
if(BoardReadGPIOReg(SPIDI))
|
|
Val = (Val << 1) | 0x01;
|
|
else
|
|
Val = (Val << 1);
|
|
|
|
}
|
|
return Val;
|
|
}
|
|
//ckw start
|
|
void FARAPI SPIReadBack(BYTE command, int numresult, BYTE *result)
|
|
{
|
|
int i;
|
|
|
|
SPIStart();
|
|
SPISendByte(0x00);
|
|
SPISendByte(0x00);
|
|
SPISendByte(0x00);
|
|
SPISendByte(command);
|
|
SPISendByte(0x00);
|
|
SPISendByte(0x00);
|
|
for (i=0;i<numresult-1;i++)
|
|
result[i] = SPISendByte(0x00);
|
|
result[i] = SPISendByte(0x80);
|
|
|
|
SPISendByte(0x80);
|
|
SPISendByte(0x80);
|
|
SPIStop();
|
|
|
|
return;
|
|
}
|
|
//ckw end
|
|
BYTE FARAPI SPISendSeq(int Num, BYTE *Data)
|
|
{
|
|
int i;
|
|
BYTE b; //ckw
|
|
|
|
SPIStart();
|
|
|
|
SPISendByte(0x00);
|
|
SPISendByte(0x00);
|
|
SPISendByte(0x00);
|
|
|
|
SPISendByte(Data[0]); //ckw
|
|
for(i=1; i<Num; i++) //ckw
|
|
{
|
|
//ckw start
|
|
b = SPISendByte(Data[i]);
|
|
if ((b != 0x80) && ((Num-i-1) + 3 != b))
|
|
{
|
|
Delay(100);
|
|
BoardWriteGPIOReg(SPIENA, TRUE);
|
|
DebugPrint((DebugLevelError, "AC3:Wrong number of args\n"));
|
|
}
|
|
//ckw end
|
|
}
|
|
SPISendByte(0x00);
|
|
SPISendByte(0x80);
|
|
b = SPISendByte(0x80); //ckw
|
|
SPIStop();
|
|
//ckw start
|
|
switch (b & 3)
|
|
{
|
|
case 1:
|
|
DebugPrint((DebugLevelError, "AC3:Invalid OPCODE!!\n"));
|
|
break;
|
|
case 2:
|
|
DebugPrint((DebugLevelError, "AC3:Invalid Parameters!!\n"));
|
|
break;
|
|
DebugPrint((DebugLevelError, "AC3:Device not ready!!\n"));
|
|
break;
|
|
}
|
|
//ckw end
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
BOOL FARAPI InitAC3Decoder(void)
|
|
{
|
|
//ckw start
|
|
char dbgstr[80];
|
|
BYTE ver[4];
|
|
DWORD version;
|
|
int i;
|
|
BoardWriteAudio(AUD_BBE, 0x01);
|
|
BoardWriteAudio(AUD_DEM, 0x00);
|
|
BoardWriteAudio(AUD_DIF, 0x01);
|
|
BoardWriteAudio(AUD_DIV, 0x02);
|
|
BoardWriteAudio(AUD_EXT, 0x00);
|
|
BoardWriteAudio(AUD_FOR, 0x00);
|
|
BoardWriteAudio(AUD_ISS, 0x03);
|
|
BoardWriteAudio(AUD_LCA, 0x00);
|
|
BoardWriteAudio(AUD_RCA, 0x00);
|
|
BoardWriteAudio(AUD_LRP, 0x00);
|
|
BoardWriteAudio(AUD_ORD, 0x00);
|
|
BoardWriteAudio(AUD_P18, 0x01);
|
|
BoardWriteAudio(AUD_SCP, 0x00);
|
|
BoardWriteAudio(AUD_SEM, 0x00);
|
|
BoardWriteAudio(AUD_SFR, 0x00);
|
|
BoardWriteAudio(AUD_RST, 0x01);
|
|
BoardWriteEPLD(INCTL, 0x01);
|
|
BoardWriteVideo(CTL, 0x02);
|
|
Delay(200);
|
|
BoardWriteVideo(CTL, 0x00);
|
|
|
|
BoardWriteEPLD(AUXCTL, 0x08);
|
|
Delay(200);
|
|
i = 0;
|
|
do
|
|
{
|
|
BoardWriteEPLD(AUXCTL, 0x00);
|
|
Delay(200);
|
|
BoardWriteEPLD(AUXCTL, 0x08);
|
|
Delay(200);
|
|
i++;
|
|
if(i>10)
|
|
{
|
|
DebugPrint((DebugLevelError,"Can not Boot AC3!!!!!!!"));
|
|
break;
|
|
}
|
|
} while (!BootAC3());
|
|
|
|
BoardWriteEPLD(AUXCTL, 0x08);
|
|
Delay(200);
|
|
SPIReadBack(0x81, 4, ver);
|
|
version = ((DWORD)(BYTE)(ver[0]) | ((DWORD)(BYTE)(ver[1]) << 8) | ((DWORD)(BYTE)(ver[2]) << 16) | ((DWORD)(BYTE)(ver[3]) << 24));
|
|
DebugPrint((DebugLevelError, "AC3:Version = %lu!!\n",version));
|
|
SPISendSeq(PARAMSIZE, CfgParams);
|
|
SPISendSeq(PARAMSIZE, AC3Params);
|
|
AC3Command(AC3_STOP); //ckw
|
|
//ckw end
|
|
return TRUE;
|
|
}
|
|
|
|
//ckw start
|
|
void FARAPI AC3Command(BYTE command)
|
|
{
|
|
SPISendSeq(1, &command); //ckw
|
|
}
|
|
//ckw end
|
|
|
|
void FARAPI SendAC3Data(BYTE *Data, DWORD Size)
|
|
{
|
|
DWORD i, PoReg;
|
|
PoReg = 0x00B00000;
|
|
|
|
for(i=0; i<Size; i++)
|
|
{
|
|
// HostDisableIT();
|
|
memOutDword(POSTOFFICEREG, PoReg|Data[i]);
|
|
// Delay(10);
|
|
while(memInDword(POSTOFFICEREG)&02000000L);
|
|
// HostEnableIT();
|
|
}
|
|
}
|
|
|
|
BOOL FARAPI BootAC3(void)
|
|
{
|
|
int i,num=0; //ckw
|
|
BYTE Val, b;
|
|
BOOL fail = FALSE; //ckw
|
|
|
|
|
|
SPIStart();
|
|
b=SPISendByte(0);
|
|
b=SPISendByte(0);
|
|
b=SPISendByte(0);
|
|
b=SPISendByte(0);
|
|
|
|
num = 0;
|
|
|
|
i = 0;
|
|
while(i < NUMCODE)
|
|
{
|
|
Val = AC3MCode[i];
|
|
|
|
Delay(100);
|
|
b = SPISendByte(Val);
|
|
if ((num == 2 ) && (b != 0x05))
|
|
{
|
|
fail = TRUE;
|
|
}
|
|
num++;
|
|
i++;
|
|
}
|
|
SPIStop();
|
|
if(fail)
|
|
{
|
|
DebugPrint((DebugLevelError,"AC3 : Error Loading MicroCode!!\n"));
|
|
return FALSE;
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
//ckw start
|
|
void FARAPI AudioTransfer(BOOL flag)
|
|
{
|
|
BoardWriteAudio(0xAE, (BYTE) flag);
|
|
return;
|
|
}
|
|
//ckw end
|