l2_global.c

来自「凌阳MP3 spSPCA755yuanma」· C语言 代码 · 共 185 行

C
185
字号
/*++
Copyright (c) 2001 Sunplus Technology Co., Ltd.

Module Name:

        L2_glbal.c

Abstract:

        Module related to L2 CDSP functions

Environment:

        Keil C51 Compiler

Revision History:

        11/12/2001      CMLin    created                 
--*/
//=============================================================================
//Header file
//=============================================================================
#include "general.h"
//#include "main.h"

//=============================================================================
//Symbol
//=============================================================================
//-----------------------------------------------------------------------------
//Constant
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
//Variable
//-----------------------------------------------------------------------------
sfr MemStretch = 0x8E;
//=============================================================================
//Program
//=============================================================================
//-----------------------------------------------------------------------------
//L2_Suspend
//-----------------------------------------------------------------------------
/*
routine description:
    Put the SPCA533 into suspend mode. This function puts all internal analog
  macros into the power-down mode and stops the clocks. The GPIO is not
  handled by this function because the functions of the GPIO depend on
  the customer application.

arguments:
  Mode:
     0: normal
     1: reset the CPU if resumed

return value:
  0x00   - success
  0x01   - general error
  0x02   - parameter error
  others - error
*/



//-----------------------------------------------------------------------------
//L2_Resume
//-----------------------------------------------------------------------------
/*
routine description:
    Resume the operation of the SPCA533. It clears the related interrupt and puts
  all the IO pins back to the normal operation states. In firmware coding,
  this function must be called right after the Suspend function.

arguments:
  none

return value:
  none
*/

void L2_Resume(void) USING_0
{
  //body
  //PRINT_L2("        L2_Resume: Enter\n");
  
  XBYTE[0x2003] = 0x00; //clear swsuspend
 
  return;
}

/*
        XBYTE[0x201b] = 0x03;	// Select FMGPIO, Port 1 Function, DSP internal ROM
        XBYTE[0x2102] = 0xFF;	// P1 Always Output
		XBYTE[0x2002] &= 0xFE;	// Enable DSP Reset, And DSP run !
		//--
		//--- 
		XBYTE[0x2025] = 0x00;	// CPU is 24MHz		
		XBYTE[0x2024] = 0x02;	// CPU is 24MHz
		//0x2025:CPUclk-default,DMAclk-default
		//0x2026:DSPclk-default
		//0x20E3,0x20E4,0x20E5:default
*/

//-----------------------------------------------------------------------------
//L2_InitGlobal
//-----------------------------------------------------------------------------
/*
routine description:
  Intialize the global module.

arguments:
  ASICMode:
    	0: power-on mode initialization

return value:
  0x00   - success
  0x01   - general error
  0x02   - parameter error
  others - error
*/

UCHAR L2_InitGlobal(UCHAR ASICMode) USING_0
{
  UCHAR status;
  
  status = L2K_SUCCESS;

  //PRINT_L2("        L2_InitGlobal: Enter\n");
  
  switch(ASICMode)
  {
    case 0:
    {
      L2_Resume(); //resume with CPU reset

      XBYTE[0x2005] = 0x01; //enable internal transceiver
 //     XBYTE[0x201B] = (XBYTE[0X201B] | 0x01); // Mux I/O Pin is used to FMGPIO for 755
      XBYTE[0x201B] |= 0x01; //Select FMGPIO for Flash I/F
//      XBYTE[0x2006] = 0x01; //enable normal operation of DRAM signal output
      XBYTE[0x2056] = 0x00; //enable normal operation of internal SRAM clock control

    }
    break;

    default:  break;
  }

  //PRINT_L2("        L2_InitGlobal: Exit\n");
  
  return(status);
}


//-----------------------------------------------------------------------------
//L2_ReadRevID
//-----------------------------------------------------------------------------
/*
routine description:
  Read the revision ID.

arguments:
  The revision ID:
                0: version "A"

return value:
  none
*/

void L2_ReadRevID(PUCHAR RevIDPt) USING_0
{
  //PRINT_L2("        L2_ReadRevID: Enter\n");

  *RevIDPt = XBYTE[0x20FF];

  //PRINT_L2("        L2_ReadRevID: RevID = %bx\n", *RevIDPt);
		
  //PRINT_L2("        L2_ReadRevID: Exit\n");
  
  return;
}





⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?