void cc_init () { // remember SAR register contents (p2p source ID) cc_sar = cc[CC_SAR] & 0x0000ffff; // configure VIC slot -- don't enable yet! sark_vic_set (CC_SLOT, CC_TNF_INT, 0, cc_int_han); }
void timer_init (uint period) { // set up count-down mode, tc[T1_CONTROL] = 0xe2; // load time in microsecs, tc[T1_LOAD] = sark.cpu_clk * period; // and configure VIC slot sark_vic_set (TIMER_SLOT, TIMER1_INT, 1, timer_int_han); }
void event_register_pkt(uint queue_size, vic_slot slot) { if (queue_size <= 256 && (queue_size & (queue_size - 1)) == 0 && slot <= SLOT_MAX && vic[VIC_CNTL + slot] == 0) { event.pkt_queue = sark_alloc(queue_size, sizeof(pkt_t)); if (event.pkt_queue != NULL) { event.pkt_insert = 1; event.pkt_size = queue_size; sark_vic_set(slot, CC_TNF_INT, 0, txpkt_int_han); cc[CC_TCR] = PKT_MC; return; } } rt_error(RTE_PKT); }