1. 程式人生 > >米聯客 ZYNQ/SOC 精品教程 S02-CH25 利用OSD實現雙目攝像頭字幕疊加

米聯客 ZYNQ/SOC 精品教程 S02-CH25 利用OSD實現雙目攝像頭字幕疊加

軟體版本:VIVADO2017.4

作業系統:WIN10 64bit

硬體平臺:適用米聯客 ZYNQ系列開發板

米聯客(MSXBO)論壇:www.osrc.cn答疑解惑專欄開通,歡迎大家給我提問!!

25.1 概述

      本課使用MT9V034搭建兩路基於VDMA的攝像頭圖形採集系統,並對OSD實現字幕疊加功能說明。提供的程式碼也包含MT9V034、OV5640攝像頭雙目例程,實現過程大同小異,這裡不做過多講解。

25.2 雙目影象採集傳輸系統架構圖

25.3 FPGA BD工程

25.3.1 攝像頭電路設計

     本課使用兩個MT9V034攝像頭(配套的程式碼也給出了2路OV5640攝像頭OSD方案),每路攝像頭輸出解析度640*480。攝像頭部分電路設計如下所示:

 

25.3.2 Vid_in IP電路搭建

        MT9V034的vid_ce訊號始終接電平。這裡給出MT9V034部分電路設計:

 

25.3.3 VDMA設定

25.3.4 OSD設定

本章要使用OSD完成字幕的疊加功能,所以要開啟AXI-lite控制介面。OSD配置如下所示:

LAYER2和LAYER3層設定

      上面第一副圖中,我們勾選了控制介面,開啟了4個Layer,最大輸出設定為了1280。至於為什麼使用4個layer,這是因為要完成2路視訊拼接和2路字幕疊加。另外最後2個layer就是字幕疊加層,所以將其設定為了Internal Graphics Controllers。第二副圖是對各個層進行顯示的設定,大家也可以修改這一部分的設定來完成各個圖層的顯示位置,功能也不僅僅侷限於拼接視訊,也可以完成畫中畫的功能,OSD是個功能很強大的IP!設定完這兩部分之後,在LAYER2、3設定ASCII Offset為0,否則後面設定字串會發生錯位,其餘的配置按預設即可。

25.3.5 PLL時鐘設定

      PLL時鐘的設定取決於解析度大小的設定,本節採用的是720P輸出,因此PLL時鐘設定如下:

25.3.6 VTC設定

25.3.7 AXI IIC設定

     本節課要使用2路攝像頭進行採集,需要兩路IIC配置對攝像頭暫存器進行配置。

此部分的設定如下圖所示:

      其餘選項的設定參考之前歷程的設定即可。

25.4 軟體部分設計

     軟體部分主要可以分為三塊,IIC協議實現、OSD驅動與VDMA配置。下面分別對這三個部分進行介紹。

25.4.1 IIC實現

     本課節當中要對兩個攝像頭進行暫存器配置,如下圖所示:

 

在main.c中可以看到攝像頭IIC初始化配置函式。

  

在I2C_8bit.c檔案中,找到I2C_config_init()配置函式。

其中,在I2C_8bit.c中可以查詢到mt9v034_config_table[]與I2C_write相關定義。

相關定義mt9v034_config_table[]

       其中write_i2c是ov5640的iic配置程式,write_i2c_mt是MT9V034的iic配置程式,程式的主要設計思想就是使用一個數字來存放要配置的暫存器地址和資料。

25.4.2 OSD驅動設計

      OSD驅動部分主要由osd.c與osd.h組成。程式由官方驅動重新封裝,此處重點介紹osd.c。OSD驅動如下表所示:

 

 

#include "xbasic_types.h"

#include "xparameters.h"

#include "xstatus.h"

#include "osd.h"

#include "xosd.h"

#include "stdio.h"

 

 

/*

 * Device related constants. Defined in xparameters.h

 */

#define OSD_DEVICE_ID     XPAR_OSD_0_DEVICE_ID

 

/*

 * OSD Device related data structures

 */

XOSD Osd;                    /* OSD Device driver instance */

XOSD_Config *OsdCfgPtr;      /* OSD device configuration pointer */

 

/*

 * Color table definition

 */

u32 ColorData[16] = {

    0x00000000, 0xa0a25f58, 0xa08080ff, 0xa0808010,

    0xa0ef5a51, 0x00000000, 0xa0465289, 0x00000000,

    0xa065ba6b, 0x00000000, 0xa09017c5, 0xa0a9c860,

    0xa0bc3198, 0xa010a5a9, 0xa0808080, 0xa0ada1ab

};

 

/*

 * Text table definition

 */

char __attribute__ ((aligned (4))) TextData[8][32] = {

    "OV5640", //"String #1",

    "OV7725",                       //"String #2",

    "MT9V034 CAMER TEST",

"www.osrc.cn"

    "Xilinx",

    "String #5",

    "String #6",

    "String #7"

   // "String #8"

};

 

/*

 * Font definition

 */

unsigned char __attribute__ ((aligned (4))) Font[128][8] = {

    {0x00, 0x36, 0x7F, 0x7F, 0x3E, 0x1C, 0x08, 0x00}, // NULL

    {0x18, 0x18, 0x18, 0x1F, 0x1F, 0x18, 0x18, 0x18},

    {0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03},

    {0x18, 0x18, 0x18, 0xF8, 0xF8, 0x00, 0x00, 0x00},

    {0x18, 0x18, 0x18, 0xF8, 0xF8, 0x18, 0x18, 0x18},

    {0x00, 0x00, 0x00, 0xF8, 0xF8, 0x18, 0x18, 0x18},

    {0x03, 0x07, 0x0E, 0x1C, 0x38, 0x70, 0xE0, 0xC0},

    {0xC0, 0xE0, 0x70, 0x38, 0x1C, 0x0E, 0x07, 0x03},

    {0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF},

    {0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F},

    {0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF},

    {0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00},

    {0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00},

    {0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},

    {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF},

    {0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0},

    {0x00, 0x1C, 0x1C, 0x77, 0x77, 0x08, 0x1C, 0x00},

    {0x00, 0x00, 0x00, 0x1F, 0x1F, 0x18, 0x18, 0x18},

    {0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00},

    {0x18, 0x18, 0x18, 0xFF, 0xFF, 0x18, 0x18, 0x18},

    {0x00, 0x00, 0x3C, 0x7E, 0x7E, 0x7E, 0x3C, 0x00},

    {0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF},

    {0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0},

    {0x00, 0x00, 0x00, 0xFF, 0xFF, 0x18, 0x18, 0x18},

    {0x18, 0x18, 0x18, 0xFF, 0xFF, 0x00, 0x00, 0x00},

    {0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0},

    {0x18, 0x18, 0x18, 0x1F, 0x1F, 0x00, 0x00, 0x00},

    {0x78, 0x60, 0x78, 0x60, 0x7E, 0x18, 0x1E, 0x00},

    {0x00, 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x00},

    {0x00, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00},

    {0x00, 0x18, 0x30, 0x7E, 0x30, 0x18, 0x00, 0x00},

    {0x00, 0x18, 0x0C, 0x7E, 0x0C, 0x18, 0x00, 0x00},

 

    {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // Space

    {0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00},

    {0x00, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00},

    {0x00, 0x66, 0xFF, 0x66, 0x66, 0xFF, 0x66, 0x00},

    {0x18, 0x3E, 0x60, 0x3C, 0x06, 0x7C, 0x18, 0x00},

    {0x00, 0x66, 0x6C, 0x18, 0x30, 0x66, 0x46, 0x00},

    {0x1C, 0x36, 0x1C, 0x38, 0x6F, 0x66, 0x3B, 0x00},

    {0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00},

    {0x00, 0x0E, 0x1C, 0x18, 0x18, 0x1C, 0x0E, 0x00},

    {0x00, 0x70, 0x38, 0x18, 0x18, 0x38, 0x70, 0x00},

    {0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00},

    {0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00},

    {0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30},

    {0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00},

    {0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00},

    {0x00, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00},// /

    {0x00, 0x3C, 0x66, 0x6E, 0x76, 0x66, 0x3C, 0x00},// 0

    {0x00, 0x18, 0x38, 0x18, 0x18, 0x18, 0x7E, 0x00},//1

    {0x00, 0x3C, 0x66, 0x0C, 0x18, 0x30, 0x7E, 0x00},//2

    {0x00, 0x7E, 0x0C, 0x18, 0x0C, 0x66, 0x3C, 0x00},//3

    {0x00, 0x0C, 0x1C, 0x3C, 0x6C, 0x7E, 0x0C, 0x00},//4

    {0x00, 0x7E, 0x60, 0x7C, 0x06, 0x66, 0x3C, 0x00},//5

    {0x00, 0x3C, 0x60, 0x7C, 0x66, 0x66, 0x3C, 0x00},//6

    {0x00, 0x7E, 0x06, 0x0C, 0x18, 0x30, 0x30, 0x00},//7

    {0x00, 0x3C, 0x66, 0x3C, 0x66, 0x66, 0x3C, 0x00},//8

    {0x00, 0x3C, 0x66, 0x3E, 0x06, 0x0C, 0x38, 0x00},//9

    {0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00},

    {0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x30},

    {0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00},

    {0x00, 0x00, 0x7E, 0x00, 0x00, 0x7E, 0x00, 0x00},

    {0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60, 0x00},

    {0x00, 0x3C, 0x66, 0x0C, 0x18, 0x00, 0x18, 0x00},

 

    {0x00, 0x3C, 0x66, 0x6E, 0x6E, 0x60, 0x3E, 0x00}, // @

    {0x00, 0x18, 0x3C, 0x66, 0x66, 0x7E, 0x66, 0x00}, // A

    {0x00, 0x7C, 0x66, 0x7C, 0x66, 0x66, 0x7C, 0x00},

    {0x00, 0x3C, 0x66, 0x60, 0x60, 0x66, 0x3C, 0x00},

    {0x00, 0x78, 0x6C, 0x66, 0x66, 0x6C, 0x78, 0x00},

    {0x00, 0x7E, 0x60, 0x7C, 0x60, 0x60, 0x7E, 0x00},

    {0x00, 0x7E, 0x60, 0x7C, 0x60, 0x60, 0x60, 0x00},

    {0x00, 0x3E, 0x60, 0x60, 0x6E, 0x66, 0x3E, 0x00},

    {0x00, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66, 0x00},

    {0x00, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00},

    {0x00, 0x06, 0x06, 0x06, 0x06, 0x66, 0x3C, 0x00},

    {0x00, 0x66, 0x6C, 0x78, 0x78, 0x6C, 0x66, 0x00},

    {0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7E, 0x00},

    {0x00, 0x63, 0x77, 0x7F, 0x6B, 0x63, 0x63, 0x00},

    {0x00, 0x66, 0x76, 0x7E, 0x7E, 0x6E, 0x66, 0x00},

    {0x00, 0x3C, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00},

    {0x00, 0x7C, 0x66, 0x66, 0x7C, 0x60, 0x60, 0x00},

    {0x00, 0x3C, 0x66, 0x66, 0x66, 0x6C, 0x36, 0x00},

    {0x00, 0x7C, 0x66, 0x66, 0x7C, 0x6C, 0x66, 0x00},

    {0x00, 0x3C, 0x60, 0x3C, 0x06, 0x06, 0x3C, 0x00},

    {0x00, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00},

    {0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7E, 0x00},

    {0x00, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00},

    {0x00, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00},

    {0x00, 0x66, 0x66, 0x3C, 0x3C, 0x66, 0x66, 0x00},

    {0x00, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x18, 0x00},

    {0x00, 0x7E, 0x0C, 0x18, 0x30, 0x60, 0x7E, 0x00},//Z

    {0x00, 0x1E, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00},

    {0x00, 0x40, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x00},

    {0x00, 0x78, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00},

    {0x00, 0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00},

    {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00},

 

    {0x40, 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00}, // `

    {0x00, 0x00, 0x3C, 0x06, 0x3E, 0x66, 0x3E, 0x00}, // a

    {0x00, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x7C, 0x00},

    {0x00, 0x00, 0x3C, 0x60, 0x60, 0x60, 0x3C, 0x00},

    {0x00, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3E, 0x00},

    {0x00, 0x00, 0x3C, 0x66, 0x7E, 0x60, 0x3C, 0x00},

    {0x00, 0x0E, 0x18, 0x3E, 0x18, 0x18, 0x18, 0x00},

    {0x00, 0x00, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x7C},

    {0x00, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x00},

    {0x00, 0x18, 0x00, 0x38, 0x18, 0x18, 0x3C, 0x00},

    {0x00, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x3C},

    {0x00, 0x60, 0x60, 0x6C, 0x78, 0x6C, 0x66, 0x00},

    {0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00},

    {0x00, 0x00, 0x66, 0x7F, 0x7F, 0x6B, 0x63, 0x00},

    {0x00, 0x00, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x00},

    {0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x00},

    {0x00, 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x60, 0x60},

    {0x00, 0x00, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x06},

    {0x00, 0x00, 0x7C, 0x66, 0x60, 0x60, 0x60, 0x00},

    {0x00, 0x00, 0x3E, 0x60, 0x3C, 0x06, 0x7C, 0x00},

    {0x00, 0x18, 0x7E, 0x18, 0x18, 0x18, 0x0E, 0x00},

    {0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3E, 0x00},

    {0x00, 0x00, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00},

    {0x00, 0x00, 0x63, 0x6B, 0x7F, 0x3E, 0x36, 0x00},

    {0x00, 0x00, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0x00},

    {0x00, 0x00, 0x66, 0x66, 0x66, 0x3E, 0x0C, 0x78},

    {0x00, 0x00, 0x7E, 0x0C, 0x18, 0x30, 0x7E, 0x00},

 

    {0x14, 0x10, 0x10, 0x40, 0x10, 0x10, 0x14, 0x00}, // {

    {0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18},

    {0x50, 0x10, 0x10, 0x04, 0x10, 0x10, 0x50, 0x00}, // }

    {0x11, 0x11, 0x44, 0x44, 0x00, 0x00, 0x00, 0x00}, // ~

    {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 127 DEL

};

 

/*

 * Function prototypes

 */

 int  OsdInit(int DeviceID);

 void external_OsdConfig(u8 layer,u16 Screen_width,u16 Screen_height,u16 Camera_width,u16 Camera_height,u16 xpos_start,u16 ypos_start);

 void internal_Graphics_setting(u8 Gcindex,u16 Screen_width,u16 Screen_height,u16 Xpos_start,u16 Ypos_start,u8 BankIndex);

 void OsdDrawText(int Gcindex,int x_pos, int y_pos, int color, int string_index, int text_size,u8 BankIndex);

 void OsdDrawBox(int Gcindex,u16 x_start, u16 y_start, u16 x_last, u16 y_last, u8 color,u8 BankIndex);

 

 

void Camera_osd_init(void)

{

    int  bOsdInitialized = 0;

 

   if ( !bOsdInitialized )

   {

      OsdInit(OSD_DEVICE_ID);

      external_OsdConfig(0,1280,720,640,480,0,140);  //外部輸入圖層配置

      external_OsdConfig(1,1280,720,640,480,640,140);//外部輸入圖層配置

     internal_Graphics_setting(2,1280,720,0,0,0); //內出輸入圖層配置

     internal_Graphics_setting(3,1280,720,0,0,0); //內出輸入圖層配置

      bOsdInitialized = 1;

   }

 

   OsdDrawText(2,30,40,8,2,8,0);  //新增文字

   OsdDrawBox(3,25,25,1255,115, 8,0);//新增框

}

 

/*****************************************************************************/

/**

*

* This function initializes the OSD device and its driver instance.

*

* @param    DeviceID is the device ID of the OSD device.

*

* @return   0 if the initialization is successful; 1 otherwise.

*

* @note     None.

*

******************************************************************************/

int OsdInit(int DeviceID)

{

int Status;

 

/* Initialize the OSD instance */

 

OsdCfgPtr = XOSD_LookupConfig(DeviceID);

Status = XOSD_CfgInitialize(&Osd, OsdCfgPtr, OsdCfgPtr->BaseAddress);

if (Status != XST_SUCCESS)

return 1;

 

/* Reset the devices */

 

XOSD_Reset(&Osd);

 

/* Enable the OSD device and tell it to pick up the register changes */

 

XOSD_Enable(&Osd);

XOSD_RegUpdateEnable(&Osd);

 

return 0;

}

 

 

void internal_Graphics_setting(u8 Gcindex,u16 Screen_width,u16 Screen_height,u16 Xpos_start,u16 Ypos_start,u8 BankIndex)

{

u16 width   = Screen_width;

u16 height  = Screen_height;

 

int LayerAlphaValue = 0xFF;

int LayerGlobalAlphaEnable = 0;

int LayerPriority;

 

u8 ColorBankIndex=BankIndex;

u8 CharBankIndex=BankIndex;

u8 TextBankIndex=BankIndex;

u8 InstructionBankIndex=BankIndex;

 

if(Gcindex==0)

LayerPriority = XOSD_LAYER_PRIORITY_0;

else if(Gcindex==1)

LayerPriority = XOSD_LAYER_PRIORITY_1;

else if(Gcindex==2)

LayerPriority = XOSD_LAYER_PRIORITY_2;

else if(Gcindex==3)

LayerPriority = XOSD_LAYER_PRIORITY_3;

else if(Gcindex==4)

LayerPriority = XOSD_LAYER_PRIORITY_4;

else if(Gcindex==5)

LayerPriority = XOSD_LAYER_PRIORITY_5;

else if(Gcindex==6)

LayerPriority = XOSD_LAYER_PRIORITY_6;

else if(Gcindex==7)

LayerPriority = XOSD_LAYER_PRIORITY_7;

else

xil_printf("Para err!");

 

 

 

/* Set up Layer's Alpha, Priority, Dimension and enable it */

XOSD_SetLayerAlpha(&Osd, Gcindex, LayerGlobalAlphaEnable, LayerAlphaValue);

XOSD_SetLayerPriority(&Osd, Gcindex, LayerPriority);

XOSD_SetLayerDimension(&Osd, Gcindex, Xpos_start, Xpos_start, width, height);

XOSD_EnableLayer(&Osd, Gcindex);

 

    /* Load color, font and text and set the active banks */

 

XOSD_LoadColorLUTBank(&Osd, Gcindex, BankIndex, ColorData);

XOSD_LoadCharacterSetBank(&Osd, Gcindex, BankIndex, (u32 *)Font);

XOSD_LoadTextBank(&Osd, Gcindex, BankIndex, (u32 *)TextData);

XOSD_SetActiveBank(&Osd, Gcindex, ColorBankIndex, CharBankIndex,  TextBankIndex, InstructionBankIndex);

 

}

 

/*****************************************************************************/

/**

*

* This function does the general configuration on an OSD device. The

* configuration includes:

*

*   - Screen Size

*   - Background Color

*   - Layer 0 setup: Alpha, Priority, Dimension and enabling

*   - Layer 1 setup: Alpha, Priority, Dimension and enabling

*   - Loading Color/Font/Text configuration

*

* @param    None.

*

* @return   None.

*

* @note     None.

*

******************************************************************************/

void external_OsdConfig(u8 layer,u16 Screen_width,u16 Screen_height,u16 Camera_width,u16 Camera_height,u16 xpos_start,u16 ypos_start)

{

   /* Background color definition */

 

   u16 screen_width = Screen_width;

   u16 screen_height = Screen_height;

   u16 camera_width = Camera_width;

   u16 camera_height = Camera_height;

 

   u8 Red = 0x0; //0xFF;

   u8 Blue = 0x0; //0;

   u8 Green = 0x0; //0;

 

   /* Layer  property definition */

 

   int LayerAlphaValue = 0xFF;

   int LayerGlobalAlphaEnable = 1;

   int LayerPriority;

 

   if(layer==0)

    LayerPriority = XOSD_LAYER_PRIORITY_0;

    else if(layer==1)

    LayerPriority = XOSD_LAYER_PRIORITY_1;

    else if(layer==2)

    LayerPriority = XOSD_LAYER_PRIORITY_2;

    else if(layer==3)

    LayerPriority = XOSD_LAYER_PRIORITY_3;

    else if(layer==4)

    LayerPriority = XOSD_LAYER_PRIORITY_4;

    else if(layer==5)

    LayerPriority = XOSD_LAYER_PRIORITY_5;

    else if(layer==6)

    LayerPriority = XOSD_LAYER_PRIORITY_6;

    else if(layer==7)

    LayerPriority = XOSD_LAYER_PRIORITY_7;

    else

    xil_printf("Para err!");

 

 

   xil_printf("OsdConfig(%d,%d) Start\r\n", screen_width, screen_height);

 

   /* Set screen size */

   xil_printf("-- Set screen size ...\r\n" );

 

   XOSD_SetScreenSize(&Osd, screen_width, screen_height);

 

   /* Set Background color */

   xil_printf("-- Set Background color ...\r\n" );

 

   XOSD_SetBackgroundColor(&Osd, Red, Blue, Green);

 

   /* Set up Layer's Alpha, Priority, Dimension and enable it */

   xil_printf("-- Set up Layer 0's Alpha, Priority, Dimension and enable it ...\r\n" );

   XOSD_SetLayerAlpha(&Osd, layer, LayerGlobalAlphaEnable, LayerAlphaValue);

   XOSD_SetLayerPriority(&Osd, layer, LayerPriority);

   XOSD_SetLayerDimension(&Osd, layer, xpos_start, ypos_start, camera_width, camera_height);

   XOSD_EnableLayer(&Osd, layer);

 

    /* Enable the OSD device and tell it to pick up the register changes */

   xil_printf("-- Enable the OSD device ...\r\n" );

 

   //XOSD_Enable(&Osd);

 

   xil_printf("OsdConfig Done\r\n" );

   return;

}

/*****************************************************************************/

/**

*

* This function draws text using the OSD device

*

* @param    None.

*

* @return   None.

*

* @note     None.

*

******************************************************************************/

void OsdDrawText(int Gcindex,int x_pos, int y_pos, int color, int string_index, int text_size,u8 BankIndex)

{

  xil_printf("OsdDrawText Start\r\n" );

 

  /* Instruction buffer */

  u32 Instruction[XOSD_INS_SIZE];

 

 

  u16 ObjType = XOSD_INS_OPCODE_TXT; /* A text string  XOSD_INS_OPCODE_TXT*/

  u8  ObjSize = (text_size<<4);      

相關推薦

ZYNQ/SOC 精品教程 S02-CH25 利用OSD實現雙目攝像頭字幕疊加

軟體版本:VIVADO2017.4 作業系統:WIN10 64bit 硬體平臺:適用米聯客 ZYNQ系列開發板 米聯客(MS

ZYNQ/SOC 精品教程 S02-CH19 利用BRAM進行PS與PL間資料互動

軟體版本:VIVADO2017.4 作業系統:WIN10 64bit 硬體平臺:適用米聯客 ZYNQ系列開發板 米聯客(MS

ZYNQ/SOC 精品教程 S03-CH01基於FDMA記憶體讀寫測試

軟體版本:VIVADO2017.4 作業系統:WIN10 64bit 硬體平臺:適用米聯客 ZYNQ系列開發板 米聯客(MS

ZYNQ/SOC 精品教程 S05-CH06 可程式設計差分晶振 Si570 使用

6.1概述      使用 FPGA 的高速序列收發器(GTP、GTX 等)設

——DMA 閉環測試 學習心得

剛學了米聯客的DMA閉環測試這一章,這裡記錄一下sdk的理解 /*………………主函式………………*/ int main(void) { init_intr_sys(); axi_dma_test(); } 主函式很簡單就兩個子函式 首先來看一下 init_intr_sy

(MSXBO)osrc-lab LINUX開發包使用說明

使用XILINX ZYNQ FPGA開發LINUX使用petalinux大行其道,沒錯使用petalinux是比較簡潔和高效的辦法

(MSXBO)MZ7035FC PCIE Nvme SDD驗證測試

1、概述 NVM Express(NVMe),或稱非易失性記憶體主機控制器介面規範(Non-Volatile Memory ex

(MSXBO)USB3.0 UVC攝像頭實現基於FT602Q晶片方案

USB3.0 UVC攝像頭實現基於FT602Q晶片方案 USB3.0介面晶片FT602Q支援UVC協議,可以很方便的實現一個US

(MSXBO)通過簡單的加法器瞭解LUT查詢表實現加法功能

1.1概述 由於FPGA需要被反覆燒寫,它實現組合邏輯的基本結構不可能像ASIC那樣通過固定的與非門來完成,而只能採用一種易於反覆配置的結構。查詢表可以很好地滿足這一要求,目前主流FPGA都採用了基於SRAM工藝的查詢表結構。LUT本質上就是一個RAM。它把資料事先寫入RAM後, 每當輸入一個

07_傳智播iOS視頻教程_#import指令

一次 img png logs -1 預編譯 port alt 技術分享 預處理指令的執行時機是在編譯之前。在編譯之前執行預處理指令。 #import指令是包含文件,將指定的文件的內容在預編譯的時候拷貝到寫指令的地方。 #import指令無論把一個文件import了多少次,

1線刷救磚教程V5版(移動聯通適用,線刷包永久有效)

裏的 警告 大全 磚頭 中國 民間 png 技術 關機 紅米1線刷救磚教程V5版(移動聯通適用,線刷包永久有效) 原文來自:http://www.miui.com/thread-1890972-1-1.html?mobile=2 ,加了些自己的經驗。 (我用這個方法救活

tensorflow精品教程:變量

orm run AR import orf 否則 port imp initial import tensorflow as tfa = tf.Variable(tf.random_uniform(shape=[10, 10]))with tf.Session() as s

Node.js的開源博系統Ghost搭建教程

參考 運行 qlite 停止 存儲 img 圖片 http 啟動 準備工作 Node.js版本:0.10.x、0.12.x、4.2.x。安裝步驟可參考:Node.js環境搭建 Ghost版本:0.7.4:中文集成版(33.6M),中文標準版(3.39M),英文原版(3.2

精品教程 如何設計一個相機陣列(3)單模固定支架

技術 2-2 center union div cpp light col translate module cam_zhuti(){ cx=43.5;cy=58;cz=29; color([1,0.5,0.3])translate(

【轉】 python開發大全、系列文章、精品教程

python應用教程 python後臺架構Django教程 python自動化測試教程 python網路爬蟲教程

利用ZYNQ SOC快速開啟演算法驗證通路(6)——利用AXI匯流排實時配置sysGen子系統

  利用ZYNQ驗證演算法的一大優勢在於,可以在上位機發送指令藉助CPU的控制能力和C語言易開發特點,實時配置演算法模組的工作模式、引數等對來對其演算法模組效能進行全面的評估。最重要的是無需重新綜合硬體模組。   接著上篇該系列博文,在sysGen中設計模組功能為:根據模式選擇輸入,來完成乘2或除2兩種運算,

零基礎學習ZYNQ+SOC+Linux開發

說到學習ZYNQ+SOC+Linux開發,我認為主要應該細分為lian兩大點:zynq,soc合為一個點,linux為一個點。下面我就給大家介紹學習的流程和路線。 一,學習zynq+soc的FPGA開發部分和片上ARM核的暫存器,裸奔應用開發,我推薦大家收閱讀文

python開發大全、系列文章、精品教程

python基礎教程 python應用教程 python後臺架構Django教程 python自動化測試教程 python網路爬蟲教程

JAVA架構師VIP精品教程,Spring原始碼解析視訊

JAVA架構師VIP精品課程 ,某泡學院稀缺資源, 《重磅乾貨Java架構師全套vip課程視訊教程》2018年最新視訊教程 java架構師篇,從學習計劃到java原始碼分析,

利用ZYNQ SOC快速開啟演算法驗證通路(6)——LWIP實現千兆TCP/IP網路傳輸

1 /****************************************************************************** 2 * 3 * Copyright (C) 2009 - 2014 Xilinx, Inc. All rights reserved