本文整理汇总了C++中DPrintf函数的典型用法代码示例。如果您正苦于以下问题:C++ DPrintf函数的具体用法?C++ DPrintf怎么用?C++ DPrintf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DPrintf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddSeg
bool AddSeg(seg_t *seg)
{
FGLSectionLine &line = SectionLines[SectionLines.Reserve(1)];
bool firstline = loop->numlines == 0;
if (ISDONE(seg-segs, processed_segs))
{
// should never happen!
DPrintf("Tried to add seg %d to Sections twice. Cannot create Sections.\n", seg-segs);
return false;
}
SETDONE(seg-segs, processed_segs);
section_for_segs[seg-segs] = Sections.Size()-1;
line.start = seg->v1;
line.end = seg->v2;
line.sidedef = seg->sidedef;
line.linedef = seg->linedef;
line.refseg = seg;
line.polysub = NULL;
line.otherside = -1;
if (loop->numlines == 0)
{
v1_l1 = seg->v1;
v2_l1 = seg->v2;
}
loop->numlines++;
return true;
}
示例2: wapimib_get_stastats_from_driver
/*todo: sta based statistics need to be implemented in wlan driver*/
static int wapimib_get_stastats_from_driver(char* ifname, char* macaddr, struct ieee80211req_sta_stats* stats)
{
struct iwreq iwr;
int sock = socket(AF_INET, SOCK_DGRAM, 0);
if(sock<0)
{
return -1;
}
(void) memset(&iwr, 0, sizeof(iwr));
(void) strncpy(iwr.ifr_name, ifname, sizeof(iwr.ifr_name));
iwr.u.data.pointer = (void *) stats;
iwr.u.data.length = sizeof(struct ieee80211req_sta_stats);
memcpy(stats->is_u.macaddr, macaddr, 6);
DPrintf("[WAPID]::get stastats from %s, chars %d, ioctl 0x%x: 0x%x\n",
iwr.ifr_name, strlen(iwr.ifr_name),IEEE80211_IOCTL_STA_STATS, SIOCDEVPRIVATE);
if (ioctl(sock, IEEE80211_IOCTL_STA_STATS, &iwr) < 0)
{
close(sock);
return -1;
}
close(sock);
return 0;
}
示例3: min
bool CTXVirtQueue::PrepareBuffers()
{
auto NumBuffers = min(m_MaxBuffers, GetRingSize());
for (m_TotalDescriptors = 0; m_TotalDescriptors < NumBuffers; m_TotalDescriptors++)
{
auto TXDescr = new (m_Context->MiniportHandle) CTXDescriptor();
if (TXDescr == nullptr)
{
break;
}
if (!TXDescr->Create(m_DrvHandle,
m_HeaderSize,
m_SGTable,
m_SGTableCapacity,
m_Context->bUseIndirect ? true : false,
m_Context->bAnyLayout ? true : false))
{
CTXDescriptor::Destroy(TXDescr, m_Context->MiniportHandle);
break;
}
m_Descriptors.Push(TXDescr);
}
m_FreeHWBuffers = m_TotalHWBuffers = NumBuffers;
DPrintf(0, "[%s] available %d Tx descriptors\n", __FUNCTION__, m_TotalDescriptors);
return m_TotalDescriptors > 0;
}
示例4: autoLock
void CParaNdisRX::PopulateQueue()
{
LIST_ENTRY TempList;
TPassiveSpinLocker autoLock(m_Lock);
InitializeListHead(&TempList);
while (!IsListEmpty(&m_NetReceiveBuffers))
{
pRxNetDescriptor pBufferDescriptor =
(pRxNetDescriptor)RemoveHeadList(&m_NetReceiveBuffers);
InsertTailList(&TempList, &pBufferDescriptor->listEntry);
}
m_NetNofReceiveBuffers = 0;
while (!IsListEmpty(&TempList))
{
pRxNetDescriptor pBufferDescriptor =
(pRxNetDescriptor)RemoveHeadList(&TempList);
if (AddRxBufferToQueue(pBufferDescriptor))
{
InsertTailList(&m_NetReceiveBuffers, &pBufferDescriptor->listEntry);
m_NetNofReceiveBuffers++;
}
else
{
/* TODO - NetMaxReceiveBuffers should take into account all queues */
DPrintf(0, "FAILED TO REUSE THE BUFFER!!!!\n");
ParaNdis_FreeRxBufferDescriptor(m_Context, pBufferDescriptor);
m_Context->NetMaxReceiveBuffers--;
}
}
m_Reinsert = true;
}
示例5: PostLinkState
static VOID PostLinkState(PARANDIS_ADAPTER *pContext, NDIS_MEDIA_CONNECT_STATE connectState)
{
NDIS_STATUS_INDICATION indication;
NDIS_LINK_STATE state;
NdisZeroMemory(&state, sizeof(state));
state.Header.Revision = NDIS_LINK_STATE_REVISION_1;
state.Header.Type = NDIS_OBJECT_TYPE_DEFAULT;
state.Header.Size = NDIS_SIZEOF_LINK_STATE_REVISION_1;
state.MediaConnectState = connectState;
state.MediaDuplexState = MediaDuplexStateFull;
state.RcvLinkSpeed = state.XmitLinkSpeed =
connectState == MediaConnectStateConnected ?
PARANDIS_MAXIMUM_RECEIVE_SPEED :
NDIS_LINK_SPEED_UNKNOWN;
state.PauseFunctions = NdisPauseFunctionsUnsupported;
NdisZeroMemory(&indication, sizeof(indication));
indication.Header.Type = NDIS_OBJECT_TYPE_STATUS_INDICATION;
indication.Header.Revision = NDIS_STATUS_INDICATION_REVISION_1;
indication.Header.Size = NDIS_SIZEOF_STATUS_INDICATION_REVISION_1;
indication.SourceHandle = pContext->MiniportHandle;
indication.StatusCode = NDIS_STATUS_LINK_STATE;
indication.StatusBuffer = &state;
indication.StatusBufferSize = sizeof(state);
DPrintf(0, ("Indicating %s\n", ConnectStateName(connectState)));
ParaNdis_DebugHistory(pContext, hopConnectIndication, NULL, connectState, 0, 0);
NdisMIndicateStatusEx(pContext->MiniportHandle , &indication);
}
示例6: DEBUG_ENTRY
int CParaNdisRX::PrepareReceiveBuffers()
{
int nRet = 0;
UINT i;
DEBUG_ENTRY(4);
for (i = 0; i < m_Context->NetMaxReceiveBuffers; ++i)
{
pRxNetDescriptor pBuffersDescriptor = CreateRxDescriptorOnInit();
if (!pBuffersDescriptor) break;
pBuffersDescriptor->Queue = this;
if (!AddRxBufferToQueue(pBuffersDescriptor))
{
ParaNdis_FreeRxBufferDescriptor(m_Context, pBuffersDescriptor);
break;
}
InsertTailList(&m_NetReceiveBuffers, &pBuffersDescriptor->listEntry);
m_NetNofReceiveBuffers++;
}
/* TODO - NetMaxReceiveBuffers should take into account all queues */
m_Context->NetMaxReceiveBuffers = m_NetNofReceiveBuffers;
DPrintf(0, "[%s] MaxReceiveBuffers %d\n", __FUNCTION__, m_Context->NetMaxReceiveBuffers);
m_Reinsert = true;
return nRet;
}
示例7: ReadGlobalConfigurationEntry
static NDIS_STATUS ReadGlobalConfigurationEntry(NDIS_HANDLE cfg, const char *_name, PULONG pValue)
{
NDIS_STATUS status;
PNDIS_CONFIGURATION_PARAMETER pParam = NULL;
NDIS_STRING name = {0};
const char *statusName;
NDIS_PARAMETER_TYPE ParameterType = NdisParameterInteger;
NdisInitializeString(&name, (PUCHAR)_name);
#pragma warning(push)
#pragma warning(disable:6102)
NdisReadConfiguration(
&status,
&pParam,
cfg,
&name,
ParameterType);
if (status == NDIS_STATUS_SUCCESS)
{
*pValue = pParam->ParameterData.IntegerData;
statusName = "value";
}
else
{
statusName = "nothing";
}
#pragma warning(pop)
DPrintf(2, ("[%s] %s read for %s - 0x%x\n", __FUNCTION__, statusName, _name, *pValue));
if (name.Buffer) NdisFreeString(name);
return status;
}
示例8: DEBUG_ENTRY
int CParaNdisRX::PrepareReceiveBuffers()
{
UINT i;
DEBUG_ENTRY(4);
NdisZeroMemory(m_ReservedRxBufferMemory, sizeof(m_ReservedRxBufferMemory));
m_RxBufferIndex = 0;
m_RxBufferOffset = 0;
for (i = 0; i < m_Context->NetMaxReceiveBuffers; ++i)
{
pRxNetDescriptor pBuffersDescriptor = CreateRxDescriptorOnInit();
if (!pBuffersDescriptor) break;
pBuffersDescriptor->Queue = this;
if (!AddRxBufferToQueue(pBuffersDescriptor))
{
ParaNdis_FreeRxBufferDescriptor(m_Context, pBuffersDescriptor);
break;
}
InsertTailList(&m_NetReceiveBuffers, &pBuffersDescriptor->listEntry);
m_NetNofReceiveBuffers++;
}
/* TODO - NetMaxReceiveBuffers should take into account all queues */
m_Context->NetMaxReceiveBuffers = m_NetNofReceiveBuffers;
DPrintf(0, ("[%s] MaxReceiveBuffers %d\n", __FUNCTION__, m_Context->NetMaxReceiveBuffers));
m_Reinsert = true;
m_VirtQueue.Kick();
return m_NetNofReceiveBuffers;
}
示例9: MIDIStreamer
XMISong::XMISong (FileReader &reader, EMidiDevice type, const char *args)
: MIDIStreamer(type, args), MusHeader(0), Songs(0)
{
SongLen = reader.GetLength();
MusHeader = new uint8_t[SongLen];
if (reader.Read(MusHeader, SongLen) != SongLen)
return;
// Find all the songs in this file.
NumSongs = FindXMIDforms(MusHeader, SongLen, NULL);
if (NumSongs == 0)
{
return;
}
// XMIDI files are played with a constant 120 Hz clock rate. While the
// song may contain tempo events, these are vestigial remnants from the
// original MIDI file that were not removed by the converter and should
// be ignored.
//
// We can use any combination of Division and Tempo values that work out
// to be 120 Hz.
Division = 60;
InitialTempo = 500000;
Songs = new TrackInfo[NumSongs];
memset(Songs, 0, sizeof(*Songs) * NumSongs);
FindXMIDforms(MusHeader, SongLen, Songs);
CurrSong = Songs;
DPrintf(DMSG_SPAMMY, "XMI song count: %d\n", NumSongs);
}
示例10: Printf
bool PClass::ReadAllFields(FSerializer &ar, void *addr) const
{
bool readsomething = false;
bool foundsomething = false;
const char *key;
key = ar.GetKey();
if (strcmp(key, "classtype"))
{
// this does not represent a DObject
Printf(TEXTCOLOR_RED "trying to read user variables but got a non-object (first key is '%s')", key);
ar.mErrors++;
return false;
}
while ((key = ar.GetKey()))
{
if (strncmp(key, "class:", 6))
{
// We have read all user variable blocks.
break;
}
foundsomething = true;
PClass *type = PClass::FindClass(key + 6);
if (type != nullptr)
{
// Only read it if the type is related to this one.
if (IsDescendantOf(type))
{
if (ar.BeginObject(nullptr))
{
readsomething |= type->VMType->Symbols.ReadFields(ar, addr, type->TypeName.GetChars());
ar.EndObject();
}
}
else
{
DPrintf(DMSG_ERROR, "Unknown superclass %s of class %s\n",
type->TypeName.GetChars(), TypeName.GetChars());
}
}
else
{
DPrintf(DMSG_ERROR, "Unknown superclass %s of class %s\n",
key+6, TypeName.GetChars());
}
}
return readsomething || !foundsomething;
}
示例11: vp_notify
/* The notify function used when creating a virt queue, common to both modern
* and legacy (the difference is in how vq->priv is set up).
*/
bool vp_notify(struct virtqueue *vq)
{
/* we write the queue's selector into the notification register to
* signal the other end */
iowrite16(vq->vdev, (unsigned short)vq->index, vq->priv);
DPrintf(0, ("virtio: vp_notify vq->index = %x\n", vq->index));
return true;
}
示例12: ParaNdis_ConfigureMSIXVectors
NDIS_STATUS ParaNdis_ConfigureMSIXVectors(PARANDIS_ADAPTER *pContext)
{
NDIS_STATUS status = NDIS_STATUS_RESOURCES;
UINT i;
PIO_INTERRUPT_MESSAGE_INFO pTable = pContext->pMSIXInfoTable;
if (pTable && pTable->MessageCount)
{
status = NDIS_STATUS_SUCCESS;
DPrintf(0, ("[%s] Using MSIX interrupts (%d messages, irql %d)\n",
__FUNCTION__, pTable->MessageCount, pTable->UnifiedIrql));
for (i = 0; i < pContext->pMSIXInfoTable->MessageCount; ++i)
{
DPrintf(0, ("[%s] MSIX message%d=%08X=>%I64X\n",
__FUNCTION__, i,
pTable->MessageInfo[i].MessageData,
pTable->MessageInfo[i].MessageAddress));
}
for (UINT j = 0; j < pContext->nPathBundles && status == NDIS_STATUS_SUCCESS; ++j)
{
status = pContext->pPathBundles[j].rxPath.SetupMessageIndex(2 * u16(j) + 1);
status = pContext->pPathBundles[j].txPath.SetupMessageIndex(2 * u16(j));
DPrintf(0, ("[%s] Using messages %u/%u for RX/TX queue %u\n", __FUNCTION__,
pContext->pPathBundles[j].rxPath.getMessageIndex(),
pContext->pPathBundles[j].txPath.getMessageIndex(),
j));
}
if (status == NDIS_STATUS_SUCCESS && pContext->bCXPathCreated)
{
/* We need own vector for control queue. If one is not available, fail the initialization */
if (pContext->nPathBundles * 2 > pTable->MessageCount - 1)
{
DPrintf(0, ("[%s] Not enough vectors for control queue!\n", __FUNCTION__));
status = NDIS_STATUS_RESOURCES;
}
else
{
status = pContext->CXPath.SetupMessageIndex(2 * u16(pContext->nPathBundles));
DPrintf(0, ("[%s] Using message %u for controls\n", __FUNCTION__, pContext->CXPath.getMessageIndex()));
}
}
}
DEBUG_EXIT_STATUS(0, status);
return status;
}
示例13: CM_ProcessRecData
void CM_ProcessRecData (DATA_StructType *msg)
{
static uint8_t size;
switch (msg->count-1){
case QIZHI1:
if(msg->byte[QIZHI1] != COM_QIZHI1){
CM_ClearCount (msg);
DPrintf ("error1\r\n");
}
break;
case QIZHI2:
if(msg->byte[QIZHI2] != COM_QIZHI2){
CM_ClearCount (msg);
DPrintf ("error2\r\n");
}
break;
case MAINPCB:
if(msg->byte[MAINPCB] != COM_MAINPCB){
CM_ClearCount (msg);
DPrintf ("error3\r\n");
}
break;
case SLPCB:
if(msg->byte[SLPCB] != COM_SLPCB){
CM_ClearCount (msg);
DPrintf ("error4\r\n");
}
break;
case SIZE:
size = msg->byte[SIZE];
break;
case CMD:
if(size != 0){
size --;
}
break;
default:
if(size != 0){
size --;
}else{
CM_SetSuccess(msg);
}
break;
}
}
示例14: ParaNdis5_SetOID
/**********************************************************
NDIS required procedure of OID SET
Just passes all the supported oids to common set procedure
Return value:
NDIS_STATUS as returned from set procedure
NDIS_STATUS_NOT_SUPPORTED if support not defined in the table
***********************************************************/
NDIS_STATUS ParaNdis5_SetOID(IN NDIS_HANDLE MiniportAdapterContext,
IN NDIS_OID Oid,
IN PVOID InformationBuffer,
IN ULONG InformationBufferLength,
OUT PULONG BytesRead,
OUT PULONG BytesNeeded)
{
NDIS_STATUS status = NDIS_STATUS_NOT_SUPPORTED;
tOidWhatToDo Rules;
PARANDIS_ADAPTER *pContext = (PARANDIS_ADAPTER *)MiniportAdapterContext;
tOidDesc _oid;
ParaNdis_GetOidSupportRules(Oid, &Rules, OidsDB);
_oid.ulToDoFlags = Rules.Flags;
*BytesRead = 0;
*BytesNeeded = 0;
ParaNdis_DebugHistory(pContext, hopOidRequest, NULL, Oid, 1, 1);
DPrintf(Rules.nEntryLevel, ("[%s], id 0x%X(%s) of %d", __FUNCTION__,
Oid,
Rules.name,
InformationBufferLength));
_oid.Oid = Oid;
_oid.InformationBuffer = InformationBuffer;
_oid.InformationBufferLength = InformationBufferLength;
_oid.pBytesNeeded = BytesNeeded;
_oid.pBytesRead = BytesRead;
_oid.pBytesWritten = BytesRead;
if (pContext->bSurprizeRemoved) status = NDIS_STATUS_NOT_ACCEPTED;
else if (Rules.Flags & ohfSet)
{
if (Rules.OidSetProc) status = Rules.OidSetProc(pContext, &_oid);
else
{
DPrintf(0, ("[%s] ERROR in OID redirection table", __FUNCTION__));
status = NDIS_STATUS_INVALID_OID;
}
}
ParaNdis_DebugHistory(pContext, hopOidRequest, NULL, Oid, status, 0);
if (status != NDIS_STATUS_PENDING)
{
DPrintf((status != NDIS_STATUS_SUCCESS) ? Rules.nExitFailLevel : Rules.nExitOKLevel,
("[%s] , id 0x%X(%s) (%X), read %d, needed %d", __FUNCTION__,
Rules.oid, Rules.name, status, *BytesRead, *BytesNeeded));
}
return status;
}
示例15: to_vvq
static void *vring_get_buf(struct virtqueue *_vq, unsigned int *len)
{
struct vring_virtqueue *vq = to_vvq(_vq);
void *ret;
struct vring_used_elem *u;
unsigned int i;
if (!more_used(vq)) {
DPrintf(4, ("No more buffers in queue: last_used_idx %d vring.used->idx %d\n",
vq->last_used_idx,
vq->vring.used->idx));
return NULL;
}
/* Only get used array entries after they have been exposed by host. */
rmb();
u = &vq->vring.used->ring[vq->last_used_idx % vq->vring.num];
i = u->id;
*len = u->len;
DPrintf(4, ("%s>>> id %d, len %d\n", __FUNCTION__, i, *len) );
if (i >= vq->vring.num) {
DPrintf(0, ("id %u out of range\n", i) );
return NULL;
}
if (!vq->data[i]) {
DPrintf(0, ("id %u is not a head!\n", i) );
return NULL;
}
/* detach_buf clears data, so grab it now. */
ret = vq->data[i];
detach_buf(vq, i);
++vq->last_used_idx;
if (!(vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT)) {
*vq->vring.vring_last_used_ptr = vq->last_used_idx;
mb();
}
return ret;
}