1/* 2 * ---------------------------------------------------------------------------- 3 * "THE BEER-WARE LICENSE" (Revision 42): 4 * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you 5 * can do whatever you want with this stuff. If we meet some day, and you think 6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp 7 * ---------------------------------------------------------------------------- 8 * --- 7 unchanged lines hidden (view full) --- 16 * The driver supports E1 mode with up to 31 channels. We send CRC4 but don't 17 * check it coming in. 18 * 19 * The FALC54 and MUNICH32X have far too many registers and weird modes for 20 * comfort, so I have not bothered typing it all into a "fooreg.h" file, 21 * you will (badly!) need the documentation anyway if you want to mess with 22 * this gadget. 23 * |
24 * $FreeBSD: head/sys/pci/if_mn.c 70159 2000-12-18 20:03:32Z julian $ |
25 */ 26 27/* 28 * Stuff to describe the MUNIC32X and FALC54 chips. 29 */ 30 31#define M32_CHAN 32 /* We have 32 channels */ 32#define M32_TS 32 /* We have 32 timeslots */ --- 149 unchanged lines hidden (view full) --- 182static ng_rcvmsg_t ngmn_rcvmsg; 183static ng_shutdown_t ngmn_shutdown; 184static ng_newhook_t ngmn_newhook; 185static ng_connect_t ngmn_connect; 186static ng_rcvdata_t ngmn_rcvdata; 187static ng_disconnect_t ngmn_disconnect; 188 189static struct ng_type mntypestruct = { |
190 NG_ABI_VERSION, |
191 NG_MN_NODE_TYPE, 192 NULL, 193 ngmn_constructor, 194 ngmn_rcvmsg, 195 ngmn_shutdown, 196 ngmn_newhook, 197 NULL, 198 ngmn_connect, --- 77 unchanged lines hidden (view full) --- 276static int 277ngmn_shutdown(node_p nodep) 278{ 279 280 return (EINVAL); 281} 282 283static int |
284ngmn_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, 285 struct ng_mesg **rptr, hook_p lasthook) |
286{ 287 struct softc *sc; |
288 struct ng_mesg *resp = NULL; |
289 struct schan *sch; 290 char *arg; 291 int pos, i; 292 293 sc = node->private; 294 295 if (msg->header.typecookie != NGM_GENERIC_COOKIE || |
296 rptr == NULL || /* temporary */ |
297 msg->header.cmd != NGM_TEXT_STATUS) { |
298 if (rptr) 299 *rptr = NULL; |
300 FREE(msg, M_NETGRAPH); 301 return (EINVAL); 302 } |
303 NG_MKRESPONSE(resp, msg, sizeof(struct ng_mesg) + NG_TEXTRESPONSE, |
304 M_NOWAIT); |
305 if (resp == NULL) { |
306 FREE(msg, M_NETGRAPH); 307 return (ENOMEM); 308 } |
309 arg = (char *)resp->data; |
310 pos = 0; 311 pos += sprintf(pos + arg,"Framer status %b;\n", sc->framer_state, "\20" 312 "\40LOS\37AIS\36LFA\35RRA" 313 "\34AUXP\33NMF\32LMFA\31frs0.0" 314 "\30frs1.7\27TS16RA\26TS16LOS\25TS16AIS" 315 "\24TS16LFA\23frs1.2\22XLS\21XLO" 316 "\20RS1\17rsw.6\16RRA\15RY0" 317 "\14RY1\13RY2\12RY3\11RY4" --- 51 unchanged lines hidden (view full) --- 369 pos += sprintf(arg + pos, " Overflow: %lu\n", sch->overflow_error); 370 371 pos += sprintf(arg + pos, " Last error: %b Prev error: %b\n", 372 sch->last_error, "\20\7SHORT\5CRC\4MOD8\3LONG\2ABORT\1OVERRUN", 373 sch->prev_error, "\20\7SHORT\5CRC\4MOD8\3LONG\2ABORT\1OVERRUN"); 374 pos += sprintf(arg + pos, " Xmit bytes pending %ld\n", 375 sch->tx_pending); 376 } |
377 resp->header.arglen = pos + 1; 378 379 /* Take care of synchronous response, if any */ 380 if (rptr) 381 *rptr = resp; 382 else if (resp) 383 FREE(resp, M_NETGRAPH); /* Will eventually send the hard way */ 384 |
385 FREE(msg, M_NETGRAPH); 386 return (0); 387} 388 389static int 390ngmn_newhook(node_p node, hook_p hook, const char *name) 391{ 392 u_int32_t ts, chan; --- 989 unchanged lines hidden --- |