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

📄 tskosd.c

📁 基于DM642的OSD显示程序
💻 C
字号:
/*
 *  Copyright 2003 by Texas Instruments Incorporated.
 *  All rights reserved. Property of Texas Instruments Incorporated.
 *  Restricted rights to use, duplicate or disclose this code are
 *  granted through contract.
 *  
 */

#include <std.h>
#include <sem.h>   
#include <gio.h>
#include <tsk.h>
#include <csl_cache.h>       
#include <csl_edma.h>

#include <evmdm642.h>     
#include <evmdm642osd.h> 

#include <osdutil.h>
#include <osdcolor.h>
#include "tskOSD.h"



extern Int EXTERNALHEAP;

static GIO_Handle osdHandle;

static void tskOSDInit()
{
    OSDUTIL_Point a, b;

    a.x = 0;
    a.y = 0;
    b.x = OSDBUF_HSIZE -1;
    b.y = 48 -1;
    OSDUTIL_rectangle((void *)osdBuf, &a, &b, OSDCOLOR_RED, OSDBUF_HSIZE);
    OSDUTIL_rectangle((void *)osdBuf4, &a, &b, OSDCOLOR_TRANSPARENT, OSDBUF_HSIZE);
	a.x += 48;
	OSDUTIL_drawPixmap((Uint8 *)osdBuf, OSDBUF_HSIZE, &a, &tilogo, OSDCOLOR_WHITE, OSDCOLOR_BLACK);
	OSDUTIL_drawPixmap((Uint8 *)osdBuf4, OSDBUF_HSIZE, &a, &tilogo, OSDCOLOR_WHITE, OSDCOLOR_TRANSPARENT);
    a.x += tilogo.width + 32;
    a.y += 4;
	OSDUTIL_text((Uint8 *)osdBuf, OSDBUF_HSIZE, &a,  "TMS320DM642 EVM Example ", OSDUTIL_FONT_DEFAULT, OSDCOLOR_WHITE, OSDCOLOR_NODRAW);
	OSDUTIL_text((Uint8 *)osdBuf4, OSDBUF_HSIZE, &a, "TMS320DM642 EVM Example ", OSDUTIL_FONT_DEFAULT, OSDCOLOR_WHITE, OSDCOLOR_TRANSPARENT);
	a.y += OSDUTIL_FONT_DEFAULT_HEIGHT*2;
    OSDUTIL_text((Uint8 *)osdBuf, OSDBUF_HSIZE, &a, "Video Loopback and OSD", OSDUTIL_FONT_DEFAULT, OSDCOLOR_WHITE, OSDCOLOR_NODRAW);
    OSDUTIL_text((Uint8 *)osdBuf4, OSDBUF_HSIZE, &a, "Video Loopback and OSD", OSDUTIL_FONT_DEFAULT, OSDCOLOR_WHITE, OSDCOLOR_TRANSPARENT);

    a.x = 0;
    a.y = 0;
    b.x = OSDBUF_HSIZE -1;
    b.y = 40 - 1;
    OSDUTIL_rectangle((void *)osdBuf2, &a, &b, OSDCOLOR_TRANSPARENT, OSDBUF_HSIZE);
    a.x = 0;
    b.x = OSDBUF_HSIZE -1;
    OSDUTIL_rectangle((void *)osdBuf3, &a, &b, OSDCOLOR_TRANSPARENT, OSDBUF_HSIZE);

	a.x = 120;
	a.y = 0;
    OSDUTIL_text((Uint8 *)osdBuf2, OSDBUF_HSIZE, &a, "THANK YOU FOR CHOOSING TMS320DM642", OSDUTIL_FONT_DEFAULT, OSDCOLOR_BLUE, OSDCOLOR_TRANSPARENT);
	OSDUTIL_text((Uint8 *)osdBuf3, OSDBUF_HSIZE, &a, "THANK YOU FOR CHOOSING TMS320DM642", OSDUTIL_FONT_DEFAULT, OSDCOLOR_TRANSPARENT, OSDCOLOR_GREEN);

	a.y += 20;	
	a.x = 60;
    OSDUTIL_text((Uint8 *)osdBuf2, OSDBUF_HSIZE, &a, "THE HIGHEST PERFORMANCE DIGITAL MEDIA PROCESSOR", OSDUTIL_FONT_DEFAULT, OSDCOLOR_WHITE, OSDCOLOR_TRANSPARENT);
    OSDUTIL_text((Uint8 *)osdBuf3, OSDBUF_HSIZE, &a, "THE HIGHEST PERFORMANCE DIGITAL MEDIA PROCESSOR", OSDUTIL_FONT_DEFAULT, OSDCOLOR_TRANSPARENT, OSDCOLOR_GREEN);

    osdParams.cLUT = &clut;
    osdParams.segId = EXTERNALHEAP;
    osdPacket1.buf = osdBuf;
    osdPacket2.buf = osdBuf2;
    CACHE_clean(CACHE_L2ALL, NULL, NULL);

    osdHandle = GIO_create("/OSD", IOM_OUTPUT, NULL, (Ptr)&osdParams, NULL);
    GIO_control(osdHandle, EVMDM642OSD_CMD_START, NULL);
}

void tskOSD()
{
    OSDUTIL_Point a; 
    Uint8 color = OSDCOLOR_WHITE;
    tskOSDInit();
    while(1)
    {
        GIO_write(osdHandle, &osdPacket1, NULL);  
        GIO_write(osdHandle, &osdPacket2, NULL);         

        if(osdPacket2.buf == osdBuf2) {
            osdPacket2.buf = osdBuf3;
        	a.x = 120;
	        a.y = 0;
        	OSDUTIL_text((Uint8 *)osdBuf3, OSDBUF_HSIZE, &a, "THANK YOU FOR CHOOSING TMS320DM642", OSDUTIL_FONT_DEFAULT, OSDCOLOR_TRANSPARENT, color);
        	a.y += 20;	
	        a.x = 60;
            OSDUTIL_text((Uint8 *)osdBuf3, OSDBUF_HSIZE, &a, "THE HIGHEST PERFORMANCE DIGITAL MEDIA PROCESSOR", OSDUTIL_FONT_DEFAULT, color, OSDCOLOR_TRANSPARENT);
            CACHE_clean(CACHE_L2, osdBuf3, sizeof(osdBuf3));
        } else {
            osdPacket2.buf = osdBuf2;
        	a.x = 120;
	        a.y = 0;
            OSDUTIL_text((Uint8 *)osdBuf2, OSDBUF_HSIZE, &a, "THANK YOU FOR CHOOSING TMS320DM642", OSDUTIL_FONT_DEFAULT, color, OSDCOLOR_TRANSPARENT);
        	a.y += 20;	
	        a.x = 60;
            OSDUTIL_text((Uint8 *)osdBuf2, OSDBUF_HSIZE, &a, "THE HIGHEST PERFORMANCE DIGITAL MEDIA PROCESSOR", OSDUTIL_FONT_DEFAULT, OSDCOLOR_TRANSPARENT, color);
            CACHE_clean(CACHE_L2, osdBuf2, sizeof(osdBuf2));
            color ++;
        } 
        if(color < OSDCOLOR_WHITE) { 
            color = OSDCOLOR_WHITE;
            GIO_write(osdHandle, &osdPacket1, NULL);  
            TSK_sleep(5000);
            
        }
    }
}

⌨️ 快捷键说明

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