Files
rocm-systems/tests/kfdtest/src/BasePacket.hpp
T

62 baris
2.0 KiB
C++
Mentah Pandangan Normal Riwayat

2018-07-23 14:45:44 -04:00
/*
* Copyright (C) 2014-2018 Advanced Micro Devices, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifndef __KFD_BASE_PACKET__H__
#define __KFD_BASE_PACKET__H__
/**
2018-08-14 09:52:31 -04:00
* All packets profiles must be defined here
* Every type defined here has sub-types
2018-07-23 14:45:44 -04:00
*/
enum PACKETTYPE {
PACKETTYPE_PM4,
PACKETTYPE_SDMA,
PACKETTYPE_AQL
};
// @class BasePacket
class BasePacket {
public:
BasePacket(void);
virtual ~BasePacket(void);
2018-07-23 14:45:44 -04:00
2018-08-14 09:52:31 -04:00
// @returns Packet type
2018-07-23 14:45:44 -04:00
virtual PACKETTYPE PacketType() const = 0;
2018-08-14 09:52:31 -04:00
// @returns Pointer to the packet
2018-07-23 14:45:44 -04:00
virtual const void *GetPacket() const = 0;
2018-08-14 09:52:31 -04:00
// @returns Packet size in bytes
2018-07-23 14:45:44 -04:00
virtual unsigned int SizeInBytes() const = 0;
2018-08-14 09:52:31 -04:00
// @returns Packet size in dwordS
2018-07-23 14:45:44 -04:00
unsigned int SizeInDWords() const { return SizeInBytes()/sizeof(unsigned int); }
void Dump() const;
protected:
unsigned int m_FamilyId;
void *m_packetAllocation;
void *AllocPacket(void);
2018-07-23 14:45:44 -04:00
};
2018-08-14 09:52:31 -04:00
#endif // __KFD_BASE_PACKET__H__