aboutsummaryrefslogtreecommitdiff
path: root/converter/ps2_usb/config.h
diff options
context:
space:
mode:
Diffstat (limited to 'converter/ps2_usb/config.h')
-rw-r--r--converter/ps2_usb/config.h86
1 files changed, 46 insertions, 40 deletions
diff --git a/converter/ps2_usb/config.h b/converter/ps2_usb/config.h
index 1ad2bd1b4..c9bab1b07 100644
--- a/converter/ps2_usb/config.h
+++ b/converter/ps2_usb/config.h
@@ -40,6 +40,52 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
40) 40)
41 41
42 42
43//#define NO_SUSPEND_POWER_DOWN
44
45
46/*
47 * PS/2 Busywait
48 */
49#ifdef PS2_USE_BUSYWAIT
50#define PS2_CLOCK_PORT PORTD
51#define PS2_CLOCK_PIN PIND
52#define PS2_CLOCK_DDR DDRD
53#define PS2_CLOCK_BIT 5
54#define PS2_DATA_PORT PORTD
55#define PS2_DATA_PIN PIND
56#define PS2_DATA_DDR DDRD
57#define PS2_DATA_BIT 2
58#endif
59
60/*
61 * PS/2 Pin interrupt
62 */
63#ifdef PS2_USE_INT
64/* uses INT1 for clock line(ATMega32U4) */
65#define PS2_CLOCK_PORT PORTD
66#define PS2_CLOCK_PIN PIND
67#define PS2_CLOCK_DDR DDRD
68#define PS2_CLOCK_BIT 1
69#define PS2_DATA_PORT PORTD
70#define PS2_DATA_PIN PIND
71#define PS2_DATA_DDR DDRD
72#define PS2_DATA_BIT 2
73#define PS2_INT_INIT() do { \
74 EICRA |= ((1<<ISC11) | \
75 (0<<ISC10)); \
76} while (0)
77#define PS2_INT_ON() do { \
78 EIMSK |= (1<<INT1); \
79} while (0)
80#define PS2_INT_OFF() do { \
81 EIMSK &= ~(1<<INT1); \
82} while (0)
83#define PS2_INT_VECT INT1_vect
84#endif
85
86/*
87 * PS/2 USART
88 */
43#ifdef PS2_USE_USART 89#ifdef PS2_USE_USART
44#if defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) 90#if defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)
45/* XCK for clock line and RXD for data line */ 91/* XCK for clock line and RXD for data line */
@@ -51,7 +97,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
51#define PS2_DATA_PIN PIND 97#define PS2_DATA_PIN PIND
52#define PS2_DATA_DDR DDRD 98#define PS2_DATA_DDR DDRD
53#define PS2_DATA_BIT 2 99#define PS2_DATA_BIT 2
54
55/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */ 100/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
56/* set DDR of CLOCK as input to be slave */ 101/* set DDR of CLOCK as input to be slave */
57#define PS2_USART_INIT() do { \ 102#define PS2_USART_INIT() do { \
@@ -82,7 +127,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
82#define PS2_USART_RX_DATA UDR1 127#define PS2_USART_RX_DATA UDR1
83#define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1))) 128#define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1)))
84#define PS2_USART_RX_VECT USART1_RX_vect 129#define PS2_USART_RX_VECT USART1_RX_vect
85
86#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328P__) 130#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328P__)
87/* XCK for clock line and RXD for data line */ 131/* XCK for clock line and RXD for data line */
88#define PS2_CLOCK_PORT PORTD 132#define PS2_CLOCK_PORT PORTD
@@ -93,7 +137,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
93#define PS2_DATA_PIN PIND 137#define PS2_DATA_PIN PIND
94#define PS2_DATA_DDR DDRD 138#define PS2_DATA_DDR DDRD
95#define PS2_DATA_BIT 0 139#define PS2_DATA_BIT 0
96
97/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */ 140/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
98/* set DDR of CLOCK as input to be slave */ 141/* set DDR of CLOCK as input to be slave */
99#define PS2_USART_INIT() do { \ 142#define PS2_USART_INIT() do { \
@@ -127,41 +170,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
127#endif 170#endif
128#endif 171#endif
129 172
130
131#ifdef PS2_USE_INT
132/* uses INT1 for clock line(ATMega32U4) */
133#define PS2_CLOCK_PORT PORTD
134#define PS2_CLOCK_PIN PIND
135#define PS2_CLOCK_DDR DDRD
136#define PS2_CLOCK_BIT 5
137#define PS2_DATA_PORT PORTD
138#define PS2_DATA_PIN PIND
139#define PS2_DATA_DDR DDRD
140#define PS2_DATA_BIT 2
141
142#define PS2_INT_INIT() do { \
143 EICRA |= ((1<<ISC11) | \
144 (0<<ISC10)); \
145} while (0)
146#define PS2_INT_ON() do { \
147 EIMSK |= (1<<INT1); \
148} while (0)
149#define PS2_INT_OFF() do { \
150 EIMSK &= ~(1<<INT1); \
151} while (0)
152#define PS2_INT_VECT INT1_vect
153#endif
154
155
156#ifdef PS2_USE_BUSYWAIT
157#define PS2_CLOCK_PORT PORTD
158#define PS2_CLOCK_PIN PIND
159#define PS2_CLOCK_DDR DDRD
160#define PS2_CLOCK_BIT 5
161#define PS2_DATA_PORT PORTD
162#define PS2_DATA_PIN PIND
163#define PS2_DATA_DDR DDRD
164#define PS2_DATA_BIT 2
165#endif
166
167#endif 173#endif