Example #1
0
void bc_dump::dump(alu_node& n) {
	sb_ostringstream s;
	static const char *omod_str[] = {"","*2","*4","/2"};
	static const char *slots = "xyzwt";

	s << (n.bc.update_exec_mask ? "M" : " ");
	s << (n.bc.update_pred ? "P" : " ");
	s << " ";
	s << (n.bc.pred_sel>=2 ? (n.bc.pred_sel == 2 ? "0" : "1") : " ");
	s << " ";

	s << slots[n.bc.slot] << ": ";

	s << n.bc.op_ptr->name << omod_str[n.bc.omod] << (n.bc.clamp ? "_sat" : "");
	fill_to(s, 26);
	s << " ";

	print_dst(s, n.bc);
	for (int k = 0; k < n.bc.op_ptr->src_count; ++k) {
		s << (k ? ", " : ",  ");
		print_src(s, n.bc, k);
	}

	if (n.bc.bank_swizzle) {
		fill_to(s, 55);
		if (n.bc.slot == SLOT_TRANS)
			s << "  " << scl_bs[n.bc.bank_swizzle];
		else
			s << "  " << vec_bs[n.bc.bank_swizzle];
	}

	sblog << s.str() << "\n";
}
Example #2
0
void ntp_setup(void)
{
    tv_t tv;
    tz_t tz;
	time_t sec;
	struct ip_info getinfo;


	// Wait until we have an IP address before we set the time
    if(!network_init)
		return;

	if(ntp_init == 0)
    {
        ip_addr_t *addr = (ip_addr_t *)safecalloc(sizeof(ip_addr_t),1);

		// form pool.ntp.org
		ipaddr_aton("206.108.0.131", addr);
		sntp_setserver(1,addr);
		ipaddr_aton("167.114.204.238", addr);
		sntp_setserver(2,addr);

#if 0
		// Alternate time setting if the local router does NTP
		if(wifi_get_ip_info(0, &getinfo))
		{
			printf("NTP:0 GW: %s\n", ipv4_2str(getinfo.gw.addr));
			printf("NTP:0 IP: %s\n", ipv4_2str(getinfo.ip.addr));
			sntp_setserver(1, & getinfo.gw);
			sntp_setserver(2, & getinfo.ip);
		}
		else
		{
			printf("NTP:0 failed to get GW address\n");
			return;
		}
#endif

        if( sntp_set_timezone(0) )
		{
			printf("NTP: set_timeone OK\n");
			sntp_init();
            safefree(addr);
		    ntp_init = 1;
            printf("NTP:1\n");
		}
		else
		{
			printf("NTP: set_timeone Failed\n");
		}
    }

	if(ntp_init == 1)
	{
		// they hard coded it to +8 hours from GMT
		if( (sec = sntp_get_current_timestamp()) > 10 )
		{
			sntp_stop();
			ntp_init = 2;
		}
	}
	if(ntp_init == 2)
	{
		time_t s;

		tm_t *p;

		printf("NTP:2\n");

		// they return GMT + 8
        // sec = sec - (8UL * 3600UL);

        tv.tv_sec = sec;
		printf("ntp_init: %s\n", asctime(gmtime(&sec)));
		printf("ntp_init: %s\n", ctime_gm(&sec));

        tv.tv_usec = 0;
        tz.tz_minuteswest = 300;
		tz.tz_dsttime = 0;

        settimeofday(&tv, &tz);

        printf("SEC:%ld\n",sec);
        printf("TIME:%s\n", ctime(&sec));
		printf("Zone: %d\n", (int) sntp_get_timezone());
		ntp_init = 3;

		set_dst(tv.tv_sec);

		print_dst_gmt();
		print_dst();

		p = gmtime(&tv.tv_sec);
		mktime(p);
		printf("Localtime: %s\n", asctime(p));
    }
}