本文整理汇总了C++中TRACE_WARNING函数的典型用法代码示例。如果您正苦于以下问题:C++ TRACE_WARNING函数的具体用法?C++ TRACE_WARNING怎么用?C++ TRACE_WARNING使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TRACE_WARNING函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SLCK_32ktoRC
//------------------------------------------------------------------------------
/// Configure the RC oscillator for the slow clock
//------------------------------------------------------------------------------
void SLCK_32ktoRC(void)
{
// Check that the master clock has a different source than slow clock.
if( (AT91C_BASE_PMC->PMC_MCKR & AT91C_PMC_CSS) == 0)
{
TRACE_WARNING("The master clock use the slow clock. " \
"Not possible to change Slow clock\n\r");
return;
}
// Check that the slow clock source is RC
if( !SLCK_Is32k() )
{
TRACE_WARNING("The slow clock is already the internal RC oscillator\n\r");
return;
}
// Enable the internal RC oscillator by setting the bit RCEN to 1
*AT91C_SYS_SLCKSEL |= AT91C_SLCKSEL_RCEN;
// Wait internal RC Startup Time for clock stabilization (software loop).
WaitTimeInUs(BOARD_MCK*2, T_ST_SLCK_RC_IN_US);
// Switch from 32768 Hz oscillator to internal RC by setting the bit OSCSEL to 0.
*AT91C_SYS_SLCKSEL &= (0xFFFFFFFF ^ AT91C_SLCKSEL_OSCSEL);
// Wait 5 slow clock cycles for internal resynchronization.
WaitTimeInUs(BOARD_MCK*2, TIME_5_CYCLES_RC_IN_US);
// Disable the 32768 Hz oscillator by setting the bit OSC32EN to 0.
*AT91C_SYS_SLCKSEL &= (0xFFFFFFFF ^ AT91C_SLCKSEL_OSC32EN);
TRACE_INFO("The slow clock is now the internal RC oscillator\n\r");
}
示例2: SLCK_RCto32k
//------------------------------------------------------------------------------
/// Configure the 32kHz oscillator for the slow clock
//------------------------------------------------------------------------------
void SLCK_RCto32k(void)
{
unsigned int timeout = 0;
// Check that the master clock has a different source than slow clock. If no,
if( (AT91C_BASE_PMC->PMC_MCKR & AT91C_PMC_CSS) == 0)
{
TRACE_WARNING("The master clock use the slow clock. " \
"Not possible to change Slow clock\n\r");
return;
}
// Check that the slow clock source is RC
if( SLCK_Is32k() )
{
TRACE_WARNING("The slow clock is already the external 32.768kHz crystal\n\r");
return;
}
// Select the internal RC oscillator by set XTALSEL to 1.
AT91C_BASE_SUPC->SUPC_CR = AT91C_SUPC_CR_XTALSEL_CRYSTAL_SEL | (0xA5 << 24);
timeout = 0;
while (!(AT91C_BASE_SUPC->SUPC_SR & AT91C_SUPC_SR_OSCSEL_CRYST) && (timeout++ < CLOCK_TIMEOUT));
TRACE_INFO("The slow clock is now the external 32.768kHz crystal\n\r");
}
示例3: _UsbDataReceived
/*----------------------------------------------------------------------------
* Callback invoked when data has been received on the USB.
*----------------------------------------------------------------------------*/
static void _UsbDataReceived(uint32_t unused,
uint8_t status,
uint32_t received,
uint32_t remaining)
{
unused = unused;
Usart *pUs = BASE_USART;
/* Check that data has been received successfully */
if (status == USBD_STATUS_SUCCESS) {
SCB_InvalidateDCache_by_Addr((uint32_t *)usbBuffer, received);
/* Send back CDC data */
if (isCdcEchoON) {
while (CDCDSerialDriver_Write(usbBuffer, received, 0, 0)
!= USBD_STATUS_SUCCESS);
}
/* Send data through USART */
if (isCdcSerialON)
_UsartDmaTx((uint32_t)&pUs->US_THR, usbBuffer, received);
/* Check if bytes have been discarded */
if ((received == DATAPACKETSIZE) && (remaining > 0)) {
TRACE_WARNING(
"_UsbDataReceived: %u bytes discarded\n\r",
(unsigned int)remaining);
}
} else {
TRACE_WARNING("_UsbDataReceived: Transfer error\n\r");
}
}
示例4: MULTIDriver_RequestHandler
//-----------------------------------------------------------------------------
/// Handles composite-specific USB requests sent by the host, and forwards
/// standard ones to the USB device driver.
/// \param request Pointer to a USBGenericRequest instance.
//-----------------------------------------------------------------------------
void MULTIDriver_RequestHandler(const USBGenericRequest *request)
{
// Check if this is a class request
if (USBGenericRequest_GetType(request) == USBGenericRequest_CLASS) {
unsigned char rc = 0;
//rc = CCID_RequestHandler(request);
if (!rc) {
TRACE_WARNING(
"MULTIDriver_RequestHandler: Unsupported request (%d)\n\r",
USBGenericRequest_GetRequest(request));
USBD_Stall(0);
}
}
// Check if this is a standard request
else if (USBGenericRequest_GetType(request) == USBGenericRequest_STANDARD) {
unsigned char rc = 0;
// Forward request to the standard handler
if (rc == 0)
USBDDriver_RequestHandler(&(usbdDriver), request);
}
// Unsupported request type
else {
TRACE_WARNING(
"MULTIDriver_RequestHandler: Unsupported request type (%d)\n\r",
USBGenericRequest_GetType(request));
USBD_Stall(0);
}
}
示例5: UsbDataReceived
//------------------------------------------------------------------------------
/// Callback invoked when data has been received on the USB.
//------------------------------------------------------------------------------
static void UsbDataReceived(unsigned int unused,
unsigned char status,
unsigned int received,
unsigned int remaining)
{
// Check that data has been received successfully
if (status == USBD_STATUS_SUCCESS) {
for(unsigned int i=0;i<received;i++) {
rb_put(&TTY_Rx_Buffer, usbBuffer[i]);
}
// Check if bytes have been discarded
if ((received == DATABUFFERSIZE) && (remaining > 0)) {
TRACE_WARNING("UsbDataReceived: %u bytes discarded\n\r",remaining);
}
}
else {
TRACE_WARNING( "UsbDataReceived: Transfer error\n\r");
}
// Restart USB read
CDCDSerialDriver_Read(usbBuffer,
DATABUFFERSIZE,
(TransferCallback) UsbDataReceived,
0);
}
示例6: network_client_init
static int32_t
network_client_init(client_t *c, void *data)
{
network_client *nc = (network_client*)c;
init_parm *parm = (init_parm*)data;
int32_t err;
err = init_this(nc, parm->factory, parm->io);
if (err)
{
TRACE_WARNING("network_client_init()->init_this() failed.");
return err;
}
nc->ops = parm->opts;
if (nc->ops && nc->ops->init)
{
err = (*nc->ops->init)(nc);
if (err)
{
TRACE_WARNING("network_client_init()->(*nc->ops->init)() failed.");
nc->ops = NULL;
finalize_this(nc); //@{obj_unref() can't reach this layer}
return err;
}
}
return 0;
}
示例7: UsbDataReceived
//------------------------------------------------------------------------------
/// Callback invoked when data has been received on the USB.
//------------------------------------------------------------------------------
static void UsbDataReceived(unsigned int unused,
unsigned char status,
unsigned int received,
unsigned int remaining)
{
// Check that data has been received successfully
if (status == USBD_STATUS_SUCCESS) {
// Send data through USART
while (!USART_WriteBuffer(AT91C_BASE_US0, usbBuffer, received));
AT91C_BASE_US0->US_IER = AT91C_US_TXBUFE;
// Check if bytes have been discarded
if ((received == DATABUFFERSIZE) && (remaining > 0)) {
TRACE_WARNING(
"UsbDataReceived: %u bytes discarded\n\r",
remaining);
}
}
else {
TRACE_WARNING( "UsbDataReceived: Transfer error\n\r");
}
}
示例8: fastsource_req_hdlr
void fastsource_req_hdlr(const USBGenericRequest *request)
{
unsigned char entity;
unsigned char interface;
switch (USBGenericRequest_GetType(request)) {
case USBGenericRequest_STANDARD:
USBDDriver_RequestHandler(&fast_source_driver, request);
return;
case USBGenericRequest_CLASS:
/* continue below */
break;
default:
TRACE_WARNING("Unsupported request type %u\n\r",
USBGenericRequest_GetType(request));
USBD_Stall(0);
return;
}
switch (USBGenericRequest_GetRequest(request)) {
case AUDGenericRequest_SETCUR:
entity = AUDGenericRequest_GetEntity(request);
interface = AUDGenericRequest_GetInterface(request);
if (((entity == AUDDLoopRecDriverDescriptors_FEATUREUNIT) ||
(entity == AUDDLoopRecDriverDescriptors_FEATUREUNIT_REC)) &&
(interface == AUDDLoopRecDriverDescriptors_CONTROL)) {
fastsource_set_feat_cur_val(entity,
AUDFeatureUnitRequest_GetChannel(request),
AUDFeatureUnitRequest_GetControl(request),
USBGenericRequest_GetLength(request));
} else {
TRACE_WARNING("Unsupported entity/interface combination 0x%04x\n\r",
USBGenericRequest_GetIndex(request));
USBD_Stall(0);
}
break;
case AUDGenericRequest_GETCUR:
entity = AUDGenericRequest_GetEntity(request);
interface = AUDGenericRequest_GetInterface(request);
if (((entity == AUDDLoopRecDriverDescriptors_FEATUREUNIT) ||
(entity == AUDDLoopRecDriverDescriptors_FEATUREUNIT_REC)) &&
(interface == AUDDLoopRecDriverDescriptors_CONTROL)) {
fastsource_get_feat_cur_val(entity,
AUDFeatureUnitRequest_GetChannel(request),
AUDFeatureUnitRequest_GetControl(request),
USBGenericRequest_GetLength(request));
} else {
TRACE_WARNING("Unsupported entity/interface combination 0x%04x\n\r",
USBGenericRequest_GetIndex(request));
USBD_Stall(0);
}
break;
default:
TRACE_WARNING("Unsupported request %u\n\r",
USBGenericRequest_GetIndex(request));
USBD_Stall(0);
break;
}
}
示例9: SpySrv_KillProcess
BOOL SpySrv_KillProcess (PROCADDR nProcessAddress, BOOL bKernelModeKill)
{
BOOL bSuccess ;
if( ! bKernelModeKill )
{
PROCSTRUCT *pProc ;
HANDLE hProcess ;
UINT nProcessId ;
ProcList_Lock () ;
pProc = ProcList_Get (nProcessAddress) ;
if( pProc ) nProcessId = pProc->nProcessId ;
ProcList_Unlock () ;
if( pProc==NULL )
{
TRACE_WARNING (TEXT("Tryed to kill an unknown process\n")) ;
}
else if( nProcessId==GetCurrentProcessId() )
{
TRACE_WARNING (TEXT("Refused to kill my process\n")) ;
bSuccess = FALSE ;
}
else
{
hProcess = OpenProcess (PROCESS_TERMINATE, FALSE, nProcessId) ;
if( ! hProcess )
{
TRACE_WARNING (TEXT("OpenProcess failed (error=%u)\n"), GetLastError()) ;
return FALSE ;
}
bSuccess = TerminateProcess (hProcess, 0) ;
CloseHandle (hProcess) ;
if( ! bSuccess )
TRACE_ERROR (TEXT("TerminateProcess failed (error=%u)\n"), GetLastError()) ;
}
}
else
{
DWORD nBytesReturned ;
bSuccess = DeviceIoControl (g_hDriver, IOCTL_KILL_PROCESS,
&nProcessAddress, sizeof(nProcessAddress),
NULL, 0, &nBytesReturned, NULL) ;
if( ! bSuccess )
TRACE_ERROR (TEXT("DeviceIoControl failed (error=%u)\n"), GetLastError()) ;
}
return bSuccess ;
}
示例10: rate_to_constant
int SerialPortMacOS::convertBaudRateFlag(int baudrate)
{
int baudRateFlag = 0;
// Set termios baudrate flag
if (baudrate > 0)
{
// Try an exact match
baudRateFlag = rate_to_constant(baudrate);
if (baudRateFlag != 0)
{
TRACE_1(SERIAL, "convertBaudRateFlag(%i) has been set to %i (exact match)\n", baudrate, baudrate);
}
else
{
int speeds[20] = {2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400,
460800, 500000, 576000, 921600, 1000000, 1152000,
1500000, 2000000, 2500000, 3000000, 3500000, 4000000};
// Try a "close enough" match (we allow ±1.5% mismatch)
for (int i = 0; i < 20; i++)
{
if ((baudrate > (static_cast<double>(speeds[i]) * 98.5 / 100.0)) && (baudrate < (static_cast<double>(speeds[i]) * 101.5 / 100.0)))
{
baudRateFlag = rate_to_constant(speeds[i]);
TRACE_WARNING(SERIAL, "convertBaudRateFlag(%i) has been set to B%i (close enough match, ±1.5%)\n", baudrate, speeds[i]);
break;
}
}
// Try a custom speed
if (baudRateFlag == 0)
{
ttyCustomSpeed = true;
baudRateFlag = B38400;
TRACE_WARNING(SERIAL, "convertBaudRateFlag(%i) has been set to B38400 (custom speed will be used)\n", baudrate);
}
}
}
else
{
TRACE_ERROR(SERIAL, "Invalid baudrate, using default value of: B1000000\n");
}
// Fallback
if (baudRateFlag == 0)
{
baudRateFlag = B1000000;
TRACE_ERROR(SERIAL, "Unable to set baud speed at %i: too slow!\n", baudrate);
TRACE_ERROR(SERIAL, "Invalid baudrate, using default value of: B1000000\n");
}
return baudRateFlag;
}
示例11: icmpProcessMessage
void icmpProcessMessage(NetInterface *interface,
Ipv4Addr srcIpAddr, const ChunkedBuffer *buffer, size_t offset)
{
size_t length;
IcmpHeader *header;
//Retrieve the length of the ICMP message
length = chunkedBufferGetLength(buffer) - offset;
//Ensure the message length is correct
if(length < sizeof(IcmpHeader))
{
//Debug message
TRACE_WARNING("ICMP message length is invalid!\r\n");
//Silently discard incoming message
return;
}
//Point to the ICMP message header
header = chunkedBufferAt(buffer, offset);
//Sanity check
if(!header) return;
//Debug message
TRACE_INFO("ICMP message received (%" PRIuSIZE " bytes)...\r\n", length);
//Dump message contents for debugging purpose
icmpDumpMessage(header);
//Verify checksum value
if(ipCalcChecksumEx(buffer, offset, length) != 0x0000)
{
//Debug message
TRACE_WARNING("Wrong ICMP header checksum!\r\n");
//Drop incoming message
return;
}
//Check the type of ICMP message
switch(header->type)
{
//Echo request?
case ICMP_TYPE_ECHO_REQUEST:
//Process Echo Request message
icmpProcessEchoRequest(interface, srcIpAddr, buffer, offset);
break;
//Unknown type?
default:
//Debug message
TRACE_WARNING("Unknown ICMP message type!\r\n");
//Discard incoming ICMP message
break;
}
}
示例12: USART2_Handler
/**
* USART interrupt handler
*/
void USART2_Handler(void)
{
Usart *pUs = BASE_USART;
uint32_t status;
uint16_t serialState;
uint32_t count;
status = USART_GetStatus(pUs);
status &= USART_GetItMask(pUs);
/* If USB device is not configured, do nothing */
if (!isCdcSerialON) {
USART_DisableIt(pUs, 0xFFFFFFFF);
return;
}
if (status & US_CSR_TIMEOUT) {
/*Clear TIMEOUT Flag and Start Time-out After Next Character Received*/
USART_AcknowledgeRxTimeOut(BASE_USART, 0);
/* Flush the DMA FIFO */
XDMAC_SoftwareFlushReq(dmad.pXdmacs, usartDmaRxChannel);
/* Transfer the last pack through USB */
count = dmad.pXdmacs->XDMAC_CHID[usartDmaRxChannel].XDMAC_CUBC;
SCB_InvalidateDCache_by_Addr((uint32_t *)usartBuffers, DATAPACKETSIZE - count);
while (CDCDSerialDriver_Write(usartBuffers, DATAPACKETSIZE - count, 0, 0)
!= USBD_STATUS_SUCCESS);
/*Reset DMA transfer*/
XDMAD_StopTransfer(&dmad, usartDmaRxChannel);
_UsartDmaRx();
} else {
/* Errors */
serialState = CDCDSerialDriver_GetSerialState();
/* Overrun */
if ((status & US_CSR_OVRE) != 0) {
TRACE_WARNING("USART_IrqHandler: Overrun\n\r");
serialState |= CDCSerialState_OVERRUN;
}
/* Framing error */
if ((status & US_CSR_FRAME) != 0) {
TRACE_WARNING("USART_IrqHandler: Framing error\n\r");
serialState |= CDCSerialState_FRAMING;
}
CDCDSerialDriver_SetSerialState(serialState);
}
}
示例13: LUN_Read
//------------------------------------------------------------------------------
//! \brief Reads data from a LUN, starting at the specified block address.
//! \param pLUN Pointer to a MSDLun instance
//! \param blockAddress First block address to read
//! \param data Pointer to a data buffer in which to store the data
//! \param length Number of blocks to read
//! \param callback Optional callback to invoke when the read finishes
//! \return Operation result code
//------------------------------------------------------------------------------
unsigned char LUN_Read(MSDLun *lun,
unsigned int blockAddress,
void *data,
unsigned int length,
TransferCallback callback,
void *argument)
{
unsigned int address;
unsigned char status;
// Check that the data is not too big
if ((length * lun->blockSize)
> (lun->size - lun->blockSize * blockAddress)) {
TRACE_WARNING("LUN_Read: Data too big\n\r");
status = USBD_STATUS_ABORTED;
}
else {
TRACE_INFO_WP("LUNRead(%u) ", blockAddress);
// Compute read start address
address = lun->media->baseAddress
+ lun->baseAddress
+ blockAddress * lun->blockSize;
// Start write operation
status = MED_Read(lun->media,
address,
data,
length * lun->blockSize,
(MediaCallback) callback,
argument);
// Check result code
if (status == MED_STATUS_SUCCESS) {
status = USBD_STATUS_SUCCESS;
}
else {
TRACE_WARNING("LUN_Read: Cannot read media\n\r");
status = USBD_STATUS_ABORTED;
}
}
return status;
}
示例14: catch
const char *TScriptCall::GetFile(const char *pzFile)
{
int nRetryCount = 0;
RESEND:
try
{
m_strResults = m_DataSource->send( "TScript",
pzFile,
(int)strlen(pzFile),/* -1 = Don't send the Null terminator */
0,
&m_pUserData,"TScriptFile=");
if (XMLProcedureCall::m_lpfnRecv)
XMLProcedureCall::m_lpfnRecv(m_strResults);
}
catch(GException &e)
{
// "General error parsing XML stream" means the data was corrupted in transit.
if (e.GetError() == 7)
{
// Resend the request.
if (nRetryCount++ < 3)
{
TRACE_WARNING("Attempting resend" );
goto RESEND;
}
}
// "the handle is invalid". We need to 'reboot' the datasource. (WININET)
if ((e.GetError() == 6) &&
(e.GetSystem() == 0))
{
// Resend the request.
if (nRetryCount++ < 3)
{
TRACE_WARNING("Attempting resend" );
m_DataSource->IPAddressChange();
goto RESEND;
}
}
// This helps distinguish Client errors from Server errors
// unless the error was a client side connect error.
throw GException("XMLProcedureCall", 4, m_DataSource->GetServerAddress(), e.GetDescription());
}
return m_strResults;
}
示例15: strAttributeName
// Called by receiveIntoObject() after an "AttributeStartTag" has been found
// this will get the next and only possible token (the value of the attribute)
// and set it to the current member or object through the CMemberMappingEntry
void XMLObjectFactory::SetRootObjectAttributeValue(xml::token **attNameTok,
MemberDescriptor *pMap,
XMLObject *pObjCurrent,
unsigned int nObjBehaviorFlags)
{
__int64 nLen = (*attNameTok)->length();
// strAttributeName will be [nLen] bytes long, we can use less memory by getting the exact amount from the heap
// or take GStrings 256 byte stack default and briefly use a little more memory much faster than the heap allocation
GString strAttributeName((*attNameTok)->get(), nLen);
if (m_tokenLookAhead.m_type != xml::_unknown)
{
// attNameTok was a pointer to m_tokenLookAhead, so we
// are freeing it here before we ask for the next token.
m_pLex->releaseLastToken(&m_tokenLookAhead);
*attNameTok = &m_token;
}
m_pLex->nextToken(&m_token);
if (m_token.m_type == xml::_pcdata)
{
// add attributes to this member if it is mapped to the object
int nMapped = 0;
if (pMap)
{
// Loads the MemberDescriptors for the object if this is the first attribute
// then copies the token value into mapped member variable in the Object.
nMapped = pObjCurrent->SetMappedAttribute(strAttributeName, m_token.get(), m_token.length() );
}
if ( !nMapped )
{
if ( nObjBehaviorFlags & PREVENT_ATTRIB_AUTOMAP )
{
// log the fact that data in the XML was lost because it was not mapped
char szTemp[128];
sprintf(szTemp, "*** Attribute Tag <%s> does not map to Object <%s> *************",
strAttributeName.Buf(), pObjCurrent->GetObjectType());
TRACE_WARNING(szTemp);
// allow for custom override
pObjCurrent->ObjectMessage(MSG_UNMAPPED_ATTRIBUTE, strAttributeName, m_token.get(), m_token.length(), 0);
}
else
{
pObjCurrent->AddAttribute(strAttributeName, m_token.get());
}
}
}
else
{
// debug tracing:
// expected token (eType,strXml) following attributeStartTag (strAttTagName)
GString strErr;
strErr.Format("Unexpected XML <%s> following Token <%s> in object <%s>", m_token.get(), strAttributeName.Buf(), pObjCurrent->GetObjectType());
TRACE_ERROR((const char *)strErr)
throw;
}
}