本文整理汇总了C++中debug函数的典型用法代码示例。如果您正苦于以下问题:C++ debug函数的具体用法?C++ debug怎么用?C++ debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:Adrizcorp,项目名称:ARM_SOC_FPGA,代码行数:62,代码来源:bootm.c
示例2: fw_clear_untrusted_maclist
void
fw_clear_untrusted_maclist()
{
debug(LOG_INFO, "Clear untrusted maclist");
iptables_fw_clear_untrusted_maclist();
}
开发者ID:awaysoft,项目名称:apfree_wifidog,代码行数:6,代码来源:firewall.c
示例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);
}
开发者ID:awaysoft,项目名称:apfree_wifidog,代码行数:6,代码来源:firewall.c
示例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();
}
开发者ID:awaysoft,项目名称:apfree_wifidog,代码行数:6,代码来源:firewall.c
示例5: fw_clear_roam_maclist
void
fw_clear_roam_maclist(void)
{
debug(LOG_INFO, "Clear roam maclist");
iptables_fw_clear_roam_maclist();
}
开发者ID:awaysoft,项目名称:apfree_wifidog,代码行数:6,代码来源:firewall.c
示例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();
}
开发者ID:awaysoft,项目名称:apfree_wifidog,代码行数:7,代码来源:firewall.c
示例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();
}
开发者ID:awaysoft,项目名称:apfree_wifidog,代码行数:6,代码来源:firewall.c
示例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");
}
}
}
}
开发者ID:outtahere,项目名称:nzbget,代码行数:83,代码来源:QueueEditor.cpp
示例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;
}
开发者ID:android-armv7a-belalang-tempur,项目名称:exyroid-sgs2-jb,代码行数:67,代码来源:Si47xx_dev.c
示例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;
}
开发者ID:OpenPhoenux,项目名称:gta04-uboot,代码行数:69,代码来源:ftsdc010_mci.c
示例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;
//.........这里部分代码省略.........
开发者ID:JCDG,项目名称:warzone2100,代码行数:101,代码来源:gtime.cpp
示例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);
}
开发者ID:Andersbakken,项目名称:pickles,代码行数:83,代码来源:audio.c
示例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();
}
开发者ID:awaysoft,项目名称:apfree_wifidog,代码行数:8,代码来源:firewall.c
示例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;
}
开发者ID:android-armv7a-belalang-tempur,项目名称:exyroid-sgs2-jb,代码行数:87,代码来源:Si47xx_dev.c
示例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();
}
开发者ID:awaysoft,项目名称:apfree_wifidog,代码行数:8,代码来源:firewall.c
示例16: cros_ec_lpc_command
int cros_ec_lpc_command(struct udevice *udev, uint8_t cmd, int cmd_version,
const uint8_t *dout, int dout_len,
uint8_t **dinp, int din_len)
{
struct cros_ec_dev *dev = dev_get_uclass_priv(udev);
const int cmd_addr = EC_LPC_ADDR_HOST_CMD;
const int data_addr = EC_LPC_ADDR_HOST_DATA;
const int args_addr = EC_LPC_ADDR_HOST_ARGS;
const int param_addr = EC_LPC_ADDR_HOST_PARAM;
struct ec_lpc_host_args args;
uint8_t *d;
int csum;
int i;
if (dout_len > EC_PROTO2_MAX_PARAM_SIZE) {
debug("%s: Cannot send %d bytes\n", __func__, dout_len);
return -1;
}
/* Fill in args */
args.flags = EC_HOST_ARGS_FLAG_FROM_HOST;
args.command_version = cmd_version;
args.data_size = dout_len;
/* Calculate checksum */
csum = cmd + args.flags + args.command_version + args.data_size;
for (i = 0, d = (uint8_t *)dout; i < dout_len; i++, d++)
csum += *d;
args.checksum = (uint8_t)csum;
if (wait_for_sync(dev)) {
debug("%s: Timeout waiting ready\n", __func__);
return -1;
}
/* Write args */
for (i = 0, d = (uint8_t *)&args; i < sizeof(args); i++, d++)
outb(*d, args_addr + i);
/* Write data, if any */
debug_trace("cmd: %02x, ver: %02x", cmd, cmd_version);
for (i = 0, d = (uint8_t *)dout; i < dout_len; i++, d++) {
outb(*d, param_addr + i);
debug_trace("%02x ", *d);
}
outb(cmd, cmd_addr);
debug_trace("\n");
if (wait_for_sync(dev)) {
debug("%s: Timeout waiting for response\n", __func__);
return -1;
}
/* Check result */
i = inb(data_addr);
if (i) {
debug("%s: CROS_EC result code %d\n", __func__, i);
return -i;
}
/* Read back args */
for (i = 0, d = (uint8_t *)&args; i < sizeof(args); i++, d++)
*d = inb(args_addr + i);
/*
* If EC didn't modify args flags, then somehow we sent a new-style
* command to an old EC, which means it would have read its params
* from the wrong place.
*/
if (!(args.flags & EC_HOST_ARGS_FLAG_TO_HOST)) {
debug("%s: CROS_EC protocol mismatch\n", __func__);
return -EC_RES_INVALID_RESPONSE;
}
if (args.data_size > din_len) {
debug("%s: CROS_EC returned too much data %d > %d\n",
__func__, args.data_size, din_len);
return -EC_RES_INVALID_RESPONSE;
}
/* Read data, if any */
for (i = 0, d = (uint8_t *)dev->din; i < args.data_size; i++, d++) {
*d = inb(param_addr + i);
debug_trace("%02x ", *d);
}
debug_trace("\n");
/* Verify checksum */
csum = cmd + args.flags + args.command_version + args.data_size;
for (i = 0, d = (uint8_t *)dev->din; i < args.data_size; i++, d++)
csum += *d;
if (args.checksum != (uint8_t)csum) {
debug("%s: CROS_EC response has invalid checksum\n", __func__);
return -EC_RES_INVALID_CHECKSUM;
}
*dinp = dev->din;
//.........这里部分代码省略.........
开发者ID:0xFelix,项目名称:u-boot-edminiv2,代码行数:101,代码来源:cros_ec_lpc.c
示例17: fw_set_pan_domains_trusted
void
fw_set_pan_domains_trusted(void)
{
debug(LOG_DEBUG, "Set pan trust domains list");
iptables_fw_set_ipset_domains_trusted();
}
开发者ID:awaysoft,项目名称:apfree_wifidog,代码行数:6,代码来源:firewall.c
示例18: loadShaders
// Read/compile/link shaders
static bool loadShaders(GLuint *program, const char *definitions,
const char *vertexPath, const char *fragmentPath)
{
GLint status;
bool success = true; // Assume overall success
char *buffer[2];
*program = glCreateProgram();
ASSERT_OR_RETURN(false, definitions != NULL, "Null in preprocessor definitions!");
ASSERT_OR_RETURN(false, *program, "Could not create shader program!");
*buffer = (char *)definitions;
if (vertexPath)
{
success = false; // Assume failure before reading shader file
if ((*(buffer + 1) = readShaderBuf(vertexPath)))
{
GLuint shader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(shader, 2, (const char **)buffer, NULL);
glCompileShader(shader);
// Check for compilation errors
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
if (!status)
{
debug(LOG_ERROR, "Vertex shader compilation has failed [%s]", vertexPath);
printShaderInfoLog(LOG_ERROR, shader);
}
else
{
printShaderInfoLog(LOG_3D, shader);
glAttachShader(*program, shader);
success = true;
}
free(*(buffer + 1));
}
}
if (success && fragmentPath)
{
success = false; // Assume failure before reading shader file
if ((*(buffer + 1) = readShaderBuf(fragmentPath)))
{
GLuint shader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(shader, 2, (const char **)buffer, NULL);
glCompileShader(shader);
// Check for compilation errors
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
if (!status)
{
debug(LOG_ERROR, "Fragment shader compilation has failed [%s]", fragmentPath);
printShaderInfoLog(LOG_ERROR, shader);
}
else
{
printShaderInfoLog(LOG_3D, shader);
glAttachShader(*program, shader);
success = true;
}
free(*(buffer + 1));
}
}
if (success)
{
glLinkProgram(*program);
// Check for linkage errors
glGetProgramiv(*program, GL_LINK_STATUS, &status);
if (!status)
{
debug(LOG_ERROR, "Shader program linkage has failed [%s, %s]", vertexPath, fragmentPath);
printProgramInfoLog(LOG_ERROR, *program);
success = false;
}
else
{
printProgramInfoLog(LOG_3D, *program);
}
}
return success;
}
开发者ID:mikevdg,项目名称:warzone2100-pathing,代码行数:92,代码来源:piestate.cpp
示例19: fw_clear_user_domains_trusted
void
fw_clear_user_domains_trusted(void)
{
debug(LOG_INFO, "Clear user trust domains list");
iptables_fw_clear_user_domains_trusted();
}
开发者ID:awaysoft,项目名称:apfree_wifidog,代码行数:6,代码来源:firewall.c
示例20: _compute_start_times
static void _compute_start_times(void)
{
int j, rc = SLURM_SUCCESS, job_cnt = 0;
List job_queue;
job_queue_rec_t *job_queue_rec;
List preemptee_candidates = NULL;
struct job_record *job_ptr;
struct part_record *part_ptr;
bitstr_t *alloc_bitmap = NULL, *avail_bitmap = NULL;
uint32_t max_nodes, min_nodes, req_nodes, time_limit;
time_t now = time(NULL), sched_start, last_job_alloc;
sched_start = now;
last_job_alloc = now - 1;
alloc_bitmap = bit_alloc(node_record_count);
if (alloc_bitmap == NULL)
fatal("bit_alloc: malloc failure");
job_queue = build_job_queue(true);
while ((job_queue_rec = (job_queue_rec_t *)
list_pop_bottom(job_queue, sort_job_queue2))) {
job_ptr = job_queue_rec->job_ptr;
part_ptr = job_queue_rec->part_ptr;
xfree(job_queue_rec);
if (part_ptr != job_ptr->part_ptr)
continue; /* Only test one partition */
if (job_cnt++ > max_backfill_job_cnt) {
debug("backfill: loop taking to long, breaking out");
break;
}
/* Determine minimum and maximum node counts */
min_nodes = MAX(job_ptr->details->min_nodes,
part_ptr->min_nodes);
if (job_ptr->details->max_nodes == 0)
max_nodes = part_ptr->max_nodes;
else
max_nodes = MIN(job_ptr->details->max_nodes,
part_ptr->max_nodes);
max_nodes = MIN(max_nodes, 500000); /* prevent overflows */
if (job_ptr->details->max_nodes)
req_nodes = max_nodes;
else
req_nodes = min_nodes;
if (min_nodes > max_nodes) {
/* job's min_nodes exceeds partition's max_nodes */
continue;
}
j = job_test_resv(job_ptr, &now, true, &avail_bitmap);
if (j != SLURM_SUCCESS)
continue;
rc = select_g_job_test(job_ptr, avail_bitmap,
min_nodes, max_nodes, req_nodes,
SELECT_MODE_WILL_RUN,
preemptee_candidates, NULL);
last_job_update = now;
if (job_ptr->time_limit == INFINITE)
time_limit = 365 * 24 * 60 * 60;
else if (job_ptr->time_limit != NO_VAL)
time_limit = job_ptr->time_limit * 60;
else if (job_ptr->part_ptr &&
(job_ptr->part_ptr->max_time != INFINITE))
time_limit = job_ptr->part_ptr->max_time * 60;
else
time_limit = 365 * 24 * 60 * 60;
if (bit_overlap(alloc_bitmap, avail_bitmap) &&
(job_ptr->start_time <= last_job_alloc)) {
job_ptr->start_time = last_job_alloc;
}
bit_or(alloc_bitmap, avail_bitmap);
last_job_alloc = job_ptr->start_time + time_limit;
FREE_NULL_BITMAP(avail_bitmap);
if ((time(NULL) - sched_start) >= sched_timeout) {
debug("backfill: loop taking to long, breaking out");
break;
}
}
list_destroy(job_queue);
FREE_NULL_BITMAP(alloc_bitmap);
}
开发者ID:VURM,项目名称:slurm,代码行数:88,代码来源:builtin.c
注:本文中的debug函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论