Changeset c2417bc in mainline for kernel/arch/ppc32/src


Ignore:
Timestamp:
2009-04-21T12:46:26Z (16 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f2d2c7ba
Parents:
44b7783
Message:

change the way how input devices are wired together according to ticket #44
(also the proposal http://lists.modry.cz/cgi-bin/private/helenos-devel/2009-March/002507.html)

Location:
kernel/arch/ppc32/src
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ppc32/src/drivers/pic.c

    r44b7783 rc2417bc  
    2727 */
    2828
    29 /** @addtogroup ppc32   
     29/** @addtogroup ppc32
    3030 * @{
    3131 */
     
    4141static volatile uint32_t *pic = NULL;
    4242
    43 void pic_init(uintptr_t base, size_t size)
     43void pic_init(uintptr_t base, size_t size, cir_t *cir, void **cir_arg)
    4444{
    4545        pic = (uint32_t *) hw_map(base, size);
     46        *cir = pic_ack_interrupt;
     47        *cir_arg = NULL;
    4648}
    4749
    48 void pic_enable_interrupt(int intnum)
     50void pic_enable_interrupt(inr_t intnum)
    4951{
    5052        if (pic) {
     
    5759}
    5860
    59 void pic_disable_interrupt(int intnum)
     61void pic_disable_interrupt(inr_t intnum)
    6062{
    6163        if (pic) {
     
    6769}
    6870
    69 void pic_ack_interrupt(int intnum)
     71void pic_ack_interrupt(void *arg, inr_t intnum)
    7072{
    7173        if (pic) {
  • kernel/arch/ppc32/src/dummy.s

    r44b7783 rc2417bc  
    3131.global asm_delay_loop
    3232.global sys_tls_set
     33.global cpu_halt
    3334
    3435sys_tls_set:
     
    3738asm_delay_loop:
    3839        blr
     40
     41cpu_halt:
     42        b cpu_halt
  • kernel/arch/ppc32/src/interrupt.c

    r44b7783 rc2417bc  
    6161       
    6262        while ((inum = pic_get_pending()) != -1) {
    63                 bool ack = false;
    6463                irq_t *irq = irq_dispatch_and_lock(inum);
    6564                if (irq) {
     
    7069                        if (irq->preack) {
    7170                                /* Acknowledge the interrupt before processing */
    72                                 pic_ack_interrupt(inum);
    73                                 ack = true;
     71                                if (irq->cir)
     72                                        irq->cir(irq->cir_arg, irq->inr);
    7473                        }
    7574                       
    7675                        irq->handler(irq);
     76                       
     77                        if (!irq->preack) {
     78                                if (irq->cir)
     79                                        irq->cir(irq->cir_arg, irq->inr);
     80                        }
     81                       
    7782                        spinlock_unlock(&irq->lock);
    7883                } else {
     
    8489#endif
    8590                }
    86                
    87                 if (!ack)
    88                         pic_ack_interrupt(inum);
    8991        }
    9092}
  • kernel/arch/ppc32/src/ppc32.c

    r44b7783 rc2417bc  
    3636#include <arch.h>
    3737#include <arch/boot/boot.h>
    38 #include <arch/drivers/cuda.h>
     38#include <genarch/drivers/via-cuda/cuda.h>
    3939#include <arch/interrupt.h>
    4040#include <genarch/fb/fb.h>
     
    4545#include <ddi/irq.h>
    4646#include <arch/drivers/pic.h>
     47#include <align.h>
    4748#include <macros.h>
    4849#include <string.h>
    4950
    5051#define IRQ_COUNT  64
     52#define IRQ_CUDA   10
    5153
    5254bootinfo_t bootinfo;
     
    118120                if (bootinfo.macio.addr) {
    119121                        /* Initialize PIC */
    120                         pic_init(bootinfo.macio.addr, PAGE_SIZE);
     122                        cir_t cir;
     123                        void *cir_arg;
     124                        pic_init(bootinfo.macio.addr, PAGE_SIZE, &cir, &cir_arg);
     125                       
     126#ifdef CONFIG_VIA_CUDA
     127                        uintptr_t pa = bootinfo.macio.addr + 0x16000;
     128                        uintptr_t aligned_addr = ALIGN_DOWN(pa, PAGE_SIZE);
     129                        size_t offset = pa - aligned_addr;
     130                        size_t size = 2 * PAGE_SIZE;
     131                       
     132                        cuda_t *cuda = (cuda_t *)
     133                            (hw_map(aligned_addr, offset + size) + offset);
    121134                       
    122135                        /* Initialize I/O controller */
    123                         cuda_init(bootinfo.macio.addr + 0x16000, 2 * PAGE_SIZE);
     136                        cuda_instance_t *cuda_instance =
     137                            cuda_init(cuda, IRQ_CUDA, cir, cir_arg);
     138                        if (cuda_instance) {
     139                                indev_t *sink = stdin_wire();
     140                                cuda_wire(cuda_instance, sink);
     141                        }
     142#endif
    124143                }
    125144               
     
    187206}
    188207
     208void arch_reboot(void)
     209{
     210        // TODO
     211        while (1);
     212}
     213
    189214/** @}
    190215 */
Note: See TracChangeset for help on using the changeset viewer.