1*617e2443SMark Logan /******************************************************************************* 2*617e2443SMark Logan * Copyright (C) 2004-2008 Intel Corp. All rights reserved. 3*617e2443SMark Logan * 4*617e2443SMark Logan * Redistribution and use in source and binary forms, with or without 5*617e2443SMark Logan * modification, are permitted provided that the following conditions are met: 6*617e2443SMark Logan * 7*617e2443SMark Logan * - Redistributions of source code must retain the above copyright notice, 8*617e2443SMark Logan * this list of conditions and the following disclaimer. 9*617e2443SMark Logan * 10*617e2443SMark Logan * - Redistributions in binary form must reproduce the above copyright notice, 11*617e2443SMark Logan * this list of conditions and the following disclaimer in the documentation 12*617e2443SMark Logan * and/or other materials provided with the distribution. 13*617e2443SMark Logan * 14*617e2443SMark Logan * - Neither the name of Intel Corp. nor the names of its 15*617e2443SMark Logan * contributors may be used to endorse or promote products derived from this 16*617e2443SMark Logan * software without specific prior written permission. 17*617e2443SMark Logan * 18*617e2443SMark Logan * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' 19*617e2443SMark Logan * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20*617e2443SMark Logan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21*617e2443SMark Logan * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corp. OR THE CONTRIBUTORS 22*617e2443SMark Logan * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23*617e2443SMark Logan * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24*617e2443SMark Logan * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25*617e2443SMark Logan * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26*617e2443SMark Logan * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27*617e2443SMark Logan * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28*617e2443SMark Logan * POSSIBILITY OF SUCH DAMAGE. 29*617e2443SMark Logan *******************************************************************************/ 30*617e2443SMark Logan 31*617e2443SMark Logan #ifndef __HECI_H__ 32*617e2443SMark Logan #define __HECI_H__ 33*617e2443SMark Logan 34*617e2443SMark Logan #include <cstring> 35*617e2443SMark Logan 36*617e2443SMark Logan #ifdef __sun 37*617e2443SMark Logan #include <string.h> 38*617e2443SMark Logan #endif // __sun 39*617e2443SMark Logan 40*617e2443SMark Logan #ifndef GUID_DEFINED 41*617e2443SMark Logan #define GUID_DEFINED 42*617e2443SMark Logan 43*617e2443SMark Logan typedef struct guid { 44*617e2443SMark Logan unsigned int data1; 45*617e2443SMark Logan unsigned short data2; 46*617e2443SMark Logan unsigned short data3; 47*617e2443SMark Logan unsigned char data4[8]; 48*617e2443SMark Logan } GUID; 49*617e2443SMark Logan 50*617e2443SMark Logan #endif 51*617e2443SMark Logan 52*617e2443SMark Logan #include "HECI_if.h" 53*617e2443SMark Logan 54*617e2443SMark Logan class HECI 55*617e2443SMark Logan { 56*617e2443SMark Logan public: 57*617e2443SMark Logan HECI(const GUID guid, bool verbose = true) : _initialized(false)58*617e2443SMark Logan _initialized(false), 59*617e2443SMark Logan _verbose(verbose), 60*617e2443SMark Logan _bufSize(0), 61*617e2443SMark Logan _protocolVersion(0) 62*617e2443SMark Logan { 63*617e2443SMark Logan memcpy(&_guid, &guid, sizeof(_guid)); 64*617e2443SMark Logan } ~HECI()65*617e2443SMark Logan virtual ~HECI() {} 66*617e2443SMark Logan 67*617e2443SMark Logan virtual bool Init(unsigned char maxProtocolVersion = 0) = 0; 68*617e2443SMark Logan virtual void Deinit() = 0; 69*617e2443SMark Logan virtual int ReceiveMessage(unsigned char *buffer, int len, unsigned long timeout = 2000) = 0; 70*617e2443SMark Logan virtual int SendMessage(const unsigned char *buffer, int len, unsigned long timeout = 2000) = 0; 71*617e2443SMark Logan virtual unsigned int GetBufferSize() const = 0; 72*617e2443SMark Logan virtual unsigned char GetProtocolVersion() const = 0; 73*617e2443SMark Logan virtual bool GetHeciVersion(HECI_VERSION &version) const = 0; 74*617e2443SMark Logan virtual bool IsInitialized() const = 0; 75*617e2443SMark Logan 76*617e2443SMark Logan protected: 77*617e2443SMark Logan GUID _guid; 78*617e2443SMark Logan bool _initialized; 79*617e2443SMark Logan bool _verbose; 80*617e2443SMark Logan unsigned int _bufSize; 81*617e2443SMark Logan unsigned char _protocolVersion; 82*617e2443SMark Logan }; 83*617e2443SMark Logan 84*617e2443SMark Logan #endif 85