FreeCalypso > hg > freecalypso-sw
view loadtools/sercomm.c @ 923:10b4bed10192
gsm-fw/L1: fix for the DSP patch corruption bug
The L1 code we got from the LoCosto fw contains a feature for DSP CPU load
measurement. This feature is a LoCosto-ism, i.e., not applicable to earlier
DBB chips (Calypso) with their respective earlier DSP ROMs. Most of the
code dealing with that feature is conditionalized as #if (DSP >= 38),
but one spot was missed, and the MCU code was writing into an API word
dealing with this feature. In TCS211 this DSP API word happens to be
used by the DSP code patch, hence that write was corrupting the patched
DSP code.
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 19 Oct 2015 17:13:56 +0000 |
parents | f1df95eed62c |
children |
line wrap: on
line source
/* * This module handles the establishment of serial communication * with the target, i.e., the host-side termios stuff. */ #include <sys/types.h> #include <sys/file.h> #include <sys/ioctl.h> #include <termios.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include <unistd.h> #include "baudrate.h" char *target_ttydev; int target_fd; struct termios target_termios; struct baudrate baud_rate_table[] = { /* the first listed rate will be our default */ {"115200", B115200, 0}, {"57600", B57600, 1}, {"38400", B38400, 2}, {"19200", B19200, 4}, /* non-standard high baud rates "remapped" by CP2102 usb2serial IC */ {"812500", B921600, -1}, {"406250", B460800, -1}, {"203125", B230400, -1}, /* table search terminator */ {NULL, B0, -1}, }; struct baudrate *current_baud_rate; open_target_serial() { target_fd = open(target_ttydev, O_RDWR|O_NONBLOCK); if (target_fd < 0) { perror(target_ttydev); exit(1); } target_termios.c_iflag = IGNBRK; target_termios.c_oflag = 0; target_termios.c_cflag = CLOCAL|HUPCL|CREAD|CS8; target_termios.c_lflag = 0; target_termios.c_cc[VMIN] = 1; target_termios.c_cc[VTIME] = 0; /* start at B19200, as that's what we'll need to use initially */ cfsetispeed(&target_termios, B19200); cfsetospeed(&target_termios, B19200); if (tcsetattr(target_fd, TCSAFLUSH, &target_termios) < 0) { perror("initial tcsetattr on target"); exit(1); } return 0; } struct baudrate * find_baudrate_by_name(srch_name) char *srch_name; { struct baudrate *br; for (br = baud_rate_table; br->name; br++) if (!strcmp(br->name, srch_name)) break; if (br->name) return(br); else { fprintf(stderr, "error: baud rate \"%s\" not known\n", srch_name); return(NULL); } } switch_baud_rate(br) struct baudrate *br; { cfsetispeed(&target_termios, br->termios_code); cfsetospeed(&target_termios, br->termios_code); if (tcsetattr(target_fd, TCSAFLUSH, &target_termios) < 0) { perror("tcsetattr to switch baud rate"); exit(1); } current_baud_rate = br; }