• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ pci_init函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: misc_init_r

int misc_init_r (void)
{
#ifdef CONFIG_PCI
	pci_init();
#endif
	setenv("verify", "n");
	return (0);
}
开发者ID:Aorjoa,项目名称:bootloader,代码行数:8,代码来源:integrator.c


示例17: initr_pci

static int initr_pci(void)
{
#ifndef CONFIG_DM_PCI
	pci_init();
#endif

	return 0;
}
开发者ID:CheezeCake,项目名称:edison-u-boot,代码行数:8,代码来源:board_r.c


示例18: init

static	int	init(int channel)
{
	char 		temp[64];
	pci_bus_cookie	*current_cookie = kmalloc(sizeof(pci_bus_cookie));
	current_cookie->channel = channel;
	pci_init(current_cookie);
	//return -1;
	bus_cookies[channel] = current_cookie;
	current_cookie->dma_supported = true;
	sprintf(temp, "pci_ide_sem%d", channel);
	current_cookie->bus_semaphore =  sem_create(1, temp);

    	if(current_cookie->bus_semaphore < 0)
      	{
		kfree(current_cookie);
		return -1;
      	}
	TRACE(("trying to discover devices on channel %d\n",channel));
	if(channel==0)
	{
		current_cookie->base_reg = 0x1f0;
		current_cookie->status_reg = 0x3f0;
	}
	else
	{
		current_cookie->base_reg = 0x170;
		current_cookie->status_reg = 0x370;
	}
	if(ide_raw_init(current_cookie)==0)
	{
		int	current_drive;
		init_dma(current_cookie);
		for(current_drive=0;current_drive<2;current_drive++)
		{
			int		i = 0;
			current_cookie->drives[current_drive] = NULL;
			TRACE(("trying to discover device %d/%d\n",channel,current_drive));
			while(ide_drives[i]!=NULL)
			{
				void	*drive_cookie = ide_drives[i]->init_drive(&pci_bus,current_cookie,channel,current_drive);
				if(drive_cookie!=NULL)
				{
					TRACE(("trying to discover device %d/%d is a %s\n",channel,current_drive,ide_drives[i]->device_name));
					current_cookie->drives[current_drive] = ide_drives[i];
					current_cookie->drive_cookie[current_drive] = drive_cookie;
					init_ide_struct(channel,current_drive,-1);
      					TRACE(("done discovering device\n"));
    					TRACE(("Cookie for interrupt is %p\n",current_cookie));
					int_set_io_interrupt_handler(14,&ide_interrupt_handler, current_cookie);
					break;
				}
				i++;
			}
		}
		return 0;
	}
	return -1;
}
开发者ID:HTshandou,项目名称:newos,代码行数:58,代码来源:pci_ide_bus.c


示例19: iface_desc

int iface_desc(const char *iface, char *desc, int size)
{
	struct ifreq ifr;
	int fd, err, len, device, vendor;
	struct ethtool_drvinfo drvinfo;
	char buf[512], path[PATH_MAX];
	struct pci_access *pacc;

	memset(&ifr, 0, sizeof(ifr));
	strcpy(ifr.ifr_name, iface);

	fd = socket(AF_INET, SOCK_DGRAM, 0);
	if (fd < 0)
	{
		perror("Cannot get control socket");
		return 1;
	}
	drvinfo.cmd = ETHTOOL_GDRVINFO;
	ifr.ifr_data = (caddr_t)&drvinfo;
	err = ioctl(fd, SIOCETHTOOL, &ifr);
	if (err < 0)
	{
		perror("Cannot get driver information");
		printf("%d\n", errno);
		return 2;
	}
	close(fd);
	snprintf(path, PATH_MAX-1, "/sys/bus/pci/devices/%s/vendor", drvinfo.bus_info);
	fd = open(path, O_RDONLY);
	if (fd < 0)
	{
		perror("Cannot open the vendor file");
		return 3;
	}
	len = read(fd, buf, sizeof(buf));
	buf[len-1] = '\0';
	close(fd);
	sscanf(buf,"%X", &vendor);
	snprintf(path, PATH_MAX, "/sys/bus/pci/devices/%s/device", drvinfo.bus_info);
	fd = open(path, O_RDONLY);
	if (fd < 0)
	{
		perror("Cannot open the device file");
		return 3;
	}
	len = read(fd, buf, sizeof(buf));
	buf[len-1] = '\0';
	close(fd);
	sscanf(buf,"%X", &device);
	pacc = pci_alloc();
	pci_init(pacc);
	pci_lookup_name(pacc, desc, size,
			PCI_LOOKUP_VENDOR | PCI_LOOKUP_DEVICE,
			vendor, device);
	pci_cleanup(pacc);
	return(0);
}
开发者ID:vmiklos,项目名称:vmexam,代码行数:57,代码来源:pci.c


示例20: at_i430vx_init

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pci_intr_disestablish函数代码示例发布时间:2022-05-30
下一篇:
C++ pci_get_word函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap