static void enter(struct inpcb *inp, struct socket *so, int state, char *proto) { struct netinfo *p; p = next_ns(); if (p == NULL) { error("Out of Memory!"); return; } p->nif_lport = inp->inp_lport; p->nif_fport = inp->inp_fport; p->nif_proto = proto; if (inp->inp_flags & INP_IPV6) { p->nif_laddr6 = inp->inp_laddr6; p->nif_faddr6 = inp->inp_faddr6; p->nif_family = AF_INET6; } else { p->nif_laddr = inp->inp_laddr; p->nif_faddr = inp->inp_faddr; p->nif_family = AF_INET; } p->nif_rcvcc = so->so_rcv.sb_cc; p->nif_sndcc = so->so_snd.sb_cc; p->nif_state = state; }
void SVIDEO_irq(void) { if (TIM_GetITStatus(TIM5, TIM_IT_Update) != RESET) { TIM_ClearITPendingBit(TIM5, TIM_IT_Update); // state++; // if (state & 1) { // next_ns(SHORT_PULSE_NS); // out(V0); // } else { // next_ns(SCANLINE_NS-SHORT_PULSE_NS); // out(V1_0); // } // // return; switch (state) { // vsync scanlines 1-5 case 0: case 2: case 4: case 6: case 8: next_ns(SCANLINE_NS/2-GAP_NS); out(V0); break; case 1: case 3: case 5: case 7: case 9: next_ns(GAP_NS); out(V0_3); break; case 10: case 12: case 14: case 16: case 18: next_ns(SHORT_PULSE_NS); out(V0); break; case 11: case 13: case 15: case 17: case 19: next_ns(SCANLINE_NS/2-SHORT_PULSE_NS); out(V0_3); scanline = 6; break; // empty top case 20: next_ns(HSYNC_NS); out(V0); break; case 21: next_ns(SCANLINE_NS-HSYNC_NS-FRONTPORCH_NS); out(V0_3); break; case 22: next_ns(FRONTPORCH_NS); out(V0); scanline++; if (scanline < 24) state = 20-1; break; // gfx case 23: next_ns(HSYNC_NS); out(V0); break; case 24: next_ns(BACKPORCH_NS); out(V0_3); break; case 25: next_ns(DISP_TEST_NS); if ((scanline & 0x7f) < 0x40) out(V1_0); else out(V0_3); break; case 26: next_ns(SCANLINE_NS-DISP_TEST_NS-HSYNC_NS-BACKPORCH_NS-FRONTPORCH_NS); if ((scanline & 0x7f) >= 0x40) out(V1_0); else out(V0_3); break; case 27: next_ns(FRONTPORCH_NS); out(V0); scanline++; if (scanline < 310) state = 23-1; break; case 28: case 30: case 32: case 34: case 36: case 38: next_ns(SHORT_PULSE_NS); out(V0); break; case 29: case 31: case 33: case 35: case 37: case 39: next_ns(SCANLINE_NS/2-SHORT_PULSE_NS); out(V0_3); break; } state++; if (state >= 40) { state = 0; scanline = 1; } #if 0 if (vline >= 243) { // vsync // if (hline < LEN_HSYNC) { // out(even ? V0_3 : V0); // } else { // out(even ? V0 : V0_3); // } if (hline == 0) { out(even ? V0_3 : V0); } else if (hline == LEN_HSYNC) { out(even ? V0 : V0_3); } } else { // hsync // if (hline < LEN_HSYNC) { // out(V0); // } else if (hline < LEN_BACK_PORCH + LEN_HSYNC) { // out(V0_3); // } else if (hline < LEN_ACTIVE + LEN_BACK_PORCH + LEN_HSYNC) { // // data // //out((hline & 1) ? V0_3 : V1_0); // out(V1_0); // } else { // // front porch // out(V0_3); // } if (hline == 0) { out(V0); } else if (hline == LEN_HSYNC) { out(V0_3); } else if (hline > LEN_HSYNC + LEN_BACK_PORCH && hline < LEN_ACTIVE + LEN_BACK_PORCH + LEN_HSYNC) { // data //out((hline & 1) ? V0_3 : V1_0); out(V1_0); } else { // front porch out(V0_3); } } if (hline == 0) { out(V0); } else if (hline == HCOUNT / 2) { out(V1_0); } hline++; if (hline >= HCOUNT) { hline = 0; out(V0_3); vline++; if (vline >= 262) { vline = 0; even = !even; } } #endif } }