summaryrefslogtreecommitdiffstats
path: root/converter
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2013-02-25 08:40:15 +0900
committertmk <nobody@nowhere>2013-02-25 14:14:46 +0900
commit308abf598d4cc19be3c5b137bbd13d18510a083a (patch)
tree8cc5d21272b79d4011734ee074479c2bb99e7fc8 /converter
parentea1ede83c36272ccaeb5e4d80efc3885edbb9209 (diff)
Fix software serial configure
Diffstat (limited to 'converter')
-rw-r--r--converter/pc98_usb/config.h23
-rw-r--r--converter/sun_usb/config.h68
2 files changed, 40 insertions, 51 deletions
diff --git a/converter/pc98_usb/config.h b/converter/pc98_usb/config.h
index 04ee5b1101..4f91c07ce4 100644
--- a/converter/pc98_usb/config.h
+++ b/converter/pc98_usb/config.h
@@ -69,11 +69,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define SERIAL_SOFT_RXD_PORT PORTD
#define SERIAL_SOFT_RXD_PIN PIND
#define SERIAL_SOFT_RXD_BIT 2
-#ifdef SERIAL_SOFT_LOGIC_NEGATIVE
- #define SERIAL_SOFT_RXD_READ() ~(SERIAL_SOFT_RXD_PIN&(1<<SERIAL_SOFT_RXD_BIT))
-#else
- #define SERIAL_SOFT_RXD_READ() (SERIAL_SOFT_RXD_PIN&(1<<SERIAL_SOFT_RXD_BIT))
-#endif
+#define SERIAL_SOFT_RXD_READ() (SERIAL_SOFT_RXD_PIN&(1<<SERIAL_SOFT_RXD_BIT))
/* RXD Interupt */
#define SERIAL_SOFT_RXD_VECT INT2_vect
#define SERIAL_SOFT_RXD_INIT() do { \
@@ -95,21 +91,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define SERIAL_SOFT_TXD_PORT PORTD
#define SERIAL_SOFT_TXD_PIN PIND
#define SERIAL_SOFT_TXD_BIT 3
-#ifdef SERIAL_SOFT_LOGIC_NEGATIVE
- #define SERIAL_SOFT_TXD_ON() do { \
- SERIAL_SOFT_TXD_PORT &= ~(1<<SERIAL_SOFT_TXD_BIT); \
- } while (0)
- #define SERIAL_SOFT_TXD_OFF() do { \
- SERIAL_SOFT_TXD_PORT |= (1<<SERIAL_SOFT_TXD_BIT); \
- } while (0)
-#else
- #define SERIAL_SOFT_TXD_ON() do { \
- SERIAL_SOFT_TXD_PORT |= (1<<SERIAL_SOFT_TXD_BIT); \
- } while (0)
- #define SERIAL_SOFT_TXD_OFF() do { \
- SERIAL_SOFT_TXD_PORT &= ~(1<<SERIAL_SOFT_TXD_BIT); \
- } while (0)
-#endif
+#define SERIAL_SOFT_TXD_HI() do { SERIAL_SOFT_TXD_PORT |= (1<<SERIAL_SOFT_TXD_BIT); } while (0)
+#define SERIAL_SOFT_TXD_LO() do { SERIAL_SOFT_TXD_PORT &= ~(1<<SERIAL_SOFT_TXD_BIT); } while (0)
#define SERIAL_SOFT_TXD_INIT() do { \
/* pin configuration: output */ \
SERIAL_SOFT_TXD_DDR |= (1<<SERIAL_SOFT_TXD_BIT); \
diff --git a/converter/sun_usb/config.h b/converter/sun_usb/config.h
index b4f0ff977a..65ce9daf61 100644
--- a/converter/sun_usb/config.h
+++ b/converter/sun_usb/config.h
@@ -43,40 +43,46 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* asynchronous, negative logic, 1200baud, no flow control
* 1-start bit, 8-data bit, non parity, 1-stop bit
*/
-#define SERIAL_BAUD 1200
-
-#define SERIAL_RXD_DDR DDRD
-#define SERIAL_RXD_PORT PORTD
-#define SERIAL_RXD_PIN PIND
-#define SERIAL_RXD_BIT 2
-#define SERIAL_RXD_VECT INT2_vect
-#define SERIAL_RXD_INIT() do { \
+#define SERIAL_SOFT_BAUD 1200
+#define SERIAL_SOFT_PARITY_NONE
+#define SERIAL_SOFT_BIT_ORDER_LSB
+#define SERIAL_SOFT_LOGIC_NEGATIVE
+/* RXD Port */
+#define SERIAL_SOFT_RXD_ENABLE
+#define SERIAL_SOFT_RXD_DDR DDRD
+#define SERIAL_SOFT_RXD_PORT PORTD
+#define SERIAL_SOFT_RXD_PIN PIND
+#define SERIAL_SOFT_RXD_BIT 2
+#define SERIAL_SOFT_RXD_VECT INT2_vect
+/* RXD Interupt */
+#define SERIAL_SOFT_RXD_INIT() do { \
/* pin configuration: input with pull-up */ \
- SERIAL_RXD_DDR &= ~(1<<SERIAL_RXD_BIT); \
- SERIAL_RXD_PORT |= (1<<SERIAL_RXD_BIT); \
- /* enable interrupt: INT2(rising edge) */ \
- EICRA |= ((1<<ISC21)|(1<<ISC20)); \
- EIMSK |= (1<<INT2); \
+ SERIAL_SOFT_RXD_DDR &= ~(1<<SERIAL_SOFT_RXD_BIT); \
+ SERIAL_SOFT_RXD_PORT |= (1<<SERIAL_SOFT_RXD_BIT); \
+ /* enable interrupt: INT2(rising edge) */ \
+ EICRA |= ((1<<ISC21)|(1<<ISC20)); \
+ EIMSK |= (1<<INT2); \
+ sei(); \
} while (0)
-#define SERIAL_RXD_INT_ENTER()
-#define SERIAL_RXD_INT_EXIT() do { \
- /* clear interrupt flag */ \
- EIFR = (1<<INTF2); \
+#define SERIAL_SOFT_RXD_INT_ENTER()
+#define SERIAL_SOFT_RXD_INT_EXIT() do { \
+ /* clear interrupt flag */ \
+ EIFR = (1<<INTF2); \
} while (0)
-#define SERIAL_RXD_READ() (~SERIAL_RXD_PIN&(1<<SERIAL_RXD_BIT))
-
-#define SERIAL_TXD_DDR DDRD
-#define SERIAL_TXD_PORT PORTD
-#define SERIAL_TXD_PIN PIND
-#define SERIAL_TXD_BIT 3
-/* negative logic */
-#define SERIAL_TXD_ON() do { SERIAL_TXD_PORT &= ~(1<<SERIAL_TXD_BIT); } while (0)
-#define SERIAL_TXD_OFF() do { SERIAL_TXD_PORT |= (1<<SERIAL_TXD_BIT); } while (0)
-#define SERIAL_TXD_INIT() do { \
- /* pin configuration: output */ \
- SERIAL_TXD_DDR |= (1<<SERIAL_TXD_BIT); \
- /* idle */ \
- SERIAL_TXD_ON(); \
+#define SERIAL_SOFT_RXD_READ() (SERIAL_SOFT_RXD_PIN&(1<<SERIAL_SOFT_RXD_BIT))
+/* TXD Port */
+#define SERIAL_SOFT_TXD_ENABLE
+#define SERIAL_SOFT_TXD_DDR DDRD
+#define SERIAL_SOFT_TXD_PORT PORTD
+#define SERIAL_SOFT_TXD_PIN PIND
+#define SERIAL_SOFT_TXD_BIT 3
+#define SERIAL_SOFT_TXD_HI() do { SERIAL_SOFT_TXD_PORT |= (1<<SERIAL_SOFT_TXD_BIT); } while (0)
+#define SERIAL_SOFT_TXD_LO() do { SERIAL_SOFT_TXD_PORT &= ~(1<<SERIAL_SOFT_TXD_BIT); } while (0)
+#define SERIAL_SOFT_TXD_INIT() do { \
+ /* pin configuration: output */ \
+ SERIAL_SOFT_TXD_DDR |= (1<<SERIAL_SOFT_TXD_BIT); \
+ /* idle */ \
+ SERIAL_SOFT_TXD_ON(); \
} while (0)
#endif