Exemple #1
0
static int srcimp_rsc_init(struct srcimp *srcimp,
			   const struct srcimp_desc *desc,
			   struct srcimp_mgr *mgr)
{
	int err;

	err = rsc_init(&srcimp->rsc, srcimp->idx[0],
		       SRCIMP, desc->msr, mgr->mgr.hw);
	if (err)
		return err;

	/* Reserve memory for imapper nodes */
	srcimp->imappers = kzalloc(sizeof(struct imapper)*desc->msr,
				   GFP_KERNEL);
	if (!srcimp->imappers) {
		err = -ENOMEM;
		goto error1;
	}

	/* Set srcimp specific operations */
	srcimp->rsc.ops = &srcimp_basic_rsc_ops;
	srcimp->ops = &srcimp_ops;
	srcimp->mgr = mgr;

	srcimp->rsc.ops->master(&srcimp->rsc);

	return 0;

error1:
	rsc_uninit(&srcimp->rsc);
	return err;
}
void ui_video_m_rsc_init()
{
  rsc_config_t  rsc_config = {0};
  vf_ft_config_t vfont_cfg;
  if(NULL == g_rsc_handle)
  {
     memcpy(&rsc_config, &g_rsc_config, sizeof(rsc_config));
     rsc_config.bmp_buf_size = 0;
     g_rsc_handle = rsc_init(&rsc_config);
    mtos_printk("##%s, line[%d], handle=[0x%x]##\n", __FUNCTION__,__LINE__,g_rsc_handle);
	vfont_cfg.vf_ft1.max_cnt = 1; //a~z, 0~9
	vfont_cfg.vf_ft1.max_height = 104;
	vfont_cfg.vf_ft1.max_width = 104;
	vfont_cfg.vf_ft1.is_alpha_spt = TRUE;
	vfont_cfg.vf_ft1.bpp = 32;
	
	vfont_cfg.vf_ft2.max_cnt = 1; //a~z, 0~9
	vfont_cfg.vf_ft2.max_height = 24;
	vfont_cfg.vf_ft2.max_width = 24;
	vfont_cfg.vf_ft2.is_alpha_spt = TRUE;
	vfont_cfg.vf_ft2.bpp = 32;

    vf_ft_attach(g_rsc_handle, &vfont_cfg);
    
  }
}
Exemple #3
0
static int sum_rsc_init(struct sum *sum,
			const struct sum_desc *desc,
			struct sum_mgr *mgr)
{
	int err;

	err = rsc_init(&sum->rsc, sum->idx[0], SUM, desc->msr, mgr->mgr.hw);
	if (err)
		return err;

	sum->rsc.ops = &sum_basic_rsc_ops;

	return 0;
}
Exemple #4
0
static int amixer_rsc_init(struct amixer *amixer,
			   const struct amixer_desc *desc,
			   struct amixer_mgr *mgr)
{
	int err;

	err = rsc_init(&amixer->rsc, amixer->idx[0],
			AMIXER, desc->msr, mgr->mgr.hw);
	if (err)
		return err;

	/* Set amixer specific operations */
	amixer->rsc.ops = &amixer_basic_rsc_ops;
	amixer->ops = &amixer_ops;
	amixer->input = NULL;
	amixer->sum = NULL;

	amixer_setup(amixer, NULL, 0, NULL);

	return 0;
}
Exemple #5
0
static int
src_rsc_init(struct src *src, u32 idx,
	     const struct src_desc *desc, struct src_mgr *mgr)
{
	int err;
	int i, n;
	struct src *p;

	n = (MEMRD == desc->mode) ? desc->multi : 1;
	for (i = 0, p = src; i < n; i++, p++) {
		err = rsc_init(&p->rsc, idx + i, SRC, desc->msr, mgr->mgr.hw);
		if (err)
			goto error1;

		/* Initialize src specific rsc operations */
		p->ops = &src_rsc_ops;
		p->multi = (0 == i) ? desc->multi : 1;
		p->mode = desc->mode;
		src_default_config[desc->mode](p);
		mgr->src_enable(mgr, p);
		p->intlv = p + 1;
	}
	(--p)->intlv = NULL;	/* Set @intlv of the last SRC to NULL */

	mgr->commit_write(mgr);

	return 0;

error1:
	for (i--, p--; i >= 0; i--, p--) {
		mgr->src_disable(mgr, p);
		rsc_uninit(&p->rsc);
	}
	mgr->commit_write(mgr);
	return err;
}
Exemple #6
0
int main(void)
{
	int error;

#if _MINT_				/* HR 151102 */
	have_ssystem = Ssystem(-1, 0, 0) == 0;		/* HR 151102: use Ssystem where possible */

	mint   = (find_cookie('MiNT') == -1) ? FALSE : TRUE;
	magx   = (find_cookie('MagX') == -1) ? FALSE : TRUE;	/* HR 151102 */
	geneva = (find_cookie('Gnva') == -1) ? FALSE : TRUE;    /* DjV 035 080203 */
	mint  |= magx;			/* Quick & dirty */

	if (mint)
	{
		Psigsetmask(0x7FFFE14EL);
		Pdomain(1);
	}
#endif

	x_init();

	if ((ap_id = appl_init()) < 0)
		return -1;

	if  (_GemParBlk.glob.version >= 0x400)
	{
		shel_write(9, 1, 0, NULL, NULL);
		menu_register(ap_id, "  Tera Desktop");
	}

	if (rsrc_load(RSRCNAME) == 0)
		form_alert(1, msg_resnfnd);
	else
	{
		if ((error = init_xdialog(&vdi_handle, malloc, free,
								  "Tera Desktop", 1, &nfonts)) < 0)
			xform_error(error);
		else
		{
			init_vdi();
			rsc_init();

			if (((max_w / screen_info.fnt_w) < 40) || ((max_h / screen_info.fnt_h) < 25))
				alert_printf(1, MRESTLOW);
			else
			{
				if ((error = alloc_global_memory()) == 0)
				{
					if (exec_deskbat() == FALSE)
					{
						if (load_icons() == FALSE)
						{
							if (init() == FALSE)
							{
								graf_mouse(ARROW, NULL);
								evntloop();

								wd_del_all();
								menu_bar(menu, 0);
								xw_close_desk();
							}

							free_icons();		/* HR 151102 */

							wind_set(0, WF_NEWDESK, NULL, 0);
							dsk_draw();
						}
					}

					Mfree(global_memory);
				}
				else
					xform_error(error);
			}

			if (vq_gdos() != 0)
				vst_unload_fonts(vdi_handle, 0);
			exit_xdialog();
		}

		rsrc_free();
	}

	/* DjV 013 030103 100203 ---vvv--- */
	/*
	 * The following section handles system shutdown and resolution change
	 * If a resolution change is required, shutdown is performed first
	 * If only shutdown s required, system will reset at the end.
	 */ 

	/* appl_exit(); */

	if ( chrez || shutdown ) /* If change resolution or shutdown ... */
	{

		/* Tell all applications which would understand it to end */

		quit = shel_write ( 4, 2, 0, NULL, NULL ); 	/* complete shutdown */
		evnt_timer( 3000, 0 );						/* Wait a bit? */

		/*

		/* 
		 * In Mint, must tell all proceseses to terminate nicely ?
		 * but this is only in this group ? What to do?
		 */

		Pkill(0, SIGTERM); 
		evnt_timer(3000, 0); /* Wait a bit? */
		*/

		/* 
		 * After all applications have hopefully been closed,
		 * change the screen resolution if needed;
		 * else- reset the computer
		 */
		if ( chrez )
			get_set_video(2);

#if 1
		else
	#if _MINT_
		if (!mint)			/* HR 230203: Dont reset under MiNT or MagiC !!!!! */
	#endif
		{
			/* Perform a reset here */

	#if 0		/* with warnings */
			long *m;					/* to memory locations */
			long rv;					/* reset vector */

			Super ( 0L );				/* Supervisor; old stack won't be needed again */
			*(m = 0x420L) = 0L;			/* memctrl  */
			*(m = 0x43aL) = 0L;			/* memval2  */
			*(m = 0x426L) = 0L;			/* resvalid */	
			m = *( m = 0x4f2 );			/* to start of OS */
			rv = *(m + 4);				/* to routine that  handles the reset */
			Supexec(rv);				/* execute it */
	#else			/* HR: without warnings */
			long (*rv)();					/* reset vector */

			Super ( 0L );				/* Supervisor; old stack won't be needed again */
			memctrl = 0L;
			memval2 = 0L;
			resvalid = 0L;
			(long)rv = *((long *)os_start + 4);	/* routine that handles the reset */
			Supexec(rv);				/* execute it */
	#endif
		}
#endif
	}
Exemple #7
0
static RET_CODE mmi_init(void)
{
  rsc_palette_t hdr_pal;
  palette_t pal;
  u8 *bits;
  u32 p_addr;
  BOOL ret = FALSE;
  handle_t rsc_handle = 0;
  paint_param_t paint_param = {0};
  
  gdi_config_t info =
  {
    /* color format */
#ifdef WIN32
     COLORFORMAT_RGB4BIT,
#else
     COLORFORMAT_RGB8BIT,
#endif
    /* screen rectangle */
    {SCREEN_POS_PAL_L, SCREEN_POS_PAL_T,
     SCREEN_POS_PAL_L + SCREEN_WIDTH,
     SCREEN_POS_PAL_T + SCREEN_HEIGHT},
    /* palette */
    &pal,
    /* default color */
    //C_TRANS,
    C_BLACK,
    /* color key */
    C_KEY,
    /* osd odd vmem */
    NULL,
    /* odd vmem size + ctrlword + palette */
    150 * KBYTES + 2 * KBYTES,
    /* osd even vmem */
    NULL,
    /* even vmem size*/
    150 * KBYTES,
    /* virtual buffer addr */
    0,
    /* virtual surface size */
    0 * KBYTES,
    /* surface cnt */
    MAX_SURFACE_CNT,
    /* cliprect cnt */
    MAX_CLIPRECT_CNT,
    /* dc cnt */
    MAX_DC_CNT,
  };

  // init osd frame buffer
  p_addr = mem_mgr_require_block(
    BLOCK_OSD0_8BIT_BUFFER,
    SYS_MODULE_GDI);
  MT_ASSERT(p_addr != 0);

  mem_mgr_release_block(BLOCK_OSD0_8BIT_BUFFER);

  info.p_odd_addr = (u32 *)p_addr;
  info.p_even_addr = (u32 *)(p_addr + info.odd_size);
  
  mmi_init_heap(GUI_PARTITION_SIZE);

  g_rsc_config.rsc_data_addr = (u32)ota_rsc_data;

  rsc_handle = rsc_init(&g_rsc_config);
  
 if(sys_static_read_ota_language() == 0)
  {
    rsc_set_curn_language(rsc_handle,LANGUAGE_CHINESE);
  }
 else
  {
    rsc_set_curn_language(rsc_handle,LANGUAGE_ENGLISH);
  }

  ret = rsc_get_palette(rsc_handle,1, &hdr_pal, (u8**)&bits);
  pal.cnt = hdr_pal.color_num;
  pal.p_entry = (color_t *)bits;
  pal.p_entry[C_TRANS].a = 0;
  rsc_set_curn_palette(rsc_handle,1);

#ifndef WIN32
  gdi_init_v2(&info);
#else
  gdi_init(&info);
#endif

  gdi_set_global_alpha_montage(255);

  ctrl_init_lib(MAX_CLASS_CNT, MAX_OBJ_CNT);
  ctrl_str_init(MAX_CTRL_STRING_BUF_SIZE);

  cont_register_class(MAX_OBJECT_NUMBER_CNT);
  cbox_register_class(MAX_OBJECT_NUMBER_CBB);
  text_register_class(MAX_OBJECT_NUMBER_TXT);
  pbar_register_class(MAX_OBJECT_NUMBER_PGB);
  nbox_register_class(MAX_OBJECT_NUMBER_NUM);

  paint_param.max_str_len = MAX_PAINT_STRING_LENGTH;
  paint_param.max_str_lines = MAX_PAINT_STRING_LINES;
  paint_param.rsc_handle = rsc_handle;
  gui_paint_init(&paint_param);

  return SUCCESS;
}