Patches for use AT91SAM7S's DBGU-USART as USART2 in hal_dbg.c and at91 serial-driver under ...packages/devs

oliver munz @ s p e a g munz@speag.ch
Fri Mar 3 14:17:00 GMT 2006


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: USART2.diff
Type: application/octet-stream
Size: 12411 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/ecos-patches/attachments/20060303/32d33dd9/attachment.obj>


More information about the Ecos-patches mailing list