cfsetospeed(&tio, baudrate);
cfsetispeed(&tio, baudrate);
tcsetattr(serial_fd, TCSANOW, &tio);
-
+
return 0;
}
int nb = 0;
unsigned int count = 0;
unsigned int loops = 0; /* Used to create a timeout */
-
+
if (min_read > buf_size) {
printf("serial_read: buffer too small for min read value.\n");
return -3;
}
if (trace_on == 2) {
isp_dump((unsigned char*)(&buf[count]), nb);
- }
+ }
count += nb;
} while (count < min_read);
while (pos < orig_size) {
unsigned int line_length = orig_size - pos;
unsigned int i = 0;
-
+
/* Start with line length */
if (line_length > LINE_DATA_LENGTH_MAX) {
line_length = LINE_DATA_LENGTH_MAX;
}
dest[new_size] = line_length + UUENCODE_ADDED_VAL;
new_size++;
-
+
/* Encode line */
while (i < line_length) {
uint32_t int_triplet = 0;
int j = 0;
-
+
/* Get original triplet (three bytes) */
for (j=0; j<3; j++) {
int_triplet |= ((src[pos + i + j] & 0xFF) << (8 * (2 - j)));
}
}
}
-
+
/* Find next line */
while ((src[pos] < UUENCODE_ADDED_VAL) && (pos < orig_size)) {
pos++;