]>
git.ipfire.org Git - people/ms/u-boot.git/blob - common/modem.c
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 char console_buffer
[];
66 extern void enable_putc(void);
67 extern int hwflow_onoff(int);
69 enable_putc(); /* enable serial_putc() */
72 init_str
= getenv("mdm_flow_control");
73 if (init_str
&& (strcmp(init_str
, "rts/cts") == 0))
80 sprintf(env_str
, "mdm_init%d", i
);
81 if ((init_str
= getenv(env_str
)) != NULL
) {
82 serial_puts(init_str
);
85 mdm_readline(console_buffer
, CONFIG_SYS_CBSIZE
);
86 dbg("ini%d: [%s]", i
, console_buffer
);
88 if ((strcmp(console_buffer
, "OK") == 0) ||
89 (strcmp(console_buffer
, "ERROR") == 0)) {
90 dbg("ini%d: cmd done", i
);
92 } else /* in case we are originating call ... */
93 if (strncmp(console_buffer
, "CONNECT", 7) == 0) {
94 dbg("ini%d: connect", i
);
99 break; /* no init string - stop modem init */
106 /* final stage - wait for connect */
107 for(;i
> 1;) { /* if 'i' > 1 - wait for connection
108 message from modem */
109 mdm_readline(console_buffer
, CONFIG_SYS_CBSIZE
);
110 dbg("ini_f: [%s]", console_buffer
);
111 if (strncmp(console_buffer
, "CONNECT", 7) == 0) {
112 dbg("ini_f: connected");