diff options
author | Jens Arnold <amiconn@rockbox.org> | 2006-11-27 02:16:32 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2006-11-27 02:16:32 +0000 |
commit | 0e6dd7efcd21d48665b5a799fe081a75cdcb960f (patch) | |
tree | 9c0db844416a114adebb725f6172e38009b317f8 /firmware/drivers/serial.c | |
parent | e43f56b58d8540492d83b44abfdf4c758b0e74bf (diff) | |
download | rockbox-0e6dd7efcd21d48665b5a799fe081a75cdcb960f.tar.gz rockbox-0e6dd7efcd21d48665b5a799fe081a75cdcb960f.zip |
Moved archos button reading to target tree. * Cleanup of button.[ch]. * Deactivated serial remote code for recorder FM/V2 as there is no remote pin, saving ~500 bytes of code.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11612 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/serial.c')
-rw-r--r-- | firmware/drivers/serial.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/firmware/drivers/serial.c b/firmware/drivers/serial.c index 866d7616ed..142f67e609 100644 --- a/firmware/drivers/serial.c +++ b/firmware/drivers/serial.c | |||
@@ -33,7 +33,8 @@ | |||
33 | /* FIX: this doesn't work on iRiver or iPod yet */ | 33 | /* FIX: this doesn't work on iRiver or iPod yet */ |
34 | /* iFP7xx has no remote */ | 34 | /* iFP7xx has no remote */ |
35 | 35 | ||
36 | #ifndef HAVE_MMC /* MMC takes serial port 1, so don't mess with it */ | 36 | #if !defined(HAVE_FMADC) /* Recorder FM/V2 has no remote control pin */ \ |
37 | && !defined(HAVE_MMC) /* MMC takes serial port 1, so don't mess with it */ | ||
37 | 38 | ||
38 | /* Received byte identifiers */ | 39 | /* Received byte identifiers */ |
39 | #define PLAY 0xC1 | 40 | #define PLAY 0xC1 |
@@ -51,8 +52,8 @@ void serial_setup (void) | |||
51 | SMR1 = 0x00; | 52 | SMR1 = 0x00; |
52 | SCR1 = 0; | 53 | SCR1 = 0; |
53 | BRR1 = (FREQ/(32*9600))-1; | 54 | BRR1 = (FREQ/(32*9600))-1; |
54 | SSR1 &= 0; /* The status bits must be read before they are cleared, | 55 | and_b(0, &SSR1); /* The status bits must be read before they are cleared, |
55 | so we do an AND operation */ | 56 | so we do an AND operation */ |
56 | 57 | ||
57 | /* Let the hardware settle. The serial port needs to wait "at least | 58 | /* Let the hardware settle. The serial port needs to wait "at least |
58 | the interval required to transmit or receive one bit" before it | 59 | the interval required to transmit or receive one bit" before it |
@@ -75,7 +76,7 @@ int remote_control_rx(void) | |||
75 | 76 | ||
76 | /* Errors? Just clear'em. The receiver stops if we don't */ | 77 | /* Errors? Just clear'em. The receiver stops if we don't */ |
77 | if(SSR1 & (SCI_ORER | SCI_FER | SCI_PER)) { | 78 | if(SSR1 & (SCI_ORER | SCI_FER | SCI_PER)) { |
78 | SSR1 &= ~(SCI_ORER | SCI_FER | SCI_PER); | 79 | and_b(~(SCI_ORER | SCI_FER | SCI_PER), &SSR1); |
79 | last_valid_button = BUTTON_NONE; | 80 | last_valid_button = BUTTON_NONE; |
80 | last_was_error = true; | 81 | last_was_error = true; |
81 | return BUTTON_NONE; | 82 | return BUTTON_NONE; |
@@ -84,7 +85,7 @@ int remote_control_rx(void) | |||
84 | if(SSR1 & SCI_RDRF) { | 85 | if(SSR1 & SCI_RDRF) { |
85 | /* Read byte and clear the Rx Full bit */ | 86 | /* Read byte and clear the Rx Full bit */ |
86 | btn = RDR1; | 87 | btn = RDR1; |
87 | SSR1 &= ~SCI_RDRF; | 88 | and_b(~SCI_RDRF, &SSR1); |
88 | 89 | ||
89 | if(last_was_error) | 90 | if(last_was_error) |
90 | { | 91 | { |
@@ -93,38 +94,36 @@ int remote_control_rx(void) | |||
93 | } | 94 | } |
94 | else | 95 | else |
95 | { | 96 | { |
96 | #if CONFIG_KEYPAD != ONDIO_PAD | ||
97 | switch (btn) | 97 | switch (btn) |
98 | { | 98 | { |
99 | case STOP: | 99 | case STOP: |
100 | last_valid_button = BUTTON_RC_STOP; | 100 | last_valid_button = BUTTON_RC_STOP; |
101 | break; | 101 | break; |
102 | 102 | ||
103 | case PLAY: | 103 | case PLAY: |
104 | last_valid_button = BUTTON_RC_PLAY; | 104 | last_valid_button = BUTTON_RC_PLAY; |
105 | break; | 105 | break; |
106 | 106 | ||
107 | case VOLUP: | 107 | case VOLUP: |
108 | last_valid_button = BUTTON_RC_VOL_UP; | 108 | last_valid_button = BUTTON_RC_VOL_UP; |
109 | break; | 109 | break; |
110 | 110 | ||
111 | case VOLDN: | 111 | case VOLDN: |
112 | last_valid_button = BUTTON_RC_VOL_DOWN; | 112 | last_valid_button = BUTTON_RC_VOL_DOWN; |
113 | break; | 113 | break; |
114 | 114 | ||
115 | case PREV: | 115 | case PREV: |
116 | last_valid_button = BUTTON_RC_LEFT; | 116 | last_valid_button = BUTTON_RC_LEFT; |
117 | break; | 117 | break; |
118 | 118 | ||
119 | case NEXT: | 119 | case NEXT: |
120 | last_valid_button = BUTTON_RC_RIGHT; | 120 | last_valid_button = BUTTON_RC_RIGHT; |
121 | break; | 121 | break; |
122 | 122 | ||
123 | default: | 123 | default: |
124 | last_valid_button = BUTTON_NONE; | 124 | last_valid_button = BUTTON_NONE; |
125 | break; | 125 | break; |
126 | } | 126 | } |
127 | #endif | ||
128 | } | 127 | } |
129 | } | 128 | } |
130 | else | 129 | else |
@@ -142,7 +141,7 @@ int remote_control_rx(void) | |||
142 | return ret; | 141 | return ret; |
143 | } | 142 | } |
144 | 143 | ||
145 | #endif /* HAVE_MMC */ | 144 | #endif /* !HAVE_FMADC && !HAVE_MMC */ |
146 | #elif defined(CPU_COLDFIRE) && defined(HAVE_SERIAL) | 145 | #elif defined(CPU_COLDFIRE) && defined(HAVE_SERIAL) |
147 | 146 | ||
148 | void serial_tx(const unsigned char *buf) | 147 | void serial_tx(const unsigned char *buf) |