Changeset 3e828ea in mainline for kernel/arch/ppc32/src/drivers/pic.c


Ignore:
Timestamp:
2019-09-23T12:49:29Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9be2358
Parents:
9259d20 (diff), 1a4ec93f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jiri Svoboda <jiri@…> (2019-09-22 12:49:07)
git-committer:
Jiri Svoboda <jiri@…> (2019-09-23 12:49:29)
Message:

Merge changes from master, especially Meson build

File:
1 edited

Legend:

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

    r9259d20 r3e828ea  
    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.