bus.h (398B)
1 /* about passing messages around */ 2 3 #define BusBufMax 256 4 5 enum { 6 ChDebug, 7 ChMem, 8 }; 9 10 typedef struct Bus Bus; 11 typedef struct Msg Msg; 12 13 struct Bus { 14 unsigned int n; 15 Msg * buf[BusBufMax]; 16 }; 17 18 Bus * createbus(void); 19 void buspush(Bus *, Msg *); 20 Msg * buspull(Bus *, int); 21 22 struct Msg { 23 unsigned int src; 24 unsigned int dst; 25 Cell *dat; 26 }; 27 28 Msg * createmsg(int, int, Cell *); 29 void freemsg(Msg *); 30