00001
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 #define Avr_ms_board_init() (Led_ms_init(), MMC_io_init(), Nandflash_init())
00046
00047
00048
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
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
00073
00074
00075
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
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113