本文整理汇总了C++中put_module函数的典型用法代码示例。如果您正苦于以下问题:C++ put_module函数的具体用法?C++ put_module怎么用?C++ put_module使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了put_module函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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, ¬ify_hooks);
return B_OK;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:29,代码来源:driver.c
示例16: TRACE
Interface::~Interface()
{
TRACE("Interface %p: destructor\n", this);
put_device_interface(fDeviceInterface);
// Uninitialize the domain datalink protocols
DatalinkTable::Iterator iterator = fDatalinkTable.GetIterator();
while (domain_datalink* datalink = iterator.Next()) {
put_domain_datalink_protocols(this, datalink->domain);
}
// Free domain datalink objects
domain_datalink* next = fDatalinkTable.Clear(true);
while (next != NULL) {
domain_datalink* datalink = next;
next = next->hash_link;
delete datalink;
}
recursive_lock_destroy(&fLock);
// Release reference of the stack - at this point, our stack may be unloaded
// if no other interfaces or sockets are left
put_module(gNetStackInterfaceModule.info.name);
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:29,代码来源:interfaces.cpp
示例17: system
/*! \brief Returns parameters for partitioning a session.
The partitioning system (module) identified by \a identifier is asked to
return parameters for the session. If the session is already partitioned
using this system, then the parameters describing the current layout will
be returned, otherwise default values.
If the supplied buffer is too small for the parameters, the function
returns \c B_OK, but doesn't fill in the buffer; the required buffer
size is returned in \a actualSize. If the buffer is large enough,
\a actualSize is set to the actually used size. The size includes the
terminating null.
\param deviceFD The device the session to be partitioned resides on.
\param sessionIndex The index of the session to be partitioned.
\param identifier A string identifying the partitioning system to be used.
\param buffer Pointer to a pre-allocated buffer of size \a bufferSize.
\param bufferSize The size of \a buffer.
\param actualSize Pointer to a pre-allocated size_t to be set to the
actually needed buffer size.
\return
- \c B_OK: The parameters could be retrieved or the buffer is too
small. \a actualSize has to be checked!
- another error code, if something went wrong
*/
status_t
get_partitioning_parameters(int deviceFD, int32 sessionIndex,
const char *identifier, char *buffer,
size_t bufferSize, size_t *actualSize)
{
status_t error = (identifier && buffer && actualSize ? B_OK : B_BAD_VALUE);
disk_scanner_module_info *diskScanner = NULL;
session_info sessionInfo;
// get the disk scanner module
if (error == B_OK) {
error = get_module(DISK_SCANNER_MODULE_NAME,
(module_info**)&diskScanner);
}
// get the session info
if (error == B_OK) {
error = diskScanner->get_nth_session_info(deviceFD, sessionIndex,
&sessionInfo, NULL);
}
// get the parameters
if (error == B_OK) {
error = diskScanner->get_partitioning_params(deviceFD, &sessionInfo,
identifier, buffer, bufferSize, actualSize);
}
// put the partition scanner module
if (diskScanner)
put_module(diskScanner->module.name);
return error;
}
开发者ID:looncraz,项目名称:haiku,代码行数:53,代码来源:disk_scanner.cpp
示例18: init_driver
status_t
init_driver()
{
TRACE("init_driver() " __DATE__ " " __TIME__ "\n");
if (get_module(B_USB_MODULE_NAME, (module_info **)&gUSBModule) != B_OK)
return B_ERROR;
gDeviceList = new(std::nothrow) DeviceList();
if (gDeviceList == NULL) {
put_module(B_USB_MODULE_NAME);
return B_NO_MEMORY;
}
mutex_init(&sDriverLock, "usb hid driver lock");
static usb_notify_hooks notifyHooks = {
&usb_hid_device_added,
&usb_hid_device_removed
};
static usb_support_descriptor supportDescriptor = {
USB_INTERFACE_CLASS_HID, 0, 0, 0, 0
};
gUSBModule->register_driver(DRIVER_NAME, &supportDescriptor, 1, NULL);
gUSBModule->install_notify(DRIVER_NAME, ¬ifyHooks);
TRACE("init_driver() OK\n");
return B_OK;
}
开发者ID:mmanley,项目名称:Antares,代码行数:29,代码来源:Driver.cpp
示例19: std_ops
static status_t
std_ops(int32 op, ...)
{
void *handle;
bool load = false;
switch (op) {
case B_MODULE_INIT:
handle = load_driver_settings("kernel");
if (handle) {
load = get_driver_boolean_parameter(handle,
"bochs_debug_output", load, true);
unload_driver_settings(handle);
}
if (load) {
if (get_module(B_ISA_MODULE_NAME, (module_info **)&sISAModule) < B_OK)
return B_ERROR;
}
return load ? B_OK : B_ERROR;
case B_MODULE_UNINIT:
put_module(B_ISA_MODULE_NAME);
return B_OK;
}
return B_BAD_VALUE;
}
开发者ID:mmanley,项目名称:Antares,代码行数:25,代码来源:bochs.cpp
示例20: bcd_std_ops
static status_t
bcd_std_ops(int32 op, ...)
{
status_t status;
switch (op) {
case B_MODULE_INIT:
new (&sConnectionList) DoublyLinkedList<HciConnection>;
add_debugger_command("btConnections", &DumpHciConnections,
"Lists Bluetooth Connections with RemoteDevices & channels");
status = get_module(NET_BUFFER_MODULE_NAME,
(module_info **)&gBufferModule);
if (status < B_OK)
return status;
return B_OK;
break;
case B_MODULE_UNINIT:
remove_debugger_command("btConnections", &DumpHciConnections);
put_module(NET_BUFFER_MODULE_NAME);
return B_OK;
break;
}
return B_ERROR;
}
开发者ID:kallisti5,项目名称:haiku,代码行数:31,代码来源:BTCoreData.cpp
注:本文中的put_module函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论