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

📄 osddrv.c

📁 以ST公司CPU为核心的彩色电视机的完整源程序。
💻 C
📖 第 1 页 / 共 2 页
字号:
	else
	    {
	    tmphigh = BUFFDRV1HIGH; /* set the next buffer start address */
	    tmplow  = BUFFDRV1LOW ;
	    }

    *(pointer_osd++) = (tmphigh | mode);  /* set the row mode + next buff start @ high byte */
    *(pointer_osd++) = tmplow;	          /* set the next buff start @ low byte */
/* set next bufer start address end */

/* set horizontal shift begin */
    pointer_sram = (unsigned char *) (sram_add+2);	/* set sram pointer to the 3rd byte of row block */
	tmphigh = *(pointer_sram++);
	*(pointer_osd++) = tmphigh;				/* set the horizontal shift high @ + RCN */
	rcn = tmphigh >> 2;
    *(pointer_osd++) = *(pointer_sram++);		/* set the horizontal shift low @ */
/* set horizontal shift end */

/* set remaining data begin */ 
	/* the number of bytes remaining to be transfered is 2 +   RCN if mode = 0 = serial mode
							     2 + 2*RCN if mode = 1 = basic parallel mode
							     2 + 3*RCN if mode = 2 = extended parallel mode */
    mode = *(pointer_sram++);	/* get the current mode to know how many bytes to transfer */
	tmphigh = 2 + ( mode +1 )*rcn ;
	if(tmphigh > 116 )
	    return;
	else
	    for (tmplow=0 ; tmplow < tmphigh ; tmplow++)	/* transfer remaining bytes in OSDRAM */
	        *(pointer_osd++) = *(pointer_sram++);

/* set remaining data end */ 

}


/*================================================================================================
      change_color_attrib_in_line
--------------------------------------------------------------------------------------------------
Meaning : modify the color attribute of 1 char in a specified line, parallel modes only

Input : the line number, the char number, the new color code

Output : none
==================================================================================================*/
void fill_color_in_line(unsigned char row, unsigned char start_char_nb, unsigned char color,unsigned char number)
{
	unsigned char *pointer_sram;
	unsigned int mode, sram_add;
	unsigned char i;
	
	sram_add = (SRAM_BUFFER_START + ((unsigned int )row) * SRAM_LINE_BUFFER_SIZE); //row-1 -> row
	
	pointer_sram = (unsigned char *) (sram_add+4);	/* get the row mode */
	mode = (unsigned int) *pointer_sram;
    
	if (mode > 0)
	{ /* parallel modes */
        mode++;
        pointer_sram = (unsigned char *) (sram_add + 8 + mode* start_char_nb);  /* point to the color attribute */
	
	    for(i=0;i<number;i++)
	     {
	     *(pointer_sram) = color;		  /* write the new value */
	     pointer_sram+=mode;
	     }
	}
}

void fill_char_in_line(unsigned char row, unsigned char start_char_nb, unsigned char tmpchar,unsigned char number)
{
	unsigned char *pointer_sram;
	unsigned int mode, sram_add;
	unsigned char i;
	
	sram_add = (SRAM_BUFFER_START + ((unsigned int )row) * SRAM_LINE_BUFFER_SIZE); //row-1 -> row
	
	pointer_sram = (unsigned char *) (sram_add+4);	/* get the row mode */
	mode = (unsigned int) *pointer_sram;

	if (mode > 0)
	{ /* parallel modes */
	    mode++;
        pointer_sram = (unsigned char *) (sram_add + 7 + mode* start_char_nb);  /* point to the color attribute */
	
	    for(i=0;i<number;i++)
	     {
	     *(pointer_sram) = tmpchar;		  /* write the new value */
	     pointer_sram+=mode;
	     }
	}
}

//feman function;
void fill_string_in_line(unsigned char row, unsigned char start_char_nb, unsigned char * string)
{
	unsigned char *pointer_sram;
	unsigned int mode, sram_add;
	unsigned char i;
	
	sram_add = (SRAM_BUFFER_START + ((unsigned int )row) * SRAM_LINE_BUFFER_SIZE); //row-1 -> row
	
	pointer_sram = (unsigned char *) (sram_add+4);	/* get the row mode */
	mode = (unsigned int) *pointer_sram;

	if (mode > 0)
	{ /* parallel modes */
        pointer_sram = (unsigned char *) (sram_add + 7 + (mode+1)* start_char_nb);  /* point to the color attribute */
	    i=0;
	    while(string[i]!=0x00)
	     {
	     *(pointer_sram) = string[i++];		  /* write the new value */
	     pointer_sram+=mode+1;
	     }
	}
}


//===============================
/*
Meaning : modify the row attribute of 1 char in a specified line, parallel modes only
          zoom the char with double heigh , move the lines that are in front of the row  
          to previous lines (13 event line) .
Input : the line number, max item number 

Output : none
*/
//===============================
/* not use this function 
void move_zoom_line(unsigned char row,unsigned char max_item)
{
	unsigned int sram_add,first_event_line;
	unsigned int * pointer;
	unsigned char * pointer_sram,i;
	
	pointer = ( unsigned int * )SRAM_BUFFER_START;
	
	first_event_line = *pointer;
	
	for(i=1;i<=row;i++)
	{
	sram_add = (SRAM_BUFFER_START + i* SRAM_LINE_BUFFER_SIZE); 
	
	pointer = (unsigned int *) sram_add;	
    pointer_sram =(unsigned char * )( sram_add + 5);
    *pointer_sram &= 0xE7;
    *( pointer) =first_event_line+i*13;
    }
  
  pointer_sram =(unsigned char * )( sram_add + 5);
  *pointer_sram |= 0x10;
  
    for(i=row+1;i<row+max_item;i++)
    {
	sram_add = (SRAM_BUFFER_START + i* SRAM_LINE_BUFFER_SIZE); 
	
	pointer = (unsigned int *) sram_add;	
     pointer_sram =(unsigned char * )(sram_add + 5);
    *pointer_sram &= 0xE7;

    *pointer = first_event_line+(i+1)*13;
    	
    }

}
*/
/* feman function transfer screan header edited by osd-editor to sram buffer */
void transfer_screan_header(const struct SCREEN_HEADER *address)
{
	unsigned char *pointer_osd, *pointer_rom;
	unsigned char i;
    unsigned int *pointer;
    
	pointer = (unsigned int*)( OSDRAM_START+2); /* pointer to the 2nd OSDRAM location */
	*(pointer) = (OSDRAM_BUFFER1 & 0x3FFF);	    /* set the first buffer start address */
	pointer = (unsigned int*) OSDRAM_BUFFER1;
	*(pointer) = (OSDRAM_BUFFER2 & 0x3FFF);	    /* set the next buffer start address of buffer 1 */
	pointer = (unsigned int*) OSDRAM_BUFFER2;
	*(pointer) = (OSDRAM_BUFFER1 & 0x3FFF);	    /* set the next buffer start address of buffer 2 */

	pointer_osd = (unsigned char *) OSDRAM_START + 4;  /* set osd pointer to the begining of osdram underline color sets */
	pointer_rom = (unsigned char *)address;				   /* set sram pointer to the begining of the color definition */

	mouse_coding_data = address->mouse_coding_data; 
	mouse_y_pos = address->mouse_y_pos; 
	mouse_x_pos = address->mouse_x_pos; 
	
	for (i=0 ; i < sizeof(struct SCREEN_HEADER); i++)	    
	    *(pointer_osd++) = *(pointer_rom++);

    fore_row_number = 0;
    back_row_number = 0;
    current_displayed_row =(unsigned char) 0;	/* reset the current displayed row number */
}
/* feman add line to sram buffer */
void reset_current_screen(void)
{
    back_row_number = 0;
}

void set_current_screen(void)
{
    fore_row_number = back_row_number;    
}

void append_line_to_buffer(const struct ROW_STRUCT *address)
{
    unsigned char *pointer_rom, *pointer_sram;
    unsigned char i, rcn, mode,tmp,number;
    struct ROW_HEADER * rowhp;
   
   
   	spp(OSD_PG);	
	while( (OSDFBR & (unsigned char )0x20));
 	spp(EXINT_PG);
    EIMR &= ~EIm_ic0m;
     
    pointer_sram = (unsigned char *) (SRAM_BUFFER_START + SRAM_LINE_BUFFER_SIZE*(unsigned int)back_row_number); /* set the pointer to the first byte of the line number i */
    back_row_number++;
        
    rowhp = (struct ROW_HEADER *)pointer_sram;
	pointer_rom=(unsigned char *) address->row_header;

	for(i=0;i<sizeof(struct ROW_HEADER);i++) /* transfer row header */
	    *(pointer_sram++)=*(pointer_rom++);

	number = address->number;
	rowhp->char_number += number;
	
	rcn = address->row_header->char_number;
	mode = address->row_header->mode;
	/* the number of bytes remaining to be transfered is RCN if mode = 0 = serial mode
								 2*RCN if mode = 1 = basic parallel mode
								 3*RCN if mode = 2 = extended parallel mode */
	mode++;
	pointer_rom =(unsigned char *) address->row_data;
	    for (i=0; i < rcn ; i++)
		    {
		     for(tmp=0; tmp<mode;tmp++)
		           *(pointer_sram++) = *(pointer_rom++);     /* transfer remaining bytes in SRAM */
             if(i==address->start_num_char)
                 for(tmp=1;tmp<=number*mode;tmp++)
                    *(pointer_sram++)=*(pointer_sram-mode); 
             
            }

 EIMR |= EIm_ic0m;

}


void set_row_header(char row_number,struct ROW_HEADER * rheader)
{
   unsigned char * pointer_sram, * source,i;
   pointer_sram = (unsigned char *) (SRAM_BUFFER_START + SRAM_LINE_BUFFER_SIZE*(unsigned int)(row_number)); /* set the pointer to the first byte of the line number i */
   source = (unsigned char *)rheader;
   
   for(i=0;i<sizeof(struct ROW_HEADER);i++)
      {
       *(pointer_sram++) = *(source++);
      }  
   
}

void get_row_header(char row_number,struct ROW_HEADER * rheader)
{
   unsigned char * pointer_sram, * source,i;
   pointer_sram = (unsigned char *) (SRAM_BUFFER_START + SRAM_LINE_BUFFER_SIZE*(unsigned int)(row_number)); /* set the pointer to the first byte of the line number i */
   source = (unsigned char *)rheader;
   
   for(i=0;i<sizeof(struct ROW_HEADER);i++)
      {
    *(source++) = *(pointer_sram++) ;
      }  
   
}
   

⌨️ 快捷键说明

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