当前位置: 首页>>代码示例>>C++>>正文


C++ pci_init函数代码示例

本文整理汇总了C++中pci_init函数的典型用法代码示例。如果您正苦于以下问题:C++ pci_init函数的具体用法?C++ pci_init怎么用?C++ pci_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pci_init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char *argv[])
{
	if (argc != 2) {
		fprintf(stderr, "Usage: %s <uio-dev>\n", argv[0]);
		return 1;
	}
	const int fd = open(argv[1], O_RDWR);
	if (fd < 0) {
		perror("Failed to open uio device");
		return 2;
	}
	ehci_bar =
		mmap(NULL, 1 << 8, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
	if (MAP_FAILED == ehci_bar) {
		perror("Failed to map ehci bar");
		close(fd);
		return 3;
	}

	ioperm(0x80, 1, 1);

	pci_access = pci_alloc();
	pci_init(pci_access);

	usbdebug_init();

	pci_cleanup(pci_access);
	munmap(ehci_bar, 1 << 8);
	close(fd);
	return 0;
}
开发者ID:tidatida,项目名称:coreboot,代码行数:31,代码来源:uio_usbdebug.c

示例2: pci_old_module_std_ops

static int32
pci_old_module_std_ops(int32 op, ...)
{
	switch (op) {
		case B_MODULE_INIT:
		{
			status_t status;

			TRACE(("PCI: pci_module_init\n"));

			status = pci_init();
			if (status < B_OK)
				return status;

			pci_print_info();

			return B_OK;
		}

		case B_MODULE_UNINIT:
			TRACE(("PCI: pci_module_uninit\n"));
			pci_uninit();
			return B_OK;
	}

	return B_BAD_VALUE;
}
开发者ID:anilkagak2,项目名称:haiku,代码行数:27,代码来源:pci_module.cpp

示例3: kmain

void kmain(s64 magic, s64 info)
{
	//vga_clear(COLOR_BLACK);
    idt_init();
    isr_init();

    serial_init();
	set_debug_traps();
    BREAKPOINT();

	cpuid_print();
	multiboot(magic, info);
	kmem_map();
    page_init();
    kmalloc_init();
    //vesa_init();

    root_init();
    pci_init();
    vm_init();
    syscall_init();
    timer_init();
    kbd_init();
    //mouse_init();

    console_init();

 	create_kthread(NULL, idle_thread, THREAD_PRI_LOW, NULL, NULL);
 	create_kthread(NULL, init_thread, THREAD_PRI_NORMAL, NULL, NULL);

    thread_schedule();
}
开发者ID:nielh,项目名称:dragon,代码行数:32,代码来源:main.c

示例4: pci_init

pci& pci::operator=(const pci &p) {
    *this = p;
    pci_init(_pacc);
    _pacc->numeric_ids = 0;
    pci_set_param(_pacc, const_cast<char*>("proc.path"), pci_get_param(p._pacc, const_cast<char*>("proc.path")));
    return *this;
}
开发者ID:DrakXtools,项目名称:ldetect,代码行数:7,代码来源:pci.cpp

示例5: detect_pci22

/* --- implementations --- */
int detect_pci22(void){
  
  unsigned int c;
  char counter=0;

  
  pacc = pci_alloc();           /* Get the pci_access structure */
  
  pci_init(pacc);               /* Initialize the PCI library */
  pci_scan_bus(pacc);           /* We want to get the list of devices */


  /* Iterate over all PCI devices */
  for(pci22_dev=pacc->devices; pci22_dev; pci22_dev=pci22_dev->next){
    
    pci_fill_info(pci22_dev, PCI_FILL_IDENT | PCI_FILL_BASES); 
    
    // Detect the specified device
    if( (pci22_dev->vendor_id == PCI22_PCI_VENDOR_ID) && 
	(pci22_dev->device_id == PCI22_PCI_DEVICE_ID) 
	){
      break;
    }

  }
  if (pci22_dev==NULL){
    printf("\n\nERROR: PCI22 card not detected\n\n\n");
    exit(0);
  }


  printf("\n\nPCI22 card detected on %02x:%02x.%d\nVendorID=%04x DeviceID=%04x irq=%d\n",
	 pci22_dev->bus,pci22_dev->dev,
	 pci22_dev->func,pci22_dev->vendor_id,
	 pci22_dev->device_id,
	 pci22_dev->irq);


  printf("\n\n--- Baseaddresses ---\n");
  printf("BAR1 %x\n",pci22_dev->base_addr[0]);
  printf("BAR2 %x\n",pci22_dev->base_addr[1]);
  printf("BAR3 %x\n",pci22_dev->base_addr[2]);
  printf("BAR4 %x\n",pci22_dev->base_addr[3]);
  printf("BAR5 %x\n",pci22_dev->base_addr[4]);
  printf("BAR6 %x\n",pci22_dev->base_addr[6]);
  printf("\n");


  //printPCIDevice(pci22_dev);

/* The baseaddress of the COM20022 is at BAR2 */

//g_pci22dipswitch = pci22_dev->base_addr[1]; //Nonworking
g_pci22base = pci22_dev->base_addr[2];

  /* Close everything */
  pci_cleanup(pacc);

  return 0;
}
开发者ID:PA10ros,项目名称:PA10ros,代码行数:61,代码来源:drv_pci22.c

示例6: root_pci

/*===========================================================================*
 *				root_pci				     *
 *===========================================================================*/
static void root_pci(void)
{
	/* Print information about PCI devices present in the system.
	 */
	u16_t vid, did;
	u8_t bcr, scr, pifr;
	char *slot_name, *dev_name;
	int r, devind;
	static int first = TRUE;

	/* This should be taken care of behind the scenes by the PCI lib. */
	if (first) {
		pci_init();
		first = FALSE;
	}

	/* Iterate over all devices, printing info for each of them. */
	r = pci_first_dev(&devind, &vid, &did);
	while (r == 1) {
		slot_name = pci_slot_name(devind);
		dev_name = pci_dev_name(vid, did);

		bcr = pci_attr_r8(devind, PCI_BCR);
		scr = pci_attr_r8(devind, PCI_SCR);
		pifr = pci_attr_r8(devind, PCI_PIFR);

		buf_printf("%s %x/%x/%x %04X:%04X %s\n",
			slot_name ? slot_name : "-",
			bcr, scr, pifr, vid, did,
			dev_name ? dev_name : "");

		r = pci_next_dev(&devind, &vid, &did);
	}
}
开发者ID:0xenvision,项目名称:minix,代码行数:37,代码来源:root.c

示例7: pci_init_r

int pci_init_r(void)
{
	/* Do pci configuration */
	pci_init();

	return 0;
}
开发者ID:Adrizcorp,项目名称:ARM_SOC_FPGA,代码行数:7,代码来源:init_wrappers.c

示例8: dev_init

/*---------------------------------------------------------------------------*/
usys     dev_init (void)
{
    usys status = GOOD ; 
    pci_t pci   ;

    /* Initialize the Clock */
    if (clk_init() != GOOD)
       status = BAD ;

    /* Initialize the Serial Port */
    if (serial_init() != GOOD)
       status = BAD ;

    /* Initialize the Keyboard */
    if (pc_kbd_init () != GOOD)
       status = BAD ;

    pci.pci_write = pci_write ;
    pci.pci_read  = pci_read  ;

    if (pci_init(&pci) != GOOD)
       status = BAD ;

    return status ;

} /* End of function dev_init() */
开发者ID:dasadahanayaka,项目名称:Akalon,代码行数:27,代码来源:devices.c

示例9: at_um8881f_init

void at_um8881f_init()
{
        at_init();
        mouse_serial_init();
        pci_init(PCI_CONFIG_TYPE_1, 0, 31);
        um8881f_init();
}
开发者ID:MoochMcGee,项目名称:PCem-mooch,代码行数:7,代码来源:model.c

示例10: atl2_probe

/*===========================================================================*
 *				atl2_probe				     *
 *===========================================================================*/
static int atl2_probe(int skip)
{
	/* Find a matching PCI device.
	 */
	u16_t vid, did;
	char *dname;
	int r, devind;

	pci_init();

	r = pci_first_dev(&devind, &vid, &did);
	if (r <= 0)
		return -1;

	while (skip--) {
		r = pci_next_dev(&devind, &vid, &did);
		if (r <= 0)
			return -1;
	}

	dname = pci_dev_name(vid, did);
	ATL2_DEBUG(("ATL2: found %s (%x/%x) at %s\n",
		dname ? dname : "<unknown>", vid, did,
		pci_slot_name(devind)));

	pci_reserve(devind);

	return devind;
}
开发者ID:ssinghi,项目名称:minix,代码行数:32,代码来源:atl2.c

示例11: at_sis496_init

void at_sis496_init()
{
        at_init();
        mouse_serial_init();
        pci_init(PCI_CONFIG_TYPE_1, 0, 31);
        device_add(&sis496_device);
}
开发者ID:aliaspider,项目名称:PCem-mooch,代码行数:7,代码来源:model.c

示例12: platinit

/*------------------------------------------------------------------
 * platinit - platform specific initialization for Galileo
 *------------------------------------------------------------------
 */
void	platinit()
{

	int32	pcidev;

	/* Initialize the PCI bus */
	pci_init();

	/* Initialize the console serial port */
	console_init();

	/* Remove Isolated Memory Region Protections */
	remove_irm_protections();

	/* Intel Quark Irq Routing */
	quark_irq_routing();

	/* Find the Ethernet device */
	pcidev = find_pci_device(INTEL_ETH_QUARK_PCI_DID,
					INTEL_ETH_QUARK_PCI_VID, 0);
	if(pcidev != SYSERR) {

		/* Store the pcidev for future use */
		ethertab[0].pcidev = pcidev;

		pci_get_dev_mmio_base_addr(pcidev, 0,
					  &devtab[ETHER0].dvcsr);
	}
}
开发者ID:lwygitcat,项目名称:Dynamic_Linker,代码行数:33,代码来源:platinit.c

示例13: create_pci_dev

static struct pci_dev *
create_pci_dev(struct pci_access * pci, char * slot)
{
    struct pci_filter filter;
    pci_filter_init(pci, &filter);
    if (pci_filter_parse_slot(&filter, slot))
    {
        fprintf(stderr, "Failed to parse device id %s\n", slot);
        goto pci_filter_parse_failed;
    }

    pci_init(pci);

    struct pci_dev * dev = pci_get_dev(pci,
                                       filter.domain,
                                       filter.bus,
                                       filter.slot,
                                       filter.func);
    if (! dev)
    {
        fprintf(stderr, "Failed to allocate dev\n");
        goto pci_get_dev_failed;
    }

    pci_fill_info(dev, PCI_FILL_IDENT);

    return dev;

pci_get_dev_failed:
pci_filter_parse_failed:
    return NULL;
}
开发者ID:enyx-opensource,项目名称:host_benchmarks,代码行数:32,代码来源:pcie_latency_benchmark.c

示例14: vbox_init

/*===========================================================================*
 *				vbox_init				     *
 *===========================================================================*/
static int vbox_init(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
	/* Initialize the device. */
	int devind;
	u16_t vid, did;
	struct VMMDevReportGuestInfo *req;
	int r;

	interval = DEFAULT_INTERVAL;
	drift = DEFAULT_DRIFT;

	if (env_argc > 1)
		optset_parse(optset_table, env_argv[1]);

	pci_init();

	r = pci_first_dev(&devind, &vid, &did);

	for (;;) {
		if (r != 1)
			panic("backdoor device not found");

		if (vid == VMMDEV_PCI_VID && did == VMMDEV_PCI_DID)
			break;

		r = pci_next_dev(&devind, &vid, &did);
	}

	pci_reserve(devind);

	port = pci_attr_r32(devind, PCI_BAR) & PCI_BAR_IO_MASK;

	irq = pci_attr_r8(devind, PCI_ILR);
	hook_id = 0;

	if ((r = sys_irqsetpolicy(irq, 0 /* IRQ_REENABLE */, &hook_id)) != OK)
		panic("unable to register IRQ: %d", r);

	if ((r = sys_irqenable(&hook_id)) != OK)
		panic("unable to enable IRQ: %d", r);

	if ((vir_ptr = alloc_contig(VMMDEV_BUF_SIZE, 0, &phys_ptr)) == NULL)
		panic("unable to allocate memory");

	req = (struct VMMDevReportGuestInfo *) vir_ptr;
	req->add_version = VMMDEV_GUEST_VERSION;
	req->os_type = VMMDEV_GUEST_OS_OTHER;

	if ((r = vbox_request(&req->header, phys_ptr,
			VMMDEV_REQ_REPORTGUESTINFO, sizeof(*req))) !=
			VMMDEV_ERR_OK)
		panic("backdoor device not functioning");

	ticks = sys_hz() * interval;

	sys_setalarm(ticks, 0);

	return OK;
}
开发者ID:anuragpeshne,项目名称:minix,代码行数:62,代码来源:vbox.c

示例15: i386_init

void
i386_init(void)
{
	extern char edata[], end[];

	// Before doing anything else, complete the ELF loading process.
	// Clear the uninitialized global data (BSS) section of our program.
	// This ensures that all static/global variables start out zero.
	memset(edata, 0, end - edata);

	// Initialize the console.
	// Can't call cprintf until after we do this!
	cons_init();

	cprintf("6828 decimal is %o octal!\n", 6828);

	// Lab 2 memory management initialization functions
	i386_detect_memory();
	i386_vm_init();

	// Lab 3 user environment initialization functions
	env_init();
	idt_init();

	// Lab 4 multitasking initialization functions
	pic_init();
	kclock_init();

	time_init();
	pci_init();

	// Should always have an idle process as first one.
	ENV_CREATE(user_idle);

	// Start fs.
	ENV_CREATE(fs_fs);

#if !defined(TEST_NO_NS)
	// Start ns.
	ENV_CREATE(net_ns);
#endif

#if defined(TEST)
	// Don't touch -- used by grading script!
	ENV_CREATE2(TEST, TESTSIZE);
#else
	// Touch all you want.
	// ENV_CREATE(net_testoutput);
	// ENV_CREATE(user_echosrv);
	// ENV_CREATE(user_httpd);
  // ENV_CREATE(user_writemotd);
	// ENV_CREATE(user_testfile);
	ENV_CREATE(user_icode);
	// ENV_CREATE(user_primes);
#endif // TEST*

	// Schedule and run the first user environment!
	sched_yield();
}
开发者ID:mcorley,项目名称:jos,代码行数:59,代码来源:init.c


注:本文中的pci_init函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。