本文整理汇总了C++中ccprintf函数的典型用法代码示例。如果您正苦于以下问题:C++ ccprintf函数的具体用法?C++ ccprintf怎么用?C++ ccprintf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ccprintf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: command_mem_dump
static int command_mem_dump(int argc, char **argv)
{
volatile uint32_t *address;
uint32_t value, num = 1, i;
char *e;
if (argc < 2)
return EC_ERROR_PARAM_COUNT;
address = (uint32_t *)(uintptr_t)strtoi(argv[1], &e, 0);
if (*e)
return EC_ERROR_PARAM1;
if (argc >= 3)
num = strtoi(argv[2], &e, 0);
for (i = 0; i < num; i++) {
value = address[i];
if (0 == (i%4))
ccprintf("\n%08X: %08x", address+i, value);
else
ccprintf(" %08x", value);
cflush();
/* Lots of output could take a while.
* Let other things happen, too */
if (!(i % 0x100)) {
watchdog_reload();
usleep(10 * MSEC);
}
}
ccprintf("\n");
cflush();
return EC_SUCCESS;
}
开发者ID:fourier49,项目名称:BIZ_EC,代码行数:35,代码来源:memory_commands.c
示例2: command_powerbtn
static int command_powerbtn(int argc, char **argv)
{
int ms = 200; /* Press duration in ms */
char *e;
if (argc > 1) {
ms = strtoi(argv[1], &e, 0);
if (*e)
return EC_ERROR_PARAM1;
}
ccprintf("Simulating %d ms power button press.\n", ms);
simulate_power_pressed = 1;
power_button_is_stable = 0;
hook_call_deferred(power_button_change_deferred, 0);
msleep(ms);
ccprintf("Simulating power button release.\n");
simulate_power_pressed = 0;
power_button_is_stable = 0;
hook_call_deferred(power_button_change_deferred, 0);
return EC_SUCCESS;
}
开发者ID:latelee,项目名称:chrome-ec,代码行数:25,代码来源:power_button.c
示例3: command_accel_read_xyz
static int command_accel_read_xyz(int argc, char **argv)
{
char *e;
int id, n = 1, ret;
struct motion_sensor_t *sensor;
vector_3_t v;
if (argc < 2)
return EC_ERROR_PARAM_COUNT;
/* First argument is sensor id. */
id = strtoi(argv[1], &e, 0);
if (*e || id < 0 || id >= motion_sensor_count)
return EC_ERROR_PARAM1;
if (argc >= 3)
n = strtoi(argv[2], &e, 0);
sensor = &motion_sensors[id];
while ((n == -1) || (n-- > 0)) {
ret = sensor->drv->read(sensor, v);
if (ret == 0)
ccprintf("Current data %d: %-5d %-5d %-5d\n",
id, v[X], v[Y], v[Z]);
else
ccprintf("vector not ready\n");
ccprintf("Last calib. data %d: %-5d %-5d %-5d\n",
id, sensor->xyz[X], sensor->xyz[Y], sensor->xyz[Z]);
task_wait_event(MIN_MOTION_SENSE_WAIT_TIME);
}
return EC_SUCCESS;
}
开发者ID:fourier49,项目名称:BIZ_EC,代码行数:34,代码来源:motion_sense.c
示例4: command_powerindebug
static int command_powerindebug(int argc, char **argv)
{
const struct power_signal_info *s = power_signal_list;
int i;
char *e;
/* If one arg, set the mask */
if (argc == 2) {
int m = strtoi(argv[1], &e, 0);
if (*e)
return EC_ERROR_PARAM1;
in_debug = m;
}
/* Print the mask */
ccprintf("power in: 0x%04x\n", in_signals);
ccprintf("debug mask: 0x%04x\n", in_debug);
/* Print the decode */
ccprintf("bit meanings:\n");
for (i = 0; i < POWER_SIGNAL_COUNT; i++, s++) {
int mask = 1 << i;
ccprintf(" 0x%04x %d %s\n",
mask, in_signals & mask ? 1 : 0, s->name);
}
return EC_SUCCESS;
};
开发者ID:Basavaraja-MS,项目名称:ec_local,代码行数:30,代码来源:common.c
示例5: do_print_later
static void do_print_later(void)
{
int lines_per_loop = 32; /* too much at once fails */
int copy_of_stuff_in;
int copy_of_overflow;
interrupt_disable();
copy_of_stuff_in = stuff_in;
copy_of_overflow = stuff_overflow;
stuff_overflow = 0;
interrupt_enable();
if (copy_of_overflow)
ccprintf("*** WARNING: %d MESSAGES WERE LOST ***\n",
copy_of_overflow);
while (lines_per_loop && stuff_out != copy_of_stuff_in) {
ccprintf("at %.6ld: ", stuff_to_print[stuff_out].t);
ccprintf(stuff_to_print[stuff_out].fmt,
stuff_to_print[stuff_out].a0,
stuff_to_print[stuff_out].a1,
stuff_to_print[stuff_out].a2,
stuff_to_print[stuff_out].a3,
stuff_to_print[stuff_out].a4);
ccprintf("\n");
stuff_out = (stuff_out + 1) % MAX_ENTRIES;
lines_per_loop--;
}
}
开发者ID:coreboot,项目名称:chrome-ec,代码行数:29,代码来源:usb.c
示例6: show_charging_progress
static void show_charging_progress(void)
{
int rv, minutes, to_full;
if (!curr.batt_is_charging) {
rv = battery_time_to_empty(&minutes);
to_full = 0;
} else {
rv = battery_time_to_full(&minutes);
to_full = 1;
}
if (rv)
CPRINTS("Battery %d%% / ??h:?? %s%s",
curr.batt.state_of_charge,
to_full ? "to full" : "to empty",
is_full ? ", not accepting current" : "");
else
CPRINTS("Battery %d%% / %dh:%d %s%s",
curr.batt.state_of_charge,
minutes / 60, minutes % 60,
to_full ? "to full" : "to empty",
is_full ? ", not accepting current" : "");
if (debugging) {
ccprintf("battery:\n");
print_battery_debug();
ccprintf("charger:\n");
print_charger_debug();
ccprintf("chg:\n");
dump_charge_state();
}
}
开发者ID:coreboot,项目名称:chrome-ec,代码行数:33,代码来源:charge_state_v2.c
示例7: command_gpio_get
static int command_gpio_get(int argc, char **argv)
{
int changed, v, i;
/* If a signal is specified, print only that one */
if (argc == 2) {
i = find_signal_by_name(argv[1]);
if (i == GPIO_COUNT)
return EC_ERROR_PARAM1;
v = gpio_get_level(i);
changed = last_val_changed(i, v);
ccprintf(" %d%c %s\n", v, (changed ? '*' : ' '),
gpio_get_name(i));
return EC_SUCCESS;
}
/* Otherwise print them all */
for (i = 0; i < GPIO_COUNT; i++) {
if (!gpio_is_implemented(i))
continue; /* Skip unsupported signals */
v = gpio_get_level(i);
changed = last_val_changed(i, v);
ccprintf(" %d%c %s\n", v, (changed ? '*' : ' '),
gpio_get_name(i));
/* Flush console to avoid truncating output */
cflush();
}
return EC_SUCCESS;
}
开发者ID:latelee,项目名称:chrome-ec,代码行数:33,代码来源:gpio_commands.c
示例8: print_status
static int print_status(void)
{
int value;
print_temps("Local", TMP432_LOCAL,
TMP432_LOCAL_THERM_LIMIT,
TMP432_LOCAL_HIGH_LIMIT_R,
TMP432_LOCAL_LOW_LIMIT_R);
print_temps("Remote1", TMP432_REMOTE1,
TMP432_REMOTE1_THERM_LIMIT,
TMP432_REMOTE1_HIGH_LIMIT_R,
TMP432_REMOTE1_LOW_LIMIT_R);
print_temps("Remote2", TMP432_REMOTE2,
TMP432_REMOTE2_THERM_LIMIT,
TMP432_REMOTE2_HIGH_LIMIT_R,
TMP432_REMOTE2_LOW_LIMIT_R);
ccprintf("\n");
if (raw_read8(TMP432_STATUS, &value) == EC_SUCCESS)
ccprintf("STATUS: %08b\n", value);
if (raw_read8(TMP432_CONFIGURATION1_R, &value) == EC_SUCCESS)
ccprintf("CONFIG1: %08b\n", value);
if (raw_read8(TMP432_CONFIGURATION2_R, &value) == EC_SUCCESS)
ccprintf("CONFIG2: %08b\n", value);
return EC_SUCCESS;
}
开发者ID:fourier49,项目名称:BIZ_EC,代码行数:32,代码来源:tmp432.c
示例9: print_channel
/**
* Print status of a PWM channel.
*
* @param ch Channel to print.
*/
static void print_channel(enum pwm_channel ch)
{
if (pwm_get_enabled(ch))
ccprintf(" %d: %d%%\n", ch, pwm_get_duty(ch));
else
ccprintf(" %d: disabled\n", ch);
}
开发者ID:akappy7,项目名称:ChromeOS_EC_LED_Diagnostics,代码行数:12,代码来源:pwm.c
示例10: verify_key
int verify_key(int c, int r, int pressed)
{
struct host_cmd_handler_args args;
uint8_t mkbp_out[KEYBOARD_COLS];
int i;
if (c >= 0 && r >= 0) {
ccprintf("Verify %s (%d, %d)\n", action[pressed], c, r);
set_state(c, r, pressed);
} else {
ccprintf("Verify last state\n");
}
args.version = 0;
args.command = EC_CMD_MKBP_STATE;
args.params = NULL;
args.params_size = 0;
args.response = mkbp_out;
args.response_max = sizeof(mkbp_out);
args.response_size = 0;
if (host_command_process(&args) != EC_RES_SUCCESS)
return 0;
for (i = 0; i < KEYBOARD_COLS; ++i)
if (mkbp_out[i] != state[i])
return 0;
return 1;
}
开发者ID:Basavaraja-MS,项目名称:ec_local,代码行数:30,代码来源:kb_mkbp.c
示例11: command_power
static int command_power(int argc, char **argv)
{
int v;
if (argc < 2) {
enum power_state_t state;
state = PSTATE_UNKNOWN;
if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
state = PSTATE_OFF;
if (chipset_in_state(CHIPSET_STATE_SUSPEND))
state = PSTATE_SUSPEND;
if (chipset_in_state(CHIPSET_STATE_ON))
state = PSTATE_ON;
ccprintf("%s\n", state_name[state]);
return EC_SUCCESS;
}
if (!parse_bool(argv[1], &v))
return EC_ERROR_PARAM1;
power_request = v ? POWER_REQ_ON : POWER_REQ_OFF;
ccprintf("Requesting power %s\n", power_req_name[power_request]);
task_wake(TASK_ID_CHIPSET);
return EC_SUCCESS;
}
开发者ID:coreboot,项目名称:chrome-ec,代码行数:28,代码来源:rockchip.c
示例12: motion_sense_read_fifo
static int motion_sense_read_fifo(int argc, char **argv)
{
int count, i;
struct ec_response_motion_sensor_data v;
if (argc < 1)
return EC_ERROR_PARAM_COUNT;
/* Limit the amount of data to avoid saturating the UART buffer */
count = MIN(queue_count(&motion_sense_fifo), 16);
for (i = 0; i < count; i++) {
queue_peek_units(&motion_sense_fifo, &v, i, 1);
if (v.flags & (MOTIONSENSE_SENSOR_FLAG_TIMESTAMP |
MOTIONSENSE_SENSOR_FLAG_FLUSH)) {
uint64_t timestamp;
memcpy(×tamp, v.data, sizeof(v.data));
ccprintf("Timestamp: 0x%016lx%s\n", timestamp,
(v.flags & MOTIONSENSE_SENSOR_FLAG_FLUSH ?
" - Flush" : ""));
} else {
ccprintf("%d %d: %-5d %-5d %-5d\n", i, v.sensor_num,
v.data[X], v.data[Y], v.data[Z]);
}
}
return EC_SUCCESS;
}
开发者ID:fourier49,项目名称:BIZ_EC,代码行数:26,代码来源:motion_sense.c
示例13: wait_until_stop_sent
static int wait_until_stop_sent(int port)
{
timestamp_t deadline;
timestamp_t slow_cutoff;
uint8_t is_slow;
deadline = slow_cutoff = get_time();
deadline.val += TIMEOUT_STOP_SENT_US;
slow_cutoff.val += SLOW_STOP_SENT_US;
while (STM32_I2C_CR1(port) & (1 << 9)) {
if (timestamp_expired(deadline, NULL)) {
ccprintf("Stop event deadline passed:\ttask=%d"
"\tCR1=%016b\n",
(int)task_get_current(), STM32_I2C_CR1(port));
return EC_ERROR_TIMEOUT;
}
if (is_slow) {
/* If we haven't gotten a fast response, sleep */
usleep(STOP_SENT_RETRY_US);
} else {
/* Check to see if this request is taking a while */
if (timestamp_expired(slow_cutoff, NULL)) {
ccprintf("Stop event taking a while: task=%d",
(int)task_get_current());
is_slow = 1;
}
}
}
return EC_SUCCESS;
}
开发者ID:alterapraxisptyltd,项目名称:chromium-ec,代码行数:33,代码来源:i2c-stm32f.c
示例14: command_hang_detect
static int command_hang_detect(int argc, char **argv)
{
ccprintf("flags: 0x%x\n", hdparams.flags);
ccputs("event: ");
if (hdparams.host_event_timeout_msec)
ccprintf("%d ms\n", hdparams.host_event_timeout_msec);
else
ccputs("disabled\n");
ccputs("reboot: ");
if (hdparams.warm_reboot_timeout_msec)
ccprintf("%d ms\n", hdparams.warm_reboot_timeout_msec);
else
ccputs("disabled\n");
ccputs("status: ");
if (active)
ccprintf("active for %s\n",
timeout_will_reboot ? "reboot" : "event");
else
ccputs("inactive\n");
return EC_SUCCESS;
}
开发者ID:Basavaraja-MS,项目名称:ec_local,代码行数:25,代码来源:ap_hang_detect.c
示例15: command_crash
static int command_crash(int argc, char **argv)
{
if (argc < 2)
return EC_ERROR_PARAM1;
if (!strcasecmp(argv[1], "assert")) {
ASSERT(0);
} else if (!strcasecmp(argv[1], "divzero")) {
int zero = 0;
cflush();
if (argc >= 3 && !strcasecmp(argv[2], "unsigned"))
ccprintf("%08x", (unsigned long)1 / zero);
else
ccprintf("%08x", (long)1 / zero);
#ifdef CONFIG_CMD_STACKOVERFLOW
} else if (!strcasecmp(argv[1], "stack")) {
stack_overflow_recurse(1);
#endif
} else if (!strcasecmp(argv[1], "unaligned")) {
cflush();
ccprintf("%08x", *(volatile int *)0xcdef);
} else if (!strcasecmp(argv[1], "watchdog")) {
while (1)
;
} else {
return EC_ERROR_PARAM1;
}
/* Everything crashes, so shouldn't get back here */
return EC_ERROR_UNKNOWN;
}
开发者ID:Basavaraja-MS,项目名称:ec_local,代码行数:32,代码来源:panic_output.c
示例16: command_peci_temp
static int command_peci_temp(int argc, char **argv)
{
int t = peci_get_cpu_temp();
if (t == -1) {
ccprintf("PECI error 0x%04x\n", LM4_PECI_M0D0 & 0xffff);
return EC_ERROR_UNKNOWN;
}
ccprintf("CPU temp = %d K = %d C\n", t, K_TO_C(t));
return EC_SUCCESS;
}
开发者ID:coreboot,项目名称:chrome-ec,代码行数:10,代码来源:peci.c
示例17: command_version
static int command_version(int argc, char **argv)
{
ccprintf("Chip: %s %s %s\n", system_get_chip_vendor(),
system_get_chip_name(), system_get_chip_revision());
ccprintf("Board: %d\n", system_get_board_version());
ccprintf("RO: %s\n", system_get_version(SYSTEM_IMAGE_RO));
ccprintf("RW: %s\n", system_get_version(SYSTEM_IMAGE_RW));
ccprintf("Build: %s\n", system_get_build_info());
return EC_SUCCESS;
}
开发者ID:longsleep,项目名称:ec,代码行数:10,代码来源:system.c
示例18: command_accel_data_rate
static int command_accel_data_rate(int argc, char **argv)
{
char *e;
int id, data, round = 1, ret;
struct motion_sensor_t *sensor;
enum sensor_config config_id;
if (argc < 2 || argc > 4)
return EC_ERROR_PARAM_COUNT;
/* First argument is sensor id. */
id = strtoi(argv[1], &e, 0);
if (*e || id < 0 || id >= motion_sensor_count)
return EC_ERROR_PARAM1;
sensor = &motion_sensors[id];
if (argc >= 3) {
/* Second argument is data to write. */
data = strtoi(argv[2], &e, 0);
if (*e)
return EC_ERROR_PARAM2;
if (argc == 4) {
/* Third argument is rounding flag. */
round = strtoi(argv[3], &e, 0);
if (*e)
return EC_ERROR_PARAM3;
}
/*
* Write new data rate, if it returns invalid arg, then
* return a parameter error.
*/
config_id = motion_sense_get_ec_config();
sensor->config[config_id].odr =
data | (round ? ROUND_UP_FLAG : 0);
ret = motion_sense_set_data_rate(sensor);
if (ret)
return EC_ERROR_PARAM2;
/* Sensor might be out of suspend, check the ec_rate */
motion_sense_set_accel_interval();
} else {
ccprintf("Data rate for sensor %d: %d\n", id,
sensor->drv->get_data_rate(sensor));
ccprintf("EC rate for sensor %d: %d\n", id,
motion_sense_ec_rate(sensor));
ccprintf("Current EC rate: %d\n", accel_interval);
}
return EC_SUCCESS;
}
开发者ID:fourier49,项目名称:BIZ_EC,代码行数:52,代码来源:motion_sense.c
示例19: command_tmp432
static int command_tmp432(int argc, char **argv)
{
char *command;
char *e;
int data;
int offset;
int rv;
if (!has_power()) {
ccprintf("ERROR: Temp sensor not powered.\n");
return EC_ERROR_NOT_POWERED;
}
/* If no args just print status */
if (argc == 1)
return print_status();
if (argc < 3)
return EC_ERROR_PARAM_COUNT;
command = argv[1];
offset = strtoi(argv[2], &e, 0);
if (*e || offset < 0 || offset > 255)
return EC_ERROR_PARAM2;
if (!strcasecmp(command, "getbyte")) {
rv = raw_read8(offset, &data);
if (rv < 0)
return rv;
ccprintf("Byte at offset 0x%02x is %08b\n", offset, data);
return rv;
}
/* Remaining commands are "tmp432 set-command offset data" */
if (argc != 4)
return EC_ERROR_PARAM_COUNT;
data = strtoi(argv[3], &e, 0);
if (*e)
return EC_ERROR_PARAM3;
if (!strcasecmp(command, "settemp")) {
ccprintf("Setting 0x%02x to %dC\n", offset, data);
rv = tmp432_set_temp(offset, data);
} else if (!strcasecmp(command, "setbyte")) {
ccprintf("Setting 0x%02x to 0x%02x\n", offset, data);
rv = raw_write8(offset, data);
} else
return EC_ERROR_PARAM1;
return rv;
}
开发者ID:fourier49,项目名称:BIZ_EC,代码行数:52,代码来源:tmp432.c
示例20: showbits
static void showbits(uint32_t b)
{
int i;
for (i = 0; i < 32; i++)
if (b & (1 << i)) {
if (deezbits[i])
ccprintf(" %s", deezbits[i]);
else
ccprintf(" %d", i);
}
ccprintf("\n");
}
开发者ID:coreboot,项目名称:chrome-ec,代码行数:13,代码来源:usb.c
注:本文中的ccprintf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论