Sistema l'errore da me commesso in fase di conversione...
[bertos.git] / hw / hw_tc520.h
1 /**
2  * \file
3  * <!--
4  * Copyright 2005 Develer S.r.l. (http://www.develer.com/)
5  * -->
6  *
7  * \version $Id$
8  *
9  * \brief TC520 hardware-specific definitions
10  *
11  * \version $Id$
12  * \author Francesco Sacchi <batt@develer.com>
13  */
14
15 #ifndef HW_TC520_H
16 #define HW_TC520_H
17
18 #include <cfg/compiler.h>
19 #include <avr/io.h>
20
21 #define CE_PIN   PE6
22 #define DV_PIN   PE5
23 #define LOAD_PIN PE3
24 #define READ_PIN PE4
25
26 #define TC520_DDR  DDRE
27 #define TC520_PORT PORTE
28 #define TC520_PIN  PINE
29
30 #define DV_HIGH() (TC520_PIN & BV(DV_PIN))
31 #define DV_LOW()  (!DV_HIGH())
32
33 #define CE_HIGH() (TC520_PORT |= BV(CE_PIN))
34 #define CE_LOW()  (TC520_PORT &= ~BV(CE_PIN))
35
36 #define LOAD_HIGH() (TC520_PORT |= BV(LOAD_PIN))
37 #define LOAD_LOW()  (TC520_PORT &= ~BV(LOAD_PIN))
38
39 #define READ_HIGH() (TC520_PORT |= BV(READ_PIN))
40 #define READ_LOW()  (TC520_PORT &= ~BV(READ_PIN))
41
42 #define TC520_HW_INIT \
43 do\
44 {\
45         TC520_PORT |= (BV(CE_PIN) | BV(LOAD_PIN) | BV(READ_PIN));\
46         TC520_DDR  |= (BV(CE_PIN) | BV(LOAD_PIN) | BV(READ_PIN));\
47         TC520_DDR  &= ~BV(DV_PIN);\
48 }\
49 while(0)
50
51 #endif /* HW_TC520_H */