|
|
1.1 ! root 1: #include <libc.h> ! 2: #include "crossbar.h" ! 3: ! 4: Crossbar::Crossbar(char *dkname, int n, int depth) ! 5: { ! 6: dial = dkname; ! 7: nouts = n; ! 8: nwires = depth; ! 9: fd = -1; ! 10: nextc = 0; ! 11: imap = 0; ! 12: } ! 13: ! 14: void ! 15: Crossbar::link(int ll, Crossbar *c, int l) ! 16: { ! 17: if(nextc) ! 18: fprint(2, "warning: redefining link from crossbar %s\n", dial); ! 19: froml = ll; ! 20: nextc = c; ! 21: nextl = l; ! 22: } ! 23: ! 24: int ! 25: Crossbar::map(int input, Crossbar **cp, int *ip) ! 26: { ! 27: int i, *oip = ip; ! 28: ! 29: if(fd < 0) ! 30: startup(); ! 31: if(imap == 0) ! 32: config(); ! 33: for(i = 0; i < nouts; i++) ! 34: if(imap[i] == input){ ! 35: if(nextc && (i == froml)){ ! 36: int k = nextc->map(nextl, cp, ip); ! 37: while(*cp) ! 38: cp++, ip++; ! 39: } else ! 40: *cp++ = this, *ip++ = i; ! 41: } ! 42: *cp = 0; ! 43: return(ip-oip); ! 44: } ! 45: ! 46: void ! 47: Crossbar::startup() ! 48: { ! 49: fprint(2, "no startup defined!!\n"); ! 50: abort(); ! 51: } ! 52: ! 53: void ! 54: Crossbar::config() ! 55: { ! 56: fprint(2, "no config defined!!\n"); ! 57: abort(); ! 58: } ! 59: ! 60: int ! 61: Crossbar::connect(int, Crossbar *, int, int) ! 62: { ! 63: fprint(2, "no connect defined!!\n"); ! 64: abort(); ! 65: return(0); ! 66: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.