avr_ms_board_drv.h

Go to the documentation of this file.
00001 /*This file is prepared for Doxygen automatic documentation generation.*/
00013 
00014 /* Copyright (c) 2009 Atmel Corporation. All rights reserved.
00015  *
00016  * Redistribution and use in source and binary forms, with or without
00017  * modification, are permitted provided that the following conditions are met:
00018  *
00019  * 1. Redistributions of source code must retain the above copyright notice,
00020  * this list of conditions and the following disclaimer.
00021  *
00022  * 2. Redistributions in binary form must reproduce the above copyright notice,
00023  * this list of conditions and the following disclaimer in the documentation
00024  * and/or other materials provided with the distribution.
00025  *
00026  * 3. The name of Atmel may not be used to endorse or promote products derived
00027  * from this software without specific prior written permission.
00028  *
00029  * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
00030  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00031  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE EXPRESSLY AND
00032  * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
00033  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00034  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00035  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00036  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00037  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00038  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00039  */
00040 
00041 
00042 // =======
00043 // GENERAL
00044 // =======
00045 #define   Avr_ms_board_init()       (Led_ms_init(), MMC_io_init(), Nandflash_init())
00046 
00047 // ====
00048 // LEDs
00049 // ====
00050 #define   Led_ms_init()             (DDRD |= 0xA0, PORTD &= ~0xA0)
00051 #define   Led_ms_write_on()         (PORTD |= 0x80)
00052 #define   Led_ms_write_off()        (PORTD &= ~0x80)
00053 #define   Led_ms_read_on()          (PORTD |= 0x20)
00054 #define   Led_ms_read_off()         (PORTD &= ~0x20)
00055 
00056 
00057 // =============
00058 // SD/MMC memory
00059 // =============
00060 #define   MMC_io_init()             (DDRB &= 0xF7, DDRB |= 0x07, PORTB |= 0x09)
00061 #ifndef   __GNUC__
00062   #define   MMC_CS_LINE             PORTB_Bit0
00063 #endif
00064 
00065 #define   MMC_CS_PORT               PORTB   // port
00066 #define   MMC_CS_PIN                0x00    // offset
00067 #define   Mmc_sd_select()           (MMC_CS_PORT &= ~(1<<MMC_CS_PIN))
00068 #define   Mmc_sd_unselect()         (MMC_CS_PORT |= (1<<MMC_CS_PIN))
00069 
00070 
00071 // ==================
00072 // NAND Flash devices
00073 // ==================
00074 
00075 // Default chip soldered
00076 #define   Nandflash_init()          (DDRC &= ~0xC0, DDRC |= 0x3F, PORTC |= 0x7C, PORTC &= ~0x03, \
00077                                      DDRB |= ~0x01, PORTB |= 0x01, DDRE |= 0x03, PORTE &= ~0x03, \
00078                                      PORTA = 0x00, DDRA |= 0xFF)
00079 #define   Nandflash_CLE_select()     (PORTC |=  0x01)    // CLE
00080 #define   Nandflash_CLE_unselect()   (PORTC &= ~0x01)
00081 #define   Nandflash_ALE_select()     (PORTC |=  0x02)    // ALE
00082 #define   Nandflash_ALE_unselect()   (PORTC &= ~0x02)
00083 #define   Nandflash0_select()        (PORTC &= ~0x04)    // CS.0
00084 #define   Nandflash0_unselect()      (PORTC |=  0x04)
00085 #define   Nandflash1_select()        (PORTC &= ~0x08)    // CS.1
00086 #define   Nandflash1_unselect()      (PORTC |=  0x08)
00087 #define   Nandflash_powerdown()     Nandflash_unselect()
00088 #define   Is_nandflash_ready()      (((PORTC&0x40) != 0) ? TRUE : FALSE)
00089 #define   Is_nandflash_busy()       (((PORTC&0x40) == 0) ? TRUE : FALSE)
00090 
00091 #define   Nandflash_wp_enable()     
00092 #define   Nandflash_wp_disable()    
00093 
00094 // Optional module
00095       // TBD (need update NF driver to support several memories)
00096       // don't forget R/B# internal pull-up
00097 
00098 // CS.1 : PC3
00099 // CS.2 : PC4
00100 // CS.3 : PC5
00101 
00102 
00103 
00104 
00105 
00106 
00107 
00108 
00109 
00110 
00111 
00112 
00113 

Generated on Wed Sep 23 09:17:02 2009 for ATMEL by  doxygen 1.5.3