touchkit.hh revision 12658
18528SN/A/*
28528SN/A * Copyright (c) 2010, 2017-2018 ARM Limited
38528SN/A * All rights reserved
48835SAli.Saidi@ARM.com *
58528SN/A * The license below extends only to copyright in the software and shall
68528SN/A * not be construed as granting a license to any other intellectual
78528SN/A * property including but not limited to intellectual property relating
88528SN/A * to a hardware implementation of the functionality of the software
98528SN/A * licensed hereunder.  You may use the software subject to the license
108528SN/A * terms below provided that you ensure that this notice is replicated
118891SAli.Saidi@ARM.com * unmodified and in its entirety in all distributions of the software,
128891SAli.Saidi@ARM.com * modified or unmodified, in source code or in binary form.
138983Snate@binkert.org *
148528SN/A * Redistribution and use in source and binary forms, with or without
159055Ssaidi@eecs.umich.edu * modification, are permitted provided that the following conditions are
168528SN/A * met: redistributions of source code must retain the above copyright
178528SN/A * notice, this list of conditions and the following disclaimer;
188528SN/A * redistributions in binary form must reproduce the above copyright
198983Snate@binkert.org * notice, this list of conditions and the following disclaimer in the
208528SN/A * documentation and/or other materials provided with the distribution;
218528SN/A * neither the name of the copyright holders nor the names of its
228528SN/A * contributors may be used to endorse or promote products derived from
239055Ssaidi@eecs.umich.edu * this software without specific prior written permission.
248528SN/A *
258721SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
268528SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
278528SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
288528SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
298528SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
308528SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
318528SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
328528SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
338528SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
348528SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
358891SAli.Saidi@ARM.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
368528SN/A *
378528SN/A * Authors: Andreas Sandberg
388528SN/A */
398528SN/A
408528SN/A#ifndef __DEV_PS2_TOUCHKIT_HH__
418891SAli.Saidi@ARM.com#define __DEV_PS2_TOUCHKIT_HH__
428721SN/A
438721SN/A#include "base/vnc/vncinput.hh"
448528SN/A#include "dev/ps2/device.hh"
458891SAli.Saidi@ARM.com
468891SAli.Saidi@ARM.comstruct PS2TouchKitParams;
478528SN/A
488528SN/Aclass PS2TouchKit : public PS2Device, public VncMouse
498528SN/A{
508528SN/A  protected:
518528SN/A    static const uint8_t ID[];
528528SN/A
538528SN/A    enum TKCommands {
548528SN/A        TouchKitActive = 'A',
558528SN/A        TouchKitFWRev = 'D',
568528SN/A        TouchKitCtrlType = 'E',
578528SN/A    };
588528SN/A
598528SN/A  public:
608528SN/A    PS2TouchKit(const PS2TouchKitParams *p);
618528SN/A
628528SN/A    void serialize(CheckpointOut &cp) const override;
638528SN/A    void unserialize(CheckpointIn &cp) override;
648528SN/A
658983Snate@binkert.org  protected: // PS2Device
668528SN/A    bool recv(const std::vector<uint8_t> &data) override;
678528SN/A
688528SN/A  public: // VncMouse
698528SN/A    void mouseAt(uint16_t x, uint16_t y, uint8_t buttons) override;
708528SN/A
718528SN/A  protected:
728528SN/A    bool recvTouchKit(const std::vector<uint8_t> &data);
738528SN/A    void sendTouchKit(const uint8_t *data, size_t size);
748528SN/A    void sendTouchKit(uint8_t data) { sendTouchKit(&data, 1); }
758528SN/A
768528SN/A    /** The vnc server we're connected to (if any) */
778528SN/A    VncInput *const vnc;
788528SN/A
798528SN/A    /** Is the device enabled? */
808528SN/A    bool enabled;
818528SN/A
828528SN/A    /**
838528SN/A     * Has the driver enabled TouchKit mode?  The model suppresses
848528SN/A     * touch event generation until this is true.
858528SN/A     */
868528SN/A    bool touchKitEnabled;
878528SN/A};
888528SN/A
898528SN/A#endif // __DEV_PS2_TOUCHKIT_HH__
908528SN/A
918528SN/A