summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-03-26 01:50:41 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-03-26 01:50:41 +0000
commitaf395f4db6ad7b83f9d9afefb1c0ceeedd140a45 (patch)
treeb631289b4a3b28d3c65b10d272d50298f377c69f /apps
parent74d678fdbcbc427c057e7682ba0a0566e49a8b97 (diff)
downloadrockbox-af395f4db6ad7b83f9d9afefb1c0ceeedd140a45.tar.gz
rockbox-af395f4db6ad7b83f9d9afefb1c0ceeedd140a45.zip
Do core interrupt masking in a less general fashion and save some instructions to decrease size and speed things up a little bit. Small fix to a few places where interrupts would get enabled again where they shouldn't have been (context switching calls when disabled).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16811 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/debug_menu.c15
-rw-r--r--apps/main.c6
-rw-r--r--apps/plugins/wavplay.c4
-rw-r--r--apps/plugins/wavrecord.c4
4 files changed, 15 insertions, 14 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index fc509ce236..d21dc032a8 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -417,7 +417,7 @@ static bool dbg_flash_id(unsigned* p_manufacturer, unsigned* p_device,
417 not_id = flash[1]; /* should be 'A' (0x41) and 'R' (0x52) from the "ARCH" marker */ 417 not_id = flash[1]; /* should be 'A' (0x41) and 'R' (0x52) from the "ARCH" marker */
418 418
419 /* disable interrupts, prevent any stray flash access */ 419 /* disable interrupts, prevent any stray flash access */
420 old_level = set_irq_level(HIGHEST_IRQ_LEVEL); 420 old_level = disable_irq_save();
421 421
422 flash[addr1] = 0xAA; /* enter command mode */ 422 flash[addr1] = 0xAA; /* enter command mode */
423 flash[addr2] = 0x55; 423 flash[addr2] = 0x55;
@@ -432,7 +432,7 @@ static bool dbg_flash_id(unsigned* p_manufacturer, unsigned* p_device,
432 /* Atmel wants 20ms pause here */ 432 /* Atmel wants 20ms pause here */
433 /* sleep(HZ/50); no sleeping possible while interrupts are disabled */ 433 /* sleep(HZ/50); no sleeping possible while interrupts are disabled */
434 434
435 set_irq_level(old_level); /* enable interrupts again */ 435 restore_irq(old_level); /* enable interrupts again */
436 436
437 /* I assume success if the obtained values are different from 437 /* I assume success if the obtained values are different from
438 the normal flash content. This is not perfectly bulletproof, they 438 the normal flash content. This is not perfectly bulletproof, they
@@ -2066,9 +2066,12 @@ static bool dbg_save_roms(void)
2066 char buf[EEPROM_SIZE]; 2066 char buf[EEPROM_SIZE];
2067 int err; 2067 int err;
2068 2068
2069 old_irq_level = set_irq_level(HIGHEST_IRQ_LEVEL); 2069 old_irq_level = disable_irq_save();
2070 2070
2071 err = eeprom_24cxx_read(0, buf, sizeof buf); 2071 err = eeprom_24cxx_read(0, buf, sizeof buf);
2072
2073 restore_irq(old_irq_level);
2074
2072 if (err) 2075 if (err)
2073 gui_syncsplash(HZ*3, "Eeprom read failure (%d)",err); 2076 gui_syncsplash(HZ*3, "Eeprom read failure (%d)",err);
2074 else 2077 else
@@ -2076,8 +2079,6 @@ static bool dbg_save_roms(void)
2076 write(fd, buf, sizeof buf); 2079 write(fd, buf, sizeof buf);
2077 } 2080 }
2078 2081
2079 set_irq_level(old_irq_level);
2080
2081 close(fd); 2082 close(fd);
2082 } 2083 }
2083#endif 2084#endif
@@ -2248,7 +2249,7 @@ static bool dbg_write_eeprom(void)
2248 2249
2249 if(rc == EEPROM_SIZE) 2250 if(rc == EEPROM_SIZE)
2250 { 2251 {
2251 old_irq_level = set_irq_level(HIGHEST_IRQ_LEVEL); 2252 old_irq_level = disable_irq_save();
2252 2253
2253 err = eeprom_24cxx_write(0, buf, sizeof buf); 2254 err = eeprom_24cxx_write(0, buf, sizeof buf);
2254 if (err) 2255 if (err)
@@ -2256,7 +2257,7 @@ static bool dbg_write_eeprom(void)
2256 else 2257 else
2257 gui_syncsplash(HZ*3, "Eeprom written successfully"); 2258 gui_syncsplash(HZ*3, "Eeprom written successfully");
2258 2259
2259 set_irq_level(old_irq_level); 2260 restore_irq(old_irq_level);
2260 } 2261 }
2261 else 2262 else
2262 { 2263 {
diff --git a/apps/main.c b/apps/main.c
index a3a2241f44..3f83850df7 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -272,7 +272,7 @@ static void init(void)
272{ 272{
273 kernel_init(); 273 kernel_init();
274 buffer_init(); 274 buffer_init();
275 set_irq_level(0); 275 enable_irq();
276 lcd_init(); 276 lcd_init();
277#ifdef HAVE_REMOTE_LCD 277#ifdef HAVE_REMOTE_LCD
278 lcd_remote_init(); 278 lcd_remote_init();
@@ -360,9 +360,9 @@ static void init(void)
360 360
361 power_init(); 361 power_init();
362 362
363 set_irq_level(0); 363 enable_irq();
364#ifdef CPU_ARM 364#ifdef CPU_ARM
365 set_fiq_status(FIQ_ENABLED); 365 enable_fiq();
366#endif 366#endif
367 lcd_init(); 367 lcd_init();
368#ifdef HAVE_REMOTE_LCD 368#ifdef HAVE_REMOTE_LCD
diff --git a/apps/plugins/wavplay.c b/apps/plugins/wavplay.c
index 6a969f187b..bf06787dd9 100644
--- a/apps/plugins/wavplay.c
+++ b/apps/plugins/wavplay.c
@@ -3345,7 +3345,7 @@ void dma_end_isr(void)
3345 3345
3346void demand_irq_enable(bool on) 3346void demand_irq_enable(bool on)
3347{ 3347{
3348 int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL); 3348 int oldlevel = disable_irq_save();
3349 3349
3350 if(on) 3350 if(on)
3351 { 3351 {
@@ -3357,7 +3357,7 @@ void demand_irq_enable(bool on)
3357 IPRA &= 0xfff0; 3357 IPRA &= 0xfff0;
3358 } 3358 }
3359 3359
3360 set_irq_level(oldlevel); 3360 restore_irq(oldlevel);
3361} 3361}
3362 3362
3363static inline int available(void) 3363static inline int available(void)
diff --git a/apps/plugins/wavrecord.c b/apps/plugins/wavrecord.c
index ee557633a4..b509212239 100644
--- a/apps/plugins/wavrecord.c
+++ b/apps/plugins/wavrecord.c
@@ -3415,7 +3415,7 @@ void rec_tick(void)
3415 3415
3416void rec_tick_enable(bool on) 3416void rec_tick_enable(bool on)
3417{ 3417{
3418 int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL); 3418 int oldlevel = disable_irq_save();
3419 3419
3420 if(on) 3420 if(on)
3421 { 3421 {
@@ -3431,7 +3431,7 @@ void rec_tick_enable(bool on)
3431 IPRB = (IPRB & 0xff0f) | 0x0080; /* Reenable IRQ6 */ 3431 IPRB = (IPRB & 0xff0f) | 0x0080; /* Reenable IRQ6 */
3432 } 3432 }
3433 3433
3434 set_irq_level(oldlevel); 3434 restore_irq(oldlevel);
3435} 3435}
3436 3436
3437void hijack_interrupts(bool on) 3437void hijack_interrupts(bool on)