本文整理汇总了C++中print_info函数的典型用法代码示例。如果您正苦于以下问题:C++ print_info函数的具体用法?C++ print_info怎么用?C++ print_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_info函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
int ret = 0;
int cast_vote = 1, master_wins = 0;
int pollcount=0, polltime=1, quiet=0, once=0;
int send_old_ringid = 0;
int err;
int opt;
votequorum_callbacks_t callbacks;
const char *devicename = "QDEVICE";
const char *options = "F:n:p:t:cmq1h";
memset(&callbacks, 0, sizeof(callbacks));
callbacks.votequorum_notify_fn = votequorum_notification_fn;
while ((opt = getopt(argc, argv, options)) != -1) {
switch (opt) {
case 'm':
master_wins = 1;
break;
case 'c':
cast_vote = 1;
break;
case '1':
once = 1;
break;
case 'q':
quiet = 1;
break;
case 'F':
send_old_ringid = atoi(optarg)+1;
break;
case 'p':
pollcount = atoi(optarg)+1;
break;
case 'n':
devicename = strdup(optarg);
break;
case 't':
polltime = atoi(optarg);
break;
case 'h':
usage(argv[0]);
exit(0);
}
}
if ( (err=votequorum_initialize(&handle, &callbacks)) != CS_OK) {
fprintf(stderr, "votequorum_initialize FAILED: %d\n", err);
return -1;
}
if (quiet && once) {
fprintf(stderr, "setting both -q (quet) and -1 (once) makes no sense\n");
usage(argv[0]);
exit(1);
}
if (!quiet) {
print_info(1);
}
if (once) {
exit(0);
}
if (argc >= 2) {
if ( (err = votequorum_trackstart(handle, handle, CS_TRACK_CHANGES)) != CS_OK) {
fprintf(stderr, "votequorum_trackstart FAILED: %d\n", err);
ret = -1;
goto out;
}
if ( (err=votequorum_qdevice_register(handle, devicename)) != CS_OK) {
fprintf(stderr, "qdevice_register FAILED: %d\n", err);
ret = -1;
goto out;
}
if ( (err=votequorum_qdevice_master_wins(handle, devicename, master_wins)) != CS_OK) {
fprintf(stderr, "qdevice_master_wins FAILED: %d\n", err);
ret = -1;
goto out;
}
while (--pollcount) {
if (votequorum_dispatch(handle, CS_DISPATCH_ALL) != CS_OK) {
fprintf(stderr, "votequorum_dispatch error\n");
ret = -1;
goto out;
}
if (!quiet) print_info(0);
if (no_sent_old_ringid + 1 >= send_old_ringid) {
/*
* Finally send correct ringid
*/
memcpy(&ring_id_to_send, &last_received_ring_id, sizeof(ring_id_to_send));
} else {
//.........这里部分代码省略.........
开发者ID:KevenChang,项目名称:corosync,代码行数:101,代码来源:testvotequorum2.c
示例2: main
int
main (int argc, char **argv)
{
int err, ret;
int ii, i;
char buffer[MAX_BUF + 1];
char *session_data = NULL;
char *session_id = NULL;
size_t session_data_size;
size_t session_id_size;
fd_set rset;
int maxfd;
struct timeval tv;
int user_term = 0;
socket_st hd;
gaa_parser (argc, argv);
if (hostname == NULL)
{
fprintf (stderr, "No hostname given\n");
exit (1);
}
sockets_init ();
#ifndef _WIN32
signal (SIGPIPE, SIG_IGN);
#endif
init_global_tls_stuff ();
socket_open( &hd, hostname, service);
socket_connect( &hd);
hd.session = init_tls_session (hostname);
if (starttls)
goto after_handshake;
for (i = 0; i < 2; i++)
{
if (i == 1)
{
hd.session = init_tls_session (hostname);
gnutls_session_set_data (hd.session, session_data,
session_data_size);
free (session_data);
}
ret = do_handshake (&hd);
if (ret < 0)
{
fprintf (stderr, "*** Handshake has failed\n");
gnutls_perror (ret);
gnutls_deinit (hd.session);
return 1;
}
else
{
printf ("- Handshake was completed\n");
if (gnutls_session_is_resumed (hd.session) != 0)
printf ("*** This is a resumed session\n");
}
if (resume != 0 && i == 0)
{
gnutls_session_get_data (hd.session, NULL, &session_data_size);
session_data = malloc (session_data_size);
gnutls_session_get_data (hd.session, session_data,
&session_data_size);
gnutls_session_get_id (hd.session, NULL, &session_id_size);
session_id = malloc (session_id_size);
gnutls_session_get_id (hd.session, session_id, &session_id_size);
/* print some information */
print_info (hd.session, hostname);
printf ("- Disconnecting\n");
socket_bye (&hd);
printf
("\n\n- Connecting again- trying to resume previous session\n");
socket_open( &hd, hostname, service);
socket_connect(&hd);
}
else
{
break;
}
}
after_handshake:
//.........这里部分代码省略.........
开发者ID:uvbs,项目名称:SupportCenter,代码行数:101,代码来源:cli.c
示例3: cache_as_ram_main
//.........这里部分代码省略.........
cpuSetAMDMSR();
post_code(0x34);
amd_ht_init(sysinfo);
post_code(0x35);
/* Setup nodes PCI space and start core 0 AP init. */
finalize_node_setup(sysinfo);
/* Setup any mainboard PCI settings etc. */
setup_mb_resource_map();
post_code(0x36);
/* wait for all the APs core0 started by finalize_node_setup. */
/* FIXME: A bunch of cores are going to start output to serial at once.
It would be nice to fixup prink spinlocks for ROM XIP mode.
I think it could be done by putting the spinlock flag in the cache
of the BSP located right after sysinfo.
*/
wait_all_core0_started();
#if CONFIG_LOGICAL_CPUS
/* Core0 on each node is configured. Now setup any additional cores. */
printk(BIOS_DEBUG, "start_other_cores()\n");
start_other_cores();
post_code(0x37);
wait_all_other_cores_started(bsp_apicid);
#endif
post_code(0x38);
#if CONFIG_SET_FIDVID
msr = rdmsr(0xc0010071);
printk(BIOS_DEBUG, "\nBegin FIDVID MSR 0xc0010071 0x%08x 0x%08x \n", msr.hi, msr.lo);
/* FIXME: The sb fid change may survive the warm reset and only
need to be done once.*/
enable_fid_change_on_sb(sysinfo->sbbusn, sysinfo->sbdn);
post_code(0x39);
if (!warm_reset_detect(0)) { // BSP is node 0
init_fidvid_bsp(bsp_apicid, sysinfo->nodes);
} else {
init_fidvid_stage2(bsp_apicid, 0); // BSP is node 0
}
post_code(0x3A);
/* show final fid and vid */
msr=rdmsr(0xc0010071);
printk(BIOS_DEBUG, "End FIDVIDMSR 0xc0010071 0x%08x 0x%08x \n", msr.hi, msr.lo);
#endif
/* Reset for HT, FIDVID, PLL and errata changes to take affect. */
if (!warm_reset_detect(0)) {
print_info("...WARM RESET...\n\n\n");
soft_reset_x(sysinfo->sbbusn, sysinfo->sbdn);
die("After soft_reset_x - shouldn't see this message!!!\n");
}
post_code(0x3B);
/* FIXME: Move this to chipset init.
enable cf9 for hard reset */
print_debug("enable_cf9_x()\n");
enable_cf9_x(sysinfo->sbbusn, sysinfo->sbdn);
post_code(0x3C);
/* It's the time to set ctrl in sysinfo now; */
printk(BIOS_DEBUG, "fill_mem_ctrl()\n");
fill_mem_ctrl(sysinfo->nodes, sysinfo->ctrl, spd_addr);
post_code(0x3D);
printk(BIOS_DEBUG, "enable_smbus()\n");
enable_smbus();
post_code(0x3E);
memreset_setup();
post_code(0x40);
// die("Die Before MCT init.");
printk(BIOS_DEBUG, "raminit_amdmct()\n");
raminit_amdmct(sysinfo);
post_code(0x41);
/*
dump_pci_device_range(PCI_DEV(0, 0x18, 0), 0, 0x200);
dump_pci_device_range(PCI_DEV(0, 0x18, 1), 0, 0x200);
dump_pci_device_range(PCI_DEV(0, 0x18, 2), 0, 0x200);
dump_pci_device_range(PCI_DEV(0, 0x18, 3), 0, 0x200);
*/
// die("After MCT init before CAR disabled.");
post_code(0x42);
post_cache_as_ram(); // BSP switch stack to ram, copy then execute LB.
post_code(0x43); // Should never see this post code.
}
开发者ID:hustcalm,项目名称:coreboot-hacking,代码行数:101,代码来源:romstage.c
示例4: sc_connect
int sc_connect()
{
int ret;
char recv_buf[100];
char send_buf[100];
stream_socket = sock_connect(cfg.srv[cfg.selected_srv]->addr,
cfg.srv[cfg.selected_srv]->port+1, CONN_TIMEOUT);
if(stream_socket < 0)
{
switch(stream_socket)
{
case SOCK_ERR_CREATE:
print_info("\nconnect: could not create network socket", 1);
ret = 2;
break;
case SOCK_ERR_RESOLVE:
print_info("\nconnect: error resolving server address", 1);
ret = 1;
break;
case SOCK_TIMEOUT:
case SOCK_INVALID:
ret = 1;
break;
default:
ret = 2;
}
sc_disconnect();
return ret;
}
/*
ret = sock_setbufsize(&stream_socket, 8192, 0);
if(ret == SOCK_ERR_SET_SBUF)
print_info("\nWarning: couldn't set socket SO_SNDBUF", 1);
*/
sock_send(&stream_socket, cfg.srv[cfg.selected_srv]->pwd,
strlen(cfg.srv[cfg.selected_srv]->pwd), SEND_TIMEOUT);
sock_send(&stream_socket, "\n", 1, SEND_TIMEOUT);
if((ret = sock_recv(&stream_socket, recv_buf, sizeof(recv_buf)-1, RECV_TIMEOUT)) == 0)
{
usleep(100000);
sc_disconnect();
return 1;
}
if( (recv_buf[0] != 'O') || (recv_buf[1] != 'K') || (ret <= 2) )
{
if(strstr(recv_buf, "invalid password") != NULL)
{
print_info("\nconnect: invalid password!\n", 1);
sc_disconnect();
return 2;
}
return 1;
}
sock_send(&stream_socket, "icy-name:", 9, SEND_TIMEOUT);
if(cfg.main.num_of_icy > 0)
if(cfg.icy[cfg.selected_icy]->desc != NULL)
send(stream_socket, cfg.icy[cfg.selected_icy]->desc,
strlen(cfg.icy[cfg.selected_icy]->desc), 0);
sock_send(&stream_socket, "\n", 1, SEND_TIMEOUT);
sock_send(&stream_socket, "icy-genre:", 10, SEND_TIMEOUT);
if(cfg.main.num_of_icy > 0)
if(cfg.icy[cfg.selected_icy]->genre != NULL)
send(stream_socket, cfg.icy[cfg.selected_icy]->genre,
strlen(cfg.icy[cfg.selected_icy]->genre), 0);
sock_send(&stream_socket, "\n", 1, SEND_TIMEOUT);
sock_send(&stream_socket, "icy-url:", 8, SEND_TIMEOUT);
if(cfg.main.num_of_icy > 0)
if(cfg.icy[cfg.selected_icy]->url != NULL)
send(stream_socket, cfg.icy[cfg.selected_icy]->url,
strlen(cfg.icy[cfg.selected_icy]->url), 0);
sock_send(&stream_socket, "\n", 1, SEND_TIMEOUT);
sock_send(&stream_socket, "icy-irc:", 8, SEND_TIMEOUT);
if(cfg.main.num_of_icy > 0)
if(cfg.icy[cfg.selected_icy]->irc != NULL)
send(stream_socket, cfg.icy[cfg.selected_icy]->irc,
strlen(cfg.icy[cfg.selected_icy]->irc), 0);
sock_send(&stream_socket, "\n", 1, SEND_TIMEOUT);
sock_send(&stream_socket, "icy-icq:", 8, SEND_TIMEOUT);
if(cfg.main.num_of_icy > 0)
if(cfg.icy[cfg.selected_icy]->icq != NULL)
send(stream_socket, cfg.icy[cfg.selected_icy]->icq,
strlen(cfg.icy[cfg.selected_icy]->icq), 0);
sock_send(&stream_socket, "\n", 1, SEND_TIMEOUT);
//.........这里部分代码省略.........
开发者ID:atmos,项目名称:butt,代码行数:101,代码来源:shoutcast.cpp
示例5: main
int main(int argc, char **argv)
{
int i;
char *p;
const struct iwinfo_ops *iw;
glob_t globbuf;
if (argc > 1 && argc < 3)
{
fprintf(stderr,
"Usage:\n"
" iwinfo <device> info\n"
" iwinfo <device> scan\n"
" iwinfo <device> txpowerlist\n"
" iwinfo <device> freqlist\n"
" iwinfo <device> assoclist\n"
" iwinfo <device> countrylist\n"
);
return 1;
}
if (argc == 1)
{
glob("/sys/class/net/*", 0, NULL, &globbuf);
for (i = 0; i < globbuf.gl_pathc; i++)
{
p = strrchr(globbuf.gl_pathv[i], '/');
if (!p)
continue;
iw = iwinfo_backend(++p);
if (!iw)
continue;
print_info(iw, p);
printf("\n");
}
globfree(&globbuf);
return 0;
}
iw = iwinfo_backend(argv[1]);
if (!iw)
{
fprintf(stderr, "No such wireless device: %s\n", argv[1]);
return 1;
}
for (i = 2; i < argc; i++)
{
switch(argv[i][0])
{
case 'i':
print_info(iw, argv[1]);
break;
case 's':
print_scanlist(iw, argv[1]);
break;
case 't':
print_txpwrlist(iw, argv[1]);
break;
case 'f':
print_freqlist(iw, argv[1]);
break;
case 'a':
print_assoclist(iw, argv[1]);
break;
case 'c':
print_countrylist(iw, argv[1]);
break;
default:
fprintf(stderr, "Unknown command: %s\n", argv[i]);
return 1;
}
}
iwinfo_finish();
return 0;
}
开发者ID:7LK,项目名称:McWRT,代码行数:92,代码来源:iwinfo_cli.c
示例6: cache_as_ram_main
//.........这里部分代码省略.........
pilot_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
console_init();
/* Halt if there was a built in self test failure */
report_bist_failure(bist);
pilot_early_init(SERIAL_DEV); //config port is being taken from SERIAL_DEV
val = cpuid_eax(1);
printk(BIOS_DEBUG, "BSP Family_Model: %08x\n", val);
printk(BIOS_DEBUG, "*sysinfo range: [%p,%p]\n",sysinfo,sysinfo+1);
printk(BIOS_DEBUG, "bsp_apicid = %02x\n", bsp_apicid);
printk(BIOS_DEBUG, "cpu_init_detectedx = %08lx\n", cpu_init_detectedx);
/* Setup sysinfo defaults */
set_sysinfo_in_ram(0);
#if CONFIG_UPDATE_CPU_MICROCODE
update_microcode(val);
#endif
post_code(0x33);
cpuSetAMDMSR();
post_code(0x34);
amd_ht_init(sysinfo);
post_code(0x35);
/* Setup nodes PCI space and start core 0 AP init. */
finalize_node_setup(sysinfo);
post_code(0x36);
/* wait for all the APs core0 started by finalize_node_setup. */
/* FIXME: A bunch of cores are going to start output to serial at once.
* It would be nice to fixup prink spinlocks for ROM XIP mode.
* I think it could be done by putting the spinlock flag in the cache
* of the BSP located right after sysinfo.
*/
wait_all_core0_started();
#if CONFIG_LOGICAL_CPUS
/* Core0 on each node is configured. Now setup any additional cores. */
printk(BIOS_DEBUG, "start_other_cores()\n");
start_other_cores();
post_code(0x37);
wait_all_other_cores_started(bsp_apicid);
#endif
#if CONFIG_SET_FIDVID
msr = rdmsr(0xc0010071);
printk(BIOS_DEBUG, "\nBegin FIDVID MSR 0xc0010071 0x%08x 0x%08x\n", msr.hi, msr.lo);
/* FIXME: The sb fid change may survive the warm reset and only
* need to be done once.*/
enable_fid_change_on_sb(sysinfo->sbbusn, sysinfo->sbdn);
post_code(0x39);
if (!warm_reset_detect(0)) { // BSP is node 0
init_fidvid_bsp(bsp_apicid, sysinfo->nodes);
} else {
init_fidvid_stage2(bsp_apicid, 0); // BSP is node 0
}
post_code(0x3A);
/* show final fid and vid */
msr=rdmsr(0xc0010071);
printk(BIOS_DEBUG, "End FIDVIDMSR 0xc0010071 0x%08x 0x%08x\n", msr.hi, msr.lo);
#endif
init_timer();
/* Reset for HT, FIDVID, PLL and errata changes to take affect. */
if (!warm_reset_detect(0)) {
print_info("...WARM RESET...\n\n\n");
soft_reset();
die("After soft_reset_x - shouldn't see this message!!!\n");
}
/* It's the time to set ctrl in sysinfo now; */
fill_mem_ctrl(sysinfo->nodes, sysinfo->ctrl, spd_addr);
enable_smbus();
//do we need apci timer, tsc...., only debug need it for better output
/* all ap stopped? */
// init_timer(); // Need to use TMICT to synconize FID/VID
printk(BIOS_DEBUG, "raminit_amdmct()\n");
raminit_amdmct(sysinfo);
post_code(0x41);
bcm5785_early_setup();
post_cache_as_ram();
}
开发者ID:andy737,项目名称:firebrickRemote,代码行数:101,代码来源:romstage.c
示例7: main
/** main() Application entry point
*
* @param argc int
* @param argv[] char*
* @return int
*
*/
int main(int argc, char *argv[])
{
odph_odpthread_t thread_tbl[MAX_WORKERS];
appl_args_t params;
int core_count, num_workers;
odp_cpumask_t cpumask;
char cpumaskstr[64];
odph_odpthread_params_t thr_params;
odp_instance_t instance;
/* Parse and store the application arguments */
parse_args(argc, argv, ¶ms);
if (params.if_count > OFP_FP_INTERFACE_MAX) {
printf("Error: Invalid number of interfaces: maximum %d\n",
OFP_FP_INTERFACE_MAX);
exit(EXIT_FAILURE);
}
if (odp_init_global(&instance, NULL, NULL)) {
OFP_ERR("Error: ODP global init failed.\n");
exit(EXIT_FAILURE);
}
if (odp_init_local(instance, ODP_THREAD_CONTROL)) {
OFP_ERR("Error: ODP local init failed.\n");
exit(EXIT_FAILURE);
}
/* Print both system and application information */
print_info(NO_PATH(argv[0]), ¶ms);
core_count = odp_cpu_count();
num_workers = core_count;
if (params.core_count && params.core_count < core_count)
num_workers = params.core_count;
if (num_workers > MAX_WORKERS)
num_workers = MAX_WORKERS;
if (core_count > 1)
num_workers--;
num_workers = odp_cpumask_default_worker(&cpumask, num_workers);
odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr));
printf("Num worker threads: %i\n", num_workers);
printf("first CPU: %i\n", odp_cpumask_first(&cpumask));
printf("cpu mask: %s\n", cpumaskstr);
ofp_init_global_param(&app_init_params);
app_init_params.if_count = params.if_count;
app_init_params.if_names = params.if_names;
if (ofp_init_global(instance, &app_init_params)) {
OFP_ERR("Error: OFP global init failed.\n");
exit(EXIT_FAILURE);
}
if (ofp_init_local()) {
OFP_ERR("Error: OFP local init failed.\n");
exit(EXIT_FAILURE);
}
build_classifier(app_init_params.if_count, app_init_params.if_names);
/* Start CLI */
ofp_start_cli_thread(instance, app_init_params.linux_core_id, params.cli_file);
sleep(1);
memset(thread_tbl, 0, sizeof(thread_tbl));
/* Start dataplane dispatcher worker threads */
thr_params.start = default_event_dispatcher;
thr_params.arg = ofp_udp4_processing;
thr_params.thr_type = ODP_THREAD_WORKER;
thr_params.instance = instance;
odph_odpthreads_create(thread_tbl,
&cpumask,
&thr_params);
app_processing();
odph_odpthreads_join(thread_tbl);
printf("End Main()\n");
return 0;
}
开发者ID:bogdanPricope,项目名称:ofp,代码行数:92,代码来源:classifier_main.c
示例8: main
int main (int argc, char *argv[])
{
// Business loan
int loan_num;
float rate = BUSINESS_LOAN_RATE / 12; // 5.4% / 12, month rate
int i = 0;
float fee = 0;
float fact = 0;
float total_fee = 0;
float total_bj = 0;
float bj = 0;
float bx_fee = 0;
float bx_loan_num = 0;
float bx_total_fee = 0;
float bx_monthly = 0;
// House Fund loan
int house_fund_num = HOUSE_FUND_NUM; // 120w
float house_fund_rate = HOUSE_FUND_RATE / 12; // month rate
float house_fund_fee = 0;
float house_fund_fact = 0;
float house_fund_total_bj = 0;
float house_fund_bj = 0;
int bx_house_fund_num = HOUSE_FUND_NUM; // 120w
float bx_house_fund_fee = 0;
float bx_house_fund_monthly = 0;
// savings = bj - bx
float savings = 0;
float total_savings = 0;
float bx_benefit = 0;
float tmp = 0;
float max_bx_benefit = 0;
// Investment
int invest_num = 0;
float invest_rate = INVEST_RATE / 12;
float income = 0, total_income = 0, year_income = 0;
initial_info ();
print_info ();
loan_num = bx_loan_num = max_loan;
fact = loan_num / max_loan_month;
invest_num = remain_num;
house_fund_fact = house_fund_num / max_loan_month;
bx_monthly = (bx_loan_num * rate * pow(1+rate, max_loan_month))
/ (pow(1+rate, max_loan_month) - 1);
printf("Business Loan, monthly pay = %d, bx monthly pay = %f\n", fact, bx_monthly);
for (i = 0; i < max_loan_month; i++) {
fee = loan_num * rate;
loan_num -= fact;
total_fee += fee;
bx_fee = bx_loan_num * rate;
bx_loan_num -= (bx_monthly - bx_fee);
if (bx_loan_num < 0)
bx_loan_num = 0;
bx_total_fee += bx_fee;
if (!(i % 12))
printf("\n\n---------------- YEAR %d --------------\n",
i/12 + 1);
printf("Month %03d, fee %05f, monthly %05f, bx_load_num = %f, bx_fee %05f, bx_monthly %05f\n",
i+1, fee, fee + fact, bx_loan_num, bx_fee, bx_monthly);
if ((i %12) == 11)
printf("Total fee = %f, bx total fee = %f\n", total_fee, bx_total_fee);
}
printf("\n\nHouse Fund + Business Loan\n");
total_fee = bx_total_fee = 0;
bx_loan_num = loan_num = business_loan;
bx_monthly = (bx_loan_num * rate * pow(1+rate, max_loan_month))
/ (pow(1+rate, max_loan_month) - 1);
bx_house_fund_monthly = (bx_house_fund_num * house_fund_rate * pow(1+house_fund_rate, max_loan_month))
/ (pow(1+house_fund_rate, max_loan_month) - 1);
fact = loan_num / max_loan_month;
for (i = 0; i < max_loan_month; i++) {
house_fund_fee = house_fund_num * house_fund_rate;
house_fund_num -= house_fund_fact;
total_fee += house_fund_fee;
bx_house_fund_fee = bx_house_fund_num * house_fund_rate;
house_fund_bj = (bx_house_fund_monthly - bx_house_fund_fee);
house_fund_total_bj += house_fund_bj;
bx_house_fund_num -= house_fund_bj;
bx_total_fee += bx_house_fund_fee;
fee = loan_num * rate;
loan_num -= fact;
total_fee += fee;
bx_fee = bx_loan_num * rate;
bj = (bx_monthly - fee);
//.........这里部分代码省略.........
开发者ID:joojler,项目名称:jrepo,代码行数:101,代码来源:main.c
示例9: cache_as_ram_main
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
static const uint16_t spd_addr[] = {
// Node 0
DIMM0, DIMM1, DIMM2, 0,
0, 0, 0, 0,
// Node 1
0, 0, 0, 0,
0, 0, 0, 0,
};
unsigned bsp_apicid = 0;
int needs_reset = 0;
struct sys_info *sysinfo = &sysinfo_car;
winbond_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
console_init();
enable_rom_decode();
print_info("now booting... fallback\n");
/* Is this a CPU only reset? Or is this a secondary CPU? */
if (!cpu_init_detectedx && boot_cpu()) {
/* Nothing special needs to be done to find bus 0. */
/* Allow the HT devices to be found. */
enumerate_ht_chain();
}
print_info("now booting... real_main\n");
if (bist == 0)
bsp_apicid = init_cpus(cpu_init_detectedx, sysinfo);
/* Halt if there was a built in self test failure. */
report_bist_failure(bist);
setup_default_resource_map();
setup_coherent_ht_domain();
wait_all_core0_started();
print_info("now booting... Core0 started\n");
#if CONFIG_LOGICAL_CPUS
/* It is said that we should start core1 after all core0 launched. */
start_other_cores();
wait_all_other_cores_started(bsp_apicid);
#endif
init_timer();
ht_setup_chains_x(sysinfo); /* Init sblnk and sbbusn, nodes, sbdn. */
needs_reset = optimize_link_coherent_ht();
needs_reset |= optimize_link_incoherent_ht(sysinfo);
needs_reset |= k8t890_early_setup_ht();
if (needs_reset) {
print_debug("ht reset -\n");
soft_reset();
}
/* the HT settings needs to be OK, because link freq change may cause HT disconnect */
vt8237_sb_enable_fid_vid();
enable_fid_change();
init_fidvid_bsp(bsp_apicid);
/* Stop the APs so we can start them later in init. */
allow_all_aps_stop(bsp_apicid);
/* It's the time to set ctrl now. */
fill_mem_ctrl(sysinfo->nodes, sysinfo->ctrl, spd_addr);
enable_smbus();
/* this seems to be some GPIO on the SMBus--in any case, setting these
* two bits reduces the pullup impedance of the bus lines and is required
* in order to be able to read SPD info */
smbus_write_byte(0x48, 0x07, smbus_read_byte(0x48, 0x07) | 0x80);
smbus_write_byte(0x4a, 0x07, smbus_read_byte(0x4a, 0x07) | 0x10);
unsigned char mask;
mask = 0;
// mask |= 1 /* AGP voltage 1.7 V (not verified, just vendor BIOS value) */
// mask |= 2 /* V-Link voltage 2.6 V (not verified either) */
smbus_write_byte(0x4a, 0x00, (smbus_read_byte(0x4a, 0x00) & ~0x0f) | (0x0f ^ (mask << 2)));
smbus_write_byte(0x4a, 0x01, (smbus_read_byte(0x4a, 0x01) & ~0x03) | (0x03 ^ mask));
mask = 25; /* RAM voltage in decivolts, valid range from 25 to 28 */
mask = 3 - (mask - 25);
smbus_write_byte(0x4a, 0x02, 0x4f | (mask << 4));
smbus_write_byte(0x4a, 0x03, 0x04 | mask);
sdram_initialize(sysinfo->nodes, sysinfo->ctrl, sysinfo);
post_cache_as_ram();
}
开发者ID:B-Rich,项目名称:coreboot,代码行数:93,代码来源:romstage.c
示例10: exec_info
//.........这里部分代码省略.........
if (match == MATCH_ALL && opt == INFO_TAG_NAMEVER)
quiet = false;
if (file != NULL) {
if ((fd = open(file, O_RDONLY)) == -1) {
warn("Unable to open %s", file);
return (EX_IOERR);
}
#ifdef HAVE_CAPSICUM
cap_rights_init(&rights, CAP_READ, CAP_FSTAT);
if (cap_rights_limit(fd, &rights) < 0 && errno != ENOSYS ) {
warn("cap_rights_limit() failed");
return (EX_SOFTWARE);
}
if (cap_enter() < 0 && errno != ENOSYS) {
warn("cap_enter() failed");
return (EX_SOFTWARE);
}
#endif
if (opt == INFO_TAG_NAMEVER)
opt |= INFO_FULL;
pkg_manifest_keys_new(&keys);
if ((opt & (INFO_RAW | INFO_FILES |
INFO_DIRS)) == 0)
open_flags = PKG_OPEN_MANIFEST_COMPACT;
if (pkg_open_fd(&pkg, fd, keys, open_flags) != EPKG_OK) {
close(fd);
return (1);
}
pkg_manifest_keys_free(keys);
print_info(pkg, opt);
close(fd);
pkg_free(pkg);
return (EX_OK);
}
ret = pkgdb_access(PKGDB_MODE_READ, PKGDB_DB_LOCAL);
if (ret == EPKG_ENOACCESS) {
warnx("Insufficient privileges to query the package database");
return (EX_NOPERM);
} else if (ret == EPKG_ENODB) {
if (match == MATCH_ALL)
return (EX_OK);
if (origin_search)
return (EX_OK);
if (!quiet)
warnx("No packages installed");
return (EX_UNAVAILABLE);
} else if (ret != EPKG_OK)
return (EX_IOERR);
ret = pkgdb_open(&db, PKGDB_DEFAULT);
if (ret != EPKG_OK)
return (EX_IOERR);
if (pkgdb_obtain_lock(db, PKGDB_LOCK_READONLY) != EPKG_OK) {
pkgdb_close(db);
warnx("Cannot get a read lock on a database, it is locked by another process");
return (EX_TEMPFAIL);
}
i = 0;
do {
开发者ID:ppentchev,项目名称:pkg,代码行数:67,代码来源:info.c
示例11: _tmain
int _tmain(int argc, char* argv[])
{
CKMCFile kmer_data_base;
int32 i;
uint32 min_count_to_set = 0;
uint32 max_count_to_set = 0;
std::string input_file_name;
std::string output_file_name;
FILE * out_file;
//------------------------------------------------------------
// Parse input parameters
//------------------------------------------------------------
if(argc < 3)
{
print_info();
return EXIT_FAILURE;
}
for(i = 1; i < argc; ++i)
{
if(argv[i][0] == '-')
{
if(strncmp(argv[i], "-ci", 3) == 0)
min_count_to_set = atoi(&argv[i][3]);
else if(strncmp(argv[i], "-cx", 3) == 0)
max_count_to_set = atoi(&argv[i][3]);
}
else
break;
}
if(argc - i < 2)
{
print_info();
return EXIT_FAILURE;
}
input_file_name = std::string(argv[i++]);
output_file_name = std::string(argv[i]);
if((out_file = fopen (output_file_name.c_str(),"wb")) == NULL)
{
print_info();
return EXIT_FAILURE;
}
setvbuf(out_file, NULL ,_IOFBF, 1 << 24);
//------------------------------------------------------------------------------
// Open kmer database for listing and print kmers within min_count and max_count
//------------------------------------------------------------------------------
if (!kmer_data_base.OpenForListing(input_file_name))
{
print_info();
return EXIT_FAILURE ;
}
else
{
uint32 _kmer_length;
uint32 _mode;
uint32 _counter_size;
uint32 _lut_prefix_length;
uint32 _signature_len;
uint32 _min_count;
uint32 _max_count;
uint64 _total_kmers;
kmer_data_base.Info(_kmer_length, _mode, _counter_size, _lut_prefix_length, _signature_len, _min_count, _max_count, _total_kmers);
//std::string str;
char str[1024];
uint32 counter_len;
CKmerAPI kmer_object(_kmer_length);
if(min_count_to_set)
if (!(kmer_data_base.SetMinCount(min_count_to_set)))
return EXIT_FAILURE;
if(max_count_to_set)
if (!(kmer_data_base.SetMaxCount(max_count_to_set)))
return EXIT_FAILURE;
if (_mode) //quake compatible mode
{
float counter;
while (kmer_data_base.ReadNextKmer(kmer_object, counter))
{
kmer_object.to_string(str);
str[_kmer_length] = '\t';
counter_len = CNumericConversions::Double2PChar(counter, 6, (uchar*)str + _kmer_length + 1);
str[_kmer_length + 1 + counter_len] = '\n';
fwrite(str, 1, _kmer_length + counter_len + 2, out_file);
}
}
else
{
uint32 counter;
//.........这里部分代码省略.........
开发者ID:el-mat,项目名称:KMC,代码行数:101,代码来源:kmc_dump.cpp
示例12: conf_init
void conf_init(void) {
init_default_values();
gboolean keyoption = FALSE;
Display *dpy = gdk_x11_display_get_xdisplay(gdk_display_get_default());
XrmInitialize();
char basename[12] = "/.Xdefaults";
char *filename = strcat(getpwuid(getuid())->pw_dir, basename);
XrmSetDatabase(dpy, XrmGetFileDatabase(filename));
char *op;
int i;
Option o;
for (i = 0; i < OPTION_COUNT; i++) {
o = options[i];
if ((op = XGetDefault(dpy, "stjerm", o.long_name)))
read_value(o.long_name, op);
}
char color[8];
for (i = 0; i < 16; i++) {
sprintf(color, "color%d", i);
if ((op = XGetDefault(dpy, "stjerm", color)))
read_value(color, op);
}
for (i = 1; i < sargc; i++) {
if (sargv != NULL) {
if (!strcmp(sargv[i], "--help")) {
print_help();
exit(1);
} else if (!strcmp(sargv[i], "--info")) {
print_info();
exit(1);
} else if (!strcmp("--toggle", sargv[i])) {
kill(get_stjerm_pid(), SIGUSR1);
exit(1);
} else if (!strcmp("--version", sargv[i]) || !strcmp("-v", sargv[i])){
print_version();
exit(1);
}
}
if (i + 1>= sargc)
break;
read_value(sargv[i], sargv[i + 1]);
}
if (keyoption == FALSE && _key == 0) {
printf("Hint: You started stjerm without specifying a shortcut key\n"
" To show/hide stjerm run stjerm with the toggle option\n"
" like this: stjerm --toggle");
}
struct stat st;
if (stat(_shell, &st) != 0) {
fprintf(stderr, "ERROR: The shell '%s' can't be opened\n", _shell);
exit(1);
}
if (_lines < 0) {
fprintf(stderr, "ERROR: A scrollback line count < 0 is not allowed\n");
exit(1);
}
if (keyoption == TRUE && _key == 0) {
fprintf(stderr, "ERROR: Wrong shortcut key is defined\n");
exit(1);
}
if (read_colors > 0 && read_colors < 16) {
fprintf(stderr, "ERROR: Read only %d colors, not 16\n"
"Specify a complete color palette\n", read_colors);
exit(1);
}
signal(SIGUSR1, (__sighandler_t) mainwindow_toggle);
int scrw = gdk_screen_get_width(gdk_screen_get_default());
int scrh = gdk_screen_get_height(gdk_screen_get_default());
if (_pos == POS_TOP) {
_posx = (scrw - _width) / 2;
_posy = 0;
} else if (_pos == POS_BOTTOM) {
_posx = (scrw - _width) / 2;
_posy = scrh - _height;
} else if (_pos == POS_LEFT) {
_posx = 0;
_posy = (scrh - _height) / 2;
} else if (_pos == POS_RIGHT) {
_posx = scrw - _width;
_posy = (scrh - _height) / 2;
} else if (_pos == POS_TOPLEFT) {
_posx = 0;
_posy = 0;
} else if (_pos == POS_TOPRIGHT) {
_posx = scrw - _width;
_posy = 0;
} else if (_pos == POS_BOTTOMLEFT) {
_posx = 0;
//.........这里部分代码省略.........
开发者ID:icebreaker,项目名称:stjerm,代码行数:101,代码来源:config.c
示例13: main
int main(int argc, char** argv)
{
if(argc < 3)
{
printf("Usage: %s send_time recv_time\n", argv[0]);
exit(-1);
}
// filling send & recv time
send_time = atoi(argv[1]);
recv_time = atoi(argv[2]);
/// number of done tasks for time
int done_tasks = 0;
// time in system
int time = 0;
// filling in tasks length {30, 10, 10, ..., 10}
task_len[0] = 30;
for(int i = 1; i < TASKS; i++)
task_len[i] = 10;
// print settings
print_info();
// initializing tasks
for(int i = 0; i < TASKS; i++)
{
states[i] = WAITING;
last_state_change_time[i] = 0;
}
// initializing answer
bzero(arr, sizeof(arr));
// when does the master gets free from ongoing send/receive operation?
int zero_free_time = 0;
while(done_tasks < TASKS)
{
// time step [time]
// done tasks for this time
int done_tasks_t = 0;
for(int i = 0; i < TASKS; i++)
{
// WAITING->SENDING if master is free
if(states[i] == WAITING && zero_free_time <= time)
{
states[i] = SENDING;
last_state_change_time[i] = time;
zero_free_time = time + send_time;
printf("TIME %d task %d is now SENDING transmission stops at %d\n", time, i, zero_free_time);
}
// SENDING->RUNNING if send is complete
if(states[i] == SENDING)
{
if(time - last_state_change_time[i] >= send_time)
{
last_state_change_time[i] = time;
states[i] = RUNNING;
printf("TIME %d task %d is now RUNNING finishing at %d\n", time, i, time + task_len[i]);
}
else
{
arr[0][time].state = SENDING;
arr[0][time].peer = i;
}
}
// RUNNING->WAITING_RECEIVE if task is complete
if(states[i] == RUNNING)
{
if(time - last_state_change_time[i] >= task_len[i])
{
last_state_change_time[i] = time;
states[i] = WAITING_RECEIVE;
printf("TIME %d task %d is WAITING_RECEIVE\n", time, i);
}
}
// WAITING_RECEIVE->RECEIVING if master is free AND if
// receive time is zero
// or we have sent all tasks
// so NOT starting to receive tasks until we sent all of them
if(states[i] == WAITING_RECEIVE && zero_free_time <= time && (recv_time == 0 || count(WAITING) == 0))
{
states[i] = RECEIVING;
last_state_change_time[i] = time;
zero_free_time = time + recv_time;
printf("TIME %d task %d is now RECEIVING transmission stops at %d\n", time, i, zero_free_time);
}
// RECEIVING->DONE if recv is complete
if(states[i] == RECEIVING)
{
if(time - last_state_change_time[i] >= recv_time)
//.........这里部分代码省略.........
开发者ID:etoestja,项目名称:inf,代码行数:101,代码来源:main.cpp
示例14: main
int main(int argc, const char *argv[])
{
int nID = 0;
const char *fname1 = NULL;
const char *fname2 = NULL;
const char *objname1 = NULL;
const char *objname2 = NULL;
diff_opt_t options;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
/* Initialize h5tools lib */
h5tools_init();
outBuffOffset = 0;
g_Parallel = 1;
MPI_Init(&argc, (char***) &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &nID);
MPI_Comm_size(MPI_COMM_WORLD, &g_nTasks);
if(g_nTasks == 1)
{
printf("Only 1 task available...doing serial diff\n");
g_Parallel = 0;
parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &options);
h5diff(fname1, fname2, objname1, objname2, &options);
print_info(&options);
}
/* Parallel h5diff */
else {
/* Have the manager process the command-line */
if(nID == 0)
{
parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &options);
h5diff(fname1, fname2, objname1, objname2, &options);
MPI_Barrier(MPI_COMM_WORLD);
print_info(&options);
print_manager_output();
}
/* All other tasks become workers and wait for assignments. */
else {
ph5diff_worker(nID);
MPI_Barrier(MPI_COMM_WORLD);
} /* end else */
} /* end else */
MPI_Finalize();
return 0;
}
开发者ID:Hulalazz,项目名称:rnnlib,代码行数:63,代码来源:ph5diff_main.c
示例15: cache_as_ram_main
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
static const uint16_t spd_addr[] = {
// first node
DIMM0, DIMM2, 0, 0,
DIMM1, DIMM3, 0, 0,
// second node
DIMM4, DIMM6, 0, 0,
DIMM5, DIMM7, 0, 0,
};
struct sys_info *sysinfo = (struct sys_info *)(CONFIG_DCACHE_RAM_BASE
+ CONFIG_DCACHE_RAM_SIZE - CONFIG_DCACHE_RAM_GLOBAL_VAR_SIZE);
int needs_reset;
unsigned bsp_apicid = 0;
if (!cpu_init_detectedx && boot_cpu()) {
/* Nothing special needs to be done to find bus 0 */
/* Allow the HT devices to be found */
enumerate_ht_chain();
/* Setup the rom access for 4M */
amd8111_enable_rom();
}
if (bist == 0) {
bsp_apicid = init_cpus(cpu_init_detectedx, sysinfo);
}
w83627hf_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
uart_init();
console_init();
/* Halt if there was a built in self test failure */
report_bist_failure(bist);
printk(BIOS_DEBUG, "*sysinfo range: [%p,%p]\n",sysinfo,sysinfo+1);
setup_mb_resource_map();
print_debug("bsp_apicid="); print_debug_hex8(bsp_apicid); print_debug("\n");
#if CONFIG_MEM_TRAIN_SEQ == 1
set_sysinfo_in_ram(0); // in BSP so could hold all ap until sysinfo is in ram
#endif
setup_coherent_ht_domain(); // routing table and start other core0
wait_all_core0_started();
#if CONFIG_LOGICAL_CPUS==1
// It is said that we should start core1 after all core0 launched
/* becase optimize_link_coherent_ht is moved out from setup_coherent_ht_domain,
* So here need to make sure last core0 is started, esp for two way system,
* (there may be apic id conflicts in that case)
*/
start_other_cores();
wait_all_other_cores_started(bsp_apicid);
#endif
/* it will set up chains and store link pair for optimization later */
ht_setup_chains_x(sysinfo); // it will init sblnk and sbbusn, nodes, sbdn
#if SET_FIDVID == 1
{
msr_t msr;
msr=rdmsr(0xc0010042);
print_debug("begin msr fid, vid "); print_debug_hex32( msr.hi ); print_debug_hex32(msr.lo); print_debug("\n");
}
enable_fid_change();
enable_fid_change_on_sb(sysinfo->sbbusn, sysinfo->sbdn);
init_fidvid_bsp(bsp_apicid);
// show final fid and vid
{
msr_t msr;
msr=rdmsr(0xc0010042);
print_debug("end msr fid, vid "); print_debug_hex32( msr.hi ); print_debug_hex32(msr.lo); print_debug("\n");
}
#endif
needs_reset = optimize_link_coherent_ht();
needs_reset |= optimize_link_incoherent_ht(sysinfo);
// fidvid change will issue one LDTSTOP and the HT change will be effective too
if (needs_reset) {
print_info("ht reset -\n");
soft_reset_x(sysinfo->sbbusn, sysinfo->sbdn);
}
allow_all_aps_stop(bsp_apicid);
//It's the time to set ctrl in sysinfo now;
//.........这里部分代码省略.........
开发者ID:jaanek,项目名称:coreboot,代码行数:101,代码来源:romstage.c
示例16: print_key
void print_key()
{
print_info();
print_matrix_B1();
print_matrix_B2();
print_matrix_MS();
print_matrix_MT();
print_matrix_MF();
print_matrix_MPK();
fp = fopen("Key.txt", "a+");
fprintf(fp, "%s", "\n\nPublic Key is written in polynomial form\n\n");
int i;
for(i = 0; i < m; i++)
{
fprintf(fp, "%s%d%s", "P(", i+1, "):\t");
int k = 1;
int l = 1;
int j;
for(j = 0; j < ((n)*(n+1))/2; j++)
{
fprintf(fp, "%d%s%d%s%d\n", );
if(matrix_MPK[i][j] <= 9 && k < 10 && l <10)
{
fprintf(fp, "%s\t", "");
fflush(fp);
}
fprintf(fp, "%s\t", "+");
if(l%n == 0)
{
k++;
l = k;
}
else
{
l++;
}
if((j+1)%5 == 0)
{
fprintf(fp, "%s\t", "");
fflush(fp);
}
}
fprintf(fp, "%s\t", "");
for(j = 0; j < n; j++)
{
fprintf(fp, "%d%s%d\t\t+\t", matrix_MPK[i][(n*(n+1))/2 + j], "*m", j+1);
if((j+1)%5 == 0)
{
fprintf(fp, "%s\t", "");
fflush(fp);
}
}
fprintf(fp, "%s\t", "");
fprintf(fp, "%d\n", matrix_MPK[i][((n+1)*(n+2))/2 -1]);
fflush(fp);
}
fclose(fp);
}
开发者ID:bokdong2,项目名称:vane,代码行数:65,代码来源:keygenLRS.c
示例17: set_camera_timing_type
|
请发表评论