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

📄 top.c

📁 一个不错的硬盘播放器程序,包含VFD显示程序,红外线遥控程序,硬盘读写程序,及解码程序等.
💻 C
📖 第 1 页 / 共 3 页
字号:
       */
      LOW_init_gateway();

#ifdef ZERO_BUFFER
      LOW_init_audio();
#endif
#ifdef ECHO
      LOW_init_audio();
#endif
      system_start();

#ifdef ZERO_BUFFER
      PCM_start_take_out();
#endif
#ifdef ECHO
      MIX_init();
      MIX_start_take_out();
#endif

      if (TDM_isCDDA)
	XPORT_restart_at(XPORT_OFFSET_PLAY_CDDA, 1);
      else {
#ifdef PLAY20
	  /*
	   * For safety, 2.0 machines will check whether the XPORT was
	   * stopped when longjump occurs. If XPORT was in STOP_STATE,
	   * then don't bother to restart XPORT; otherwise, we may
	   * have the strange behavior of having "slide show" when we intend
	   * to show one slide.
	   */
	  if ((mvd[xport_read_status]&0x7f) != XPORT_OFFSET_STOP_STATE)
	    XPORT_restart_at(XPORT_OFFSET_FUZZY_PLAY, 0);
#else
	  XPORT_restart_at(XPORT_OFFSET_FUZZY_PLAY, 0);
#endif
      }
      XFER_start(xfer_mode);

      EPRINTF(("WATCH DOG RESET!\n"));
    }
#endif

#ifdef FRACTINT
    if (xport_type == AUDIO_ELM_ONLY) {
    	FRACT_start();
    }
#endif

#ifdef DVD_VCD
    init_hellen();
    while(!hellen_is_alive){
	risc_sleep_a_bit(100000);
    }
#endif

#if defined(DVD_VCD) && defined(I2C_E2PROM)
    { /* process jump info reading */
	int i;
	for ( i = 0; i < 10000 ; i ++ ){
	    i2c_e2prom_process();
	}
    }
#endif

#ifdef KEYDEBUG
    dram_at_0 = *((int *)0x12000000);
#endif
    initMicroObject();
    do {
	    microEngine();
	    current_task = what_to_do();

#ifdef FIXEFM
	{
	    static int prev_skip_sectors;
	    if (prev_skip_sectors && !TDM_skip_sectors) {
		/* 
		 * We shall start decoding again. Reset video and audio.
		 * We have thrown away a number of sectors!
		 */
		VID_init();
		AUD_init();
	    }
	    prev_skip_sectors = TDM_skip_sectors;
	}
#endif /* FIXEFM */


#if (C80 && THREE_CDS)
	cd_exchange() ; /* 97/12/31 */
#endif

	if (current_task) DBG_log_task(1, current_task, 0, 0, 0, 0);
	switch (current_task) {
	    case 0:
	        TSK_background();
		break;
	    case 1:
#ifdef SUB_PICTURE
	 	DBG_check_elapsed_every(1);	
	    	check_spu_data();
		spu_decoder();
#else
		oh_my(4);
		TSK_decode_audio();
#endif
		break;
	    case 2:
		oh_my(5);
		TSK_decode_video();
		break;
#ifdef KARAOKE
	    case 3:
		oh_my(6);
		TSK_karaoke();
		break;
#endif
	    case 4:
		TSK_cdda();
		break;
#ifdef VSCALE
	    case 5:
/* When vscale is ready, it is not really the new picture is ready,
   so, the program will scale the old one. In slide show, we have
   destroied the original picture, it is really bad to see this 
   picture rescaled before the new one coming */
#ifdef ZOOM
		if ((zoom_level || expect_zoom) &&
		     zoom_frame == H_VscaleFrame) resetVscale();
#endif
	        vscale2();
		break;
#endif
#ifdef ECHO
	   case 6:
		TSK_echo();
		break;
#endif
#ifdef MZOOM
	   case 7:
	   	MZM_ip_frame();
		break;
#endif
	}

#ifdef C80
/*    cd_exchange() ; 97/12/31 */
	if ((current_task == 0) || (cd_presmodu != T_RUN))
	    cd_main() ;
#endif

	if (current_task) DBG_log_task(2, current_task, 0, 0, 0, 0);

	/*
	 * reset the task
	 */
	current_task = 0;
#ifdef ZOOM
	/* do zoom when necessary */
	if (!VID_decoding_in_progress && !end_of_still && 
	    expect_zoom) {
	    if  (vcx_VertSz <= 288) {
#if (CUST3 && !CUST71)
	       cancel_zoom();
#else
	       zoom_reset();
#endif
	       set_zoom();
	    }
	    expect_zoom = 0;
	}
#endif

#ifdef MZOOM
#if 0
        if (!VID_decoding_in_progress) {
	    if (in) {
		MZM_in();
		in = 0;
	    } else if (out) {
		MZM_out();
		out = 0;
	    }

	    if (up) {
		MZM_pan_up();
		up = 0;
	    } else if (down) {
		MZM_pan_down();
		down = 0;
	    } else if (left) {
		MZM_pan_left();
		left = 0;
	    } else if (right) {
		MZM_pan_right();
		right = 0;
	    }
	}
#endif
#endif

	TSK_background_high_priority();

#ifdef DVD_VCD
	VBV_update_occupancy(VBV_fullness);
#endif

#ifdef KEYDEBUG
	if (dram_at_0 != *((int *)0x12000000)) {
	    KEYDEBUGINC(1, dram_overwrite);
	    DBG_console();
	}
#endif

    } while (1);
}

#if !((defined(CUST3)||defined(CUST4)) && defined(NOLOGO))
/* Not every one needs it */
/***************************************************************************
 Decode and display an mpeg still.
 Side effect: the entire data chain starting from xport is stopped!
 ***************************************************************************/
int show_mpeg_still(e1e2, data, n)
int e1e2;           /* Either 0xe1 or 0xe2 */
int *data;          /* Where data starts */
int n;              /* Size of stream in 32-bit words */
{
    extern int arodnap;

#if defined(NOLOGO)
    arodnap = 0;
    /* If we want to save space, we have the option not to include logo */
    DISP_paint_screen(COLOR_BLUE, 1, DISP_frame);
#else
    int	m;

#ifdef MPEG1
    int	save[32], matrix_status;
    extern int H_CurrFrame;

    /* Save quant matrices */
    matrix_status = VID_save_q_matrices(save);
#endif

    arodnap = 0;
    assert(n <= VBV_size);
    system_reset();

    /* Move the data to the VBV.
       Force data size to be integer multiples of VBV_read. */
    sram_to_dram(VBV_start, data, n);
    m = n % VBV_read;
    if (m) {
	int *p = (int *)dram(VBV_start + n);
	while (m++ < VBV_read) {
	    *p++ = 0; n++;
	}
    }
    VBV_wrptr_advance(n);
    PRINTF(("LOGO (%d) now in DRAM at 0x%x.\n", n, dram(VBV_start)));

    /* Start draining the VBV. We set VBV_filling to 1 to fool
       hufdecv_xfer_end into not starting a xportv_xfer. */
    VBV_start_draining();
    VBV_filling = 1;

    /* The real decoding loop */
    VID_decoding_in_progress = 1;
    while (VID_decoding_in_progress) {
	VID_decode();
    }
    
#ifdef VSCALE
    /* Do vertical scaling if necessary */
    if ((vcx_scn_vscale != 0x10) && 
        (vcx_user_video_stream != 0xe2)){
      	H_VscaleFrame = H_CurrFrame;
      	initVscale_Pointer();
      	VscaleStart = 1;
	VscaleLastFrame = 0;
      	while (VscaleStart) vscale2();
	DISP_frame = 2;  
    } else DISP_frame = H_CurrFrame;
#else    
#ifdef MPEG1
    DISP_frame = H_CurrFrame;
#else
    DISP_frame = 1;
#endif
#endif
    DISP_count = 0;

    system_reset();

#ifdef MPEG1
    /* Restore quant matrices */
    VID_restore_q_matrices(matrix_status, save);
#endif	/* NOLOGO or MPEG2 */
#endif	/* NOLOGO */
}
#endif

/***************************************************************************
 The main entry point.
 ***************************************************************************/
main()
{
    /* ******** RISC and register setups ******** */
    register int psw_shadow = 0xc3;
    asm volatile("movtos %0,psw" :  :"r" (psw_shadow) );
    mvd = (int *)OMNI_BASE;
#ifdef MKROM
    /* Chip version detected in startup.s; 0xc3 at 0 means 3210 */
    mvd_version = (*((int *)(dram(0))) == 0xc3) ? 0x3210 : 0x3208;
#endif

#ifdef DSC
    DSC_getstatus();
#endif
    Init_const();
    initialization();
    DBG_allocate_trace_buffer();
#ifdef C80
    cd_init() ;
#endif

    TSK_main();
}

/***************************************************************************
 Misc interrupt handling.
 ***************************************************************************/
extern void trap0;
static int *trapptr0 = &trap0;

#ifndef DRAM_GAME
static 
#endif
void install_interrupt_vectors()
{
    int *a, *b, i;

#ifdef MKROM
    b = (int*)((int)trapptr0<<2);
#else
    b = (int*)((int)trapptr0);
#endif
    /* 
     * The DWORD at 0x18 is used for resume!!
     * The DWORD at 0x1c is used for real-time clock!! 
     *
     * Don't read 0x10 to 0x1f, they meant to be noncachable.
     */
    for (a = (int*)0, i = 0; i < 4; i++) *a++ = *b++;
}

#if (CUST3 && !CUST71)
int free_time_act() 
{
#ifdef VCDROM
    if (VCD_30)
	return;
#endif

    if (vcx_digest) 
	return;

    if (play_state == PLAY_STEP_STATE || play_state == PLAY_SLOW_STATE ||
	play_state == ENTRY_STATE)
	return;

    current_task = what_to_do();
    switch(current_task) {
	case 1:
#ifdef SUB_PICTURE
	    DBG_check_elapsed_every(1);	
	    check_spu_data();
	    spu_decoder();
#else
	    oh_my(4);
	    TSK_decode_audio();
#endif
	    break;
	case 2:
	    oh_my(5);
	    TSK_decode_video();
	    break;
#ifdef KARAOKE
	case 3:
	    oh_my(6);
	    TSK_karaoke();
	    break;
#endif
	case 4:
	    TSK_cdda();
	    break;
#ifdef VSCALE
	case 5:
#ifdef ZOOM
	   if ((zoom_level || expect_zoom) &&
	     zoom_frame == H_VscaleFrame) resetVscale();
#endif
	    vscale2();
	    break;
#endif
#ifdef ECHO
	case 6:
	    TSK_echo();
	    break;
#endif
    }
    current_task = 0;		/* reset current_task */
    return current_task;
}
#endif

#ifdef CUST6
void VFD_Getsw()
{}

int GetHC244_sts()
{
    unsigned int tmp;
    unsigned char * ptr = (unsigned char *) 0x14020004; /* Bank 1 address */

    /* Equivalent to CLEAR_AUX5, see ioport.h */
    tmp = shadow_riface_aux2 & ~4;
    tmp |= 0x40;

    /* Disable interrupt for 16 instructions */
    mvd[riface_irqsuppress] = 0;        
    asm("nop");
    mvd[riface_aux2] = tmp;     /* Officially set aux5 low              */
    tmp = *ptr;                 /* Read 244 (assume it only has 8b      */
    mvd[riface_aux2] = shadow_riface_aux2;      /* Restore AUX5 value   */

    /* Now tmp has the 244 value */
    return(tmp);
}
#endif /* CUST6 */

#ifdef VCDROM
int *data_loc_30=0;

void vcd30()
{
    void BB_jump30(int *);

    power_up = 0;

#ifdef ECHO
    if (vcx_echo >= 0)
        MIC_stop_take_in();
#endif
 
    if (repeat_a2b) {/* REPEAT_AB_START or REPEAT_AB_END */
        repeat_a2b = REPEAT_AB_OFF;
        panel_repeat_ab(REPEAT_AB_OFF);
    }

    system_reset();
    mvd[riface_irqmask]=0;

    mvd[vid_scn_hstart]         = vcx_scn_hstart+4;
    mvd[vid_scn_hend]           = vcx_scn_hstart+4 + 720;
    old_vcx_scn_height = vcx_scn_height;

    asm("addi r0,#0x6000,r29");

    BB_jump30(data_loc_30);
    VCD_30 = 1;
    XPORT_active = 0;
    init();
}

void vcd20(int vcd30_event)
{
    extern int screen_end;
    int i;
    int time_out;
    int addr;
    register int stack = VCD20STACK;
    extern short list_previous_list_offset;
    extern short list_next_list_offset;
    extern unsigned char cur_list_state;


    stack += (ADJUST_4_LINE * 4);/* Optionally adjust stack for 4 line OSD */

    /* set the screen to blank. */
    mvd[vid_scn_vstart]       = screen_end;
    mvd[vid_scn_vend]         = screen_end + 1;
    time_out = glbTimer + 3;
    while (glbTimer < time_out)
	VCX_service();
	
    mvd[riface_irqmask]       = 0;

#ifndef CUST71
    if (!vcd30_event) {
	DSC_powerup();
	return;	
    }
#endif

    SPA_level = 0; /* reset surround */
    play_clip = vcd30_event;
    VCD_30 = 0;

    /* Flush cache */
    addr = 48;
    for (i = 0; i < (8196/(16*4)); i++){
	int tmp1, tmp2, tmp3;
	tmp1 = addr + 2048;
	tmp2 = tmp1 + 2048;
	tmp3 = tmp2 + 2048;

	reg0 = *(int*)addr;
	reg0 = *(int*)tmp1;
	reg0 = *(int*)tmp2;
	reg0 = *(int*)tmp3;
	addr += 16;
    }
	
    VCD30_event = vcd30_event;

    asm("addi %0,#0,r29" : : "r" (stack));
    VBV_size = MPEG_VBV_size;
    pic_height = 0;
    pic_width = 0;
    list_previous_list_offset = -1;
    list_next_list_offset = -1;
    cur_list_state = 0;
	
    DSC_toggle();
    initialization();
    
    if (vcx_scn_height != old_vcx_scn_height) 
	DISP_change_TV();

    DBG_allocate_trace_buffer();
#ifdef ECHO
    /* reset mix pointers, so it does not produce audio noise. */
    MIX_init();
    if (MIC_is_turned_on && (vcx_echo >= 0)) {
	MIC_init();	
	MIC_start_take_in();
    }

#endif
    TSK_main();
}
#endif

⌨️ 快捷键说明

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