Changeset ebbc03c7 in mainline


Ignore:
Timestamp:
2019-05-05T12:22:55Z (5 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1fbe639b
Parents:
5773e82
Message:

Use ioport32_t for ppc32 pic

File:
1 edited

Legend:

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

    r5773e82 rebbc03c7  
    3737#include <byteorder.h>
    3838#include <bitops.h>
     39#include <typedefs.h>
    3940
    40 static volatile uint32_t *pic = NULL;
     41static ioport32_t *pic = NULL;
    4142
    4243void pic_init(uintptr_t base, size_t size, cir_t *cir, void **cir_arg)
     
    5051void pic_enable_interrupt(inr_t intnum)
    5152{
    52         if (pic) {
    53                 if (intnum < 32)
    54                         pic[PIC_MASK_LOW] = pic[PIC_MASK_LOW] | (1 << intnum);
    55                 else
    56                         pic[PIC_MASK_HIGH] = pic[PIC_MASK_HIGH] | (1 << (intnum - 32));
     53        if (!pic)
     54                return;
     55
     56        if (intnum < 32) {
     57                pio_write_32(&pic[PIC_MASK_LOW],
     58                    pio_read_32(&pic[PIC_MASK_LOW]) | (1 << intnum));
     59        } else {
     60                pio_write_32(&pic[PIC_MASK_HIGH],
     61                    pio_read_32(&pic[PIC_MASK_HIGH]) | (1 << (intnum - 32)));
    5762        }
    58 
    5963}
    6064
    6165void pic_disable_interrupt(inr_t intnum)
    6266{
    63         if (pic) {
    64                 if (intnum < 32)
    65                         pic[PIC_MASK_LOW] = pic[PIC_MASK_LOW] & (~(1 << intnum));
    66                 else
    67                         pic[PIC_MASK_HIGH] = pic[PIC_MASK_HIGH] & (~(1 << (intnum - 32)));
     67        if (!pic)
     68                return;
     69
     70        if (intnum < 32) {
     71                pio_write_32(&pic[PIC_MASK_LOW],
     72                    pio_read_32(&pic[PIC_MASK_LOW]) & (~(1 << intnum)));
     73        } else {
     74                pio_write_32(&pic[PIC_MASK_HIGH],
     75                    pio_read_32(&pic[PIC_MASK_HIGH]) & (~(1 << (intnum - 32))));
    6876        }
    6977}
     
    7179void pic_ack_interrupt(void *arg, inr_t intnum)
    7280{
    73         if (pic) {
    74                 if (intnum < 32)
    75                         pic[PIC_ACK_LOW] = 1 << intnum;
    76                 else
    77                         pic[PIC_ACK_HIGH] = 1 << (intnum - 32);
     81        if (!pic)
     82                return;
     83
     84        if (intnum < 32) {
     85                pio_write_32(&pic[PIC_ACK_LOW], 1 << intnum);
     86        } else {
     87                pio_write_32(&pic[PIC_ACK_HIGH], 1 << (intnum - 32));
    7888        }
    7989}
     
    8797                uint32_t pending;
    8898
    89                 pending = pic[PIC_PENDING_LOW];
     99                pending = pio_read_32(&pic[PIC_PENDING_LOW]);
    90100                if (pending != 0)
    91101                        return fnzb32(pending);
    92102
    93                 pending = pic[PIC_PENDING_HIGH];
     103                pending = pio_read_32(&pic[PIC_PENDING_HIGH]);
    94104                if (pending != 0)
    95105                        return fnzb32(pending) + 32;
Note: See TracChangeset for help on using the changeset viewer.