コード例 #1
0
ファイル: pm.c プロジェクト: wosigh/kernel
int __init omap3_pm_init(void)
{
	int ret;

	printk(KERN_ERR "OMAP 3430 Power Management subsystem initializing.\n");

	omap_sram_idle_setup();
	suspend_set_ops(&omap_pm_ops);

	/* In case of cold boot, clear scratchpad */
	if (RM_RSTST_CORE & 0x1)
		clear_scratchpad_contents();
#ifdef CONFIG_MPU_OFF
	save_scratchpad_contents();
#endif

	/*
	 * Initialize the PRCM subsystem
	 */
	prcm_init();

	memret1 = (struct res_handle *)resource_get("resouret1", "core_mem1ret");
	memret2 = (struct res_handle *)resource_get("resouret12", "core_mem2ret");
	logret1 = (struct res_handle *)resource_get("logic retntion", "core_logicret");

	/* Initialize settings for voltage scaling.
	 */
	if (0 != prcm_vdd_clk_init()) {
		printk(KERN_ERR "could not initialize clocks.\n");
		return -1;
	}

	PRM_IRQSTATUS_MPU  = 0x3FFFFFD; // It takes into account reserved bits
	PRM_IRQENABLE_MPU  = 0x201;     // IOPAD + WKUP event

#ifdef CONFIG_OMAP_VOLT_SR_BYPASS
	/* Enabling the VOLTAGE CONTROLLER PRCM interrupts */
	PRM_IRQENABLE_MPU |= PRM_VC_TIMEOUTERR_EN | PRM_VC_RAERR_EN|
				PRM_VC_SAERR_EN;
#endif /* #ifdef CONFIG_OMAP_VOLT_SR_BYPASS */

	/* Registering PRCM Interrupts to MPU, for Wakeup events */
	ret = request_irq(PRCM_MPU_IRQ, prcm_interrupt_handler,
			  IRQF_DISABLED, "prcm", NULL);
	if (ret) {
		printk(KERN_ERR "request_irq failed to register for 0x%x\n",
		       PRCM_MPU_IRQ);
		return -1;
	}

#ifdef CONFIG_PROC_FS
	create_pmproc_entry();
#endif
	return 0;
}
コード例 #2
0
ファイル: hsmmc.c プロジェクト: smartassfox/archos_kernel_27
void __init hsmmc_init(void)
{
	rhandlemmc1 = resource_get("hsmmc1", "t2_vmmc1");
	rhandlemmc2 = resource_get("hsmmc2", "t2_vmmc2");
	rhandlevsim = resource_get("vsim", "t2_vsim");

	hsmmc_data[0] = &mmc1_data;
#ifdef CONFIG_OMAP_HS_MMC2
	hsmmc_data[1] = &mmc2_data;
#endif
#ifdef CONFIG_OMAP_HS_MMC3
	hsmmc_data[2] = &mmc3_data;
#endif
	omap2_init_mmc(hsmmc_data, OMAP34XX_NR_MMC);
}
コード例 #3
0
ファイル: watchlist.c プロジェクト: glankk/gz
static void watchfile_menu_init(void)
{
  static _Bool ready = 0;
  if (!ready) {
    ready = 1;
    struct menu *menu = &watchfile_menu;
    menu_init(menu, MENU_NOVALUE, MENU_NOVALUE, MENU_NOVALUE);
    watchfile_return = menu_add_submenu(menu, 0, 0, NULL, "return");
    watchfile_return->leave_proc = watchfile_leave_proc;
    struct gfx_texture *t_arrow = resource_get(RES_ICON_ARROW);
    menu_add_button_icon(menu, 0, 1,
                         t_arrow, 0, 0xFFFFFF,
                         scroll_up_proc, NULL);
    menu_add_button_icon(menu, 0, 1 + WATCHFILE_VIEW_ROWS - 1,
                         t_arrow, 1, 0xFFFFFF,
                         scroll_down_proc, NULL);
    for (int i = 0; i < WATCHFILE_VIEW_ROWS; ++i) {
      struct menu_item *item = menu_item_add(menu, 2, 1 + i, NULL, 0xFFFFFF);
      item->data = (void*)i;
      item->enter_proc = entry_enter_proc;
      item->draw_proc = entry_draw_proc;
      item->activate_proc = entry_activate_proc;
      watchfile_items[i] = item;
    }
  }
}
コード例 #4
0
ファイル: watchlist.c プロジェクト: glankk/gz
struct menu_item *watchlist_create(struct menu *menu,
                                   struct menu *menu_release,
                                   int x, int y)
{
  struct menu *imenu;
  struct menu_item *item = menu_add_imenu(menu, x, y, &imenu);
  struct item_data *data = malloc(sizeof(*data));
  data->menu_release = menu_release;
  data->imenu = imenu;
  vector_init(&data->members, sizeof(struct member_data*));
  if (!list_icons)
    list_icons = resource_load_grc_texture("list_icons");
  data->add_button = menu_add_button_icon(imenu, 0, 0,
                                          list_icons, 0, 0x00FF00,
                                          add_button_proc, data);
#ifndef WIIVC
  struct gfx_texture *file_icons = resource_get(RES_ICON_FILE);
  data->import_button = menu_add_button_icon(imenu, 2, 0,
                                             file_icons, 1, 0xFFFFFF,
                                             import_button_proc, data);
#endif
  item->data = data;
  item->destroy_proc = destroy_proc;
  return item;
}
コード例 #5
0
ファイル: gl.c プロジェクト: gnieboer/gr-fosphor
int
fosphor_gl_init(struct fosphor *self)
{
	struct fosphor_gl_state *gl;
	const void *font_data;
	int len, rv;

	/* Allocate structure */
	gl = malloc(sizeof(struct fosphor_gl_state));
	if (!gl)
		return -ENOMEM;

	self->gl = gl;

	memset(gl, 0, sizeof(struct fosphor_gl_state));

	/* Font */
	gl->font = glf_alloc(8, GLF_FLG_LCD);
	if (!gl->font) {
		rv = -ENOMEM;
		goto error;
	}

	font_data = resource_get("DroidSansMonoDotted.ttf", &len);
	if (!font_data) {
		rv = -ENOENT;
		goto error;
	}

	rv = glf_load_face_mem(gl->font, font_data, len);
	if (rv)
		goto error;

	/* Color mapping */
	gl->cmap_ctx = fosphor_gl_cmap_init();

	rv  = (gl->cmap_ctx == NULL);

	rv |= fosphor_gl_cmap_generate(&gl->cmap_waterfall,
	                               fosphor_gl_cmap_waterfall, NULL, 256);
	rv |= fosphor_gl_cmap_generate(&gl->cmap_histogram,
	                               fosphor_gl_cmap_histogram, NULL, 256);

	if (rv)
		goto error;

	/* Done */
	return 0;

error:
	fosphor_gl_release(self);

	return rv;
}
コード例 #6
0
ファイル: mem.c プロジェクト: n3rdswithgame/gz
void mem_menu_create(struct menu *menu)
{
  /* initialize data */
  vector_init(&domains, sizeof(struct mem_domain));
  add_domain(0x80000000, 0x00C00000, "k0 rdram");
  add_domain(0xA0000000, 0x00C00000, "k1 rdram");
  add_domain(0xA3F00000, 0x00100000, "rdram regs");
  add_domain(0xA4000000, 0x00100000, "sp regs");
  add_domain(0xA4100000, 0x00100000, "dp com");
  add_domain(0xA4200000, 0x00100000, "dp span");
  add_domain(0xA4300000, 0x00100000, "mi regs");
  add_domain(0xA4400000, 0x00100000, "vi regs");
  add_domain(0xA4500000, 0x00100000, "ai regs");
  add_domain(0xA4600000, 0x00100000, "pi regs");
  add_domain(0xA4800000, 0x00100000, "si regs");
  add_domain(0xA8000000, 0x08000000, "cart dom2");
  add_domain(0xB0000000, 0x0FC00000, "cart dom1");
  add_domain(0xBFC00000, 0x000007C0, "pif rom");
  add_domain(0xBFC007C0, 0x00000040, "pif ram");
  /* initialize menus */
  menu_init(menu, MENU_NOVALUE, MENU_NOVALUE, MENU_NOVALUE);
  menu->selector = menu_add_submenu(menu, 0, 0, NULL, "return");
  {
    view_address = menu_add_intinput(menu, 0, 1, 16, 8, address_proc, NULL);
    struct menu_item *data_size = menu_add_option(menu, 9, 1,
                                                  "byte\0""halfword\0""word\0",
                                                  data_size_proc, NULL);
    menu_option_set(data_size, 2);
    view_data_size = 4;
    menu_add_button(menu, 18, 1, "<", prev_domain_proc, NULL);
    menu_add_button(menu, 20, 1, ">", next_domain_proc, NULL);
    view_domain_name = menu_add_static(menu, 22, 1, NULL, 0xC0C0C0);
    view_domain_name->text = malloc(32);
    struct gfx_texture *t_arrow = resource_get(RES_ICON_ARROW);
    view_pageup = menu_add_button_icon(menu, 0, 2, t_arrow, 0, 0xFFFFFF,
                                       page_up_proc, NULL);
    view_pagedown = menu_add_button_icon(menu, 2, 2, t_arrow, 1, 0xFFFFFF,
                                         page_down_proc, NULL);
    menu_add_static(menu, 9, 2, "0 1 2 3 4 5 6 7", 0xC0C0C0);
    for (int y = 0; y < MEM_VIEW_ROWS; ++y) {
      view_rows[y] = menu_add_static(menu, 0, 3 + y, NULL, 0xC0C0C0);
      view_rows[y]->text = malloc(9);
    }
    make_cells(menu);
    goto_domain(0);
  }
}
コード例 #7
0
ファイル: punity.c プロジェクト: gingerBill/LD35
void
bitmap_load_resource(Bitmap *bitmap, const char *resource_name)
{
    int width, height, comp;
    isize size;
    void *ptr;
    Color *pixels;

    ptr = resource_get(resource_name, &size);

    ASSERT(ptr);
    pixels = (Color *)stbi_load_from_memory((u8 *)ptr, (int)size, &width, &height, &comp, STBI_rgb_alpha);
    ASSERT(pixels);
    ASSERT(comp == 4);

    bitmap_init(bitmap, (i32)width, (i32)height, pixels, BITMAP_32);
    free(pixels);
}
コード例 #8
0
ファイル: punity.c プロジェクト: gingerBill/LD35
void
sound_load_resource(Sound *sound, const char *resource_name)
{
    isize resource_size;
    void *resource_data;
    int error = 0;
    stb_vorbis *stream;

    memset(sound, 0, sizeof(Sound));

    resource_data = resource_get(resource_name, &resource_size);
    ASSERT(resource_data);

    stream = stb_vorbis_open_memory((u8 *)resource_data, resource_size,
                                    &error, 0);

    ASSERT(!error && stream);

    punp_sound_load_stbv(sound, stream);
}
コード例 #9
0
ファイル: clock.c プロジェクト: mozyg/kernel
/* This function will enable the power for the domain in the which the devices
 * falls. It is called from clk_enable function.  If the device is in PER
 * domain then the power state for PER becomes ON as soon as the first device
 * in PER calls clk_enable.
*/
static int enable_power_domain(struct clk *clk)
{
	char *resource_name;
	u32 domainid;
	u32 ret = 0;
	unsigned short level;

	domainid      = DOMAIN_ID(clk->prcmid);
	resource_name = id_to_name[domainid - 1];

	/* Request for logical resource. Only CORE domain is modelled as a
	 * logical resource.
	 */
	if (resource_name == NULL)
		return ret;

	pr_debug("%s: pwr_domain_name %s name %s\n", __FUNCTION__,
		resource_name, clk->name);

	if (clk->flags & POWER_ON_REQUIRED) {
		if (clk->res == NULL) {
			clk->res = resource_get(clk->name, resource_name);
			if (clk->res == NULL) {
				printk(KERN_ERR"Could not get resource handle"
						"for %s\n", resource_name);
				return -EINVAL;
			}
		}

		level = (!strcmp(resource_name, "core")) ?
					LOGICAL_USED : POWER_DOMAIN_ON;
		ret = resource_request(clk->res, level);
		if (ret) {
			printk(KERN_ERR "Could not request ON for resource %s\n",
							 resource_name);
			return ret;
		}
	}
	return ret;
}
コード例 #10
0
ファイル: explorer.c プロジェクト: n3rdswithgame/gz
static void draw_crosshair(struct menu_item *item)
{
  struct item_data *data = item->data;
  struct gfx_texture *texture = resource_get(RES_TEXTURE_CROSSHAIR);
  /* define meshes */
  static Vtx lat_mesh[] =
  {
    gdSPDefVtx(-16, 0, 16,  0,  0),
    gdSPDefVtx(16,  0, 16,  62, 0),
    gdSPDefVtx(-16, 0, -16, 0,  62),
    gdSPDefVtx(16,  0, -16, 62, 62),
  };
  static Vtx vert_mesh[] =
  {
    gdSPDefVtx(-16, 16,  0, 0,  0),
    gdSPDefVtx(16,  16,  0, 62, 0),
    gdSPDefVtx(-16, -16, 0, 0,  62),
    gdSPDefVtx(16,  -16, 0, 62, 62),
  };
  /* create modelview matrices */
  float xscale = 1.5f;
  float yscale = 1.5f;
  float zscale = 1.5f;
  Mtx m;
  MtxF mf;
  MtxF mt;
  {
    guTranslateF(&mf, data->x, data->y, data->z);
  }
  {
    guScaleF(&mt, xscale, yscale, zscale);
    guMtxCatF(&mt, &mf, &mf);
  }
  guMtxF2L(&mf, &m);
  Mtx *p_latz_mtx = gDisplayListData(&data->gfx.poly_xlu.d, m);
  {
    guRotateF(&mt, -M_PI / 2.f, 0.f, 1.f, 0.f);
    guMtxCatF(&mt, &mf, &mf);
  }
  guMtxF2L(&mf, &m);
  Mtx *p_latx_mtx = gDisplayListData(&data->gfx.poly_xlu.d, m);
  {
    guTranslateF(&mf, data->x, data->y, data->z);
  }
  {
    guRotateF(&mt, data->yaw, 0.f, 1.f, 0.f);
    guMtxCatF(&mt, &mf, &mf);
  }
  {
    guScaleF(&mt, xscale, yscale, zscale);
    guMtxCatF(&mt, &mf, &mf);
  }
  guMtxF2L(&mf, &m);
  Mtx *p_vert_mtx = gDisplayListData(&data->gfx.poly_xlu.d, m);
  /* build dlist */
  gDisplayListAppend(&data->gfx.poly_xlu.p,
    gsDPPipeSync(),
    /* rsp state */
    gsSPLoadGeometryMode(G_ZBUFFER),
    /* rdp state */
    gsDPSetCycleType(G_CYC_1CYCLE),
    /* texture engine */
    gsSPTexture(0x8000, 0x8000, 0, G_TX_RENDERTILE, G_ON),
    gsDPSetTexturePersp(G_TP_PERSP),
    gsDPSetTextureDetail(G_TD_CLAMP),
    gsDPSetTextureLUT(G_TT_NONE),
    /* texture filter */
    gsDPSetTextureFilter(G_TF_BILERP),
    gsDPSetTextureConvert(G_TC_FILT),
    /* color combiner */
    gsDPSetCombineMode(G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM),
    /* blender */
    gsDPSetAlphaCompare(G_AC_NONE),
    gsDPSetDepthSource(G_ZS_PIXEL),
    gsDPSetRenderMode(G_RM_AA_ZB_XLU_SURF, G_RM_AA_ZB_XLU_SURF2),
    /* memory interface */
    gsDPSetColorDither(G_CD_DISABLE),
    gsDPSetAlphaDither(G_AD_DISABLE),
    /* load meshes */
    gsSPMatrix(p_latx_mtx, G_MTX_MODELVIEW | G_MTX_LOAD),
    gsSPVertex(&lat_mesh, 4, 0),
    gsSPMatrix(p_vert_mtx, G_MTX_MODELVIEW | G_MTX_LOAD),
    gsSPVertex(&vert_mesh, 4, 4),
    gsSPMatrix(p_latz_mtx, G_MTX_MODELVIEW | G_MTX_LOAD),
    gsSPVertex(&lat_mesh, 4, 8),
  );
  /* render navigation indicator primitives */
  gDPSetPrimColor(data->gfx.poly_xlu.p++, 0, 0, 0xFF, 0xFF, 0xFF, 0x40);
  if (input_pad() & BUTTON_Z) {
    gfx_disp_rdp_load_tile(&data->gfx.poly_xlu.p, texture, 2);
    gSP2Triangles(data->gfx.poly_xlu.p++, 4, 5, 6, 0, 6, 5, 7, 0);
  }
  else {
    gfx_disp_rdp_load_tile(&data->gfx.poly_xlu.p, texture, 1);
    gSP2Triangles(data->gfx.poly_xlu.p++, 0, 1, 2, 0, 2, 1, 3, 0);
  }
  /* render crosshair primitives */
  gfx_disp_rdp_load_tile(&data->gfx.poly_xlu.p, texture, 0);
  gDisplayListAppend(&data->gfx.poly_xlu.p,
    gsDPSetPrimColor(0, 0, 0x00, 0x00, 0xFF, 0x40),
    gsSP2Triangles(8, 9, 10, 0, 10, 9, 11, 0),
    gsDPPipeSync(),
    gsDPSetPrimColor(0, 0, 0xFF, 0x00, 0x00, 0x40),
    gsSP2Triangles(0, 1, 2, 0, 2, 1, 3, 0),
    gsDPPipeSync(),
    gsDPSetPrimColor(0, 0, 0x00, 0xFF, 0x00, 0x40),
    gsSP2Triangles(4, 5, 6, 0, 6, 5, 7, 0),
  );
}
コード例 #11
0
ファイル: space.c プロジェクト: China-ls/virtuoso-opensource
buffer_desc_t *
it_new_page (index_tree_t * it, dp_addr_t addr, int type, int in_pmap,
	     it_cursor_t * has_hold)
{
  it_map_t * itm;
  extent_map_t * em = it->it_extent_map;
  int ext_type = (!it->it_blobs_with_index && (DPF_BLOB  == type || DPF_BLOB_DIR == type)) ? EXT_BLOB : EXT_INDEX, n_tries;
  buffer_desc_t *buf;
  buffer_pool_t * action_bp = NULL;
  dp_addr_t physical_dp;

  if (in_pmap)
    GPF_T1 ("do not call isp_new_page in page map");

  physical_dp = em_new_dp (em, ext_type, addr, NULL);
  if (!physical_dp)
    {
      log_error ("Out of disk space for database");
      if (DPF_INDEX == type)
	{
	  /* a split must never fail to get a page.  Use the remap hold as a backup */
	  physical_dp = em_new_dp (it->it_extent_map, EXT_REMAP, 0, &has_hold->itc_n_pages_on_hold);
	  if (!physical_dp)
	    {
	      log_error ("After running out of disk, cannot get a page from remap reserve to complete operation.  Exiting.");
	      call_exit (-1);
	    }
	}
      else
	return NULL;
    }

  if (DPF_INDEX == type)
    it->it_n_index_est++;
  else
    it->it_n_blob_est++;
  for (n_tries =  0; ; n_tries++)
    {
      buf = bp_get_buffer_1 (NULL, &action_bp, in_log_replay ? BP_BUF_REQUIRED : BP_BUF_IF_AVAIL);
      if (buf)
	break;
      if (action_bp)
	bp_delayed_stat_action (action_bp);
      action_bp = NULL;
      if (n_tries > 10)
	{
	  log_error ("Signaling out of disk due to failure to get a buffer.  This condition is not a case of running out of disk");
	  return NULL;
	}
      if (5 == n_tries)
	log_info ("Failed to get a buffer for a new page. Retrying.  If the failure repeats, an out of disk error will be signalled.  The cause of this is having too many buffers wired down for preread, flush or group by/hash join temp space.  To correct, increase the number of buffers in the configuration file.  If this repeats in spite of having hundreds of thousands  of buffers, please report to support.");
      if (n_tries > 4)
	virtuoso_sleep (0, 50000 * (n_tries - 4));
    }
  if (action_bp)
    bp_delayed_stat_action (action_bp);
  if (buf->bd_readers != 1)
    GPF_T1 ("expecting buf to be wired down when allocated");
    buf_dbg_printf (("Buf %x new in tree %x dp=%d\n", buf, isp, physical_dp));
  itm = IT_DP_MAP (it, physical_dp);
  mutex_enter (&itm->itm_mtx);

  sethash (DP_ADDR2VOID (physical_dp), &itm->itm_dp_to_buf, (void*) buf);
  sethash (DP_ADDR2VOID (physical_dp), &itm->itm_remap,
	   DP_ADDR2VOID (physical_dp));
  buf->bd_page = physical_dp;
  buf->bd_physical_page = physical_dp;
  buf->bd_tree = it;
  buf->bd_storage = it->it_storage;
  buf->bd_pl = NULL;
  buf->bd_readers = 0;
  BD_SET_IS_WRITE (buf, 1);
  mutex_leave (&itm->itm_mtx);
  if (em != em->em_dbs->dbs_extent_map && EXT_INDEX == ext_type)
    {
      mutex_enter (em->em_mtx);
      remhash (DP_ADDR2VOID(physical_dp), em->em_uninitialized);
      mutex_leave (em->em_mtx);
    }
#ifdef PAGE_TRACE

  memset (buf->bd_buffer, 0, PAGE_SZ); /* all for debug view */
#else
  memset (buf->bd_buffer, 0, PAGE_SZ - PAGE_DATA_SZ); /* header only */
#endif
  SHORT_SET (buf->bd_buffer + DP_FLAGS, type);
  if (type == DPF_INDEX)
    {
      page_map_t * map = buf->bd_content_map;
      if (!map)
	buf->bd_content_map = (page_map_t*) resource_get (PM_RC (PM_SZ_1));
      else
	{
	  if (map->pm_size > PM_SZ_1)
	    {
	      resource_store (PM_RC (map->pm_size), (void*) map);
	      buf->bd_content_map = (page_map_t *) resource_get (PM_RC (PM_SZ_1));
	    }
	}
      pg_map_clear (buf);
      LONG_SET (buf->bd_buffer + DP_KEY_ID, it->it_key ? it->it_key->key_id : KI_TEMP);
    }
  else if (buf->bd_content_map)
    {
      resource_store (PM_RC (buf->bd_content_map->pm_size), (void*) buf->bd_content_map);
      buf->bd_content_map = NULL;
    }

  buf_set_dirty (buf);
  DBG_PT_PRINTF (("New page L=%d B=%p FL=%d K=%s \n", buf->bd_page, buf, type,
		 it->it_key ? (it->it_key->key_name ? it->it_key->key_name : "unnamed key") : "no key"));
  TC (tc_new_page);
  return buf;
}