本文整理汇总了C++中Benaphore::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ Benaphore::Init方法的具体用法?C++ Benaphore::Init怎么用?C++ Benaphore::Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Benaphore
的用法示例。
在下文中一共展示了Benaphore::Init方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init_driver
status_t init_driver()
{
LogFlowFunc(("init_driver\n"));
gLock.Init("VBoxVideo driver lock");
uint32 pciIndex = 0;
while (gPCI->get_nth_pci_info(pciIndex, &gDeviceInfo.pciInfo) == B_OK)
{
if (gDeviceInfo.pciInfo.vendor_id == VENDOR_ID && gDeviceInfo.pciInfo.device_id == DEVICE_ID)
{
sprintf(gDeviceInfo.name, "graphics/" DEVICE_FORMAT,
gDeviceInfo.pciInfo.vendor_id, gDeviceInfo.pciInfo.device_id,
gDeviceInfo.pciInfo.bus, gDeviceInfo.pciInfo.device, gDeviceInfo.pciInfo.function);
TRACE("found device %s\n", gDeviceInfo.name);
gCanHasDevice = true;
gDeviceInfo.openCount = 0;
size_t sharedSize = (sizeof(SharedInfo) + 7) & ~7;
gDeviceInfo.sharedArea = create_area("vboxvideo shared info",
(void **)&gDeviceInfo.sharedInfo, B_ANY_KERNEL_ADDRESS,
ROUND_TO_PAGE_SIZE(sharedSize), B_FULL_LOCK,
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
uint16_t width, height, vwidth, bpp, flags;
VBoxVideoGetModeRegisters(&width, &height, &vwidth, &bpp, &flags);
gDeviceInfo.sharedInfo->currentMode.space = get_color_space_for_depth(bpp);
gDeviceInfo.sharedInfo->currentMode.virtual_width = width;
gDeviceInfo.sharedInfo->currentMode.virtual_height = height;
gDeviceInfo.sharedInfo->currentMode.h_display_start = 0;
gDeviceInfo.sharedInfo->currentMode.v_display_start = 0;
gDeviceInfo.sharedInfo->currentMode.flags = 0;
gDeviceInfo.sharedInfo->currentMode.timing.h_display = width;
gDeviceInfo.sharedInfo->currentMode.timing.v_display = height;
/* Not used, but this makes a reasonable-sounding refresh rate show in screen prefs: */
gDeviceInfo.sharedInfo->currentMode.timing.h_total = 1000;
gDeviceInfo.sharedInfo->currentMode.timing.v_total = 1;
gDeviceInfo.sharedInfo->currentMode.timing.pixel_clock = 850;
/* Map the PCI memory space */
uint32 command_reg = gPCI->read_pci_config(gDeviceInfo.pciInfo.bus,
gDeviceInfo.pciInfo.device, gDeviceInfo.pciInfo.function, PCI_command, 2);
command_reg |= PCI_command_io | PCI_command_memory | PCI_command_master;
gPCI->write_pci_config(gDeviceInfo.pciInfo.bus, gDeviceInfo.pciInfo.device,
gDeviceInfo.pciInfo.function, PCI_command, 2, command_reg);
gDeviceInfo.sharedInfo->framebufferArea = map_physical_memory("vboxvideo framebuffer",
(phys_addr_t)gDeviceInfo.pciInfo.u.h0.base_registers[0],
gDeviceInfo.pciInfo.u.h0.base_register_sizes[0], B_ANY_KERNEL_BLOCK_ADDRESS,
B_READ_AREA | B_WRITE_AREA, &(gDeviceInfo.sharedInfo->framebuffer));
vm_set_area_memory_type(gDeviceInfo.sharedInfo->framebufferArea,
(phys_addr_t)gDeviceInfo.pciInfo.u.h0.base_registers[0], B_MTR_WC);
break;
}
pciIndex++;
}
return B_OK;
}