本文整理汇总了C++中TRACE_ALWAYS函数的典型用法代码示例。如果您正苦于以下问题:C++ TRACE_ALWAYS函数的具体用法?C++ TRACE_ALWAYS怎么用?C++ TRACE_ALWAYS使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TRACE_ALWAYS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: usb_disk_prepare_partial_buffer
static status_t
usb_disk_prepare_partial_buffer(device_lun *lun, off_t position, size_t length,
void *&partialBuffer, void *&blockBuffer, uint32 &blockPosition,
uint16 &blockCount)
{
blockPosition = (uint32)(position / lun->block_size);
blockCount = (uint16)((uint32)((position + length + lun->block_size - 1)
/ lun->block_size) - blockPosition);
size_t blockLength = blockCount * lun->block_size;
blockBuffer = malloc(blockLength);
if (blockBuffer == NULL) {
TRACE_ALWAYS("no memory to allocate partial buffer\n");
return B_NO_MEMORY;
}
status_t result = usb_disk_block_read(lun, blockPosition, blockCount,
blockBuffer, &blockLength);
if (result != B_OK) {
TRACE_ALWAYS("block read failed when filling partial buffer\n");
free(blockBuffer);
return result;
}
off_t offset = position - (blockPosition * lun->block_size);
partialBuffer = (uint8 *)blockBuffer + offset;
return B_OK;
}
示例2: lookup_and_create_device
DavicomDevice *
lookup_and_create_device(usb_device device)
{
const usb_device_descriptor *deviceDescriptor
= gUSBModule->get_device_descriptor(device);
if (deviceDescriptor == NULL) {
TRACE_ALWAYS("Error of getting USB device descriptor.\n");
return NULL;
}
TRACE("trying %#06x:%#06x.\n",
deviceDescriptor->vendor_id, deviceDescriptor->product_id);
// use binary search to lookup device in table
uint32 id = deviceDescriptor->vendor_id << 16
| deviceDescriptor->product_id;
int left = -1;
int right = B_COUNT_OF(gSupportedDevices);
while ((right - left) > 1) {
int i = (left + right) / 2;
((gSupportedDevices[i].Key() < id) ? left : right) = i;
}
if (gSupportedDevices[right].Key() == id)
return new DavicomDevice(device, gSupportedDevices[right]);
TRACE_ALWAYS("Search for %#x failed %d-%d.\n", id, left, right);
return NULL;
}
示例3: my_modeswitch
status_t
my_modeswitch(my_device* device)
{
status_t err = B_OK;
if (device->type[0] == MSG_NONE)
return B_OK;
for (int i = 0; i < 3; i++) {
if (device->type[i] == MSG_NONE)
break;
err = my_transfer_data(device, false, kDevicesMsg[device->type[i]],
sizeof(kDevicesMsg[device->type[i]]));
if (err != B_OK) {
TRACE_ALWAYS("send message %d failed\n", i + 1);
return err;
}
TRACE("device switched: %p\n", device);
char data[36];
err = my_transfer_data(device, true, data, sizeof(data));
if (err != B_OK) {
TRACE_ALWAYS("receive response %d failed 0x%" B_PRIx32 "\n",
i + 1, device->status);
return err;
}
TRACE("device switched (response length %ld)\n", device->actual_length);
}
TRACE("device switched: %p\n", device);
return B_OK;
}
示例4: TRACE_ALWAYS
status_t
AX88772Device::_SetupAX88772B()
{
// Reload EEPROM
size_t actualLength = 0;
status_t result = gUSBModule->send_request(fDevice,
USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT,
WRITE_GPIOS, GPIO_RSE, 0, 0, 0, &actualLength);
if (result != B_OK) {
TRACE_ALWAYS("Error of reloading EEPROM: %#010x\n", result);
return result;
}
result = _WakeupPHY();
if (result != B_OK)
return result;
result = WriteRXControlRegister(0);
if (result != B_OK) {
TRACE_ALWAYS("Error of writing %#04x RX Control:%#010x\n", 0, result);
return result;
}
fIPG[0] = 0x15;
fIPG[1] = 0x16;
fIPG[2] = 0x1A;
return B_OK;
}
示例5: TRACE_ALWAYS
void
HIDReport::PrintToStream()
{
TRACE_ALWAYS("HIDReport %p\n", this);
const char *typeName = "unknown";
switch (fType) {
case HID_REPORT_TYPE_INPUT:
typeName = "input";
break;
case HID_REPORT_TYPE_OUTPUT:
typeName = "output";
break;
case HID_REPORT_TYPE_FEATURE:
typeName = "feature";
break;
}
TRACE_ALWAYS("\ttype: %u %s\n", fType, typeName);
TRACE_ALWAYS("\treport id: %u\n", fReportID);
TRACE_ALWAYS("\treport size: %" B_PRIu32 " bits = %" B_PRIu32 " bytes\n",
fReportSize, (fReportSize + 7) / 8);
TRACE_ALWAYS("\titem count: %" B_PRIu32 "\n", fItemsUsed);
for (uint32 i = 0; i < fItemsUsed; i++) {
HIDReportItem *item = fItems[i];
if (item != NULL)
item->PrintToStream(1);
}
}
示例6: init_driver
status_t
init_driver()
{
status_t status = get_module(B_PCI_MODULE_NAME, (module_info**)&gPCIModule);
if (status < B_OK) {
return ENOSYS;
}
load_settings();
TRACE_ALWAYS("%s\n", kVersion);
pci_info info = {0};
for (long i = 0; B_OK == (*gPCIModule->get_nth_pci_info)(i, &info); i++) {
for (size_t idx = 0; idx < _countof(cardInfos); idx++) {
if (info.vendor_id == cardInfos[idx].VendorId()
&& info.device_id == cardInfos[idx].DeviceId())
{
TRACE_ALWAYS("Found:%s %#010x\n",
cardInfos[idx].Description(), cardInfos[idx].Id());
if (numCards == MAX_DEVICES) {
break;
}
Device* device = new Device(cardInfos[idx], info);
if (device == 0) {
return ENODEV;
}
status_t status = device->InitCheck();
if (status < B_OK) {
delete device;
break;
}
status = device->SetupDevice();
if (status < B_OK) {
delete device;
break;
}
char name[DEVNAME_LEN] = {0};
sprintf(name, "net/%s/%ld", cardInfos[idx].Name(), numCards);
gDeviceNames[numCards] = strdup(name);
gDevices[numCards++] = device;
}
}
}
if (numCards == 0) {
put_module(B_PCI_MODULE_NAME);
return ENODEV;
}
add_debugger_command(DRIVER_NAME, SiS19X_DebuggerCommand,
"SiS190/191 Ethernet driver info");
return B_OK;
}
示例7: usb_disk_inquiry
status_t
usb_disk_inquiry(device_lun *lun)
{
uint32 dataLength = sizeof(scsi_inquiry_6_parameter);
scsi_inquiry_6_parameter parameter;
status_t result = B_ERROR;
for (uint32 tries = 0; tries < 3; tries++) {
result = usb_disk_operation(lun, SCSI_INQUIRY_6, 6, 0, dataLength,
¶meter, &dataLength, true);
if (result == B_OK)
break;
}
if (result != B_OK) {
TRACE_ALWAYS("getting inquiry data failed\n");
lun->device_type = B_DISK;
lun->removable = true;
return result;
}
TRACE("peripherial_device_type 0x%02x\n", parameter.peripherial_device_type);
TRACE("peripherial_qualifier 0x%02x\n", parameter.peripherial_qualifier);
TRACE("removable_medium %s\n", parameter.removable_medium ? "yes" : "no");
TRACE("version 0x%02x\n", parameter.version);
TRACE("response_data_format 0x%02x\n", parameter.response_data_format);
TRACE_ALWAYS("vendor_identification \"%.8s\"\n", parameter.vendor_identification);
TRACE_ALWAYS("product_identification \"%.16s\"\n", parameter.product_identification);
TRACE_ALWAYS("product_revision_level \"%.4s\"\n", parameter.product_revision_level);
lun->device_type = parameter.peripherial_device_type; /* 1:1 mapping */
lun->removable = (parameter.removable_medium == 1);
return B_OK;
}
示例8: TRACE_FUNCALLS
status_t
FTDIDevice::SetControlLineState(uint16 state)
{
TRACE_FUNCALLS("> FTDIDevice::SetControlLineState(0x%08x, 0x%04x)\n", this, state);
int32 control;
control = (state & USB_CDC_CONTROL_SIGNAL_STATE_RTS) ? FTDI_SIO_SET_RTS_HIGH
: FTDI_SIO_SET_RTS_LOW;
size_t length = 0;
status_t status = gUSBModule->send_request(Device(),
USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT,
FTDI_SIO_MODEM_CTRL, control,
FTDI_PIT_DEFAULT, 0, NULL, &length);
if (status != B_OK)
TRACE_ALWAYS("= FTDIDevice::SetControlLineState(): control set request failed: 0x%08x\n", status);
control = (state & USB_CDC_CONTROL_SIGNAL_STATE_DTR) ? FTDI_SIO_SET_DTR_HIGH
: FTDI_SIO_SET_DTR_LOW;
status = gUSBModule->send_request(Device(),
USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT,
FTDI_SIO_MODEM_CTRL, control,
FTDI_PIT_DEFAULT, 0, NULL, &length);
if (status != B_OK)
TRACE_ALWAYS("= FTDIDevice::SetControlLineState(): control set request failed: 0x%08x\n", status);
TRACE_FUNCRET("< FTDIDevice::SetControlLineState() returns: 0x%08x\n", status);
return status;
}
示例9: usb_disk_mode_sense
status_t
usb_disk_mode_sense(device_lun *lun)
{
uint32 dataLength = sizeof(scsi_mode_sense_6_parameter);
uint8 commandBlock[12];
memset(commandBlock, 0, sizeof(commandBlock));
commandBlock[0] = SCSI_MODE_SENSE_6;
commandBlock[1] = lun->logical_unit_number << 5;
commandBlock[2] = 0; // Current values
commandBlock[7] = dataLength >> 8;
commandBlock[8] = dataLength;
scsi_mode_sense_6_parameter parameter;
status_t result = usb_disk_operation(lun, commandBlock,
¶meter, &dataLength, true);
if (result != B_OK) {
TRACE_ALWAYS("getting mode sense data failed\n");
return result;
}
lun->write_protected
= (parameter.device_specific & SCSI_DEVICE_SPECIFIC_WRITE_PROTECT) != 0;
TRACE_ALWAYS("write protected: %s\n", lun->write_protected ? "yes" : "no");
return B_OK;
}
示例10: FindReport
HIDReport *
HIDParser::_FindOrCreateReport(uint8 type, uint8 id)
{
HIDReport *report = FindReport(type, id);
if (report != NULL)
return report;
report = new(std::nothrow) HIDReport(this, type, id);
if (report == NULL) {
TRACE_ALWAYS("no memory when allocating report\n");
return NULL;
}
HIDReport **newReports = (HIDReport **)realloc(fReports,
(fReportCount + 1) * sizeof(HIDReport *));
if (newReports == NULL) {
TRACE_ALWAYS("no memory when growing report list\n");
delete report;
return NULL;
}
fReports = newReports;
fReports[fReportCount++] = report;
return report;
}
示例11: init_driver
/* init_driver - optional function - called every time the driver is loaded. */
status_t init_driver (void){
int i;
status_t status = B_OK;
load_setting();
create_log();
TRACE_FUNCALLS("init_driver\n");
if((status = get_module(B_USB_MODULE_NAME, (module_info **)&usb)) == B_OK){
if(usb){
for(i = 0; i < DEVICES_COUNT; i++)
usb_vision_devices[i] = 0;
usb_vision_names[0] = NULL;
(*usb->register_driver)(DRIVER_NAME, supported_devices, SIZEOF(supported_devices), DRIVER_NAME);
(*usb->install_notify)(DRIVER_NAME, ¬ify_hooks);
usb_vision_lock = create_sem(1, DRIVER_NAME"_devices_table_lock");
}else{
status = B_ERROR;
TRACE_ALWAYS("init_driver failed: usb:%08x", usb);
}
}else
TRACE_ALWAYS("init_driver failed:%lx cannot get a module %s", status, B_USB_MODULE_NAME);
TRACE_FUNCRET("init_driver returns:%08x\n", status);
return status;
}
示例12: sizeof
status_t
BeceemCPU::CPURun()
{
uint32 clockRegister = 0;
// Read current clock register contents
if (BizarroReadRegister(CLOCK_RESET_CNTRL_REG_1,
sizeof(clockRegister), &clockRegister) != B_OK) {
TRACE_ALWAYS("Error: Read of clock reset reg failure\n");
return B_ERROR;
}
// Adjust clock register contents to start cpu
if (fWmxDevice->CPUFlashBoot)
clockRegister &= ~(1 << 30);
else
clockRegister |= (1 << 30);
// Write new clock register contents
if (BizarroWriteRegister(CLOCK_RESET_CNTRL_REG_1,
sizeof(clockRegister), &clockRegister) != B_OK) {
TRACE_ALWAYS("Error: Write of clock reset reg failure\n");
return B_ERROR;
}
return B_OK;
}
示例13: ReadMACAddress
status_t
DavicomDevice::SetupDevice(bool deviceReplugged)
{
ether_address address;
status_t result = ReadMACAddress(&address);
if(result != B_OK) {
TRACE_ALWAYS("Error reading MAC address:%#010x\n", result);
return result;
}
TRACE("MAC address is:%02x:%02x:%02x:%02x:%02x:%02x\n",
address.ebyte[0], address.ebyte[1], address.ebyte[2],
address.ebyte[3], address.ebyte[4], address.ebyte[5]);
if(deviceReplugged) {
// this might be the same device that was replugged - read the MAC address
// (which should be at the same index) to make sure
if(memcmp(&address, &fMACAddress, sizeof(address)) != 0) {
TRACE_ALWAYS("Cannot replace device with MAC address:"
"%02x:%02x:%02x:%02x:%02x:%02x\n",
fMACAddress.ebyte[0], fMACAddress.ebyte[1], fMACAddress.ebyte[2],
fMACAddress.ebyte[3], fMACAddress.ebyte[4], fMACAddress.ebyte[5]);
return B_BAD_VALUE; // is not the same
}
} else
fMACAddress = address;
return B_OK;
}
示例14: _ReadRegister
status_t
DavicomDevice::SetPromiscuousMode(bool on)
{
/* load multicast filter and update promiscious mode bit */
uint8_t rxmode;
status_t result = _ReadRegister(RCR, 1, &rxmode);
if (result != B_OK) {
TRACE_ALWAYS("Error reading RX Control:%#010x\n", result);
return result;
}
rxmode &= ~(RCR_ALL | RCR_PRMSC);
if (on)
rxmode |= RCR_ALL | RCR_PRMSC;
/* else if (ifp->if_flags & IFF_ALLMULTI)
rxmode |= RCR_ALL; */
/* write new mode bits */
result = _Write1Register(RCR, rxmode);
if(result != B_OK) {
TRACE_ALWAYS("Error writing %#04x to RX Control:%#010x\n", rxmode, result);
}
return result;
}
示例15: TRACE_ALWAYS
status_t
Device::_MultiBufferExchange(multi_buffer_info* Info)
{
for (int i = 0; i < fStreams.Count(); i++) {
if (!fStreams[i]->IsRunning()) {
fStreams[i]->Start();
}
}
TRACE_ALWAYS("Exchange!\n");
snooze(1000000);
return B_OK;
status_t status = B_ERROR;
bool anyBufferProcessed = false;
for (int i = 0; i < fStreams.Count() && !anyBufferProcessed; i++) {
status = acquire_sem_etc(fBuffersReadySem, 1,
B_RELATIVE_TIMEOUT | B_CAN_INTERRUPT, 50000);
if (status == B_TIMED_OUT) {
TRACE_ALWAYS("Timeout during buffers exchange.\n");
break;
}
anyBufferProcessed = fStreams[i]->ExchangeBuffer(Info);
status = anyBufferProcessed ? B_OK : B_ERROR;
}
return status;
}