2 * (C) Copyright 2002-2009
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 /* 'inline' - We have to do it fast */
27 static inline void mdm_readline(char *buf, int bufsiz)
50 return; /* sanity check */
59 extern void dbg(const char *fmt, ...);
65 extern void enable_putc(void);
66 extern int hwflow_onoff(int);
68 enable_putc(); /* enable serial_putc() */
71 init_str = getenv("mdm_flow_control");
72 if (init_str && (strcmp(init_str, "rts/cts") == 0))
79 sprintf(env_str, "mdm_init%d", i);
80 if ((init_str = getenv(env_str)) != NULL) {
81 serial_puts(init_str);
84 mdm_readline(console_buffer, CONFIG_SYS_CBSIZE);
85 dbg("ini%d: [%s]", i, console_buffer);
87 if ((strcmp(console_buffer, "OK") == 0) ||
88 (strcmp(console_buffer, "ERROR") == 0)) {
89 dbg("ini%d: cmd done", i);
91 } else /* in case we are originating call ... */
92 if (strncmp(console_buffer, "CONNECT", 7) == 0) {
93 dbg("ini%d: connect", i);
98 break; /* no init string - stop modem init */
105 /* final stage - wait for connect */
106 for(;i > 1;) { /* if 'i' > 1 - wait for connection
107 message from modem */
108 mdm_readline(console_buffer, CONFIG_SYS_CBSIZE);
109 dbg("ini_f: [%s]", console_buffer);
110 if (strncmp(console_buffer, "CONNECT", 7) == 0) {
111 dbg("ini_f: connected");