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

📄 l1_power.c

📁 dz3000_51.0.0.4.rar
💻 C
📖 第 1 页 / 共 2 页
字号:
  //////// COMPRESSION //////////////////////////////////////////////
  L2_SetCamMode(0);           //must switch back to idle before compression
  L2_SetJPEGVscale(G_Vsize,G_Vsize);  //turn off JPEG Vertical scaling function

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

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

    //use option 0x30 instead of 0x20 in the final version
    //since our AP can only deal with the non-JFIF format, so use 0x20 here
    L2_Compress(2,K_SDRAM_FrameBufBAddr,G_Hsize,G_Vsize,  //source
                K_SDRAM_GeneralBufAddr,                   //destination
                K_SDRAM_AviCapVLCBufAddrA,                   //DC-teram location
                0x20);                        //Mode (use 0x03 in the final JFIF version)

    L2_ReadCompSize(&size);

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

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


  //PRINT_L1("    L1_DeCompressPower: 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(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

  /////// 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
  }

  //////// COMPRESSION //////////////////////////////////////////////
  L2_SetCamMode(0);           //must switch back to idle before compression
  L2_SetJPEGVscale(G_Vsize,G_Vsize);  //turn off JPEG Vertical scaling function

  //use option 0x30 instead of 0x20 in the final version
  //since our AP can only deal with the non-JFIF format, so use 0x20 here
  L2_Compress(2,K_SDRAM_FrameBufBAddr,G_Hsize,G_Vsize,  //source
              K_SDRAM_GeneralBufAddr,                   //destination
              K_SDRAM_AviCapVLCBufAddrA,                   //DC-teram location
              0x20);                        //Mode (use 0x03 in the final JFIF version)

  L2_ReadCompSize(&size);

  //////// DECOMPRESSION //////////////////////////////////////////////
  L2_SetCamMode(0);

  L1_InitPlayback();

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

  while(1)
  {
    L2_WriteGTimer(0);
    L2_StartGTimer();

    L2_DeCompress(K_SDRAM_GeneralBufAddr, G_Hsize, G_Vsize, K_SDRAM_FrameBufBAddr, 0x00, 0x00, 0x00);

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

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

  L1_InitPreview(1);

     	L2_TurnOnOffDisplay(1);  //turn on the display device
}

//ID= 0x0F07
void L1_UpLoadPower(void) USING_0
{
  //PRINT_L1 ("    L1_UpLoadPower: Enter\n");
}

//ID= 0x0F08
void L1_DnLoadPower(void) USING_0
{
  //PRINT_L1 ("    L1_DnLoadPower: Enter\n");
}

//ID = 0x0F10
#if (0)
void L1_DoCDSP2(void) USING_0
{

  //PRINT_L1 ("    L1_DoCDSP2: Enter\n");
  ULONG i;



  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);

  ////// COLOR PROCESSING ///////////////////////////////////////////
  L2_DoCDSP2(K_SDRAM_FrameBufAAddr,G_Hsize,G_Vsize+L1K_VEXTEND*2,
             K_SDRAM_FrameBufBAddr,G_Hsize,G_Vsize,
             0,0,K_SDRAM_TemporaryBufAddr);

//  L2_DoCDSPSB(G_AFBAddr,G_Hsize,G_Vsize+L1K_VEXTEND*2,G_Vsize,G_FreeAddr);

  L2_DoCDSP2(K_SDRAM_FrameBufAAddr,G_Hsize,G_Vsize+L1K_VEXTEND*2,
             K_SDRAM_FrameBufAAddr,G_Hsize,G_Vsize,
             0,0,K_SDRAM_TemporaryBufAddr);

  //PRINT_L1("    L1_DoCDSP2: Exit");
}
#endif
//patch5.0@richie@sdram mapping end

⌨️ 快捷键说明

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