mirror of
https://github.com/fail0verflow/mini.git
synced 2024-06-15 23:58:50 +02:00
move the gecko upload client out of irq context
This commit is contained in:
parent
37cee63ed9
commit
a7b9770cbf
19
gecko.c
19
gecko.c
|
@ -24,6 +24,7 @@ Copyright (C) 2009 Andre Heider "dhewg" <dhewg@wiibrew.org>
|
||||||
#include "powerpc_elf.h"
|
#include "powerpc_elf.h"
|
||||||
#include "gecko.h"
|
#include "gecko.h"
|
||||||
|
|
||||||
|
static u8 gecko_found = 0;
|
||||||
static u8 gecko_console_enabled = 0;
|
static u8 gecko_console_enabled = 0;
|
||||||
|
|
||||||
static u32 _gecko_command(u32 command)
|
static u32 _gecko_command(u32 command)
|
||||||
|
@ -207,13 +208,12 @@ void gecko_init(void)
|
||||||
write32(EXI0_CSR, 0);
|
write32(EXI0_CSR, 0);
|
||||||
write32(EXI1_CSR, 0);
|
write32(EXI1_CSR, 0);
|
||||||
write32(EXI2_CSR, 0);
|
write32(EXI2_CSR, 0);
|
||||||
write32(EXI0_CSR, 0x2000);
|
|
||||||
write32(EXI0_CSR, 3<<10);
|
|
||||||
write32(EXI1_CSR, 3<<10);
|
|
||||||
|
|
||||||
if (!gecko_isalive())
|
if (!gecko_isalive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
gecko_found = 1;
|
||||||
|
|
||||||
gecko_flush();
|
gecko_flush();
|
||||||
gecko_console_enabled = 1;
|
gecko_console_enabled = 1;
|
||||||
}
|
}
|
||||||
|
@ -269,17 +269,12 @@ static u32 _gecko_receive_left = 0;
|
||||||
static u32 _gecko_receive_len = 0;
|
static u32 _gecko_receive_len = 0;
|
||||||
static u8 *_gecko_receive_buffer = NULL;
|
static u8 *_gecko_receive_buffer = NULL;
|
||||||
|
|
||||||
void gecko_timer_initialize(void)
|
void gecko_process(void) {
|
||||||
{
|
|
||||||
if (!gecko_isalive())
|
|
||||||
return;
|
|
||||||
|
|
||||||
irq_set_alarm(20, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void gecko_timer(void) {
|
|
||||||
u8 b;
|
u8 b;
|
||||||
|
|
||||||
|
if (!gecko_found)
|
||||||
|
return;
|
||||||
|
|
||||||
if (_gecko_cmd_start_time && read32(HW_TIMER) >
|
if (_gecko_cmd_start_time && read32(HW_TIMER) >
|
||||||
(_gecko_cmd_start_time + IRQ_ALARM_MS2REG(5000)))
|
(_gecko_cmd_start_time + IRQ_ALARM_MS2REG(5000)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
5
gecko.h
5
gecko.h
|
@ -27,14 +27,13 @@ u8 gecko_enable_console(const u8 enable);
|
||||||
int gecko_printf(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
|
int gecko_printf(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void gecko_timer_initialize(void);
|
void gecko_process(void);
|
||||||
void gecko_timer(void);
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define gecko_init(...) do { } while(0)
|
#define gecko_init(...) do { } while(0)
|
||||||
#define gecko_enable_console(...) do { } while(0)
|
#define gecko_enable_console(...) do { } while(0)
|
||||||
#define gecko_printf(...) do { } while(0)
|
#define gecko_printf(...) do { } while(0)
|
||||||
#define gecko_timer_initialize(...) do { } while(0)
|
#define gecko_process(...) do { } while(0)
|
||||||
#define gecko_timer(...) do { } while(0)
|
#define gecko_timer(...) do { } while(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
2
ipc.c
2
ipc.c
|
@ -343,6 +343,8 @@ u32 ipc_process_slow(void)
|
||||||
|
|
||||||
if (!vector)
|
if (!vector)
|
||||||
{
|
{
|
||||||
|
gecko_process();
|
||||||
|
|
||||||
u32 cookie = irq_kill();
|
u32 cookie = irq_kill();
|
||||||
if(slow_queue_head == slow_queue_tail)
|
if(slow_queue_head == slow_queue_tail)
|
||||||
irq_wait();
|
irq_wait();
|
||||||
|
|
6
irq.c
6
irq.c
|
@ -54,11 +54,9 @@ void irq_handler(void)
|
||||||
flags = flags & enabled;
|
flags = flags & enabled;
|
||||||
|
|
||||||
if(flags & IRQF_TIMER) {
|
if(flags & IRQF_TIMER) {
|
||||||
if (_alarm_frequency) {
|
if (_alarm_frequency)
|
||||||
// currently we use the alarm timer only for lame usbgecko polling
|
|
||||||
gecko_timer();
|
|
||||||
write32(HW_ALARM, read32(HW_TIMER) + _alarm_frequency);
|
write32(HW_ALARM, read32(HW_TIMER) + _alarm_frequency);
|
||||||
}
|
|
||||||
write32(HW_ARMIRQFLAG, IRQF_TIMER);
|
write32(HW_ARMIRQFLAG, IRQF_TIMER);
|
||||||
}
|
}
|
||||||
if(flags & IRQF_NAND) {
|
if(flags & IRQF_NAND) {
|
||||||
|
|
4
main.c
4
main.c
|
@ -55,11 +55,11 @@ u32 _main(void *base)
|
||||||
read32(0xffffff0c), read32(0xffffff10), read32(0xffffff14));
|
read32(0xffffff0c), read32(0xffffff10), read32(0xffffff14));
|
||||||
|
|
||||||
irq_initialize();
|
irq_initialize();
|
||||||
irq_enable(IRQ_TIMER);
|
|
||||||
// irq_enable(IRQ_GPIO1B);
|
// irq_enable(IRQ_GPIO1B);
|
||||||
irq_enable(IRQ_GPIO1);
|
irq_enable(IRQ_GPIO1);
|
||||||
irq_enable(IRQ_RESET);
|
irq_enable(IRQ_RESET);
|
||||||
gecko_timer_initialize();
|
irq_enable(IRQ_TIMER);
|
||||||
|
irq_set_alarm(20, 1);
|
||||||
gecko_printf("Interrupts initialized\n");
|
gecko_printf("Interrupts initialized\n");
|
||||||
|
|
||||||
crypto_initialize();
|
crypto_initialize();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user