FreeCalypso > hg > freecalypso-sw
comparison rvinterf/old/g23sh/sendsp.c @ 964:373af5f74e39
rvinterf: all retired stuff gathered under old
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Fri, 06 Nov 2015 23:22:47 +0000 |
parents | rvinterf/g23sh/sendsp.c@922efdd65dce |
children |
comparison
equal
deleted
inserted
replaced
963:d69d1e097b18 | 964:373af5f74e39 |
---|---|
1 /* | |
2 * g23sh system primitive sending command | |
3 */ | |
4 | |
5 #include <sys/types.h> | |
6 #include <stdio.h> | |
7 #include <string.h> | |
8 #include <strings.h> | |
9 #include <stdlib.h> | |
10 #include "pktmux.h" | |
11 #include "limits.h" | |
12 | |
13 void | |
14 cmd_sendsp(argc, argv) | |
15 char **argv; | |
16 { | |
17 char *stackdest, *primarg; | |
18 unsigned intlen; | |
19 u_char sendpkt[MAX_PKT_TO_TARGET+1]; | |
20 unsigned pktlen; | |
21 | |
22 stackdest = argv[1]; | |
23 primarg = argv[2]; | |
24 if (strlen(stackdest) > 4) { | |
25 printf( | |
26 "error: stack destination arg may not exceed 4 characters\n"); | |
27 return; | |
28 } | |
29 intlen = 12 + strlen(primarg); | |
30 pktlen = intlen + 4; | |
31 if (pktlen > MAX_PKT_TO_TARGET) { | |
32 printf("error: max pkt to target limit exceeded\n"); | |
33 return; | |
34 } | |
35 /* fill out the packet */ | |
36 sendpkt[0] = RVT_L23_HEADER; | |
37 sendpkt[1] = 0xB7; /* system prim */ | |
38 sendpkt[2] = intlen; | |
39 sendpkt[3] = intlen >> 8; | |
40 /* send zeros for the timestamp */ | |
41 sendpkt[4] = 0; | |
42 sendpkt[5] = 0; | |
43 sendpkt[6] = 0; | |
44 sendpkt[7] = 0; | |
45 /* as far as TI's sw is concerned, we are PCO */ | |
46 sendpkt[8] = 'P'; | |
47 sendpkt[9] = 'C'; | |
48 sendpkt[10] = 'O'; | |
49 sendpkt[11] = ' '; | |
50 sprintf(sendpkt + 12, "%-4s%s", stackdest, primarg); | |
51 /* send it! */ | |
52 send_pkt_to_target(sendpkt, pktlen); | |
53 } |