#How to setup the serial ports inside the kernel source

Edit the file:

**arch/arm/mact-at91/board-sam9x5ek.c**

Inside the function **ek_map_io()** modify these lines: 

<pre class="prettyprint">
static void __init ek_map_io(void)
{
	/* Initialize processor and DBGU */
	cm_map_io();

	at91_register_uart(AT91SAM9X5_ID_USART0, 1, 0); // USART0 on ttyS1 (only Rx,Tx)
	at91_register_uart(AT91SAM9X5_ID_USART1, 2, 0); // USART0 on ttyS2 (only Rx,Tx)
	at91_register_uart(AT91SAM9X5_ID_USART2, 3, 0); // USART0 on ttyS3 (only Rx,Tx)
	at91_register_uart(AT91SAM9X5_ID_USART3, 4, 0); // USART0 on ttyS4 (only Rx,Tx)

	at91_set_A_periph(AT91_PIN_PA1, 1);  // Pull-up on RXD0 
	at91_set_A_periph(AT91_PIN_PA6, 1);  // Pull-up on RXD1 
	at91_set_A_periph(AT91_PIN_PA8, 1);  // Pull-up on RXD2 
	at91_set_A_periph(AT91_PIN_PC23, 1); // Pull-up on RXD3 
}
</pre>


Se il terzo parametro passato a **at91_register_uart** e' 0 vengono usati solo
i segnali TXD e RXD.

Se si specificano dei valori si attivano anche i criteri se previsti dall'hardware:

* ATMEL_UART_RTS
* ATMEL_UART_CTS

I due valori si possono mettere in or

Le istruzioni tipo: 	

<pre class="prettyprint">
at91_set_A_periph(AT91_PIN_PA1, 1);  // Pull-up on RXD0 
</pre>

le ho messe per attivare la resistenza di pull-up sull'RXD di ogni porta.

