=================================================================== RCS file: /cvs/funnyos/arch/sam7s64/config.c,v retrieving revision 1.10 retrieving revision 1.20 diff -u -r1.10 -r1.20 --- funnyos/arch/sam7s64/config.c 2007/11/24 15:13:33 1.10 +++ funnyos/arch/sam7s64/config.c 2008/01/07 20:29:21 1.20 @@ -1,5 +1,5 @@ /* - * $Id: config.c,v 1.10 2007/11/24 15:13:33 nbrk Exp $ + * $Id: config.c,v 1.20 2008/01/07 20:29:21 nbrk Exp $ */ #include #include @@ -17,8 +17,16 @@ extern struct driver saapbus_dr; extern struct driver sapio_dr; extern struct driver gpioled_dr; +extern struct driver saaic_dr; +extern struct driver sartt_dr; +extern struct driver gpiobtn_dr; +extern struct driver saspi_dr; +extern struct driver spisdmmc_dr; +extern struct driver sdmmc_dr; +extern struct driver gpio7seg_dr; +extern struct driver p64lcd_dr; +extern struct driver h44780_dr; - extern void (*putchar)(char); extern void sausart_early_putchar(char ch); @@ -30,12 +38,22 @@ */ struct attachinfo config_attachinfo[] = { /* child, parent, pminor, loc, intrno, flags */ - { "cpu" , "root", 0, 0, 0, 0 }, - { "saapbus","root", 0, 0, 0, 0 }, - { "sapio", "saapbus", 0, 0, 0, 0 }, - { "gpioled","sapio", 0, 17, 0, 0 }, - { "gpioled","sapio", 0, 18, 0, 0 }, - { NULL, NULL, 0, 0, 0, 0 } + { "cpu" , "root", 0, 0, -1, 0 }, + { "saapbus","root", 0, 0, -1, 0 }, + { "sapio", "saapbus", 0, 0, -1, 0 }, + { "gpioled","sapio", 0, 17, -1, 0 }, + { "gpioled","sapio", 0, 18, -1, 0 }, + { "gpiobtn","sapio", 0, 19, 0, 0 /*controls gpioled/0*/}, + { "gpiobtn","sapio", 0, 20, 30, 0 /*controls gpioled/1*/}, + { "gpio7seg","sapio", 0, 0, -1, 0 }, + { "p64lcd", "sapio", 0, 0, -1, 0 }, + { "h44780", "p64lcd", 0, 0, -1, 0 }, +// { "sartt", "saapbus", 0, 0, 1, 0 }, + { "saspi", "saapbus", 0, 0, 0, 0 }, + { "spisdmmc","saspi", 0, 0, 0, 0 }, + { "sdmmc", "spisdmmc", 0, 0, 0, 0 }, +// { "saaic", "saapbus", 0, 0, -1, 0 }, + { NULL, NULL, 0, 0, -1, 0 } }; @@ -49,6 +67,15 @@ { "saapbus" , &saapbus_dr, -1 }, { "sapio", &sapio_dr, -1 }, { "gpioled", &gpioled_dr, -1 }, + { "saaic", &saaic_dr, -1 }, + { "sartt", &sartt_dr, -1 }, + { "gpiobtn", &gpiobtn_dr, -1 }, + { "saspi", &saspi_dr, -1 }, + { "spisdmmc", &spisdmmc_dr, -1 }, + { "sdmmc", &sdmmc_dr, -1 }, + { "gpio7seg", &gpio7seg_dr, -1 }, + { "p64lcd", &p64lcd_dr, -1 }, + { "h44780", &h44780_dr, -1 }, { NULL, NULL, 0 } }; @@ -71,6 +98,9 @@ /* set FLASH to high-speed */ *AT91C_MC_FMR = AT91C_MC_FWS_0FWS; + /* enable user RESET (magic button on board) */ + *AT91C_RSTC_RMR = AT91C_RSTC_URSTEN | AT91C_RSTC_KEY; + /* * Initialize oscillators. * Taken from Atmel's examples. @@ -118,42 +148,31 @@ while(!(*AT91C_PMC_SR & AT91C_PMC_MCKRDY)) ; - /* enable clock to PIO and USART0 */ - *AT91C_PMC_PCER = AT91C_ID_PIOA | AT91C_ID_US0; + /* enable clock to all modules */ + *AT91C_PMC_PCER = AT91C_ALL_INT; - *AT91C_PIOA_PER = (1 << 17 | 1 << 18); - *AT91C_PIOA_OER = (1 << 17 | 1 << 18); - *AT91C_PIOA_CODR= (1 << 17 | 1 << 18); - /* initialize USART0 (we clock it in PMC above) */ - *AT91C_PIOA_PDR = AT91C_PA5_RXD0 | /* Enable RxD0 Pin */ - AT91C_PA6_TXD0; /* Enalbe TxD0 Pin */ + *AT91C_PIOA_PDR = AT91C_PA21_RXD1 | /* Enable RxD0 Pin */ + AT91C_PA22_TXD1; /* Enalbe TxD0 Pin */ - *AT91C_US0_CR = AT91C_US_RSTRX | /* Reset Receiver */ - AT91C_US_RSTTX | /* Reset Transmitter */ - AT91C_US_RXDIS | /* Receiver Disable */ - AT91C_US_TXDIS; /* Transmitter Disable */ - - *AT91C_US0_MR = AT91C_US_USMODE_NORMAL | /* Normal Mode */ + *AT91C_US1_MR = AT91C_US_USMODE_NORMAL | /* Normal Mode */ AT91C_US_CLKS_CLOCK | /* Clock = MCK */ AT91C_US_CHRL_8_BITS | /* 8-bit Data */ AT91C_US_PAR_NONE | /* No Parity */ AT91C_US_NBSTOP_1_BIT; /* 1 Stop Bit */ - *AT91C_US0_BRGR = 48054857 / 16 / 9600; /* Baud Rate Divisor */ + *AT91C_US1_BRGR = 48054857 / 16 / 9600; /* Baud Rate Divisor */ /* enable DMA transfers on USART0 */ - *AT91C_US0_PTCR = AT91C_PDC_TXTEN | AT91C_PDC_RXTEN; + *AT91C_US1_PTCR = AT91C_PDC_TXTEN | AT91C_PDC_RXTEN; - *AT91C_US0_CR = AT91C_US_RXEN | /* Receiver Enable */ + *AT91C_US1_CR = AT91C_US_RXEN | /* Receiver Enable */ AT91C_US_TXEN; /* Transmitter Enable */ /* redefine putchar */ putchar = sausart_early_putchar; -// putchar(0); -// putchar(0x46); -// putchar(0x46); + }