Date: Wed, 29 Mar 2006 06:39:34 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 94228 for review Message-ID: <200603290639.k2T6dYG2008336@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=94228 Change 94228 by imp@imp_Speedy on 2006/03/29 06:38:36 Start to add DMA stuff, one weenie step at a time Affected files ... .. //depot/projects/arm/src/sys/arm/at91/uart_dev_at91usart.c#18 edit Differences ... ==== //depot/projects/arm/src/sys/arm/at91/uart_dev_at91usart.c#18 (text+ko) ==== @@ -45,6 +45,15 @@ #include "uart_if.h" +/* + * High-level UART interface. + */ +struct at91_usart_softc { + struct uart_softc base; + bus_dma_tag_t dmatag; /* bus dma tag for mbufs */ + bus_dmamap_t tx_map; +}; + #define DEFAULT_RCLK AT91C_MASTER_CLOCK #define RD4(bas, reg) \ @@ -283,10 +292,28 @@ static int at91_usart_bus_attach(struct uart_softc *sc) { + int err; + struct at91_usart_softc *atsc; + + atsc = (struct at91_usart_softc *)sc; + sc->sc_txfifosz = 128; /* Really 64k, but 128 seems a good number */ sc->sc_rxfifosz = 128; sc->sc_hwiflow = 0; - return (0); + + /* + * Allocate DMA tags and maps + */ + err = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT, + BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, 1, MCLBYTES, + BUS_DMA_ALLOCNOW, NULL, NULL, &atsc->dmatag); + if (err != 0) + goto errout; + err = bus_dmamap_create(atsc->dmatag, 0, &atsc->tx_map); + if (err != 0) + goto errout; +errout:; + return (err); } static int at91_usart_bus_transmit(struct uart_softc *sc) @@ -430,7 +457,7 @@ struct uart_class at91_usart_class = { "at91_usart class", at91_usart_methods, - 1, + sizeof(struct at91_usart_softc), .uc_range = 8, .uc_rclk = DEFAULT_RCLK };
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603290639.k2T6dYG2008336>