Example #1
0
File: pd.c Project: TitaniumBoy/lin
static int pd_detect( void )

{       int	k, unit;

	k = 0;
	if (pd_drive_count == 0) {  /* nothing spec'd - so autoprobe for 1 */
	    unit = 0;
	    if (pi_init(PI,1,-1,-1,-1,-1,-1,pd_scratch,
	             PI_PD,verbose,PD.name)) {
		if (pd_probe_drive(unit)) {
			PD.present = 1;
			k = 1;
		} else pi_release(PI);
	    }

   	} else for (unit=0;unit<PD_UNITS;unit++) if (DU[D_PRT])
	    if (pi_init(PI,0,DU[D_PRT],DU[D_MOD],DU[D_UNI],
			DU[D_PRO],DU[D_DLY],pd_scratch,
			PI_PD,verbose,PD.name)) {
                if (pd_probe_drive(unit)) {
                        PD.present = 1;
                        k = unit+1;
                } else pi_release(PI);
            }
	for (unit=0;unit<PD_UNITS;unit++)
		register_disk(&pd_gendisk,MKDEV(MAJOR_NR,unit<<PD_BITS),
				PD_PARTNS,&pd_fops,
				PD.present?PD.capacity:0);

/* We lie about the number of drives found, as the generic partition
   scanner assumes that the drives are numbered sequentially from 0.
   This can result in some bogus error messages if non-sequential
   drive numbers are used.
*/
	if (k)
		return k; 
        printk("%s: no valid drive found\n",name);
        return 0;
}
Example #2
0
unsigned long net_dev_init (unsigned long mem_start, unsigned long mem_end)
{

#if defined(CONFIG_LANCE)			/* Note this is _not_ CONFIG_AT1500. */
	mem_start = lance_init(mem_start, mem_end);
#endif
#if defined(CONFIG_PI)
	mem_start = pi_init(mem_start, mem_end);
#endif	
#if defined(CONFIG_APRICOT)
	mem_start = apricot_init(mem_start, mem_end);
#endif	
	return mem_start;
}
int Alsprolog_Init(Tcl_Interp *interp)
#pragma export reset
{
	AP_Obj consult;
  printf("about to pi_prolog_init\n");
  PI_prolog_init(0, NULL);
  printf("about to pi_init\n");
  pi_init();
  consult = 
  	AP_NewInitStructure(NULL, AP_NewSymbolFromStr(NULL, "xconsult"), 1,
  		AP_NewSymbolFromStr(NULL, "tcltk.pro"), AP_UNBOUND_OBJ);
  AP_Call(NULL, AP_NewSymbolFromStr(NULL, "builtins"), &consult);
  return ALSProlog_Package_Init(interp, NULL);
}
Example #4
0
File: dev.c Project: 0xffea/gnumach
int net_dev_init(void)
{
	struct device *dev, **dp;

	/*
	 *	Initialise the packet receive queue.
	 */

#ifndef MACH
	skb_queue_head_init(&backlog);
#endif
	
	/*
	 *	The bridge has to be up before the devices
	 */

#ifdef CONFIG_BRIDGE	 
	br_init();
#endif	
	
	/*
	 * This is Very Ugly(tm).
	 *
	 * Some devices want to be initialized early..
	 */
#if defined(CONFIG_PI)
	pi_init();
#endif	
#if defined(CONFIG_PT)
	pt_init();
#endif
#if defined(CONFIG_DLCI)
	dlci_setup();
#endif
#if defined(CONFIG_SDLA)
	sdla_setup();
#endif
	/*
	 *	SLHC if present needs attaching so other people see it
	 *	even if not opened.
	 */
#if (defined(CONFIG_SLIP) && defined(CONFIG_SLIP_COMPRESSED)) \
	 || defined(CONFIG_PPP) \
    || (defined(CONFIG_ISDN) && defined(CONFIG_ISDN_PPP))
	slhc_install();
#endif	

	/*
	 *	Add the devices.
	 *	If the call to dev->init fails, the dev is removed
	 *	from the chain disconnecting the device until the
	 *	next reboot.
	 */

	dp = &dev_base;
	while ((dev = *dp) != NULL)
	{
		int i;
		for (i = 0; i < DEV_NUMBUFFS; i++)  {
			skb_queue_head_init(dev->buffs + i);
		}

		if (dev->init && dev->init(dev)) 
		{
			/*
			 *	It failed to come up. Unhook it.
			 */
			*dp = dev->next;
		} 
		else
		{
			dp = &dev->next;
		}
	}

#ifdef CONFIG_PROC_FS
	proc_net_register(&(struct proc_dir_entry) {
		PROC_NET_DEV, 3, "dev",
		S_IFREG | S_IRUGO, 1, 0, 0,
		0, &proc_net_inode_operations,
		dev_get_info
	});
Example #5
0
/*!
 * This function is used to initialize any module/dsp
 * module specific structures or tables etc.
 *
 * @param context SS level igd_context.
 *
 * @return 0 on success.
 * @return -IGD_INVAL or -IGD_ERROR_NODEV on failure
 */
int mode_init(igd_context_t *context)
{
	igd_dispatch_t     *dispatch = &context->dispatch;
	inter_module_dispatch_t *md;

	EMGD_TRACE_ENTER;

	EMGD_DEBUG("Allocating a mode context...");

	/* Clear the allocated memory for mode context */
	OS_MEMSET((void *)mode_context, 0, sizeof(mode_context_t));

	/* Set the pointer to igd level context */
	mode_context->context = context;
	mode_context->first_alter = TRUE;
	mode_context->display_color =
		context->mod_dispatch.init_params->display_color;
	mode_context->ref_freq =
		context->mod_dispatch.init_params->ref_freq;
	mode_context->tuning_wa =
		context->mod_dispatch.init_params->tuning_wa;

	/* Get mode's dispatch table */
	mode_context->dispatch = (mode_dispatch_t *)
		dispatch_acquire(context, mode_dispatch);
	if(!mode_context->dispatch) {
		EMGD_ERROR_EXIT("Unsupported Device");
		return -IGD_ERROR_NODEV;
	}

	md = &context->mod_dispatch;

	/* Set the fw_info to 0 */
	mode_context->fw_info = NULL;

	/* Hook up the IGD dispatch table entires for mode */
	dispatch->get_EDID_block = igd_get_EDID_block;
	dispatch->power_display = igd_power_display;
	dispatch->query_mode_list = igd_query_mode_list;
	dispatch->alter_displays = igd_alter_displays;

	OPT_MICRO_CALL(full_mode_init(context, mode_context));

	/* Hook up inter-module dispatch functions */
	md->mode_get_gpio_sets = mode_context->dispatch->get_gpio_sets;
	md->mode_reset_plane_pipe_ports =
		mode_context->dispatch->reset_plane_pipe_ports;
	md->filter_modes = mode_context->dispatch->filter_modes;

	/* Hook up Core specific IGD dispatch table entries */
	dispatch->set_palette_entries =
		mode_context->dispatch->full->set_palette_entries;
	dispatch->set_palette_entry = mode_context->dispatch->set_palette_entry;
	dispatch->get_palette_entry = mode_context->dispatch->get_palette_entry;
	dispatch->wait_vblank = mode_context->dispatch->wait_vblank;

	/* Initialize dsp module */
	if (dsp_init(context)) {
		EMGD_ERROR("dsp_init() failed.");
		return -IGD_INVAL;
	}

	/* Initialze port interface (pi) module */
	if (pi_init(context)) {
		EMGD_ERROR_EXIT("pi_init() failed.");
		if(md->dsp_shutdown) {
			md->dsp_shutdown(context);
		}
		return -IGD_ERROR_INVAL;
	}

	if (mode_context->dispatch->full && md->reg_get_mod_state) {
		/* Save mode state */
		module_state_h *state = NULL;
		unsigned long *flags = NULL;
		md->reg_get_mod_state(REG_MODE_STATE, &state, &flags);
		md->mode_save(context, state, flags);
	}

	/* Initialize the Display Configuration List */
	/* FIXME: This should be done in dsp init */
	dsp_dc_init(context);

	EMGD_TRACE_EXIT;
	return 0;
}
int __init island_pwr_mgr_init()
{

    struct v0x_spec_i2c_cmd_ptr v_ptr;
    int i;
    struct pi* pi;
    struct pm_policy_cfg cfg;
    cfg.ac = 1;
    cfg.atl = 0;

    v_ptr.other_ptr = 1;
    v_ptr.set2_val = 1; /*Retention voltage inx*/
    v_ptr.set2_ptr = 45;
    v_ptr.set1_val = 2;/*Should be 8 ????Wakeup override*/
    v_ptr.set1_ptr = 49;
    v_ptr.zerov_ptr = 45; /*Not used for island*/
#if 0
    /*disable jtag clock instrusive during debug*/
    pwr_mgr_ignore_dap_powerup_request(true);
#endif
    pwr_mgr_init(&island_pwr_mgr_info);
    island_pi_mgr_init();

    /*MM override is not set by default*/
    //pwr_mgr_pi_set_wakeup_override(PI_MGR_PI_ID_MM,false/*clear*/);

    /*clear all the event */
    pwr_mgr_event_clear_events(LCDTE_EVENT, EVENT_ID_ALL);

    pwr_mgr_event_set(SOFTWARE_2_EVENT,1);
    pwr_mgr_event_set(SOFTWARE_0_EVENT,1);

    /*Init I2c seq*/
    pwr_mgr_pm_i2c_enable(false);
    /*Program I2C sequencer*/
    island_pm_i2c_cmd_init();
    //pwr_mgr_pm_i2c_cmd_write(i2c_cmd,ARRAY_SIZE(i2c_cmd));
    /*Program voltage lookup table
    AVS driver may chnage this later*/
    //pwr_mgr_pm_i2c_var_data_write(pwrmgr_default_volt_lut,VLT_LUT_SIZE);
    /*populate the jump voltage table */
    //pwr_mgr_set_v0x_specific_i2c_cmd_ptr(VOLT0,&v_ptr);

    pwr_mgr_pm_i2c_enable(true);

    /*Init event table*/
    for(i = 0; i < ARRAY_SIZE(event_table); i++)
    {
        u32 event_id;

        event_id = event_table[i].event_id;

        if (event_id >= GPIO29_A_EVENT && event_id <= SPARE10_A_EVENT)
            event_id = GPIO29_A_EVENT;

        if (event_id >= GPIO29_B_EVENT && event_id <= SPARE10_B_EVENT)
            event_id = GPIO29_B_EVENT;


        pwr_mgr_event_trg_enable(event_table[i].event_id,event_table[i].trig_type);

        cfg.policy = event_table[i].policy_modem;
        pwr_mgr_event_set_pi_policy(event_id, PI_MGR_PI_ID_MODEM, &cfg);

        cfg.policy = event_table[i].policy_arm_core;
        pwr_mgr_event_set_pi_policy(event_id, PI_MGR_PI_ID_ARM_CORE, &cfg);

        cfg.policy = event_table[i].policy_arm_sub;
        pwr_mgr_event_set_pi_policy(event_id, PI_MGR_PI_ID_ARM_SUB_SYSTEM, &cfg);

        cfg.policy = event_table[i].policy_hub_aon;
        pwr_mgr_event_set_pi_policy(event_id, PI_MGR_PI_ID_HUB_AON, &cfg);

        cfg.policy = event_table[i].policy_hub_switchable;
        pwr_mgr_event_set_pi_policy(event_id, PI_MGR_PI_ID_HUB_SWITCHABLE, &cfg);

    }
    /*Init all PIs*/
    /*Init all PIs*/
    for(i = 0; i < PI_MGR_PI_ID_MODEM; i++)
    {
        pi = pi_mgr_get(i);
        BUG_ON(pi == NULL);
        pi_init(pi);
    }

    island_clock_init();

    /*All the initializations are done. Clear override bit here so that
     * appropriate policies take effect*/
#if 1
    for (i = 0; i < PI_MGR_PI_ID_MODEM; i++) {
        pi = pi_mgr_get(i);
        BUG_ON(pi == NULL);
        pi_init_state(pi);
    }
#endif
    return 0;
}
Example #7
0
// Creates and initializes a device.
struct cen64_device *device_create(struct cen64_device *device,
  const struct rom_file *ddipl, const struct rom_file *ddrom,
  const struct rom_file *pifrom, const struct rom_file *cart,
  const struct save_file *eeprom, const struct save_file *sram,
  const struct save_file *flashram, const struct controller *controller,
  bool no_audio, bool no_video) {

  // Initialize the bus.
  device->bus.ai = &device->ai;
  device->bus.dd = &device->dd;
  device->bus.pi = &device->pi;
  device->bus.ri = &device->ri;
  device->bus.si = &device->si;
  device->bus.vi = &device->vi;

  device->bus.rdp = &device->rdp;
  device->bus.rsp = &device->rsp;
  device->bus.vr4300 = &device->vr4300;

  // Initialize the bus.
  if (bus_init(&device->bus)) {
    debug("create_device: Failed to initialize the bus.\n");
    return NULL;
  }

  // Initialize the AI.
  if (ai_init(&device->ai, &device->bus, no_audio)) {
    debug("create_device: Failed to initialize the AI.\n");
    return NULL;
  }

  // Initialize the DD.
  if (dd_init(&device->dd, &device->bus,
    ddipl->ptr, ddrom->ptr, ddrom->size)) {
    debug("create_device: Failed to initialize the DD.\n");
    return NULL;
  }

  // Initialize the PI.
  if (pi_init(&device->pi, &device->bus, cart->ptr, cart->size, sram, flashram)) {
    debug("create_device: Failed to initialize the PI.\n");
    return NULL;
  }

  // Initialize the RI.
  if (ri_init(&device->ri, &device->bus)) {
    debug("create_device: Failed to initialize the RI.\n");
    return NULL;
  }

  // Initialize the SI.
  if (si_init(&device->si, &device->bus, pifrom->ptr,
    cart->ptr, ddipl->ptr != NULL, eeprom->ptr, eeprom->size,
    controller)) {
    debug("create_device: Failed to initialize the SI.\n");
    return NULL;
  }

  // Initialize the VI.
  if (vi_init(&device->vi, &device->bus, no_video)) {
    debug("create_device: Failed to initialize the VI.\n");
    return NULL;
  }

  // Initialize the RDP.
  if (rdp_init(&device->rdp, &device->bus)) {
    debug("create_device: Failed to initialize the RDP.\n");
    return NULL;
  }

  // Initialize the RSP.
  if (rsp_init(&device->rsp, &device->bus)) {
    debug("create_device: Failed to initialize the RSP.\n");
    return NULL;
  }

  // Initialize the VR4300.
  if (vr4300_init(&device->vr4300, &device->bus)) {
    debug("create_device: Failed to initialize the VR4300.\n");
    return NULL;
  }

  return device;
}