summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2003-11-07 12:15:24 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2003-11-07 12:15:24 +0000
commitbef7ab0c2648bff663700645b019969d53ea5923 (patch)
treeff9a3e9761e9741621eabb4a307d7bd20dc05aa8
parent0dd7d48c3a216e6f6e8441d7444c330d1e83ada4 (diff)
downloadrockbox-bef7ab0c2648bff663700645b019969d53ea5923.tar.gz
rockbox-bef7ab0c2648bff663700645b019969d53ea5923.zip
The code police strikes back
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4024 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/backlight.c11
-rw-r--r--firmware/drivers/ata.c14
-rw-r--r--firmware/drivers/fmradio.c23
-rw-r--r--firmware/drivers/i2c.c37
-rw-r--r--firmware/drivers/led.c11
-rw-r--r--firmware/drivers/mas.c10
-rw-r--r--firmware/drivers/power.c24
-rw-r--r--firmware/export/system.h116
-rw-r--r--firmware/mpeg.c28
9 files changed, 79 insertions, 195 deletions
diff --git a/firmware/backlight.c b/firmware/backlight.c
index 9a1159e59f..d3b4580daa 100644
--- a/firmware/backlight.c
+++ b/firmware/backlight.c
@@ -74,7 +74,7 @@ void backlight_thread(void)
74 /* Disable square wave */ 74 /* Disable square wave */
75 rtc_write(0x0a, rtc_read(0x0a) & ~0x40); 75 rtc_write(0x0a, rtc_read(0x0a) & ~0x40);
76#else 76#else
77 __set_bit_constant(14-8, &PADRH); 77 or_b(0x40, &PADRH);
78#endif 78#endif
79 } 79 }
80 /* else if(backlight_timer) */ 80 /* else if(backlight_timer) */
@@ -84,7 +84,7 @@ void backlight_thread(void)
84 /* Enable square wave */ 84 /* Enable square wave */
85 rtc_write(0x0a, rtc_read(0x0a) | 0x40); 85 rtc_write(0x0a, rtc_read(0x0a) | 0x40);
86#else 86#else
87 __clear_bit_constant(14-8, &PADRH); 87 and_b(~0x40, &PADRH);
88#endif 88#endif
89 } 89 }
90 break; 90 break;
@@ -94,7 +94,7 @@ void backlight_thread(void)
94 /* Disable square wave */ 94 /* Disable square wave */
95 rtc_write(0x0a, rtc_read(0x0a) & ~0x40); 95 rtc_write(0x0a, rtc_read(0x0a) & ~0x40);
96#else 96#else
97 __set_bit_constant(14-8, &PADRH); 97 or_b(0x40, &PADRH);
98#endif 98#endif
99 break; 99 break;
100 100
@@ -172,7 +172,10 @@ void backlight_init(void)
172 create_thread(backlight_thread, backlight_stack, 172 create_thread(backlight_thread, backlight_stack,
173 sizeof(backlight_stack), backlight_thread_name); 173 sizeof(backlight_stack), backlight_thread_name);
174 174
175 __set_bit_constant(14-8, &PAIORH); 175#ifndef HAVE_RTC
176
177 or_b(0x40, &PAIORH); /* Set data direction of PA14 */
178#endif
176 179
177 backlight_on(); 180 backlight_on();
178} 181}
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 507a0c6353..3c58d1f27c 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -607,11 +607,11 @@ int ata_hard_reset(void)
607 int ret; 607 int ret;
608 608
609 /* state HRR0 */ 609 /* state HRR0 */
610 __clear_bit_constant(9-8, &PADRH); /* assert _RESET */ 610 and_b(~0x02, &PADRH); /* assert _RESET */
611 sleep(1); /* > 25us */ 611 sleep(1); /* > 25us */
612 612
613 /* state HRR1 */ 613 /* state HRR1 */
614 __set_bit_constant(9-8, &PADRH); /* negate _RESET */ 614 or_b(0x02, &PADRH); /* negate _RESET */
615 sleep(1); /* > 2ms */ 615 sleep(1); /* > 2ms */
616 616
617 /* state HRR2 */ 617 /* state HRR2 */
@@ -718,11 +718,11 @@ static int io_address_detect(void)
718void ata_enable(bool on) 718void ata_enable(bool on)
719{ 719{
720 if(on) 720 if(on)
721 __clear_bit_constant(7, &PADRL); /* enable ATA */ 721 and_b(~0x80, &PADRL); /* enable ATA */
722 else 722 else
723 __set_bit_constant(7, &PADRL); /* disable ATA */ 723 or_b(0x80, &PADRL); /* disable ATA */
724 724
725 __set_bit_constant(7, &PAIORL); 725 or_b(0x80, &PAIORL);
726} 726}
727 727
728static int identify(void) 728static int identify(void)
@@ -787,8 +787,8 @@ int ata_init(void)
787 led(false); 787 led(false);
788 788
789 /* Port A setup */ 789 /* Port A setup */
790 __set_bit_constant(9-8, &PAIORH); /* output for ATA reset */ 790 or_b(0x02, &PAIORH); /* output for ATA reset */
791 __set_bit_constant(9-8, &PADRH); /* release ATA reset */ 791 or_b(0x02, &PADRH); /* release ATA reset */
792 PACR2 &= 0xBFFF; /* GPIO function for PA7 (IDE enable) */ 792 PACR2 &= 0xBFFF; /* GPIO function for PA7 (IDE enable) */
793 793
794 sleeping = false; 794 sleeping = false;
diff --git a/firmware/drivers/fmradio.c b/firmware/drivers/fmradio.c
index 4b496b7e1c..604005b884 100644
--- a/firmware/drivers/fmradio.c
+++ b/firmware/drivers/fmradio.c
@@ -32,21 +32,16 @@
32 DO (Data Out) - PB4 32 DO (Data Out) - PB4
33*/ 33*/
34 34
35#define PB0 0x0001
36#define PB1 0x0002
37#define PB3 0x0008
38#define PB4 0x0010
39
40/* cute little functions */ 35/* cute little functions */
41#define CE_LO __clear_bit_constant(3, PBDRL_ADDR) 36#define CE_LO and_b(~0x08, PBDRL_ADDR)
42#define CE_HI __set_bit_constant(3, PBDRL_ADDR) 37#define CE_HI or_b(0x08, PBDRL_ADDR)
43#define CL_LO __clear_bit_constant(1, PBDRL_ADDR) 38#define CL_LO and_b(~0x02, PBDRL_ADDR)
44#define CL_HI __set_bit_constant(1, PBDRL_ADDR) 39#define CL_HI or_b(0x02, PBDRL_ADDR)
45#define DO (PBDR & PB4) 40#define DO (PBDR & 0x10)
46#define DI_LO __clear_bit_constant(0, PBDRL_ADDR) 41#define DI_LO and_b(~0x01, PBDRL_ADDR)
47#define DI_HI __set_bit_constant(0, PBDRL_ADDR) 42#define DI_HI or_b(0x01, PBDRL_ADDR)
48 43
49#define START __set_mask_constant((PB3 | PB1), PBDRL_ADDR) 44#define START or_b((0x08 | 0x02), PBDRL_ADDR)
50 45
51/* delay loop */ 46/* delay loop */
52#define DELAY do { int _x; for(_x=0;_x<10;_x++);} while (0) 47#define DELAY do { int _x; for(_x=0;_x<10;_x++);} while (0)
diff --git a/firmware/drivers/i2c.c b/firmware/drivers/i2c.c
index 6530227ad7..24ad77495d 100644
--- a/firmware/drivers/i2c.c
+++ b/firmware/drivers/i2c.c
@@ -23,22 +23,23 @@
23#include "debug.h" 23#include "debug.h"
24#include "system.h" 24#include "system.h"
25 25
26#define PB13 0x2000 26/*
27#define PB7 0x0080 27** SDA is PB7
28#define PB5 0x0020 28** SCL is PB13
29 29*/
30
30/* cute little functions, atomic read-modify-write */ 31/* cute little functions, atomic read-modify-write */
31#define SDA_LO __clear_bit_constant(7, &PBDRL) 32#define SDA_LO and_b(~0x80, &PBDRL)
32#define SDA_HI __set_bit_constant(7, &PBDRL) 33#define SDA_HI or_b(0x80, &PBDRL)
33#define SDA_INPUT __clear_bit_constant(7, &PBIORL) 34#define SDA_INPUT and_b(~0x80, &PBIORL)
34#define SDA_OUTPUT __set_bit_constant(7, &PBIORL) 35#define SDA_OUTPUT or_b(0x80, &PBIORL)
35#define SDA (PBDR & PB7) 36#define SDA (PBDR & 0x80)
36 37
37#define SCL_INPUT __clear_bit_constant(13-8, &PBIORH) 38#define SCL_INPUT and_b(~0x20, &PBIORH)
38#define SCL_OUTPUT __set_bit_constant(13-8, &PBIORH) 39#define SCL_OUTPUT or_b(0x20, &PBIORH)
39#define SCL_LO __clear_bit_constant(13-8, &PBDRH) 40#define SCL_LO and_b(~0x20, &PBDRH)
40#define SCL_HI __set_bit_constant(13-8, &PBDRH) 41#define SCL_HI or_b(0x20, &PBDRH)
41#define SCL (PBDR & PB13) 42#define SCL (PBDR & 0x2000)
42 43
43/* arbitrary delay loop */ 44/* arbitrary delay loop */
44#define DELAY do { int _x; for(_x=0;_x<20;_x++);} while (0) 45#define DELAY do { int _x; for(_x=0;_x<20;_x++);} while (0)
@@ -82,11 +83,11 @@ void i2c_init(void)
82 PBCR2 &= ~0xcc00; /* PB5 abd PB7 */ 83 PBCR2 &= ~0xcc00; /* PB5 abd PB7 */
83 84
84 /* PB5 is "MAS enable". make it output and high */ 85 /* PB5 is "MAS enable". make it output and high */
85 __set_bit_constant(5, &PBIORL); 86 or_b(0x20, &PBIORL);
86 __set_bit_constant(5, &PBDRL); 87 or_b(0x20, &PBDRL);
87 88
88 /* Set the clock line PB13 to an output */ 89 /* Set the clock line PB13 to an output */
89 __set_bit_constant(13-8, &PBIORH); 90 or_b(0x20, &PBIORH);
90 91
91 SDA_OUTPUT; 92 SDA_OUTPUT;
92 SDA_HI; 93 SDA_HI;
diff --git a/firmware/drivers/led.c b/firmware/drivers/led.c
index ad21dc9baf..adeb2714e0 100644
--- a/firmware/drivers/led.c
+++ b/firmware/drivers/led.c
@@ -24,19 +24,12 @@
24 24
25void led(bool on) 25void led(bool on)
26{ 26{
27#ifdef ASM_IMPLEMENTATION
28 if ( on )
29 asm("or.b" "\t" "%0,@(r0,gbr)" : : "I"(0x40), "z"(PBDR_ADDR+1));
30 else
31 asm("and.b" "\t" "%0,@(r0,gbr)" : : "I"(~0x40), "z"(PBDR_ADDR+1));
32#else
33 if ( on ) 27 if ( on )
34 { 28 {
35 __set_bit_constant(6, &PBDRL); 29 or_b(0x40, &PBDRL);
36 } 30 }
37 else 31 else
38 { 32 {
39 __clear_bit_constant(6, &PBDRL); 33 and_b(~0x40, &PBDRL);
40 } 34 }
41#endif
42} 35}
diff --git a/firmware/drivers/mas.c b/firmware/drivers/mas.c
index 4d2c35be0f..c39a46c9f2 100644
--- a/firmware/drivers/mas.c
+++ b/firmware/drivers/mas.c
@@ -269,21 +269,21 @@ static int mas_devread(unsigned long *dest, int len)
269#ifdef HAVE_MAS3587F 269#ifdef HAVE_MAS3587F
270void mas_reset(void) 270void mas_reset(void)
271{ 271{
272 __set_bit_constant(8-8, &PAIORH); 272 or_b(0x01, &PAIORH);
273 273
274 if(old_recorder) 274 if(old_recorder)
275 { 275 {
276 /* Older recorder models don't invert the POR signal */ 276 /* Older recorder models don't invert the POR signal */
277 __set_bit_constant(8-8, &PADRH); 277 or_b(0x01, &PADRH);
278 sleep(HZ/100); 278 sleep(HZ/100);
279 __clear_bit_constant(8-8, &PADRH); 279 and_b(~0x01, &PADRH);
280 sleep(HZ/5); 280 sleep(HZ/5);
281 } 281 }
282 else 282 else
283 { 283 {
284 __clear_bit_constant(8-8, &PADRH); 284 and_b(~0x01, &PADRH);
285 sleep(HZ/100); 285 sleep(HZ/100);
286 __set_bit_constant(8-8, &PADRH); 286 or_b(0x01, &PADRH);
287 sleep(HZ/5); 287 sleep(HZ/5);
288 } 288 }
289} 289}
diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c
index c0fa57d3b0..14e912d89c 100644
--- a/firmware/drivers/power.c
+++ b/firmware/drivers/power.c
@@ -33,11 +33,11 @@ bool charger_enabled;
33void power_init(void) 33void power_init(void)
34{ 34{
35#ifdef HAVE_CHARGE_CTRL 35#ifdef HAVE_CHARGE_CTRL
36 __set_bit_constant(5, &PBIORL); /* Set charging control bit to output */ 36 or_b(0x20, &PBIORL); /* Set charging control bit to output */
37 charger_enable(false); /* Default to charger OFF */ 37 charger_enable(false); /* Default to charger OFF */
38#endif 38#endif
39#ifdef HAVE_ATA_POWER_OFF 39#ifdef HAVE_ATA_POWER_OFF
40 __set_bit_constant(5, &PAIORL); 40 or_b(0x20, &PAIORL);
41 PACR2 &= 0xFBFF; 41 PACR2 &= 0xFBFF;
42#endif 42#endif
43} 43}
@@ -63,12 +63,12 @@ void charger_enable(bool on)
63#ifdef HAVE_CHARGE_CTRL 63#ifdef HAVE_CHARGE_CTRL
64 if(on) 64 if(on)
65 { 65 {
66 __clear_bit_constant(5, &PBDRL); 66 and_b(~0x20, &PBDRL);
67 charger_enabled = 1; 67 charger_enabled = 1;
68 } 68 }
69 else 69 else
70 { 70 {
71 __set_bit_constant(5, &PBDRL); 71 or_b(0x20, &PBDRL);
72 charger_enabled = 0; 72 charger_enabled = 0;
73 } 73 }
74#else 74#else
@@ -80,9 +80,9 @@ void ide_power_enable(bool on)
80{ 80{
81#ifdef HAVE_ATA_POWER_OFF 81#ifdef HAVE_ATA_POWER_OFF
82 if(on) 82 if(on)
83 __set_bit_constant(5, &PADRL); 83 or_b(0x20, &PADRL);
84 else 84 else
85 __clear_bit_constant(5, &PADRL); 85 and_b(~0x20, &PADRL);
86#else 86#else
87 on = on; 87 on = on;
88#endif 88#endif
@@ -92,14 +92,14 @@ void power_off(void)
92{ 92{
93 set_irq_level(15); 93 set_irq_level(15);
94#ifdef HAVE_POWEROFF_ON_PBDR 94#ifdef HAVE_POWEROFF_ON_PBDR
95 __clear_mask_constant(PBDR_BTN_OFF, &PBDRL); 95 and_b(~0x10, &PBDRL);
96 __set_mask_constant(PBDR_BTN_OFF, &PBIORL); 96 or_b(0x10, &PBIORL);
97#elif defined(HAVE_POWEROFF_ON_PB5) 97#elif defined(HAVE_POWEROFF_ON_PB5)
98 __clear_bit_constant(5, &PBDRL); 98 and_b(~0x20, &PBDRL);
99 __set_bit_constant(5, &PBIORL); 99 or_b(0x20, &PBIORL);
100#else 100#else
101 __clear_bit_constant(11-8, &PADRH); 101 and_b(~0x08, &PADRH);
102 __set_bit_constant(11-8, &PAIORH); 102 or_b(0x08, &PAIORH);
103#endif 103#endif
104 while(1); 104 while(1);
105} 105}
diff --git a/firmware/export/system.h b/firmware/export/system.h
index d5f1b4ba97..01d2f130d3 100644
--- a/firmware/export/system.h
+++ b/firmware/export/system.h
@@ -46,135 +46,27 @@
46#define nop \ 46#define nop \
47 asm volatile ("nop") 47 asm volatile ("nop")
48 48
49#define __set_mask_constant(mask,address) \ 49#define or_b(mask, address) \
50 asm \ 50 asm \
51 ("or.b\t%0,@(r0,gbr)" \ 51 ("or.b\t%0,@(r0,gbr)" \
52 : \ 52 : \
53 : /* %0 */ "I"((char)(mask)), \ 53 : /* %0 */ "I"((char)(mask)), \
54 /* %1 */ "z"(address-GBR)) 54 /* %1 */ "z"(address-GBR))
55 55
56#define __clear_mask_constant(mask,address) \ 56#define and_b(mask, address) \
57 asm \ 57 asm \
58 ("and.b\t%0,@(r0,gbr)" \ 58 ("and.b\t%0,@(r0,gbr)" \
59 : \ 59 : \
60 : /* %0 */ "I"((char)~(mask)), \ 60 : /* %0 */ "I"((char)(mask)), \
61 /* %1 */ "z"(address-GBR)) 61 /* %1 */ "z"(address-GBR))
62 62
63#define __toggle_mask_constant(mask,address) \ 63#define xor_b(mask, address) \
64 asm \ 64 asm \
65 ("xor.b\t%0,@(r0,gbr)" \ 65 ("xor.b\t%0,@(r0,gbr)" \
66 : \ 66 : \
67 : /* %0 */ "I"((char)(mask)), \ 67 : /* %0 */ "I"((char)(mask)), \
68 /* %1 */ "z"(address-GBR)) 68 /* %1 */ "z"(address-GBR))
69 69
70#define __test_mask_constant(mask,address) \
71 ({ \
72 int result; \
73 asm \
74 ("tst.b\t%1,@(r0,gbr)\n\tmovt\t%0" \
75 : "=r"(result) \
76 : "I"((char)(mask)),"z"(address-GBR)); \
77 result; \
78 })
79
80#define __set_bit_constant(bit,address) \
81 asm \
82 ("or.b\t%0,@(r0,gbr)" \
83 : \
84 : /* %0 */ "I"((char)(1<<(bit))), \
85 /* %1 */ "z"(address-GBR))
86
87#define __clear_bit_constant(bit,address) \
88 asm \
89 ("and.b\t%0,@(r0,gbr)" \
90 : \
91 : /* %0 */ "I"((char)~(1<<(bit))), \
92 /* %1 */ "z"(address-GBR))
93
94#define __toggle_bit_constant(bit,address) \
95 asm \
96 ("xor.b\t%0,@(r0,gbr)" \
97 : \
98 : /* %0 */ "I"((char)(1<<(bit))), \
99 /* %1 */ "z"(address-GBR))
100
101#define __test_bit_constant(bit,address) \
102 ({ \
103 int result; \
104 asm \
105 ("tst.b\t%1,@(r0,gbr)\n\tmovt\t%0" \
106 : "=r"(result) \
107 : "I"((char)(1<<(bit))),"z"(address-GBR)); \
108 result; \
109 })
110
111#define __set_mask(mask,address) /* FIXME */
112#define __test_mask(mask,address) 0 /* FIXME */
113#define __clear_mask(mask,address) /* FIXME */
114#define __toggle_mask(mask,address) /* FIXME */
115
116#define __set_bit(bit,address) /* FIXME */
117#define __test_bit(bit,address) 0 /* FIXME */
118#define __clear_bit(bit,address) /* FIXME */
119#define __toggle_bit(bit,address) /* FIXME */
120
121#define set_mask(mask,address) \
122 if (__builtin_constant_p (mask)) \
123 __set_mask_constant (mask,address); \
124 else \
125 __set_mask (mask,address)
126
127#define clear_mask(mask,address) \
128 if (__builtin_constant_p (mask)) \
129 __clear_mask_constant (mask,address); \
130 else \
131 __clear_mask (mask,address)
132
133#define toggle_mask(mask,address) \
134 if (__builtin_constant_p (mask)) \
135 __toggle_mask_constant (mask,address); \
136 else \
137 __toggle_mask (mask,address)
138
139#define test_mask(mask,address) \
140 ( \
141 (__builtin_constant_p (mask)) \
142 ? (int)__test_mask_constant (mask,address) \
143 : (int)__test_mask (mask,address) \
144 )
145
146
147#define set_bit(bit,address) \
148 if (__builtin_constant_p (bit)) \
149 __set_bit_constant (bit,address); \
150 else \
151 __set_bit (bit,address)
152
153#define clear_bit(bit,address) \
154 if (__builtin_constant_p (bit)) \
155 __clear_bit_constant (bit,address); \
156 else \
157 __clear_bit (bit,address)
158
159#define toggle_bit(bit,address) \
160 if (__builtin_constant_p (bit)) \
161 __toggle_bit_constant (bit,address); \
162 else \
163 __toggle_bit (bit,address)
164
165#define test_bit(bit,address) \
166 ( \
167 (__builtin_constant_p (bit)) \
168 ? (int)__test_bit_constant (bit,address) \
169 : (int)__test_bit (bit,address) \
170 )
171
172
173extern char __swap_bit[256];
174
175#define swap_bit(byte) \
176 __swap_bit[byte]
177
178#ifndef SIMULATOR 70#ifndef SIMULATOR
179 71
180static inline short SWAB16(short value) 72static inline short SWAB16(short value)
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index a8f2dd3238..b51f9b9732 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -740,7 +740,7 @@ void drain_dma_buffer(void)
740 { 740 {
741 while((*((volatile unsigned char *)PBDR_ADDR) & 0x40)) 741 while((*((volatile unsigned char *)PBDR_ADDR) & 0x40))
742 { 742 {
743 __set_bit_constant(11-8, &PADRH); 743 or_b(0x08, &PADRH);
744 744
745 while(*((volatile unsigned char *)PBDR_ADDR) & 0x80); 745 while(*((volatile unsigned char *)PBDR_ADDR) & 0x80);
746 746
@@ -748,7 +748,7 @@ void drain_dma_buffer(void)
748 the data is read */ 748 the data is read */
749 asm(" nop\n nop\n nop\n"); 749 asm(" nop\n nop\n nop\n");
750 asm(" nop\n nop\n nop\n"); 750 asm(" nop\n nop\n nop\n");
751 __clear_bit_constant(11-8, &PADRH); 751 and_b(~0x08, &PADRH);
752 752
753 while(!(*((volatile unsigned char *)PBDR_ADDR) & 0x80)); 753 while(!(*((volatile unsigned char *)PBDR_ADDR) & 0x80));
754 } 754 }
@@ -757,7 +757,7 @@ void drain_dma_buffer(void)
757 { 757 {
758 while((*((volatile unsigned char *)PBDR_ADDR) & 0x40)) 758 while((*((volatile unsigned char *)PBDR_ADDR) & 0x40))
759 { 759 {
760 __clear_bit_constant(11-8, &PADRH); 760 and_b(~0x08, &PADRH);
761 761
762 while(*((volatile unsigned char *)PBDR_ADDR) & 0x80); 762 while(*((volatile unsigned char *)PBDR_ADDR) & 0x80);
763 763
@@ -766,7 +766,7 @@ void drain_dma_buffer(void)
766 asm(" nop\n nop\n nop\n"); 766 asm(" nop\n nop\n nop\n");
767 asm(" nop\n nop\n nop\n"); 767 asm(" nop\n nop\n nop\n");
768 768
769 __set_bit_constant(11-8, &PADRH); 769 or_b(0x08, &PADRH);
770 770
771 while(!(*((volatile unsigned char *)PBDR_ADDR) & 0x80)); 771 while(!(*((volatile unsigned char *)PBDR_ADDR) & 0x80));
772 } 772 }
@@ -814,7 +814,7 @@ static void dma_tick(void)
814 while((*((volatile unsigned char *)PBDR_ADDR) & 0x40) 814 while((*((volatile unsigned char *)PBDR_ADDR) & 0x40)
815 && i < 30) 815 && i < 30)
816 { 816 {
817 __set_bit_constant(11-8, &PADRH); 817 or_b(0x08, &PADRH);
818 818
819 while(*((volatile unsigned char *)PBDR_ADDR) & 0x80); 819 while(*((volatile unsigned char *)PBDR_ADDR) & 0x80);
820 820
@@ -828,7 +828,7 @@ static void dma_tick(void)
828 828
829 i++; 829 i++;
830 830
831 __clear_bit_constant(11-8, &PADRH); 831 and_b(~0x08, &PADRH);
832 832
833 /* No wait for /RTW, cause it's not necessary */ 833 /* No wait for /RTW, cause it's not necessary */
834 } 834 }
@@ -839,7 +839,7 @@ static void dma_tick(void)
839 while((*((volatile unsigned char *)PBDR_ADDR) & 0x40) 839 while((*((volatile unsigned char *)PBDR_ADDR) & 0x40)
840 && i < 30) 840 && i < 30)
841 { 841 {
842 __clear_bit_constant(11-8, &PADRH); 842 and_b(~0x08, &PADRH);
843 843
844 while(*((volatile unsigned char *)PBDR_ADDR) & 0x80); 844 while(*((volatile unsigned char *)PBDR_ADDR) & 0x80);
845 845
@@ -853,7 +853,7 @@ static void dma_tick(void)
853 853
854 i++; 854 i++;
855 855
856 __set_bit_constant(11-8, &PADRH); 856 or_b(0x08, &PADRH);
857 857
858 /* No wait for /RTW, cause it's not necessary */ 858 /* No wait for /RTW, cause it's not necessary */
859 } 859 }
@@ -2169,7 +2169,7 @@ static void setup_sci0(void)
2169 PBCR1 = (PBCR1 & 0x0cff) | 0x1208; 2169 PBCR1 = (PBCR1 & 0x0cff) | 0x1208;
2170 2170
2171 /* Set PB12 to output */ 2171 /* Set PB12 to output */
2172 __set_bit_constant(12-8, &PBIORH); 2172 or_b(0x10, &PBIORH);
2173 2173
2174 /* Disable serial port */ 2174 /* Disable serial port */
2175 SCR0 = 0x00; 2175 SCR0 = 0x00;
@@ -2190,8 +2190,8 @@ static void setup_sci0(void)
2190 IPRD &= 0x0ff0; 2190 IPRD &= 0x0ff0;
2191 2191
2192 /* set PB15 and PB14 to inputs */ 2192 /* set PB15 and PB14 to inputs */
2193 __clear_bit_constant(15-8, &PBIORH); 2193 and_b(~0x80, &PBIORH);
2194 __clear_bit_constant(14-8, &PBIORH); 2194 and_b(~0x40, &PBIORH);
2195 2195
2196 /* Enable End of DMA interrupt at prio 8 */ 2196 /* Enable End of DMA interrupt at prio 8 */
2197 IPRC = (IPRC & 0xf0ff) | 0x0800; 2197 IPRC = (IPRC & 0xf0ff) | 0x0800;
@@ -3144,7 +3144,7 @@ void mpeg_init(int volume, int bass, int treble, int balance, int loudness,
3144 setup_sci0(); 3144 setup_sci0();
3145 3145
3146#ifdef HAVE_MAS3587F 3146#ifdef HAVE_MAS3587F
3147 __set_bit_constant(11-8, &PAIORH); /* output for /PR */ 3147 or_b(0x08, &PAIORH); /* output for /PR */
3148 init_playback(); 3148 init_playback();
3149 3149
3150 mas_version_code = mas_readver(); 3150 mas_version_code = mas_readver();
@@ -3157,9 +3157,9 @@ void mpeg_init(int volume, int bass, int treble, int balance, int loudness,
3157#endif 3157#endif
3158 3158
3159#ifdef HAVE_MAS3507D 3159#ifdef HAVE_MAS3507D
3160 __clear_bit_constant(5, &PBDRL); 3160 and_b(~0x20, &PBDRL);
3161 sleep(HZ/5); 3161 sleep(HZ/5);
3162 __set_bit_constant(5, &PBDRL); 3162 or_b(0x20, &PBDRL);
3163 sleep(HZ/5); 3163 sleep(HZ/5);
3164 3164
3165 /* set IRQ6 to edge detect */ 3165 /* set IRQ6 to edge detect */