FreeCalypso > hg > freecalypso-sw
comparison rvinterf/packettx.c @ 171:4d8e4c58df71
rvtdump: implemented Tx extension hack, compiles
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Wed, 20 Nov 2013 05:39:31 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
170:4b53bd08f345 | 171:4d8e4c58df71 |
---|---|
1 /* | |
2 * This module handles the lowest level of serial packet Tx | |
3 */ | |
4 | |
5 #include <sys/types.h> | |
6 #include <stdio.h> | |
7 #include <stdlib.h> | |
8 #include <unistd.h> | |
9 #include "pktmux.h" | |
10 #include "txpkt.h" | |
11 | |
12 extern int target_fd; | |
13 | |
14 send_pkt_to_target(pkt, pktlen) | |
15 u_char *pkt; | |
16 { | |
17 u_char buf[MAX_PKT_TO_TARGET*2+2]; | |
18 u_char *cp, *dp, *endp; | |
19 int c; | |
20 | |
21 endp = pkt + pktlen; | |
22 dp = buf; | |
23 *dp++ = STX; | |
24 for (cp = pkt; cp < endp; cp++) { | |
25 c = *cp; | |
26 if (c == STX || c == DLE) | |
27 *dp++ = DLE; | |
28 *dp++ = c; | |
29 } | |
30 *dp++ = STX; | |
31 write(target_fd, buf, dp - buf); | |
32 } |