serial.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  1. /*
  2. * (C) Copyright 2000
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  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.
  12. *
  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.
  17. *
  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,
  21. * MA 02111-1307 USA
  22. */
  23. #include <common.h>
  24. #include <commproc.h>
  25. #include <command.h>
  26. #include <watchdog.h>
  27. #if !defined(CONFIG_8xx_CONS_NONE) /* No Console at all */
  28. #if defined(CONFIG_8xx_CONS_SMC1) /* Console on SMC1 */
  29. #define SMC_INDEX 0
  30. #undef SCC_INDEX
  31. #define PROFF_SMC PROFF_SMC1
  32. #define CPM_CR_CH_SMC CPM_CR_CH_SMC1
  33. #elif defined(CONFIG_8xx_CONS_SMC2) /* Console on SMC2 */
  34. #define SMC_INDEX 1
  35. #undef SCC_INDEX
  36. #define PROFF_SMC PROFF_SMC2
  37. #define CPM_CR_CH_SMC CPM_CR_CH_SMC2
  38. #elif defined(CONFIG_8xx_CONS_SCC1) /* Console on SCC1 */
  39. #undef SMC_INDEX
  40. #define SCC_INDEX 0
  41. #define PROFF_SCC PROFF_SCC1
  42. #define CPM_CR_CH_SCC CPM_CR_CH_SCC1
  43. #elif defined(CONFIG_8xx_CONS_SCC2) /* Console on SCC2 */
  44. #undef SMC_INDEX
  45. #define SCC_INDEX 1
  46. #define PROFF_SCC PROFF_SCC2
  47. #define CPM_CR_CH_SCC CPM_CR_CH_SCC2
  48. #elif defined(CONFIG_8xx_CONS_SCC3) /* Console on SCC3 */
  49. #undef SMC_INDEX
  50. #define SCC_INDEX 2
  51. #define PROFF_SCC PROFF_SCC3
  52. #define CPM_CR_CH_SCC CPM_CR_CH_SCC3
  53. #elif defined(CONFIG_8xx_CONS_SCC4) /* Console on SCC4 */
  54. #undef SMC_INDEX
  55. #define SCC_INDEX 3
  56. #define PROFF_SCC PROFF_SCC4
  57. #define CPM_CR_CH_SCC CPM_CR_CH_SCC4
  58. #else /* CONFIG_8xx_CONS_? */
  59. #error "console not correctly defined"
  60. #endif
  61. static void serial_setdivisor(volatile cpm8xx_t *cp)
  62. {
  63. DECLARE_GLOBAL_DATA_PTR;
  64. int divisor=gd->cpu_clk/16/gd->baudrate;
  65. if(divisor/16>0x1000) {
  66. /* bad divisor, assume 50Mhz clock and 9600 baud */
  67. divisor=(50*1000*1000)/16/9600;
  68. }
  69. #ifdef CFG_BRGCLK_PRESCALE
  70. divisor /= CFG_BRGCLK_PRESCALE;
  71. #endif
  72. if(divisor<=0x1000) {
  73. cp->cp_brgc1=((divisor-1)<<1) | CPM_BRG_EN;
  74. } else {
  75. cp->cp_brgc1=((divisor/16-1)<<1) | CPM_BRG_EN | CPM_BRG_DIV16;
  76. }
  77. }
  78. #if (defined (CONFIG_8xx_CONS_SMC1) || defined (CONFIG_8xx_CONS_SMC2))
  79. /*
  80. * Minimal serial functions needed to use one of the SMC ports
  81. * as serial console interface.
  82. */
  83. int serial_init (void)
  84. {
  85. volatile immap_t *im = (immap_t *)CFG_IMMR;
  86. volatile smc_t *sp;
  87. volatile smc_uart_t *up;
  88. volatile cbd_t *tbdf, *rbdf;
  89. volatile cpm8xx_t *cp = &(im->im_cpm);
  90. #if (!defined(CONFIG_8xx_CONS_SMC1)) && (defined(CONFIG_MPC823) || defined(CONFIG_MPC850))
  91. volatile iop8xx_t *ip = (iop8xx_t *)&(im->im_ioport);
  92. #endif
  93. uint dpaddr;
  94. /* initialize pointers to SMC */
  95. sp = (smc_t *) &(cp->cp_smc[SMC_INDEX]);
  96. up = (smc_uart_t *) &cp->cp_dparam[PROFF_SMC];
  97. /* Disable transmitter/receiver.
  98. */
  99. sp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);
  100. /* Enable SDMA.
  101. */
  102. im->im_siu_conf.sc_sdcr = 1;
  103. /* clear error conditions */
  104. #ifdef CFG_SDSR
  105. im->im_sdma.sdma_sdsr = CFG_SDSR;
  106. #else
  107. im->im_sdma.sdma_sdsr = 0x83;
  108. #endif
  109. /* clear SDMA interrupt mask */
  110. #ifdef CFG_SDMR
  111. im->im_sdma.sdma_sdmr = CFG_SDMR;
  112. #else
  113. im->im_sdma.sdma_sdmr = 0x00;
  114. #endif
  115. #if defined(CONFIG_8xx_CONS_SMC1)
  116. /* Use Port B for SMC1 instead of other functions.
  117. */
  118. cp->cp_pbpar |= 0x000000c0;
  119. cp->cp_pbdir &= ~0x000000c0;
  120. cp->cp_pbodr &= ~0x000000c0;
  121. #else /* CONFIG_8xx_CONS_SMC2 */
  122. # if defined(CONFIG_MPC823) || defined(CONFIG_MPC850)
  123. /* Use Port A for SMC2 instead of other functions.
  124. */
  125. ip->iop_papar |= 0x00c0;
  126. ip->iop_padir &= ~0x00c0;
  127. ip->iop_paodr &= ~0x00c0;
  128. # else /* must be a 860 then */
  129. /* Use Port B for SMC2 instead of other functions.
  130. */
  131. cp->cp_pbpar |= 0x00000c00;
  132. cp->cp_pbdir &= ~0x00000c00;
  133. cp->cp_pbodr &= ~0x00000c00;
  134. # endif
  135. #endif
  136. #if defined(CONFIG_FADS) || defined(CONFIG_ADS)
  137. /* Enable RS232 */
  138. #if defined(CONFIG_8xx_CONS_SMC1)
  139. *((uint *) BCSR1) &= ~BCSR1_RS232EN_1;
  140. #else
  141. *((uint *) BCSR1) &= ~BCSR1_RS232EN_2;
  142. #endif
  143. #endif /* CONFIG_FADS */
  144. #if defined(CONFIG_RPXLITE) || defined(CONFIG_RPXCLASSIC)
  145. /* Enable Monitor Port Transceiver */
  146. *((uchar *) BCSR0) |= BCSR0_ENMONXCVR ;
  147. #endif /* CONFIG_RPXLITE */
  148. /* Set the physical address of the host memory buffers in
  149. * the buffer descriptors.
  150. */
  151. #ifdef CFG_ALLOC_DPRAM
  152. dpaddr = dpram_alloc_align (sizeof(cbd_t)*2 + 2, 8) ;
  153. #else
  154. dpaddr = CPM_SERIAL_BASE ;
  155. #endif
  156. /* Allocate space for two buffer descriptors in the DP ram.
  157. * For now, this address seems OK, but it may have to
  158. * change with newer versions of the firmware.
  159. * damm: allocating space after the two buffers for rx/tx data
  160. */
  161. rbdf = (cbd_t *)&cp->cp_dpmem[dpaddr];
  162. rbdf->cbd_bufaddr = (uint) (rbdf+2);
  163. rbdf->cbd_sc = 0;
  164. tbdf = rbdf + 1;
  165. tbdf->cbd_bufaddr = ((uint) (rbdf+2)) + 1;
  166. tbdf->cbd_sc = 0;
  167. /* Set up the uart parameters in the parameter ram.
  168. */
  169. up->smc_rbase = dpaddr;
  170. up->smc_tbase = dpaddr+sizeof(cbd_t);
  171. up->smc_rfcr = SMC_EB;
  172. up->smc_tfcr = SMC_EB;
  173. #if defined(CONFIG_MBX)
  174. board_serial_init();
  175. #endif /* CONFIG_MBX */
  176. /* Set UART mode, 8 bit, no parity, one stop.
  177. * Enable receive and transmit.
  178. */
  179. sp->smc_smcmr = smcr_mk_clen(9) | SMCMR_SM_UART;
  180. /* Mask all interrupts and remove anything pending.
  181. */
  182. sp->smc_smcm = 0;
  183. sp->smc_smce = 0xff;
  184. /* Set up the baud rate generator.
  185. */
  186. serial_setbrg ();
  187. /* Make the first buffer the only buffer.
  188. */
  189. tbdf->cbd_sc |= BD_SC_WRAP;
  190. rbdf->cbd_sc |= BD_SC_EMPTY | BD_SC_WRAP;
  191. /* Single character receive.
  192. */
  193. up->smc_mrblr = 1;
  194. up->smc_maxidl = 0;
  195. /* Initialize Tx/Rx parameters.
  196. */
  197. while (cp->cp_cpcr & CPM_CR_FLG) /* wait if cp is busy */
  198. ;
  199. cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_SMC, CPM_CR_INIT_TRX) | CPM_CR_FLG;
  200. while (cp->cp_cpcr & CPM_CR_FLG) /* wait if cp is busy */
  201. ;
  202. /* Enable transmitter/receiver.
  203. */
  204. sp->smc_smcmr |= SMCMR_REN | SMCMR_TEN;
  205. return (0);
  206. }
  207. void
  208. serial_setbrg (void)
  209. {
  210. volatile immap_t *im = (immap_t *)CFG_IMMR;
  211. volatile cpm8xx_t *cp = &(im->im_cpm);
  212. /* Set up the baud rate generator.
  213. * See 8xx_io/commproc.c for details.
  214. *
  215. * Wire BRG1 to SMCx
  216. */
  217. cp->cp_simode = 0x00000000;
  218. serial_setdivisor(cp);
  219. }
  220. #ifdef CONFIG_MODEM_SUPPORT
  221. void disable_putc(void)
  222. {
  223. DECLARE_GLOBAL_DATA_PTR;
  224. gd->be_quiet = 1;
  225. }
  226. void enable_putc(void)
  227. {
  228. DECLARE_GLOBAL_DATA_PTR;
  229. gd->be_quiet = 0;
  230. }
  231. #endif
  232. void
  233. serial_putc(const char c)
  234. {
  235. volatile cbd_t *tbdf;
  236. volatile char *buf;
  237. volatile smc_uart_t *up;
  238. volatile immap_t *im = (immap_t *)CFG_IMMR;
  239. volatile cpm8xx_t *cpmp = &(im->im_cpm);
  240. #ifdef CONFIG_MODEM_SUPPORT
  241. DECLARE_GLOBAL_DATA_PTR;
  242. if (gd->be_quiet)
  243. return;
  244. #endif
  245. if (c == '\n')
  246. serial_putc ('\r');
  247. up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_SMC];
  248. tbdf = (cbd_t *)&cpmp->cp_dpmem[up->smc_tbase];
  249. /* Wait for last character to go.
  250. */
  251. buf = (char *)tbdf->cbd_bufaddr;
  252. *buf = c;
  253. tbdf->cbd_datlen = 1;
  254. tbdf->cbd_sc |= BD_SC_READY;
  255. __asm__("eieio");
  256. while (tbdf->cbd_sc & BD_SC_READY) {
  257. WATCHDOG_RESET ();
  258. __asm__("eieio");
  259. }
  260. }
  261. int
  262. serial_getc(void)
  263. {
  264. volatile cbd_t *rbdf;
  265. volatile unsigned char *buf;
  266. volatile smc_uart_t *up;
  267. volatile immap_t *im = (immap_t *)CFG_IMMR;
  268. volatile cpm8xx_t *cpmp = &(im->im_cpm);
  269. unsigned char c;
  270. up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_SMC];
  271. rbdf = (cbd_t *)&cpmp->cp_dpmem[up->smc_rbase];
  272. /* Wait for character to show up.
  273. */
  274. buf = (unsigned char *)rbdf->cbd_bufaddr;
  275. while (rbdf->cbd_sc & BD_SC_EMPTY)
  276. WATCHDOG_RESET ();
  277. c = *buf;
  278. rbdf->cbd_sc |= BD_SC_EMPTY;
  279. return(c);
  280. }
  281. int
  282. serial_tstc()
  283. {
  284. volatile cbd_t *rbdf;
  285. volatile smc_uart_t *up;
  286. volatile immap_t *im = (immap_t *)CFG_IMMR;
  287. volatile cpm8xx_t *cpmp = &(im->im_cpm);
  288. up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_SMC];
  289. rbdf = (cbd_t *)&cpmp->cp_dpmem[up->smc_rbase];
  290. return(!(rbdf->cbd_sc & BD_SC_EMPTY));
  291. }
  292. #else /* ! CONFIG_8xx_CONS_SMC1, CONFIG_8xx_CONS_SMC2 */
  293. int serial_init (void)
  294. {
  295. volatile immap_t *im = (immap_t *)CFG_IMMR;
  296. volatile scc_t *sp;
  297. volatile scc_uart_t *up;
  298. volatile cbd_t *tbdf, *rbdf;
  299. volatile cpm8xx_t *cp = &(im->im_cpm);
  300. uint dpaddr;
  301. #if (SCC_INDEX != 2) || !defined(CONFIG_MPC850)
  302. volatile iop8xx_t *ip = (iop8xx_t *)&(im->im_ioport);
  303. #endif
  304. /* initialize pointers to SCC */
  305. sp = (scc_t *) &(cp->cp_scc[SCC_INDEX]);
  306. up = (scc_uart_t *) &cp->cp_dparam[PROFF_SCC];
  307. #if defined(CONFIG_LWMON) && defined(CONFIG_8xx_CONS_SCC2)
  308. { /* Disable Ethernet, enable Serial */
  309. uchar c;
  310. c = pic_read (0x61);
  311. c &= ~0x40; /* enable COM3 */
  312. c |= 0x80; /* disable Ethernet */
  313. pic_write (0x61, c);
  314. /* enable RTS2 */
  315. cp->cp_pbpar |= 0x2000;
  316. cp->cp_pbdat |= 0x2000;
  317. cp->cp_pbdir |= 0x2000;
  318. }
  319. #endif /* CONFIG_LWMON */
  320. /* Disable transmitter/receiver.
  321. */
  322. sp->scc_gsmrl &= ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
  323. #if (SCC_INDEX == 2) && defined(CONFIG_MPC850)
  324. /*
  325. * The MPC850 has SCC3 on Port B
  326. */
  327. cp->cp_pbpar |= 0x06;
  328. cp->cp_pbdir &= ~0x06;
  329. cp->cp_pbodr &= ~0x06;
  330. #elif (SCC_INDEX < 2) || !defined(CONFIG_IP860)
  331. /*
  332. * Standard configuration for SCC's is on Part A
  333. */
  334. ip->iop_papar |= ((3 << (2 * SCC_INDEX)));
  335. ip->iop_padir &= ~((3 << (2 * SCC_INDEX)));
  336. ip->iop_paodr &= ~((3 << (2 * SCC_INDEX)));
  337. #else
  338. /*
  339. * The IP860 has SCC3 and SCC4 on Port D
  340. */
  341. ip->iop_pdpar |= ((3 << (2 * SCC_INDEX)));
  342. #endif
  343. /* Allocate space for two buffer descriptors in the DP ram.
  344. */
  345. #ifdef CFG_ALLOC_DPRAM
  346. dpaddr = dpram_alloc_align (sizeof(cbd_t)*2 + 2, 8) ;
  347. #else
  348. dpaddr = CPM_SERIAL_BASE ;
  349. #endif
  350. /* Enable SDMA.
  351. */
  352. im->im_siu_conf.sc_sdcr = 0x0001;
  353. /* Set the physical address of the host memory buffers in
  354. * the buffer descriptors.
  355. */
  356. rbdf = (cbd_t *)&cp->cp_dpmem[dpaddr];
  357. rbdf->cbd_bufaddr = (uint) (rbdf+2);
  358. rbdf->cbd_sc = 0;
  359. tbdf = rbdf + 1;
  360. tbdf->cbd_bufaddr = ((uint) (rbdf+2)) + 1;
  361. tbdf->cbd_sc = 0;
  362. /* Set up the baud rate generator.
  363. */
  364. serial_setbrg ();
  365. /* Set up the uart parameters in the parameter ram.
  366. */
  367. up->scc_genscc.scc_rbase = dpaddr;
  368. up->scc_genscc.scc_tbase = dpaddr+sizeof(cbd_t);
  369. /* Initialize Tx/Rx parameters.
  370. */
  371. while (cp->cp_cpcr & CPM_CR_FLG) /* wait if cp is busy */
  372. ;
  373. cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_SCC, CPM_CR_INIT_TRX) | CPM_CR_FLG;
  374. while (cp->cp_cpcr & CPM_CR_FLG) /* wait if cp is busy */
  375. ;
  376. up->scc_genscc.scc_rfcr = SCC_EB | 0x05;
  377. up->scc_genscc.scc_tfcr = SCC_EB | 0x05;
  378. up->scc_genscc.scc_mrblr = 1; /* Single character receive */
  379. up->scc_maxidl = 0; /* disable max idle */
  380. up->scc_brkcr = 1; /* send one break character on stop TX */
  381. up->scc_parec = 0;
  382. up->scc_frmec = 0;
  383. up->scc_nosec = 0;
  384. up->scc_brkec = 0;
  385. up->scc_uaddr1 = 0;
  386. up->scc_uaddr2 = 0;
  387. up->scc_toseq = 0;
  388. up->scc_char1 = 0x8000;
  389. up->scc_char2 = 0x8000;
  390. up->scc_char3 = 0x8000;
  391. up->scc_char4 = 0x8000;
  392. up->scc_char5 = 0x8000;
  393. up->scc_char6 = 0x8000;
  394. up->scc_char7 = 0x8000;
  395. up->scc_char8 = 0x8000;
  396. up->scc_rccm = 0xc0ff;
  397. /* Set low latency / small fifo.
  398. */
  399. sp->scc_gsmrh = SCC_GSMRH_RFW;
  400. /* Set SCC(x) clock mode to 16x
  401. * See 8xx_io/commproc.c for details.
  402. *
  403. * Wire BRG1 to SCCn
  404. */
  405. /* Set UART mode, clock divider 16 on Tx and Rx
  406. */
  407. sp->scc_gsmrl |=
  408. (SCC_GSMRL_MODE_UART | SCC_GSMRL_TDCR_16 | SCC_GSMRL_RDCR_16);
  409. sp->scc_psmr |= SCU_PSMR_CL;
  410. /* Mask all interrupts and remove anything pending.
  411. */
  412. sp->scc_sccm = 0;
  413. sp->scc_scce = 0xffff;
  414. sp->scc_dsr = 0x7e7e;
  415. sp->scc_psmr = 0x3000;
  416. /* Make the first buffer the only buffer.
  417. */
  418. tbdf->cbd_sc |= BD_SC_WRAP;
  419. rbdf->cbd_sc |= BD_SC_EMPTY | BD_SC_WRAP;
  420. /* Enable transmitter/receiver.
  421. */
  422. sp->scc_gsmrl |= (SCC_GSMRL_ENR | SCC_GSMRL_ENT);
  423. return (0);
  424. }
  425. void
  426. serial_setbrg (void)
  427. {
  428. volatile immap_t *im = (immap_t *)CFG_IMMR;
  429. volatile cpm8xx_t *cp = &(im->im_cpm);
  430. /* Set up the baud rate generator.
  431. * See 8xx_io/commproc.c for details.
  432. *
  433. * Wire BRG1 to SCCx
  434. */
  435. cp->cp_sicr &= ~(0x000000FF << (8 * SCC_INDEX));
  436. serial_setdivisor(cp);
  437. }
  438. void
  439. serial_putc(const char c)
  440. {
  441. volatile cbd_t *tbdf;
  442. volatile char *buf;
  443. volatile scc_uart_t *up;
  444. volatile immap_t *im = (immap_t *)CFG_IMMR;
  445. volatile cpm8xx_t *cpmp = &(im->im_cpm);
  446. if (c == '\n')
  447. serial_putc ('\r');
  448. up = (scc_uart_t *)&cpmp->cp_dparam[PROFF_SCC];
  449. tbdf = (cbd_t *)&cpmp->cp_dpmem[up->scc_genscc.scc_tbase];
  450. /* Wait for last character to go.
  451. */
  452. buf = (char *)tbdf->cbd_bufaddr;
  453. *buf = c;
  454. tbdf->cbd_datlen = 1;
  455. tbdf->cbd_sc |= BD_SC_READY;
  456. __asm__("eieio");
  457. while (tbdf->cbd_sc & BD_SC_READY) {
  458. __asm__("eieio");
  459. WATCHDOG_RESET ();
  460. }
  461. }
  462. int
  463. serial_getc(void)
  464. {
  465. volatile cbd_t *rbdf;
  466. volatile unsigned char *buf;
  467. volatile scc_uart_t *up;
  468. volatile immap_t *im = (immap_t *)CFG_IMMR;
  469. volatile cpm8xx_t *cpmp = &(im->im_cpm);
  470. unsigned char c;
  471. up = (scc_uart_t *)&cpmp->cp_dparam[PROFF_SCC];
  472. rbdf = (cbd_t *)&cpmp->cp_dpmem[up->scc_genscc.scc_rbase];
  473. /* Wait for character to show up.
  474. */
  475. buf = (unsigned char *)rbdf->cbd_bufaddr;
  476. while (rbdf->cbd_sc & BD_SC_EMPTY)
  477. WATCHDOG_RESET ();
  478. c = *buf;
  479. rbdf->cbd_sc |= BD_SC_EMPTY;
  480. return(c);
  481. }
  482. int
  483. serial_tstc()
  484. {
  485. volatile cbd_t *rbdf;
  486. volatile scc_uart_t *up;
  487. volatile immap_t *im = (immap_t *)CFG_IMMR;
  488. volatile cpm8xx_t *cpmp = &(im->im_cpm);
  489. up = (scc_uart_t *)&cpmp->cp_dparam[PROFF_SCC];
  490. rbdf = (cbd_t *)&cpmp->cp_dpmem[up->scc_genscc.scc_rbase];
  491. return(!(rbdf->cbd_sc & BD_SC_EMPTY));
  492. }
  493. #endif /* CONFIG_8xx_CONS_SMC1, CONFIG_8xx_CONS_SMC2 */
  494. void
  495. serial_puts (const char *s)
  496. {
  497. while (*s) {
  498. serial_putc (*s++);
  499. }
  500. }
  501. #if (CONFIG_COMMANDS & CFG_CMD_KGDB)
  502. void
  503. kgdb_serial_init(void)
  504. {
  505. #if defined(CONFIG_8xx_CONS_SMC1)
  506. serial_printf("[on SMC1] ");
  507. #elif defined(CONFIG_8xx_CONS_SMC2)
  508. serial_printf("[on SMC2] ");
  509. #elif defined(CONFIG_8xx_CONS_SCC1)
  510. serial_printf("[on SCC1] ");
  511. #elif defined(CONFIG_8xx_CONS_SCC2)
  512. serial_printf("[on SCC2] ");
  513. #elif defined(CONFIG_8xx_CONS_SCC3)
  514. serial_printf("[on SCC3] ");
  515. #elif defined(CONFIG_8xx_CONS_SCC4)
  516. serial_printf("[on SCC4] ");
  517. #endif
  518. }
  519. void
  520. putDebugChar (int c)
  521. {
  522. serial_putc (c);
  523. }
  524. void
  525. putDebugStr (const char *str)
  526. {
  527. serial_puts (str);
  528. }
  529. int
  530. getDebugChar (void)
  531. {
  532. return serial_getc();
  533. }
  534. void
  535. kgdb_interruptible (int yes)
  536. {
  537. return;
  538. }
  539. #endif /* CFG_CMD_KGDB */
  540. #endif /* CONFIG_8xx_CONS_NONE */