本文整理汇总了C++中DPRINT_DBG函数的典型用法代码示例。如果您正苦于以下问题:C++ DPRINT_DBG函数的具体用法?C++ DPRINT_DBG怎么用?C++ DPRINT_DBG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DPRINT_DBG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VmbusOnISR
static int VmbusOnISR(struct hv_driver *drv)
{
int ret = 0;
int cpu = smp_processor_id();
void *page_addr;
struct hv_message *msg;
union hv_synic_event_flags *event;
page_addr = gHvContext.synICMessagePage[cpu];
msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT;
DPRINT_ENTER(VMBUS);
/* Check if there are actual msgs to be process */
if (msg->Header.MessageType != HvMessageTypeNone) {
DPRINT_DBG(VMBUS, "received msg type %d size %d",
msg->Header.MessageType,
msg->Header.PayloadSize);
ret |= 0x1;
}
/* TODO: Check if there are events to be process */
page_addr = gHvContext.synICEventPage[cpu];
event = (union hv_synic_event_flags *)page_addr + VMBUS_MESSAGE_SINT;
/* Since we are a child, we only need to check bit 0 */
if (test_and_clear_bit(0, (unsigned long *) &event->Flags32[0])) {
DPRINT_DBG(VMBUS, "received event %d", event->Flags32[0]);
ret |= 0x2;
}
DPRINT_EXIT(VMBUS);
return ret;
}
示例2: rwl_wifi_purge_actionframes
/*
* read out all the action frame which are queued in the driver even
* before issuing any wl cmd. This is essential because due to late arrival of frame it can
* get queued after the read expires.
*/
void
rwl_wifi_purge_actionframes(void *wl)
{
dot11_action_wifi_vendor_specific_t *rec_frame;
void *ptr = NULL;
if ((rec_frame = (dot11_action_wifi_vendor_specific_t *)
malloc(RWL_WIFI_ACTION_FRAME_SIZE)) == NULL) {
DPRINT_DBG(OUTPUT, "Purge Error in reading the frame \n");
return;
}
for (;;) {
if (rwl_var_getbuf(wl, RWL_WIFI_GET_ACTION_CMD, rec_frame,
RWL_WIFI_ACTION_FRAME_SIZE, &ptr) < 0) {
DPRINT_DBG(OUTPUT, "rwl_wifi_purge_actionframes:"
"Purge Error in reading the frame \n");
break;
}
memcpy((char*)rec_frame, ptr, RWL_WIFI_ACTION_FRAME_SIZE);
if ((rec_frame->category != RWL_ACTION_WIFI_CATEGORY))
break;
}
free(rec_frame);
return;
}
示例3: DumpMonitorPage
static void DumpMonitorPage(struct hv_monitor_page *MonitorPage)
{
int i = 0;
int j = 0;
DPRINT_DBG(VMBUS, "monitorPage - %p, trigger state - %d",
MonitorPage, MonitorPage->TriggerState);
for (i = 0; i < 4; i++)
DPRINT_DBG(VMBUS, "trigger group (%d) - %llx", i,
MonitorPage->TriggerGroup[i].AsUINT64);
for (i = 0; i < 4; i++) {
for (j = 0; j < 32; j++) {
DPRINT_DBG(VMBUS, "latency (%d)(%d) - %llx", i, j,
MonitorPage->Latency[i][j]);
}
}
for (i = 0; i < 4; i++) {
for (j = 0; j < 32; j++) {
DPRINT_DBG(VMBUS, "param-conn id (%d)(%d) - %d", i, j,
MonitorPage->Parameter[i][j].ConnectionId.Asu32);
DPRINT_DBG(VMBUS, "param-flag (%d)(%d) - %d", i, j,
MonitorPage->Parameter[i][j].FlagNumber);
}
}
}
示例4: RingBufferWrite
int RingBufferWrite(RING_BUFFER_INFO *OutRingInfo,
struct scatterlist *sglist, u32 sgcount)
{
int i = 0;
u32 byteAvailToWrite;
u32 byteAvailToRead;
u32 totalBytesToWrite = 0;
struct scatterlist *sg;
volatile u32 nextWriteLocation;
u64 prevIndices = 0;
unsigned long flags;
DPRINT_ENTER(VMBUS);
for_each_sg(sglist, sg, sgcount, i)
{
totalBytesToWrite += sg->length;
}
totalBytesToWrite += sizeof(u64);
spin_lock_irqsave(&OutRingInfo->ring_lock, flags);
GetRingBufferAvailBytes(OutRingInfo,
&byteAvailToRead,
&byteAvailToWrite);
DPRINT_DBG(VMBUS, "Writing %u bytes...", totalBytesToWrite);
/* DumpRingInfo(OutRingInfo, "BEFORE "); */
/* If there is only room for the packet, assume it is full. */
/* Otherwise, the next time around, we think the ring buffer */
/* is empty since the read index == write index */
if (byteAvailToWrite <= totalBytesToWrite) {
DPRINT_DBG(VMBUS,
"No more space left on outbound ring buffer "
"(needed %u, avail %u)",
totalBytesToWrite,
byteAvailToWrite);
spin_unlock_irqrestore(&OutRingInfo->ring_lock, flags);
DPRINT_EXIT(VMBUS);
return -1;
}
/* Write to the ring buffer */
nextWriteLocation = GetNextWriteLocation(OutRingInfo);
for_each_sg(sglist, sg, sgcount, i)
{
nextWriteLocation = CopyToRingBuffer(OutRingInfo,
nextWriteLocation,
sg_virt(sg),
sg->length);
}
示例5: RingBufferRead
/*++
Name:
RingBufferRead()
Description:
Read and advance the read index
--*/
int
RingBufferRead(
RING_BUFFER_INFO* InRingInfo,
PVOID Buffer,
UINT32 BufferLen,
UINT32 Offset
)
{
UINT32 bytesAvailToWrite;
UINT32 bytesAvailToRead;
UINT32 nextReadLocation=0;
UINT64 prevIndices=0;
ASSERT(BufferLen > 0);
SpinlockAcquire(InRingInfo->RingLock);
GetRingBufferAvailBytes(InRingInfo, &bytesAvailToRead, &bytesAvailToWrite);
DPRINT_DBG(VMBUS, "Reading %u bytes...", BufferLen);
//DumpRingInfo(InRingInfo, "BEFORE ");
// Make sure there is something to read
if (bytesAvailToRead < BufferLen )
{
DPRINT_DBG(VMBUS, "got callback but not enough to read <avail to read %d read size %d>!!", bytesAvailToRead, BufferLen);
SpinlockRelease(InRingInfo->RingLock);
return -1;
}
nextReadLocation = GetNextReadLocationWithOffset(InRingInfo, Offset);
nextReadLocation = CopyFromRingBuffer(InRingInfo,
Buffer,
BufferLen,
nextReadLocation);
nextReadLocation = CopyFromRingBuffer(InRingInfo,
&prevIndices,
sizeof(UINT64),
nextReadLocation);
// Make sure all reads are done before we update the read index since
// the writer may start writing to the read area once the read index is updated
MemoryFence();
// Update the read index
SetNextReadLocation(InRingInfo, nextReadLocation);
//DumpRingInfo(InRingInfo, "AFTER ");
SpinlockRelease(InRingInfo->RingLock);
return 0;
}
示例6: heartbeat_onchannelcallback
/*
* Heartbeat functionality.
* Every two seconds, Hyper-V send us a heartbeat request message.
* we respond to this message, and Hyper-V knows we are alive.
*/
static void heartbeat_onchannelcallback(void *context)
{
struct vmbus_channel *channel = context;
u8 *buf;
u32 buflen, recvlen;
u64 requestid;
struct icmsg_hdr *icmsghdrp;
struct heartbeat_msg_data *heartbeat_msg;
DPRINT_ENTER(VMBUS);
buflen = PAGE_SIZE;
buf = kmalloc(buflen, GFP_ATOMIC);
VmbusChannelRecvPacket(channel, buf, buflen, &recvlen, &requestid);
if (recvlen > 0) {
DPRINT_DBG(VMBUS, "heartbeat packet: len=%d, requestid=%lld",
recvlen, requestid);
icmsghdrp = (struct icmsg_hdr *)&buf[
sizeof(struct vmbuspipe_hdr)];
icmsghdrp = (struct icmsg_hdr *)&buf[
sizeof(struct vmbuspipe_hdr)];
if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) {
prep_negotiate_resp(icmsghdrp, NULL, buf);
} else {
heartbeat_msg = (struct heartbeat_msg_data *)&buf[
sizeof(struct vmbuspipe_hdr) +
sizeof(struct icmsg_hdr)];
DPRINT_DBG(VMBUS, "heartbeat seq = %lld",
heartbeat_msg->seq_num);
heartbeat_msg->seq_num += 1;
}
icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION
| ICMSGHDRFLAG_RESPONSE;
VmbusChannelSendPacket(channel, buf,
recvlen, requestid,
VmbusPacketTypeDataInBand, 0);
}
kfree(buf);
DPRINT_EXIT(VMBUS);
}
示例7: CopyFromRingBuffer
/*++
Name:
CopyFromRingBuffer()
Description:
Helper routine to copy to source from ring buffer.
Assume there is enough room. Handles wrap-around in src case only!!
--*/
UINT32
CopyFromRingBuffer(
RING_BUFFER_INFO *RingInfo,
PVOID Dest,
UINT32 DestLen,
UINT32 StartReadOffset)
{
/* Fixme: This should not be a void pointer! */
PVOID ringBuffer=GetRingBuffer(RingInfo);
UINT32 ringBufferSize=GetRingBufferSize(RingInfo);
UINT32 fragLen;
if (DestLen > ringBufferSize - StartReadOffset) // wrap-around detected at the src
{
DPRINT_DBG(VMBUS, "src wrap-around detected!");
fragLen = ringBufferSize - StartReadOffset;
/* Fixme: Cast needed due to void pointer */
memcpy(Dest, (UCHAR *)ringBuffer + StartReadOffset, fragLen);
/* Fixme: Cast needed due to void pointer */
memcpy((UCHAR *)Dest + fragLen, ringBuffer, DestLen - fragLen);
}
else
{
/* Fixme: Cast needed due to void pointer */
memcpy(Dest, (UCHAR *)ringBuffer + StartReadOffset, DestLen);
}
StartReadOffset += DestLen;
StartReadOffset %= ringBufferSize;
return StartReadOffset;
}
示例8: shutdown_onchannelcallback
static void shutdown_onchannelcallback(void *context)
{
struct vmbus_channel *channel = context;
u32 recvlen;
u64 requestid;
u8 execute_shutdown = false;
struct shutdown_msg_data *shutdown_msg;
struct icmsg_hdr *icmsghdrp;
struct icmsg_negotiate *negop = NULL;
vmbus_recvpacket(channel, shut_txf_buf,
PAGE_SIZE, &recvlen, &requestid);
if (recvlen > 0) {
DPRINT_DBG(VMBUS, "shutdown packet: len=%d, requestid=%lld",
recvlen, requestid);
icmsghdrp = (struct icmsg_hdr *)&shut_txf_buf[
sizeof(struct vmbuspipe_hdr)];
if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) {
prep_negotiate_resp(icmsghdrp, negop, shut_txf_buf);
} else {
shutdown_msg =
(struct shutdown_msg_data *)&shut_txf_buf[
sizeof(struct vmbuspipe_hdr) +
sizeof(struct icmsg_hdr)];
switch (shutdown_msg->flags) {
case 0:
case 1:
icmsghdrp->status = HV_S_OK;
execute_shutdown = true;
DPRINT_INFO(VMBUS, "Shutdown request received -"
" gracefull shutdown initiated");
break;
default:
icmsghdrp->status = HV_E_FAIL;
execute_shutdown = false;
DPRINT_INFO(VMBUS, "Shutdown request received -"
" Invalid request");
break;
};
}
icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION
| ICMSGHDRFLAG_RESPONSE;
vmbus_sendpacket(channel, shut_txf_buf,
recvlen, requestid,
VM_PKT_DATA_INBAND, 0);
}
if (execute_shutdown == true)
orderly_poweroff(false);
}
示例9: remote_wifi_response
/*
* Send the response to the remote if the channel of the server matches with the
* server channel.
*/
void remote_wifi_response(void* wl)
{
#ifdef RWL_WIFI
dot11_action_wifi_vendor_specific_t *list;
if ((list = rwl_wifi_allocate_actionframe()) == NULL) {
DPRINT_DBG(OUTPUT, "remote_wifi_response: Failed to allocate frame \n");
return;
}
/* it's sync frame and received from client */
memcpy((char*)&list->data[RWL_WIFI_CDC_HEADER_OFFSET],
&g_rem_pkt_ptr[RWL_WIFI_CDC_HEADER_OFFSET], REMOTE_SIZE);
memcpy((char*)&list->data[REMOTE_SIZE], g_rem_pkt_ptr->message,
RWL_WIFI_FRAG_DATA_SIZE);
list->type = RWL_WIFI_FIND_MY_PEER;
/* Store the client mac addr */
memcpy((void*)&rwlea, (void*)&list->data[RWL_DUT_MAC_ADDRESS_OFFSET], ETHER_ADDR_LEN);
/* send the response to client if server is on the same channel */
rwl_wifi_find_server_response(wl, list);
free(list);
#else
UNUSED_PARAMETER(wl);
#endif /* RWL_WIFI */
return;
}
示例10: remote_shell_async_get_resp
/* Function to get the shell response from the file */
int
remote_shell_async_get_resp(char* shell_fname, char* buf_ptr, int msg_len)
{
int sts = 0;
FILE *shell_fpt;
shell_fpt = fopen(shell_fname, "rb");
if (shell_fpt == NULL) {
DPRINT_ERR(ERR, "\nShell Cmd:File open error\n");
return sts;
}
/* If there is any response from the shell, Read the file and
* update the buffer for the shell response
* else Just send the return value of the command executed
*/
if (g_shellsync_pid != SHELL_ASYNCCMD_ID) {
if (msg_len)
sts = fread(buf_ptr, sizeof(char), msg_len, shell_fpt);
fscanf(shell_fpt, "%2x", &sts);
}
else
sts = fread(buf_ptr, sizeof(char), MAX_SHELL_CMD_LENTH, shell_fpt);
fclose(shell_fpt);
remove(shell_fname);
DPRINT_DBG(OUTPUT, "\n Resp buff from shell cmdis %s\n", buf_ptr);
return sts;
}
示例11: NetVscInitialize
/*
* NetVscInitialize - Main entry point
*/
int NetVscInitialize(struct hv_driver *drv)
{
struct netvsc_driver *driver = (struct netvsc_driver *)drv;
DPRINT_DBG(NETVSC, "sizeof(struct hv_netvsc_packet)=%zd, "
"sizeof(struct nvsp_message)=%zd, "
"sizeof(struct vmtransfer_page_packet_header)=%zd",
sizeof(struct hv_netvsc_packet),
sizeof(struct nvsp_message),
sizeof(struct vmtransfer_page_packet_header));
/* Make sure we are at least 2 pages since 1 page is used for control */
/* ASSERT(driver->RingBufferSize >= (PAGE_SIZE << 1)); */
drv->name = gDriverName;
memcpy(&drv->deviceType, &gNetVscDeviceType, sizeof(struct hv_guid));
/* Make sure it is set by the caller */
/* FIXME: These probably should still be tested in some way */
/* ASSERT(driver->OnReceiveCallback); */
/* ASSERT(driver->OnLinkStatusChanged); */
/* Setup the dispatch table */
driver->Base.OnDeviceAdd = NetVscOnDeviceAdd;
driver->Base.OnDeviceRemove = NetVscOnDeviceRemove;
driver->Base.OnCleanup = NetVscOnCleanup;
driver->OnSend = NetVscOnSend;
RndisFilterInit(driver);
return 0;
}
示例12: rwl_read_serial_port
int
rwl_read_serial_port(void* hndle, char* read_buf, uint data_size, uint *numread)
{
int ret;
uint total_numread = 0;
while (total_numread < data_size) {
ret = read(*(int *)hndle, read_buf, data_size - total_numread);
*numread = ret;
if (ret == -1) {
perror("ReadFromPort Failed");
DPRINT_ERR(ERR, "Errno:%d\n", errno);
return FAIL;
}
if (*numread != data_size - total_numread) {
DPRINT_DBG(OUTPUT, "asked for %d bytes got %d bytes\n",
data_size - total_numread, *numread);
}
if (*numread == 0)
break;
total_numread += *numread;
read_buf += *numread;
}
return SUCCESS;
}
示例13: rwl_send_to_streamsocket
/* Transmit the response in the opened TCP stream socket */
int
rwl_send_to_streamsocket(int SocketDes, const char* SendBuff, int data_size, int Flag)
{
int total_numwritten = 0, numwritten = 0;
while (total_numwritten < data_size) {
if ((numwritten = send(SocketDes, SendBuff,
data_size - total_numwritten, Flag)) == -1) {
perror("Failed to send()");
DPRINT_ERR(ERR, "\n errno:%d\n", errno);
return (FAIL);
}
/* Sent successfully at first attempt no more retries */
if (numwritten == data_size) {
total_numwritten = numwritten;
break;
}
/* If socket is busy we may hit this condition */
if (numwritten != data_size - total_numwritten) {
DPRINT_DBG(OUTPUT, "wanted to send %d bytes sent only %d bytes\n",
data_size - total_numwritten, numwritten);
}
/* Now send the remaining buffer */
total_numwritten += numwritten;
SendBuff += numwritten;
}
return total_numwritten;
}
示例14: rwl_receive_from_streamsocket
/* Receive the response from the opened TCP stream socket */
int
rwl_receive_from_streamsocket(int SocketDes, char* RecvBuff, int data_size, int Flag)
{
int numread;
int total_numread = 0;
while (total_numread < data_size) {
if ((numread = recv(SocketDes, RecvBuff, data_size - total_numread, Flag)) == -1) {
perror("Failed to Receive()");
DPRINT_ERR(ERR, "\n errno:%d\n", errno);
return FAIL;
}
if (numread != data_size - total_numread) {
DPRINT_DBG(OUTPUT, "asked %d bytes got %d bytes\n",
data_size - total_numread, numread);
}
if (numread == 0)
break;
total_numread += numread;
RecvBuff += numread;
}
return numread;
}
示例15: rwl_read_serial_port
int
rwl_read_serial_port(void* hndle, char* read_buf, uint data_size, uint *numread)
{
uint total_numread = 0;
int c = 0;
while (total_numread < data_size) {
if (ReadFile(hndle, read_buf, data_size - total_numread, numread, NULL) == 0) {
DPRINT_ERR(ERR, "rwl_read_serial_port failed with:%d", WSAGetLastError());
return FAIL;
}
if (*numread != data_size - total_numread) {
c++;
DPRINT_DBG(OUTPUT, "asked %d bytes got %d bytes\n",
data_size - total_numread, *numread);
if (c > MAX_SERIAL_READ_RETRY) {
DPRINT_ERR(ERR, "rwl_read_serial_port failed: "
"reached max retry limit.\n");
return FAIL;
}
Sleep(10);
}
total_numread += *numread;
read_buf += *numread;
}
return SUCCESS;
}