⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 l1_power.c

📁 dz3000_51.0.0.4.rar
💻 C
📖 第 1 页 / 共 2 页
字号:
/********************************************************************************
  Copyright (c) 2001 Sunplus Technology Co., Ltd.
  Module Name:  l1.c
  Function   :  Level-1 function
  Environment:  Keil C51 Compiler
  Creation   :  2001/10/25 Max Hsu
***********************************************************************************/
#include "general.h"
#include "main.h"
#include "initio.h"

//ID = 0x0F01
void L1_PCcamPower(void) USING_0
{
  //PRINT_L1("    L1_PCcamPower: Enter\n");

  L1_InitPCCam();
}

//ID = 0x0F02
//patch5.0@richie@sdram mapping begin  mark all the following functions
#if (0)
void L1_CapturePower(void) USING_0
{
  ULONG rtime;




  //PRINT_L1("    L1_CapturePower: Enter\n");

  L2_TurnOnOffDisplay(0);  //turn off the display device

  /////// RAW DATA CAPTURE /////////////////////////////////////////////////////
  L2_SetCDSPScale(G_Hsize,G_Hsize); //TurnOff the CDSP H-scale function
  L2_SetImageType(0);               //Set raw dta type
  L2_SetDisplayMode(0,0);           // disable  frame rate conversion

  L2_SetRFBAddr(K_SDRAM_FrameBufAAddr+G_Hsize*L1K_VEXTEND); //captured raw data will be stored in the buffer
  L2_SetAFBAddr(K_SDRAM_FrameBufAAddr+G_Hsize*L1K_VEXTEND);

  L2_SetAFBSize(G_Hsize,G_Vsize);
  L2_SetRFBSize(G_Hsize,G_Vsize);      //pointed by the Raw buffer pointer

  L2_SetRCDSPWidth(G_Hsize);
  L2_SetACDSPWidth(G_Hsize);

  L2_SetCamMode(0); //prepare to receiver data fomr the sensor
  L2_SetCamMode(2);

  L2_SetModuPowerDown(0x1f8);
  L2_ConfigGTimer(5); //up count and timebase 1 ms

  while(1) //infinite loop fore power measurement
  {
    L2_WriteGTimer(0);
    L2_StartGTimer();

    L2_WaitVD(0,1);   //wait for the falling edge of VD for one time
    L2_SnapFront(1);  //Trigger the  CMOS sensor into the full-frame mode
    while((L2_CheckDRAMStatus()&0X02)!=0X02);

    L2_StopGTimer();
    L2_ReadGTimer(&rtime);
    //PRINT_L1("    L1_CapturePower: Run time = %lu\n",rtime);
  }
}
#endif

//ID = 0x0F03
#if (0)
void L1_CDSPPower(void) USING_0
{
  ULONG rtime;
  ULONG i;


  //PRINT_L1 ("    L1_CDSPPower: Enter\n");

  L2_TurnOnOffDisplay(0); //turn off the display device

  /////// RAW DATA CAPTURE /////////////////////////////////////////////////////

  L2_SetCDSPScale(G_Hsize,G_Hsize); //TurnOff the CDSP H-scale function
  L2_SetImageType(0);         //Set raw dta type
  L2_SetDisplayMode(0,0);     // disable  frame rate conversion

  L2_SetRFBAddr(K_SDRAM_FrameBufAAddr+G_Hsize*L1K_VEXTEND); //captured raw data will be stored in the buffer
  L2_SetAFBAddr(K_SDRAM_FrameBufAAddr+G_Hsize*L1K_VEXTEND);

  L2_SetAFBSize(G_Hsize,G_Vsize);
  L2_SetRFBSize(G_Hsize,G_Vsize); //pointed by the Raw buffer pointer

  L2_SetRCDSPWidth(G_Hsize);
  L2_SetACDSPWidth(G_Hsize);

  L2_SetCamMode(0); //prepare to receiver data fomr the sensor
  L2_SetCamMode(2);

  L2_WaitVD(0,1);  //wait for the falling edge of VD for one time                          // Set to DSC mode
  L2_SnapFront(1); //Trigger the  CMOS sensor into the full-frame mode

  while((L2_CheckDRAMStatus()&0X02)!=0X02);

  ///////// VERTICAL LINE EXTENSION ////////////////////////////////////////////
  //Extend the vertical image size by 12 lines (mirror) for CDSP
  //The horizontal extending pixels are mirrored by the CDSP automatically
  for(i=1;i<7;i++) //top mirror
    L2_DoDRAMDMA(K_SDRAM_FrameBufAAddr*2+(ULONG)G_Hsize*L1K_VEXTEND*2+(ULONG)G_Hsize*i*2,
                 K_SDRAM_FrameBufAAddr*2+(ULONG)G_Hsize*L1K_VEXTEND*2-(ULONG)G_Hsize*i*2,
                 G_Hsize*2);

  for(i=1;i<7;i++) //bottom mirror
    L2_DoDRAMDMA(K_SDRAM_FrameBufAAddr*2+(ULONG)G_Hsize*L1K_VEXTEND*2-(ULONG)G_Hsize*i*2+(ULONG)G_Hsize*(G_Vsize-1)*2,
	         K_SDRAM_FrameBufAAddr*2+(ULONG)G_Hsize*L1K_VEXTEND*2+(ULONG)G_Hsize*i*2+(ULONG)G_Hsize*(G_Vsize-1)*2,
	         G_Hsize*2);

  L2_SetModuPowerDown(0x1f8);
  L2_ConfigGTimer(5); //up count and timebase 1 ms

  ////// COLOR PROCESSING ///////////////////////////////////////////
  while(1) //infinite loop for power measurement
  {
    L2_WriteGTimer(0);
    L2_StartGTimer();

    L2_DoCDSP(K_SDRAM_FrameBufAAddr,G_Hsize,G_Vsize+L1K_VEXTEND*2,
              K_SDRAM_FrameBufBAddr,G_Hsize,G_Vsize,
              0,0); //this function should extend the horizontal 16-pixels
                    // After this function is done, YUV data is in BFB

    L2_StopGTimer();
    L2_ReadGTimer(&rtime);
    //PRINT_L1("    L1_CDSPPower: Run time = %lu\n",rtime);
  }
}
#endif

#if (0)
//ID = 0x0F04
void L1_CompressPower(void) USING_0
{
  ULONG rtime;
  ULONG i;
  ULONG size;



  //PRINT_L1("    L1_CompressPower: Enter\n");

  L2_TurnOnOffDisplay(0); //turn off the display device

  /////// RAW DATA CAPTURE /////////////////////////////////////////////////////

  L2_SetCDSPScale(G_Hsize,G_Hsize); //TurnOff the CDSP H-scale function
  L2_SetImageType(0);               //Set raw dta type
  L2_SetDisplayMode(0,0);           // disable  frame rate conversion

  L2_SetRFBAddr(K_SDRAM_FrameBufAAddr+G_Hsize*L1K_VEXTEND); //captured raw data will be stored in the buffer
  L2_SetAFBAddr(K_SDRAM_FrameBufAAddr+G_Hsize*L1K_VEXTEND);

  L2_SetAFBSize(G_Hsize,G_Vsize);
  L2_SetRFBSize(G_Hsize,G_Vsize); //pointed by the Raw buffer pointer

  L2_SetRCDSPWidth(G_Hsize);
  L2_SetACDSPWidth(G_Hsize);

  L2_SetCamMode(0); //prepare to receiver data fomr the sensor
  L2_SetCamMode(2); //Set to DSC mode

  L2_WaitVD(0,1);  //wait for the falling edge of VD for one time
  L2_SnapFront(1); //Trigger the  CMOS sensor into the full-frame mode

  while((L2_CheckDRAMStatus()&0X02)!=0X02);

  ///////// VERTICAL LINE EXTENSION ////////////////////////////////////////////
  //Extend the vertical image size by 12 lines (mirror) for CDSP
  //The horizontal extending pixels are mirrored by the CDSP automatically
  for(i=1;i<7;i++) //top mirror
    L2_DoDRAMDMA(K_SDRAM_FrameBufAAddr*2+(ULONG)G_Hsize*L1K_VEXTEND*2+(ULONG)G_Hsize*i*2,
                 K_SDRAM_FrameBufAAddr*2+(ULONG)G_Hsize*L1K_VEXTEND*2-(ULONG)G_Hsize*i*2,
                 G_Hsize*2);

  for(i=1;i<7;i++) //bottom mirror
    L2_DoDRAMDMA(K_SDRAM_FrameBufAAddr*2+(ULONG)G_Hsize*L1K_VEXTEND*2-(ULONG)G_Hsize*i*2+(ULONG)G_Hsize*(G_Vsize-1)*2,
	         K_SDRAM_FrameBufAAddr*2+(ULONG)G_Hsize*L1K_VEXTEND*2+(ULONG)G_Hsize*i*2+(ULONG)G_Hsize*(G_Vsize-1)*2,
	         G_Hsize*2);

  ////// COLOR PROCESSING ///////////////////////////////////////////
  /*
  L2_DoCDSP(G_AFBAddr,G_Hsize,G_Vsize+L1K_VEXTEND*2,
            G_BFBAddr,G_Hsize,G_Vsize,
            0,0); //this function should extend the horizontal 16-pixels
                  // After this function is done, YUV data is in BFB

  */

  L2_DoCDSP(K_SDRAM_FrameBufAAddr,G_Hsize,G_Vsize+L1K_VEXTEND*2,
            K_SDRAM_FrameBufBAddr,120,100,
            0,0x33);

  return;



  /////// 2X Digital Zoom ///////////////////////////////////////////
  if(G_PVZFactor==20)
  {
    L2_CopyImage(K_SDRAM_FrameBufBAddr,G_Hsize,G_Vsize,        //source address and size
                 G_Hsize/4,G_Vsize/4,              //source offset
                 G_Hsize/2,G_Vsize/2,              //size to be copied
                 K_SDRAM_FrameBufAAddr,G_Hsize/2,G_Vsize/2,    //destination address and size
                 0,0);                             //destination offset

    L2_ScaleUpImage(K_SDRAM_FrameBufAAddr,G_Hsize/2,G_Vsize/2, //source
                    K_SDRAM_FrameBufBAddr, G_Hsize, G_Vsize,   //destination
                    K_SDRAM_TemporaryBufAddr);                   //temp buffer
  }

⌨️ 快捷键说明

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