cpu: remove unnecessary data ptr from O3 internal read() funcs
[gem5.git] / src / dev / uart.hh
index 2dd15d9b8afcd4aacf87947973cbabb08c63cfe5..6c9c08ee7cab27b3ce6ff7fc4ee21643d420c754 100644 (file)
@@ -24,6 +24,8 @@
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Ali Saidi
  */
 
 /** @file
 #ifndef __UART_HH__
 #define __UART_HH__
 
-#include "base/range.hh"
 #include "dev/io_device.hh"
+#include "dev/terminal.hh"
+#include "params/Uart.hh"
 
-class SimConsole;
 class Platform;
 
 const int RX_INT = 0x1;
 const int TX_INT = 0x2;
 
-
 class Uart : public BasicPioDevice
 {
-
   protected:
     int status;
     Platform *platform;
-    SimConsole *cons;
+    Terminal *term;
 
   public:
-    struct Params : public BasicPioDevice::Params
-    {
-        SimConsole *cons;
-    };
+    typedef UartParams Params;
+    Uart(const Params *p, Addr pio_size);
 
-    Uart(Params *p);
+    const Params *
+    params() const
+    {
+        return dynamic_cast<const Params *>(_params);
+    }
 
     /**
      * Inform the uart that there is data available.
      */
     virtual void dataAvailable() = 0;
 
-
     /**
      * Return if we have an interrupt pending
      * @return interrupt status
@@ -72,8 +73,7 @@ class Uart : public BasicPioDevice
     bool intStatus() { return status ? true : false; }
 
   protected:
-    const Params *params() const {return (const Params *)_params; }
-
+    MakeCallback<Uart, &Uart::dataAvailable> callbackDataAvail;
 };
 
 #endif // __UART_HH__