本文整理汇总了C++中debug函数的典型用法代码示例。如果您正苦于以下问题:C++ debug函数的具体用法?C++ debug怎么用?C++ debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_bootm_linux
int do_bootm_linux(int flag, int argc, char * const argv[],
bootm_headers_t *images)
{
void (*theKernel) (int, char **, char **, int *);
char *commandline = getenv("bootargs");
char env_buf[12];
char *cp;
if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
return 1;
/* find kernel entry point */
theKernel = (void (*)(int, char **, char **, int *))images->ep;
bootstage_mark(BOOTSTAGE_ID_RUN_OS);
#ifdef DEBUG
printf("## Transferring control to Linux (at address %08lx) ...\n",
(ulong) theKernel);
#endif
linux_params_init(UNCACHED_SDRAM(gd->bd->bi_boot_params), commandline);
#ifdef CONFIG_MEMSIZE_IN_BYTES
sprintf(env_buf, "%lu", (ulong)gd->ram_size);
debug("## Giving linux memsize in bytes, %lu\n", (ulong)gd->ram_size);
#else
sprintf(env_buf, "%lu", (ulong)(gd->ram_size >> 20));
debug("## Giving linux memsize in MB, %lu\n",
(ulong)(gd->ram_size >> 20));
#endif /* CONFIG_MEMSIZE_IN_BYTES */
linux_env_set("memsize", env_buf);
sprintf(env_buf, "0x%08X", (uint) UNCACHED_SDRAM(images->rd_start));
linux_env_set("initrd_start", env_buf);
sprintf(env_buf, "0x%X", (uint) (images->rd_end - images->rd_start));
linux_env_set("initrd_size", env_buf);
sprintf(env_buf, "0x%08X", (uint) (gd->bd->bi_flashstart));
linux_env_set("flash_start", env_buf);
sprintf(env_buf, "0x%X", (uint) (gd->bd->bi_flashsize));
linux_env_set("flash_size", env_buf);
cp = getenv("ethaddr");
if (cp)
linux_env_set("ethaddr", cp);
cp = getenv("eth1addr");
if (cp)
linux_env_set("eth1addr", cp);
/* we assume that the kernel is in place */
printf("\nStarting kernel ...\n\n");
theKernel(linux_argc, linux_argv, linux_env, 0);
/* does not return */
return 1;
}
示例2: fw_clear_untrusted_maclist
void
fw_clear_untrusted_maclist()
{
debug(LOG_INFO, "Clear untrusted maclist");
iptables_fw_clear_untrusted_maclist();
}
示例3: fw_set_trusted_mac
void
fw_set_trusted_mac(const char *mac)
{
debug(LOG_INFO, "Clear untrusted maclist");
iptables_fw_set_trusted_mac(mac);
}
示例4: fw_set_user_domains_trusted
void
fw_set_user_domains_trusted(void)
{
debug(LOG_INFO, "Setting user trust domains list");
iptables_fw_set_user_domains_trusted();
}
示例5: fw_clear_roam_maclist
void
fw_clear_roam_maclist(void)
{
debug(LOG_INFO, "Clear roam maclist");
iptables_fw_clear_roam_maclist();
}
示例6: fw_clear_pan_domains_trusted
//>>>>> liudf added 20151224
void
fw_clear_pan_domains_trusted(void)
{
debug(LOG_DEBUG, "Clear pan trust domains list");
iptables_fw_clear_ipset_domains_trusted();
}
示例7: fw_refresh_user_domains_trusted
void
fw_refresh_user_domains_trusted(void)
{
debug(LOG_INFO, "Refresh user trust domains list");
iptables_fw_refresh_user_domains_trusted();
}
示例8: debug
void QueueEditor::SetNzbCategory(NzbInfo* nzbInfo, const char* category, bool applyParams)
{
debug("QueueEditor: setting category '%s' for '%s'", category, nzbInfo->GetName());
bool oldUnpack = g_Options->GetUnpack();
const char* oldPostScript = g_Options->GetPostScript();
if (applyParams && !Util::EmptyStr(nzbInfo->GetCategory()))
{
Options::Category* categoryObj = g_Options->FindCategory(nzbInfo->GetCategory(), false);
if (categoryObj)
{
oldUnpack = categoryObj->GetUnpack();
if (!Util::EmptyStr(categoryObj->GetPostScript()))
{
oldPostScript = categoryObj->GetPostScript();
}
}
}
g_QueueCoordinator->SetQueueEntryCategory(m_downloadQueue, nzbInfo, category);
if (!applyParams)
{
return;
}
bool newUnpack = g_Options->GetUnpack();
const char* newPostScript = g_Options->GetPostScript();
if (!Util::EmptyStr(nzbInfo->GetCategory()))
{
Options::Category* categoryObj = g_Options->FindCategory(nzbInfo->GetCategory(), false);
if (categoryObj)
{
newUnpack = categoryObj->GetUnpack();
if (!Util::EmptyStr(categoryObj->GetPostScript()))
{
newPostScript = categoryObj->GetPostScript();
}
}
}
if (oldUnpack != newUnpack)
{
nzbInfo->GetParameters()->SetParameter("*Unpack:", newUnpack ? "yes" : "no");
}
if (strcasecmp(oldPostScript, newPostScript))
{
// add new params not existed in old category
Tokenizer tokNew(newPostScript, ",;");
while (const char* newScriptName = tokNew.Next())
{
bool found = false;
const char* oldScriptName;
Tokenizer tokOld(oldPostScript, ",;");
while ((oldScriptName = tokOld.Next()) && !found)
{
found = !strcasecmp(newScriptName, oldScriptName);
}
if (!found)
{
nzbInfo->GetParameters()->SetParameter(BString<1024>("%s:", newScriptName), "yes");
}
}
// remove old params not existed in new category
Tokenizer tokOld(oldPostScript, ",;");
while (const char* oldScriptName = tokOld.Next())
{
bool found = false;
const char* newScriptName;
Tokenizer tokNew(newPostScript, ",;");
while ((newScriptName = tokNew.Next()) && !found)
{
found = !strcasecmp(newScriptName, oldScriptName);
}
if (!found)
{
nzbInfo->GetParameters()->SetParameter(BString<1024>("%s:", oldScriptName), "no");
}
}
}
}
示例9: Si47xx_dev_init
int Si47xx_dev_init(struct Si47xx_device_t *si47xx_dev)
{
int ret = 0;
Si47xx_dev = si47xx_dev;
Si47xx_dev->client = si47xx_dev->client;
pSi47xxdata = si47xx_dev->pdata;
si47xx_irq = Si47xx_dev->client->irq;
debug("Si47xx_dev_init called");
mutex_lock(&Si47xx_dev->lock);
Si47xx_dev->state.power_state = RADIO_POWERDOWN;
Si47xx_dev->state.seek_state = RADIO_SEEK_OFF;
Si47xx_dev->valid_client_state = eTRUE;
Si47xx_dev->valid = eFALSE;
#ifdef RDS_INTERRUPT_ON_ALWAYS
/*Creating Circular Buffer */
/*Single RDS_Block_Data buffer size is 4x16 bits */
RDS_Block_Data_buffer = kzalloc(RDS_BUFFER_LENGTH * 8, GFP_KERNEL);
if (!RDS_Block_Data_buffer) {
dev_err(Si47xx_dev->dev, "Not sufficient memory for creating "
"RDS_Block_Data_buffer");
ret = -ENOMEM;
goto EXIT;
}
/*Single RDS_Block_Error buffer size is 4x8 bits */
RDS_Block_Error_buffer = kzalloc(RDS_BUFFER_LENGTH * 4, GFP_KERNEL);
if (!RDS_Block_Error_buffer) {
dev_err(Si47xx_dev->dev, "Not sufficient memory for creating "
"RDS_Block_Error_buffer");
ret = -ENOMEM;
kfree(RDS_Block_Data_buffer);
goto EXIT;
}
/*Initialising read and write indices */
RDS_Buffer_Index_read = 0;
RDS_Buffer_Index_write = 0;
/*Creating work-queue */
Si47xx_wq = create_singlethread_workqueue("Si47xx_wq");
if (!Si47xx_wq) {
dev_err(Si47xx_dev->dev, "Not sufficient memory for Si47xx_wq, work-queue");
ret = -ENOMEM;
kfree(RDS_Block_Error_buffer);
kfree(RDS_Block_Data_buffer);
goto EXIT;
}
/*Initialising work_queue */
INIT_WORK(&Si47xx_work, Si47xx_work_func);
RDS_Data_Available = 0;
RDS_Data_Lost = 0;
RDS_Groups_Available_till_now = 0;
EXIT:
#endif
mutex_unlock(&(Si47xx_dev->lock));
debug("Si47xx_dev_init call over");
return ret;
}
示例10: ftsdc010_send_cmd
static inline int ftsdc010_send_cmd(struct mmc *mmc, struct mmc_cmd *mmc_cmd)
{
struct ftsdc010_chip *chip = mmc->priv;
struct ftsdc010_mmc __iomem *regs = chip->regs;
int ret = -ETIMEDOUT;
uint32_t ts, st;
uint32_t cmd = FTSDC010_CMD_IDX(mmc_cmd->cmdidx);
uint32_t arg = mmc_cmd->cmdarg;
uint32_t flags = mmc_cmd->resp_type;
cmd |= FTSDC010_CMD_CMD_EN;
if (chip->acmd) {
cmd |= FTSDC010_CMD_APP_CMD;
chip->acmd = 0;
}
if (flags & MMC_RSP_PRESENT)
cmd |= FTSDC010_CMD_NEED_RSP;
if (flags & MMC_RSP_136)
cmd |= FTSDC010_CMD_LONG_RSP;
writel(FTSDC010_STATUS_RSP_MASK | FTSDC010_STATUS_CMD_SEND,
®s->clr);
writel(arg, ®s->argu);
writel(cmd, ®s->cmd);
if (!(flags & (MMC_RSP_PRESENT | MMC_RSP_136))) {
for (ts = get_timer(0); get_timer(ts) < CFG_CMD_TIMEOUT; ) {
if (readl(®s->status) & FTSDC010_STATUS_CMD_SEND) {
writel(FTSDC010_STATUS_CMD_SEND, ®s->clr);
ret = 0;
break;
}
}
} else {
st = 0;
for (ts = get_timer(0); get_timer(ts) < CFG_CMD_TIMEOUT; ) {
st = readl(®s->status);
writel(st & FTSDC010_STATUS_RSP_MASK, ®s->clr);
if (st & FTSDC010_STATUS_RSP_MASK)
break;
}
if (st & FTSDC010_STATUS_RSP_CRC_OK) {
if (flags & MMC_RSP_136) {
mmc_cmd->response[0] = readl(®s->rsp3);
mmc_cmd->response[1] = readl(®s->rsp2);
mmc_cmd->response[2] = readl(®s->rsp1);
mmc_cmd->response[3] = readl(®s->rsp0);
} else {
mmc_cmd->response[0] = readl(®s->rsp0);
}
ret = 0;
} else {
debug("ftsdc010: rsp err (cmd=%d, st=0x%x)\n",
mmc_cmd->cmdidx, st);
}
}
if (ret) {
debug("ftsdc010: cmd timeout (op code=%d)\n",
mmc_cmd->cmdidx);
} else if (mmc_cmd->cmdidx == MMC_CMD_APP_CMD) {
chip->acmd = 1;
}
return ret;
}
示例11: gameTimeUpdate
/* Call this each loop to update the game timer */
void gameTimeUpdate()
{
uint32_t currTime = wzGetTicks();
if (currTime < baseTime)
{
// Warzone 2100, the first relativistic computer game!
// Exhibit A: Time travel
// force a rebase
debug(LOG_WARNING, "Time travel is occurring! Clock went back in time a bit from %d to %d!\n", baseTime, currTime);
baseTime = currTime;
timeOffset = graphicsTime;
}
// Do not update the game time if gameTimeStop has been called
if (stopCount == 0)
{
bool mayUpdate = true;
// Calculate the new game time
uint32_t scaledCurrTime = (currTime - baseTime)*modifier + timeOffset;
if (scaledCurrTime < graphicsTime) // Make sure the clock doesn't step back at all.
{
debug(LOG_WARNING, "Rescaled clock went back in time a bit from %d to %d!\n", graphicsTime, scaledCurrTime);
scaledCurrTime = graphicsTime;
baseTime = currTime;
timeOffset = graphicsTime;
}
if (updateWantedTime == 0 && scaledCurrTime >= gameTime)
{
updateWantedTime = currTime; // This is the time that we wanted to tick.
}
if (scaledCurrTime >= gameTime && !checkPlayerGameTime(NET_ALL_PLAYERS))
{
unsigned player;
// Pause time, since we are waiting GAME_GAME_TIME from other players.
scaledCurrTime = graphicsTime;
baseTime = currTime;
timeOffset = graphicsTime;
debug(LOG_SYNC, "Waiting for other players. gameTime = %u, player times are {%s}", gameTime, listToString("%u", ", ", gameQueueTime, gameQueueTime + game.maxPlayers).c_str());
mayUpdate = false;
for (player = 0; player < game.maxPlayers; ++player)
{
if (!checkPlayerGameTime(player))
{
NETsetPlayerConnectionStatus(CONNECTIONSTATUS_WAITING_FOR_PLAYER, player);
break; // GAME_GAME_TIME is processed serially, so don't know if waiting for more players.
}
}
}
// Calculate the time for this frame
deltaGraphicsTime = scaledCurrTime - graphicsTime;
// Adjust deltas.
if (scaledCurrTime >= gameTime && mayUpdate)
{
if (scaledCurrTime > gameTime + GAME_TICKS_PER_UPDATE)
{
// Game isn't updating fast enough...
uint32_t slideBack = deltaGraphicsTime - GAME_TICKS_PER_UPDATE;
baseTime += slideBack / modifier; // adjust the addition to base time
deltaGraphicsTime -= slideBack;
}
deltaGameTime = GAME_TICKS_PER_UPDATE;
updateLatency();
if (crcError)
{
debug(LOG_ERROR, "Synch error, gameTimes were: {%s}", listToString("%10u", ", ", gameQueueCheckTime, gameQueueCheckTime + game.maxPlayers).c_str());
debug(LOG_ERROR, "Synch error, CRCs were: {%s}", listToString("0x%08X", ", ", gameQueueCheckCrc, gameQueueCheckCrc + game.maxPlayers).c_str());
crcError = false;
}
}
else
{
deltaGameTime = 0;
}
// Store the game and graphics times
gameTime += deltaGameTime;
graphicsTime += deltaGraphicsTime;
}
else
{
// The game is paused, so the change in time is zero.
deltaGameTime = 0;
deltaGraphicsTime = 0;
}
// Pre-calculate fraction used in timeAdjustedIncrement
graphicsTimeFraction = (float)deltaGraphicsTime / (float)GAME_TICKS_PER_SEC;
//.........这里部分代码省略.........
示例12: audio_capabilities
/* This uses the currently opened audio device, queries its caps.
In case of buffered playback, this works _once_ by querying the buffer for the caps before entering the main loop. */
void audio_capabilities(audio_output_t *ao, mpg123_handle *mh)
{
int force_fmt = 0;
int fmts;
size_t ri;
/* Pitching introduces a difference between decoder rate and playback rate. */
long rate, decode_rate;
int channels;
const long *rates;
size_t num_rates, rlimit;
debug("audio_capabilities");
mpg123_rates(&rates, &num_rates);
mpg123_format_none(mh); /* Start with nothing. */
if(param.force_encoding != NULL)
{
int i;
if(!param.quiet) fprintf(stderr, "Note: forcing output encoding %s\n", param.force_encoding);
for(i=0; i<KNOWN_ENCS; ++i)
if(!strncasecmp(encdesc[i].name, param.force_encoding, encdesc[i].nlen))
{
force_fmt = encdesc[i].code;
break;
}
if(i==KNOWN_ENCS)
{
error1("Failed to find an encoding to match requested \"%s\"!\n", param.force_encoding);
return; /* No capabilities at all... */
}
else if(param.verbose > 2) fprintf(stderr, "Note: forcing encoding code 0x%x\n", force_fmt);
}
rlimit = param.force_rate > 0 ? num_rates+1 : num_rates;
for(channels=1; channels<=2; channels++)
for(ri = 0; ri<rlimit; ri++)
{
decode_rate = ri < num_rates ? rates[ri] : param.force_rate;
rate = pitch_rate(decode_rate);
if(param.verbose > 2) fprintf(stderr, "Note: checking support for %liHz/%ich.\n", rate, channels);
#ifndef NOXFERMEM
if(param.usebuffer)
{ /* Ask the buffer process. It is waiting for this. */
buffermem->rate = rate;
buffermem->channels = channels;
buffermem->format = 0; /* Just have it initialized safely. */
debug2("asking for formats for %liHz/%ich", rate, channels);
xfermem_putcmd(buffermem->fd[XF_WRITER], XF_CMD_AUDIOCAP);
xfermem_getcmd(buffermem->fd[XF_WRITER], TRUE);
fmts = buffermem->format;
}
else
#endif
{ /* Check myself. */
ao->rate = rate;
ao->channels = channels;
fmts = ao->get_formats(ao);
}
if(param.verbose > 2) fprintf(stderr, "Note: result 0x%x\n", fmts);
if(force_fmt)
{ /* Filter for forced encoding. */
if((fmts & force_fmt) == force_fmt) fmts = force_fmt;
else fmts = 0; /* Nothing else! */
if(param.verbose > 2) fprintf(stderr, "Note: after forcing 0x%x\n", fmts);
}
if(fmts < 0) continue;
else mpg123_format(mh, decode_rate, channels, fmts);
}
#ifndef NOXFERMEM
/* Buffer loop shall start normal operation now. */
if(param.usebuffer)
{
xfermem_putcmd(buffermem->fd[XF_WRITER], XF_CMD_WAKEUP);
xfermem_getcmd(buffermem->fd[XF_WRITER], TRUE);
}
#endif
if(param.verbose > 1) print_capabilities(ao, mh);
}
示例13: fw_clear_authservers
/** Remove all auth server firewall whitelist rules
*/
void
fw_clear_authservers(void)
{
debug(LOG_INFO, "Clearing the authservers list");
iptables_fw_clear_authservers();
}
示例14: Si47xx_dev_powerup
int Si47xx_dev_powerup(void)
{
int ret = 0;
u32 value = 100;
debug("Si47xx_dev_powerup called");
if (!(RADIO_ON == Si47xx_dev->state.power_state)) {
ret = powerup();
if (ret < 0) {
dev_err(Si47xx_dev->dev, "%s failed %d\n",
__func__, ret);
} else if (Si47xx_dev->valid_client_state == eFALSE) {
dev_err(Si47xx_dev->dev, "Si47xx_dev_powerup called "
"when DS(state, client) is invalid");
ret = -1;
} else {
/* initial settings */
#ifdef _ENABLE_RDS_
si47xx_set_property(FM_RDS_CONFIG, 1);
si47xx_set_property(GPO_IEN, GPO_IEN_STCIEN_MASK |
GPO_IEN_STCREP_MASK);
si47xx_set_property(GPO_IEN, GPO_IEN_STCIEN_MASK |
GPO_IEN_RDSIEN_MASK | GPO_IEN_STCREP_MASK);
si47xx_set_property(FM_RDS_INTERRUPT_SOURCE,
FM_RDS_INTERRUPT_SOURCE_RECV_MASK);
si47xx_set_property(FM_RDS_CONFIG,
FM_RDS_CONFIG_RDSEN_MASK |
(3 << FM_RDS_CONFIG_BLETHA_SHFT) |
(3 << FM_RDS_CONFIG_BLETHB_SHFT) |
(3 << FM_RDS_CONFIG_BLETHC_SHFT) |
(3 << FM_RDS_CONFIG_BLETHD_SHFT));
#endif
/*VNVS:18-NOV'09 : Setting DE-Time Constant as 50us(Europe,Japan,Australia)*/
si47xx_set_property(FM_DEEMPHASIS, FM_DEEMPH_50US);
/* SYSCONFIG2_BITSET_SEEKTH( */
/* &Si47xx_dev->registers[SYSCONFIG2],2); */
/*VNVS:18-NOV'09 : modified for detecting more stations of good quality*/
si47xx_set_property(FM_SEEK_TUNE_RSSI_THRESHOLD,
TUNE_RSSI_THRESHOLD);
si47xx_set_property(FM_SEEK_BAND_BOTTOM, 8750);
si47xx_set_property(FM_SEEK_BAND_TOP, 10800);
Si47xx_dev->settings.band = BAND_87500_108000_kHz;
Si47xx_dev->settings.bottom_of_band = FREQ_87500_kHz;
si47xx_set_property(FM_SEEK_FREQ_SPACING,
CHAN_SPACING_100_kHz);
Si47xx_dev->settings.channel_spacing =
CHAN_SPACING_100_kHz;
/* SYSCONFIG3_BITSET_SKSNR( */
/* &Si47xx_dev->registers[SYSCONFIG3],3); */
/*VNVS:18-NOV'09 : modified for detecting more stations of good quality*/
si47xx_set_property(FM_SEEK_TUNE_SNR_THRESHOLD,
TUNE_SNR_THRESHOLD);
Si47xx_dev->settings.timeout_RDS =
msecs_to_jiffies(value);
Si47xx_dev->settings.curr_snr = TUNE_SNR_THRESHOLD;
Si47xx_dev->settings.curr_rssi_th = TUNE_RSSI_THRESHOLD;
Si47xx_dev->valid = eTRUE;
Si47xx_dev_STEREO_SET();
#ifdef RDS_INTERRUPT_ON_ALWAYS
/*Initialising read and write indices */
RDS_Buffer_Index_read = 0;
RDS_Buffer_Index_write = 0;
RDS_Data_Available = 0;
RDS_Data_Lost = 0;
RDS_Groups_Available_till_now = 0;
#endif
}
} else
debug("Device already Powered-ON");
ret = request_irq(si47xx_irq, Si47xx_isr,
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, "Si47xx", NULL);
si47xx_set_property(0xff00, 0);
/* tune initial frequency to remove tunestatus func err
* sometimes occur tunestatus func err when execute tunestatus function
* before to complete tune_freq.
* so run tune_freq just after to complete booting sequence*/
ret = tune_freq(Si47xx_dev->settings.bottom_of_band);
return ret;
}
示例15: fw_set_authservers
/** Add the necessary firewall rules to whitelist the authservers
*/
void
fw_set_authservers(void)
{
debug(LOG_INFO, "Setting the authservers list");
iptables_fw_set_authservers();
}