| Index: embios/trunk/target/ipodnano2g/interrupt.c | 
| — | — | @@ -93,7 +93,7 @@ | 
| 94 | 94 |      if (TDCON & 0x00038000) timervector[3]();
 | 
| 95 | 95 |  }
 | 
| 96 | 96 |  
 | 
| 97 |   | -static void (* const dmavector[])(void) IDATA_ATTR =
 | 
|   | 97 | +static void (* dmavector[])(void) IDATA_ATTR =
 | 
| 98 | 98 |  {
 | 
| 99 | 99 |      INT_DMA0,INT_DMA1,INT_DMA2,INT_DMA3,INT_DMA4,INT_DMA5,INT_DMA6,INT_DMA7,INT_DMA8
 | 
| 100 | 100 |  };
 | 
| — | — | @@ -148,6 +148,12 @@ | 
| 149 | 149 |      else timervector[timer] = unhandled_irq;
 | 
| 150 | 150 |  }
 | 
| 151 | 151 |  
 | 
|   | 152 | +void int_dma_set_handler(int channel, void* handler)
 | 
|   | 153 | +{
 | 
|   | 154 | +    if (handler) dmavector[channel] = handler;
 | 
|   | 155 | +    else dmavector[channel] = unhandled_irq;
 | 
|   | 156 | +}
 | 
|   | 157 | +
 | 
| 152 | 158 |  void interrupt_init(void)
 | 
| 153 | 159 |  {
 | 
| 154 | 160 |      INTMSK = (1 << IRQ_TIMER) | (1 << IRQ_DMA);
 | 
| Index: embios/trunk/target/ipodnano4g/interrupt.c | 
| — | — | @@ -141,16 +141,16 @@ | 
| 142 | 142 |  
 | 
| 143 | 143 |  void irqhandler(void)
 | 
| 144 | 144 |  {
 | 
| 145 |   | -	uint32_t dummy = VIC0ADDRESS;
 | 
|   | 145 | +    uint32_t dummy = VIC0ADDRESS;
 | 
| 146 | 146 |      dummy = VIC1ADDRESS;
 | 
| 147 | 147 |      uint32_t irqs0 = VIC0IRQSTATUS;
 | 
| 148 | 148 |      uint32_t irqs1 = VIC1IRQSTATUS;
 | 
| 149 |   | -	for (current_irq = 0; irqs0; current_irq++, irqs0 >>= 1)
 | 
| 150 |   | -		if (irqs0 & 1)
 | 
| 151 |   | -		    irqvector[current_irq]();
 | 
| 152 |   | -	for (current_irq = 32; irqs1; current_irq++, irqs1 >>= 1)
 | 
| 153 |   | -		if (irqs1 & 1)
 | 
| 154 |   | -		    irqvector[current_irq]();
 | 
|   | 149 | +    for (current_irq = 0; irqs0; current_irq++, irqs0 >>= 1)
 | 
|   | 150 | +        if (irqs0 & 1)
 | 
|   | 151 | +            irqvector[current_irq]();
 | 
|   | 152 | +    for (current_irq = 32; irqs1; current_irq++, irqs1 >>= 1)
 | 
|   | 153 | +        if (irqs1 & 1)
 | 
|   | 154 | +            irqvector[current_irq]();
 | 
| 155 | 155 |      VIC0ADDRESS = 0;
 | 
| 156 | 156 |      VIC1ADDRESS = 0;
 | 
| 157 | 157 |  }
 | 
| — | — | @@ -157,22 +157,28 @@ | 
| 158 | 158 |  
 | 
| 159 | 159 |  void interrupt_enable(int irq, bool state)
 | 
| 160 | 160 |  {
 | 
| 161 |   | -	if (state) VICINTENABLE(irq >> 5) = 1 << (irq & 0x1f);
 | 
| 162 |   | -	else VICINTENCLEAR(irq >> 5) = 1 << (irq & 0x1f);
 | 
|   | 161 | +    if (state) VICINTENABLE(irq >> 5) = 1 << (irq & 0x1f);
 | 
|   | 162 | +    else VICINTENCLEAR(irq >> 5) = 1 << (irq & 0x1f);
 | 
| 163 | 163 |  }
 | 
| 164 | 164 |  
 | 
| 165 | 165 |  void interrupt_set_handler(int irq, void* handler)
 | 
| 166 | 166 |  {
 | 
| 167 |   | -	if (handler) irqvector[irq] = handler;
 | 
| 168 |   | -	else irqvector[irq] = unhandled_irq;
 | 
|   | 167 | +    if (handler) irqvector[irq] = handler;
 | 
|   | 168 | +    else irqvector[irq] = unhandled_irq;
 | 
| 169 | 169 |  }
 | 
| 170 | 170 |  
 | 
| 171 | 171 |  void int_timer_set_handler(int timer, void* handler)
 | 
| 172 | 172 |  {
 | 
| 173 |   | -	if (handler) timervector[timer] = handler;
 | 
| 174 |   | -	else timervector[timer] = unhandled_irq;
 | 
|   | 173 | +    if (handler) timervector[timer] = handler;
 | 
|   | 174 | +    else timervector[timer] = unhandled_irq;
 | 
| 175 | 175 |  }
 | 
| 176 | 176 |  
 | 
|   | 177 | +void int_dma_set_handler(int channel, void* handler)
 | 
|   | 178 | +{
 | 
|   | 179 | +    void(channel);
 | 
|   | 180 | +    void(handler);
 | 
|   | 181 | +}
 | 
|   | 182 | +
 | 
| 177 | 183 |  void interrupt_init(void)
 | 
| 178 | 184 |  {
 | 
| 179 | 185 |      VIC0INTENABLE = 1 << IRQ_TIMER;
 | 
| Index: embios/trunk/export/syscallwrappers.h | 
| — | — | @@ -184,6 +184,7 @@ | 
| 185 | 185 |  #define hwkeyaes(args...) __embios_syscall->hwkeyaes(args)
 | 
| 186 | 186 |  #define hmacsha1(args...) __embios_syscall->hmacsha1(args)
 | 
| 187 | 187 |  #define reset(args...) __embios_syscall->reset(args)
 | 
|   | 188 | +#define int_dma_set_handler(args...) __embios_syscall->int_dma_set_handler(args)
 | 
| 188 | 189 |  
 | 
| 189 | 190 |  
 | 
| 190 | 191 |  #endif
 | 
| Index: embios/trunk/export/syscallapi.h | 
| — | — | @@ -63,7 +63,7 @@ | 
| 64 | 64 |  #include "../libc/tlsf/tlsf.h"
 | 
| 65 | 65 |  
 | 
| 66 | 66 |  /* increase this every time the api struct changes */
 | 
| 67 |   | -#define EMBIOS_API_VERSION 0
 | 
|   | 67 | +#define EMBIOS_API_VERSION 1
 | 
| 68 | 68 |  
 | 
| 69 | 69 |  /* update this to latest version if a change to the api struct breaks
 | 
| 70 | 70 |     backwards compatibility (and please take the opportunity to sort in any
 | 
| — | — | @@ -79,8 +79,8 @@ | 
| 80 | 80 |  {
 | 
| 81 | 81 |      uint32_t table_version;
 | 
| 82 | 82 |      uint32_t table_minversion;
 | 
| 83 |   | -	typeof(panic) *panic;
 | 
| 84 |   | -	typeof(panicf) *panicf;
 | 
|   | 83 | +    typeof(panic) *panic;
 | 
|   | 84 | +    typeof(panicf) *panicf;
 | 
| 85 | 85 |      typeof(cprintf) *cprintf;
 | 
| 86 | 86 |      typeof(cvprintf) *cvprintf;
 | 
| 87 | 87 |      typeof(cputc) *cputc;
 | 
| — | — | @@ -228,6 +228,7 @@ | 
| 229 | 229 |      typeof(hwkeyaes) *hwkeyaes;
 | 
| 230 | 230 |      typeof(hmacsha1) *hmacsha1;
 | 
| 231 | 231 |      typeof(reset) *reset;
 | 
|   | 232 | +    typeof(int_dma_set_handler) *int_dma_set_handler;
 | 
| 232 | 233 |  };
 | 
| 233 | 234 |  
 | 
| 234 | 235 |  
 | 
| Index: embios/trunk/interrupt.h | 
| — | — | @@ -34,5 +34,6 @@ | 
| 35 | 35 |  void interrupt_enable(int irq, bool state);
 | 
| 36 | 36 |  void interrupt_set_handler(int irq, void* handler);
 | 
| 37 | 37 |  void int_timer_set_handler(int timer, void* handler);
 | 
|   | 38 | +void int_dma_set_handler(int channel, void* handler);
 | 
| 38 | 39 |  
 | 
| 39 | 40 |  #endif
 | 
| Index: embios/trunk/syscallapi.c | 
| — | — | @@ -194,6 +194,7 @@ | 
| 195 | 195 |      .hwkeyaes = hwkeyaes,
 | 
| 196 | 196 |  #endif
 | 
| 197 | 197 |  #ifdef HAVE_HMACSHA1
 | 
| 198 |   | -    .hmacsha1 = hmacsha1
 | 
|   | 198 | +    .hmacsha1 = hmacsha1,
 | 
| 199 | 199 |  #endif
 | 
|   | 200 | +    .int_dma_set_handler = int_dma_set_handler
 | 
| 200 | 201 |  };
 |