This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
Patches for use AT91SAM7S's DBGU-USART as USART2 in hal_dbg.c and at91 serial-driver under ...packages/devs
- From: "oliver munz @ s p e a g" <munz at speag dot ch>
- To: "Andrew Lunn" <andrew at lunn dot ch>, <ecos-patches at sourceware dot org>
- Date: Fri, 3 Mar 2006 15:19:07 +0100
- Subject: Patches for use AT91SAM7S's DBGU-USART as USART2 in hal_dbg.c and at91 serial-driver under ...packages/devs
- References: <20060110162533.GM5620@lunn.ch> <012e01c63c61$3b8bcdb0$5a188481@haus.hellmutstrasse.ch> <20060228123323.GH18806@lunn.ch> <014e01c63c69$dc198350$5a188481@haus.hellmutstrasse.ch> <20060228133951.GK18806@lunn.ch> <017101c63c72$23d57d90$5a188481@haus.hellmutstrasse.ch> <20060228170425.GN18806@lunn.ch> <01c001c63cab$7f14edb0$5a188481@haus.hellmutstrasse.ch> <20060228211551.GI19406@lunn.ch> <021101c63cb8$91c406f0$5a188481@haus.hellmutstrasse.ch> <20060303125725.GC4034@lunn.ch>
- Reply-to: "oliver munz @ s p e a g" <munz at speag dot ch>
This patch allows to use the DBGU-USART of the AT91SAM-Family as /dev/ser2
and so on.
Description:
1. DMA-Enable:
Index: packages/devs/serial/arm/at91/current/src/at91_serial.c
+ HAL_WRITE_UINT32(base + AT91_US_PTCR, AT91_US_PTCR_RXTEN |
AT91_US_PTCR_TXTEN);
2. Call an other isr if the source wasn't the USART
+ cyg_uint32 retcode = 0;
3. Default 3 com-channels and debug on USART2
Index: packages/hal/arm/at91/at91sam7s/current/cdl/hal_arm_at91sam7s.cdl
- requires { CYGPKG_IO_SERIAL_ARM_AT91_SERIAL2 == 0 }
...
4. Define the CYGNUM_HAL_INTERRUPT_USART2 vector for hal_dbg.c and
at91-serial-driver
Index: packages/hal/arm/at91/at91sam7s/current/include/hal_platform_ints.h
+#define CYGNUM_HAL_INTERRUPT_USART2 CYGNUM_HAL_INTERRUPT_DBG /* Def...
5. Correct PLL Setting
Index: packages/hal/arm/at91/at91sam7s/current/include/hal_platform_setup.h
+ ldr r1,=(AT91_PMC_PLLR_USBDIV_1...
6. Define some AT91-Constats
Index: packages/hal/arm/at91/at91sam7s/current/include/plf_io.h
+#define AT91_US_PTCR_RXTEN (1 << 0)
7. Add port initialisation for the DBGU-USART
Index: packages/hal/arm/at91/at91sam7s/current/src/at91sam7s_misc.c
+ AT91_PIO_PSR_RXD0 | AT91_PIO_PSR_TXD0 |
AT91_PIO_PSR_DTXD);
8. Correct the flag-constant
+ AT91_PMC_PCER_SYS);
9. Add a AT91-constant
Index: packages/hal/arm/at91/var/current/include/var_io.h
+#define AT91_PMC_PCER_SYS (1 << 1) // SYSTEM + DEBUG
10. Correct the memory-allocation CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS
Index: packages/hal/arm/at91/var/current/src/hal_diag.c
-static channel_data_t at91_ser_channels[3] = {
+static channel_data_t
at91_ser_channels[CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS] = {
11. Correct the precompiler code for use 0..3 com-channels.
+#if CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS > 0
I tested this code and cyg_io_write() and diag_printf() worked from two
threads over the same USART2 (DBGU) alternating whitout any problem.
Oliver
Attachment:
USART2.diff
Description: Binary data