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


C++ put_module函数代码示例

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


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

示例1: find_graphics_card

static status_t
find_graphics_card(addr_t frameBuffer, addr_t& base, size_t& size)
{
	// TODO: when we port this over to the new driver API, this mechanism can be
	// used to find the right device_node
	pci_module_info* pci;
	if (get_module(B_PCI_MODULE_NAME, (module_info**)&pci) != B_OK)
		return B_ERROR;

	pci_info info;
	for (int32 index = 0; pci->get_nth_pci_info(index, &info) == B_OK; index++) {
		if (info.class_base != PCI_display)
			continue;

		// check PCI BARs
		for (uint32 i = 0; i < 6; i++) {
			if (info.u.h0.base_registers[i] <= frameBuffer
				&& info.u.h0.base_registers[i] + info.u.h0.base_register_sizes[i]
					> frameBuffer) {
				// found it!
				base = info.u.h0.base_registers[i];
				size = info.u.h0.base_register_sizes[i];

				put_module(B_PCI_MODULE_NAME);
				return B_OK;
			}
		}
	}

	put_module(B_PCI_MODULE_NAME);
	return B_ENTRY_NOT_FOUND;
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:32,代码来源:vesa.cpp

示例2: init_driver

status_t
init_driver(void)
{
	SHOW_FLOW0(3, "");

	if (get_module(B_PCI_MODULE_NAME, (module_info **)&pci_bus) != B_OK)
		return B_ERROR;

	/* get a handle for the agp bus if it exists */
	get_module(B_AGP_GART_MODULE_NAME, (module_info **)&sAGP);

	/* driver private data */
	devices = (radeon_devices *)calloc(1, sizeof(radeon_devices));
	if (devices == NULL) {
		put_module(B_PCI_MODULE_NAME);
		if (sAGP != NULL)
			put_module(B_AGP_GART_MODULE_NAME);
		return B_ERROR;
	}

	(void)INIT_BEN(devices->kernel, "Radeon Kernel");

	GetDriverSettings();
	Radeon_ProbeDevices();
	return B_OK;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:26,代码来源:driver.c

示例3: std_ops

static status_t std_ops(int32 op, ...)
{
    switch(op) {
    case B_MODULE_INIT:
        if (get_module(pci_name, (module_info **) &pci) != B_OK)
            return B_ERROR;

        if (get_module(cam_name, (module_info **) &cam) != B_OK) {
            put_module(pci_name);
            return B_ERROR;
        }

        if(sim_install_buslogic()) {
            return B_OK;
        }

        put_module(pci_name);
        put_module(cam_name);
        return B_ERROR;

    case B_MODULE_UNINIT:
        put_module(pci_name);
        put_module(cam_name);
        return B_OK;

    default:
        return B_ERROR;
    }
}
开发者ID:mmanley,项目名称:Antares,代码行数:29,代码来源:buslogic.c

示例4: uninit_driver

// called just before the kernel unloads the driver
void
uninit_driver(void)
{
	CALLED();

	int32 j;

	for (j = 0; j < MAX_BT_GENERIC_USB_DEVICES; j++) {

		if (publish_names[j] != NULL)
			free(publish_names[j]);

		if (bt_usb_devices[j] != NULL) {
			//	if (connected_dev != NULL) {
			//		debugf("Device %p still exists.\n",	connected_dev);
			//	}
			ERROR("%s: %s still present?\n", __func__, bt_usb_devices[j]->name);
			kill_device(bt_usb_devices[j]);
		}
	}

	usb->uninstall_notify(BLUETOOTH_DEVICE_DEVFS_NAME);

	remove_debugger_command("bth2generic", &dump_driver);

	// Releasing modules
	put_module(usb_name);
	put_module(hci_name);
	// TODO: netbuffers

	delete_sem(dev_table_sem);
}
开发者ID:mmuman,项目名称:haiku,代码行数:33,代码来源:h2generic.cpp

示例5: std_ops

static status_t std_ops(int32 op, ...)
{
	switch(op) {
	case B_MODULE_INIT:
#if DEBUG_SAFETY
		set_dprintf_enabled(true);
#endif
		load_driver_symbols("53c8xx");

		if (get_module(pci_name, (module_info **) &pci) != B_OK)
			return B_ERROR;

		if (get_module(cam_name, (module_info **) &cam) != B_OK) {
			put_module(pci_name);
			return B_ERROR;
		}

		if(sim_install_symbios()){
			return B_OK;
		}

		put_module(pci_name);
		put_module(cam_name);
		return B_ERROR;

	case B_MODULE_UNINIT:
		put_module(pci_name);
		put_module(cam_name);
		return B_OK;

	default:
		return B_ERROR;
	}
}
开发者ID:DonCN,项目名称:haiku,代码行数:34,代码来源:53c8xx.c

示例6: init_driver

status_t
init_driver(void)
{
	int i = 0;
	status_t err;
	num_cards = 0;

	TRACE("@@init_driver()\n");

	if (get_module(B_PCI_MODULE_NAME, (module_info **)&pci))
		return ENOSYS;

	if (get_module(B_MPU_401_MODULE_NAME, (module_info **) &mpu401)) {
		put_module(B_PCI_MODULE_NAME);
		return ENOSYS;
	}

	while ((*pci->get_nth_pci_info)(i, &cards[num_cards].info) == B_OK) {
		//TODO check other Vendor_ID and DEVICE_ID
		if ((cards[num_cards].info.vendor_id == ICE1712_VENDOR_ID)
			&& (cards[num_cards].info.device_id == ICE1712_DEVICE_ID)) {
			if (num_cards == NUM_CARDS) {
				TRACE("Too many ice1712 cards installed!\n");
				break;
			}

			if ((err = (*pci->reserve_device)(cards[num_cards].info.bus,
				cards[num_cards].info.device, cards[num_cards].info.function,
				DRIVER_NAME, &cards[num_cards])) < B_OK) {
				dprintf("%s: failed to reserve_device(%d, %d, %d,): %s\n",
					DRIVER_NAME, cards[num_cards].info.bus,
					cards[num_cards].info.device,
					cards[num_cards].info.function, strerror(err));
				continue;
			}
			if (ice1712_setup(&cards[num_cards]) != B_OK) {
			//Vendor_ID and Device_ID has been modified
				TRACE("Setup of ice1712 %d failed\n", (int)(num_cards + 1));
				(*pci->unreserve_device)(cards[num_cards].info.bus,
					cards[num_cards].info.device,
					cards[num_cards].info.function,
					DRIVER_NAME, &cards[num_cards]);
			} else {
				num_cards++;
			}
		}
		i++;
	}

	TRACE("Number of succesfully initialised card : %d\n", (int)num_cards);

	if (num_cards == 0) {
		put_module(B_PCI_MODULE_NAME);
		put_module(B_MPU_401_MODULE_NAME);
		return ENODEV;
	}
	return B_OK;
}
开发者ID:michael-manley,项目名称:haiku,代码行数:58,代码来源:ice1712.c

示例7: uninit_driver

void
uninit_driver(void)
{
	/* free the driver data */
	DELETE_BEN(pd->kernel);
	free(pd);
	pd = NULL;

	/* put the pci module away */
	put_module(B_PCI_MODULE_NAME);
	put_module(B_ISA_MODULE_NAME);
}
开发者ID:luciang,项目名称:haiku,代码行数:12,代码来源:driver.c

示例8: uninit_driver

void
uninit_driver(void)
{
	SHOW_FLOW0(3, "");
	DELETE_BEN(devices->kernel);

	free(devices);
	devices = NULL;

	put_module(B_PCI_MODULE_NAME);
	if (sAGP) 
		put_module(B_AGP_GART_MODULE_NAME);
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:13,代码来源:driver.c

示例9: uninit_driver

void
uninit_driver()
{
	int32 i = 0;
	for (i=0; i<devices_count; i++) {
		free (devices[i]);
	}
	free(devices);
	devices = NULL;

	put_module(DS_MODULE_NAME);
	put_module(CS_CLIENT_MODULE_NAME);
}
开发者ID:mmanley,项目名称:Antares,代码行数:13,代码来源:ds.c

示例10: uninit_driver

void uninit_driver(void) {

	/* free the driver data */
	DELETE_BEN(pd->kernel);
	free(pd);
	pd = NULL;

	/* put the pci module away */
	put_module(B_PCI_MODULE_NAME);
	put_module(B_ISA_MODULE_NAME);

	/* put the agp module away if it's there */
	if (agp_bus) put_module(B_AGP_MODULE_NAME);
}
开发者ID:looncraz,项目名称:haiku,代码行数:14,代码来源:driver.c

示例11: init_driver

status_t
init_driver(void)
{
	status_t ret = ENODEV;
	int i;

	TRACE("init_driver\n");

	if (get_module(B_PCI_MODULE_NAME, (module_info **)&gPciBus) != B_OK) {
		ret = B_ERROR;
		goto done;
	}

	if (!(gPd = calloc(1, sizeof(DeviceData)))) {
		put_module(B_PCI_MODULE_NAME);
		ret = B_ERROR;
		goto done;
	}

	/* Remember the PCI information */
	for (i = 0; (*gPciBus->get_nth_pci_info)(i, &gPd->pcii) == B_OK; i++) 
		if (gPd->pcii.vendor_id == PCI_VENDOR_ID_VMWARE &&
			gPd->pcii.device_id == PCI_DEVICE_ID_VMWARE_SVGA2) {
			ret = B_OK;
			break;
		}

	if (ret != B_OK) {
		free(gPd);
		put_module(B_PCI_MODULE_NAME);
		goto done;
	}

	/* Create a benaphore for exclusive access in OpenHook/FreeHook */
	INIT_BEN(gPd->kernel);

	/* The device name */
	gPd->names[0] = strdup("graphics/vmware");
	gPd->names[1] = NULL;

	/* Usual initializations */
	gPd->isOpen = 0;
	gPd->sharedArea = -1;
	gPd->si = NULL;

done:
	TRACE("init_driver: %ld\n", ret);
	return ret;
}
开发者ID:DonCN,项目名称:haiku,代码行数:49,代码来源:driver.c

示例12: init_hardware

status_t
init_hardware(void)
{
	long index = 0;
	pci_info pcii;
	bool found = false;

	/* choke if we can't find the PCI bus */
	if (get_module(B_PCI_MODULE_NAME, (module_info **)&pci_bus) != B_OK)
		return B_ERROR;

	/* choke if we can't find the ISA bus */
	if (get_module(B_ISA_MODULE_NAME, (module_info **)&isa_bus) != B_OK)
	{
		put_module(B_PCI_MODULE_NAME);
		return B_ERROR;
	}

	/* while there are more pci devices */
	while ((*pci_bus->get_nth_pci_info)(index, &pcii) == B_NO_ERROR) {
		int vendor = 0;

		/* if we match a supported vendor */
		while (SupportedDevices[vendor].vendor) {
			if (SupportedDevices[vendor].vendor == pcii.vendor_id) {
				uint16 *devices = SupportedDevices[vendor].devices;
				/* while there are more supported devices */
				while (*devices) {
					/* if we match a supported device */
					if (*devices == pcii.device_id ) {

						found = true;
						goto done;
					}
					/* next supported device */
					devices++;
				}
			}
			vendor++;
		}
		/* next pci_info struct, please */
		index++;
	}

done:
	/* put away the module manager */
	put_module(B_PCI_MODULE_NAME);
	return found ? B_OK : B_ERROR;
}
开发者ID:luciang,项目名称:haiku,代码行数:49,代码来源:driver.c

示例13: ethernet_init

status_t
ethernet_init(const char *name, net_device **_device)
{
	// make sure this is a device in /dev/net, but not the
	// networking (userland) stack driver
	if (strncmp(name, "/dev/net/", 9) || !strcmp(name, "/dev/net/stack")
		|| !strcmp(name, "/dev/net/userland_server"))
		return B_BAD_VALUE;

	status_t status = get_module(NET_BUFFER_MODULE_NAME, (module_info **)&gBufferModule);
	if (status < B_OK)
		return status;

	ethernet_device *device = new (std::nothrow) ethernet_device;
	if (device == NULL) {
		put_module(NET_BUFFER_MODULE_NAME);
		return B_NO_MEMORY;
	}

	memset(device, 0, sizeof(ethernet_device));

	strcpy(device->name, name);
	device->flags = IFF_BROADCAST | IFF_LINK;
	device->type = IFT_ETHER;
	device->mtu = 1500;
	device->media = IFM_ACTIVE | IFM_ETHER;
	device->header_length = ETHER_HEADER_LENGTH;
	device->fd = -1;

	*_device = device;
	return B_OK;
}
开发者ID:luciang,项目名称:haiku,代码行数:32,代码来源:ethernet.cpp

示例14: init_driver

extern "C" status_t
init_driver(void)
{
	TRACE((DEVICE_NAME ": init_driver()\n"));

	gDeviceInfo[0] = (vesa_info*)malloc(sizeof(vesa_info));
	if (gDeviceInfo[0] == NULL)
		return B_NO_MEMORY;

	memset(gDeviceInfo[0], 0, sizeof(vesa_info));

	status_t status = get_module(B_ISA_MODULE_NAME, (module_info**)&gISA);
	if (status != B_OK)
		goto err1;

	gDeviceNames[0] = strdup("graphics/vesa");
	if (gDeviceNames[0] == NULL) {
		status = B_NO_MEMORY;
		goto err2;
	}

	gDeviceNames[1] = NULL;

	mutex_init(&gLock, "vesa lock");
	return B_OK;

err2:
	put_module(B_ISA_MODULE_NAME);
err1:
	free(gDeviceInfo[0]);
	return status;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:32,代码来源:driver.cpp

示例15: init_driver

status_t
init_driver(void)
{
	DPRINTF_INFO("init_driver(), built %s %s\n", __DATE__, __TIME__);

#if DEBUG_DRIVER
	if (load_driver_symbols(drivername) == B_OK) {
		DPRINTF_INFO("loaded symbols\n");
	} else {
		DPRINTF_INFO("no symbols for you!\n");
	}
#endif

	if (get_module(B_USB_MODULE_NAME, (module_info**) &usb) != B_OK) {
		DPRINTF_INFO("cannot get module \"%s\"\n", B_USB_MODULE_NAME);
		return B_ERROR;
	}

	if ((gDeviceListLock = create_sem(1, "dev_list_lock")) < 0) {
		put_module(B_USB_MODULE_NAME);
		return gDeviceListLock;
	}

	usb->register_driver(kDriverName, supported_devices,
		sizeof(supported_devices)/sizeof(usb_support_descriptor), NULL);
	usb->install_notify(kDriverName, &notify_hooks);

	return B_OK;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:29,代码来源:driver.c


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