Date: Thu, 24 May 2007 04:26:23 GMT From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 120296 for review Message-ID: <200705240426.l4O4QNB6016168@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=120296 Change 120296 by marcel@marcel_macbsd on 2007/05/24 04:25:21 Port to -CURRENT. Affected files ... .. //depot/projects/e500/sys/dev/uart/uart.h#2 edit .. //depot/projects/e500/sys/dev/uart/uart_dev_quicc.c#2 edit Differences ... ==== //depot/projects/e500/sys/dev/uart/uart.h#2 (text+ko) ==== @@ -65,6 +65,7 @@ struct uart_class; extern struct uart_class uart_ns8250_class __attribute__((weak)); +extern struct uart_class uart_quicc_class __attribute__((weak)); extern struct uart_class uart_sab82532_class __attribute__((weak)); extern struct uart_class uart_z8530_class __attribute__((weak)); ==== //depot/projects/e500/sys/dev/uart/uart_dev_quicc.c#2 (text+ko) ==== @@ -146,7 +146,7 @@ static void quicc_init(struct uart_bas *bas, int, int, int, int); static void quicc_term(struct uart_bas *bas); static void quicc_putc(struct uart_bas *bas, int); -static int quicc_poll(struct uart_bas *bas); +static int quicc_rxready(struct uart_bas *bas); static int quicc_getc(struct uart_bas *bas, struct mtx *); static struct uart_ops uart_quicc_ops = { @@ -154,7 +154,7 @@ .init = quicc_init, .term = quicc_term, .putc = quicc_putc, - .poll = quicc_poll, + .rxready = quicc_rxready, .getc = quicc_getc, }; @@ -195,30 +195,35 @@ static int quicc_poll(struct uart_bas *bas) { - volatile char *buf; - int c; - uint16_t sc, rb; + uint16_t rb; rb = quicc_read2(bas, QUICC_PRAM_SCC_RBASE(bas->chan - 1)); - if ((sc = quicc_read2(bas, rb)) & 0x8000) - return (-1); - - buf = (void *)quicc_read4(bas, rb + 4); - c = *buf; - quicc_write2(bas, rb, sc | 0x8000); - return (c); + return ((quicc_read2(bas, rb) & 0x8000) ? 0 : 1); } static int quicc_getc(struct uart_bas *bas, struct mtx *hwmtx) { + volatile char *buf; int c; + uint16_t rb, sc; - do { + uart_lock(hwmtx); + + rb = quicc_read2(bas, QUICC_PRAM_SCC_RBASE(bas->chan - 1)); + + while ((sc = quicc_read2(bas, rb)) & 0x8000) { + uart_unlock(hwmtx); + DELAY(4); uart_lock(hwmtx); - c = quicc_poll(bas); - uart_unlock(hwmtx); - } while (c == -1); + } + + buf = (void *)quicc_read4(bas, rb + 4); + c = *buf; + quicc_write(bas, rb, sc | 0x8000); + + uart_unlock(hwmtx); + return (c); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705240426.l4O4QNB6016168>
