00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __SUBCFG_H__
00022 #define __SUBCFG_H__
00023 #ifndef ASSEMBLER
00024 #include <stddef.h>
00025 #endif
00026
00027
00028
00029
00030
00031
00032 #define DIR_PORT PORTA
00033 #define DIR_DDR DDRA
00034 #define DIR PORTA4
00035
00036 #ifndef USBKEY
00037
00038
00039 #define LED_PORT PORTA
00040 #define LED_DDR DDRA
00041 #define RLED PORTA0
00042 #define YLED PORTA1
00043 #define LED_OFF( LEDN ) LED_PORT |= _BV( LEDN )
00044 #define LED_ON( LEDN ) LED_PORT &=~_BV( LEDN )
00045 #define IS_LED_ON(LEDN) (!(LED_PORT & _BV(LEDN)))
00046 #define LED_TGL( LEDN ) LED_PORT ^= _BV(LEDN)
00047
00048
00049 #define SW_PORT PORTA
00050 #define SW_PIN PINA
00051 #define SW1 PINA2
00052 #define SW2 PINA3
00053
00054
00055 #define DE_PORT PORTA
00056 #define DE_DDR DDRA
00057 #define DE_PIN PORTA7
00058 #define RE_PORT PORTA
00059 #define RE_DDR DDRA
00060 #define RE_PIN PORTA6
00061
00062 #else
00063
00064 #define SW1_PIN PINE
00065 #define SW1_BIT PORTE2
00066 #define LED_ON() (LED_PORT |= BIT(LED_BIT))
00067 #define LED_OFF() (LED_PORT &= ~BIT(LED_BIT))
00068 #define IS_LED_ON() (LED_PORT & BIT(LED_BIT))
00069
00070 #endif
00071
00072
00073 #define GPIO_PIN0 PINC
00074 #define GPIO_DDR0 DDRC
00075 #define GPIO_PORT0 PORTC
00076 #define GPIO_PIN1 PIND
00077 #define GPIO_DDR1 DDRD
00078 #define GPIO_PORT1 PORTD
00079 #define GPIO_PIN2 PINF
00080 #define GPIO_DDR2 DDRF
00081 #define GPIO_PORT2 PORTF
00082 #define GPIO_PIN3 PINE
00083 #define GPIO_DDR3 DDRE
00084 #define GPIO_PORT3 PORTE
00085
00086
00087 #define GPIOB_PIN0 PINB
00088 #define GPIOB_DDR0 DDRB
00089 #define GPIOB_PORT0 PORTC
00090
00091
00092 #define MDIO0_PORT PORTD
00093 #define MDIO0_DDR DDRD
00094 #define MDIO0_PINS PIND
00095 #define MDC0_PIN PORTD6
00096 #define MDIO0_PIN PORTD7
00097
00098 #define MDIO1_PORT PORTB
00099 #define MDIO1_DDR DDRB
00100 #define MDIO1_PINS PINB
00101 #define MDC1_PIN PORTB2
00102 #define MDIO1_PIN PORTB1
00103
00104
00105 #define LCD_RS_PORT PORTC
00106 #define LCD_RS_DDR DDRC
00107 #define LCD_RS_PIN PORTC7
00108
00109 #define LCD_E_PORT PORTC
00110 #define LCD_E_DDR DDRC
00111 #define LCD_E_PIN PORTC6
00112
00113 #define LCD_WDTH 4
00114 #define LCD_PORT 0
00115 #define LCD_D4_PORT PORTC
00116 #define LCD_D4_DDR DDRC
00117 #define LCD_D4_PIN PORTC3
00118 #define LCD_D5_PORT PORTC
00119 #define LCD_D5_DDR DDRC
00120 #define LCD_D5_PIN PORTC2
00121 #define LCD_D6_PORT PORTC
00122 #define LCD_D6_DDR DDRC
00123 #define LCD_D6_PIN PORTC1
00124 #define LCD_D7_PORT PORTC
00125 #define LCD_D7_DDR DDRC
00126 #define LCD_D7_PIN PORTC0
00127
00128 #define LCD_DATA_PORT PORTC
00129 #define LCD_DATA_DDR DDRC
00130
00131 #ifndef ASSEMBLER
00132
00133 #define MAX_STR_DESCR 4
00134 typedef struct
00135 {
00136 uint8_t bLength;
00137 uint8_t bDescriptorType;
00138 uint16_t data[10];
00139 }sub_string_descr_t;
00140
00141 #if defined(_MSC_VER) && (_MSC_VER > 800)
00142 #pragma pack(push, 1)
00143 #endif
00144
00145 typedef struct
00146 {
00147 uint8_t lcd_w;
00148 uint8_t lcd_h;
00149 uint8_t serial;
00150 uint8_t buttons;
00151 uint16_t ir_car;
00152 }sub_vpd_t;
00153
00154 #if defined(_MSC_VER) && (_MSC_VER > 800)
00155 #pragma pack(pop)
00156 #endif
00157
00158 typedef struct
00159 {
00160 uint8_t st_ver;
00161 uint8_t bl_ver;
00162 uint8_t dev_descr[18];
00163 sub_string_descr_t string_descr[MAX_STR_DESCR];
00164 sub_vpd_t vpd;
00165 }sub_cfg_t ;
00166
00167 #endif
00168
00169
00170 #ifdef AVR
00171
00172 #define SUBCFG_ADDR ((uint32_t)(FLASHEND+1-256))
00173 #define SUBCFG_OFFSET(MEMBER) offsetof(sub_cfg_t, MEMBER)
00174
00175 #endif
00176
00177 #endif
00178