i8259.hh revision 5634
15390SN/A/*
25390SN/A * Copyright (c) 2004-2005 The Regents of The University of Michigan
35390SN/A * All rights reserved.
45390SN/A *
55390SN/A * Redistribution and use in source and binary forms, with or without
65390SN/A * modification, are permitted provided that the following conditions are
75390SN/A * met: redistributions of source code must retain the above copyright
85390SN/A * notice, this list of conditions and the following disclaimer;
95390SN/A * redistributions in binary form must reproduce the above copyright
105390SN/A * notice, this list of conditions and the following disclaimer in the
115390SN/A * documentation and/or other materials provided with the distribution;
125390SN/A * neither the name of the copyright holders nor the names of its
135390SN/A * contributors may be used to endorse or promote products derived from
145390SN/A * this software without specific prior written permission.
155390SN/A *
165390SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
175390SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
185390SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
195390SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
205390SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
215390SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
225390SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
235390SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
245390SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
255390SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
265390SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
275390SN/A *
285390SN/A * Authors: Gabe Black
295390SN/A */
305390SN/A
315630Sgblack@eecs.umich.edu#ifndef __DEV_X86_I8259_HH__
325630Sgblack@eecs.umich.edu#define __DEV_X86_I8259_HH__
335390SN/A
345630Sgblack@eecs.umich.edu#include "dev/io_device.hh"
355634Sgblack@eecs.umich.edu#include "dev/x86/intdev.hh"
365630Sgblack@eecs.umich.edu#include "params/I8259.hh"
375634Sgblack@eecs.umich.edu#include "enums/X86I8259CascadeMode.hh"
385390SN/A
395390SN/Anamespace X86ISA
405390SN/A{
415390SN/A
425634Sgblack@eecs.umich.educlass I8259 : public BasicPioDevice, public IntDev
435390SN/A{
445630Sgblack@eecs.umich.edu  protected:
455630Sgblack@eecs.umich.edu    Tick latency;
465634Sgblack@eecs.umich.edu    IntPin *output;
475634Sgblack@eecs.umich.edu    Enums::X86I8259CascadeMode mode;
485630Sgblack@eecs.umich.edu
495631Sgblack@eecs.umich.edu    // Interrupt Request Register
505631Sgblack@eecs.umich.edu    uint8_t IRR;
515631Sgblack@eecs.umich.edu    // In Service Register
525631Sgblack@eecs.umich.edu    uint8_t ISR;
535631Sgblack@eecs.umich.edu    // Interrupt Mask Register
545631Sgblack@eecs.umich.edu    uint8_t IMR;
555631Sgblack@eecs.umich.edu
565632Sgblack@eecs.umich.edu    bool cascadeMode;
575632Sgblack@eecs.umich.edu    // A bit vector of lines with slaves attached, or the slave id, depending
585632Sgblack@eecs.umich.edu    // on if this is a master or slave PIC.
595632Sgblack@eecs.umich.edu    uint8_t cascadeBits;
605632Sgblack@eecs.umich.edu
615631Sgblack@eecs.umich.edu    bool edgeTriggered;
625632Sgblack@eecs.umich.edu    bool readIRR;
635632Sgblack@eecs.umich.edu
645632Sgblack@eecs.umich.edu    // State machine information for reading in initialization control words.
655631Sgblack@eecs.umich.edu    bool expectICW4;
665631Sgblack@eecs.umich.edu    int initControlWord;
675631Sgblack@eecs.umich.edu
685390SN/A  public:
695630Sgblack@eecs.umich.edu    typedef I8259Params Params;
705390SN/A
715630Sgblack@eecs.umich.edu    const Params *
725630Sgblack@eecs.umich.edu    params() const
735630Sgblack@eecs.umich.edu    {
745630Sgblack@eecs.umich.edu        return dynamic_cast<const Params *>(_params);
755630Sgblack@eecs.umich.edu    }
765630Sgblack@eecs.umich.edu
775634Sgblack@eecs.umich.edu    I8259(Params * p) : BasicPioDevice(p), latency(p->pio_latency),
785634Sgblack@eecs.umich.edu                        output(p->output), mode(p->mode), readIRR(true),
795634Sgblack@eecs.umich.edu                        initControlWord(0)
805630Sgblack@eecs.umich.edu    {
815630Sgblack@eecs.umich.edu        pioSize = 2;
825630Sgblack@eecs.umich.edu    }
835390SN/A
845390SN/A    Tick read(PacketPtr pkt);
855390SN/A
865390SN/A    Tick write(PacketPtr pkt);
875632Sgblack@eecs.umich.edu
885632Sgblack@eecs.umich.edu    void signalInterrupt(int line);
895390SN/A};
905390SN/A
915390SN/A}; // namespace X86ISA
925390SN/A
935630Sgblack@eecs.umich.edu#endif //__DEV_X86_I8259_HH__
94