8#include <xaiefal/common/xaiefal-common.hpp>
9#include <xaiefal/rsc/xaiefal-rsc-base.hpp>
10#include <xaiefal/rsc/xaiefal-rscmgr.hpp>
25 GroupEvent(gEvent), GroupComposition(0) {
28 if (getGroupId(DevHd,
Mod, gEvent, GroupId) != XAIE_OK) {
29 throw std::invalid_argument(
"Invalid group Event");
32 State.Initialized = 1;
67 (uint32_t)
Loc.Col <<
"," << (uint32_t)
Loc.Row <<
")" <<
68 " Mod=" <<
Mod <<
", empty handle." << std::endl;
69 return XAIE_INVALID_ARGS;
71 if (
State.Reserved == 1) {
72 if (GroupComposition != Comp) {
74 (uint32_t)
Loc.Col <<
"," << (uint32_t)
Loc.Row <<
")" <<
75 " Mod=" <<
Mod <<
" E=" << GroupEvent <<
" (" <<
76 XAie_EventGetString(GroupEvent) <<
") is reserved with " <<
77 GroupComposition <<
", request composition is " <<
78 Comp <<
"." << std::endl;
79 RC = XAIE_INVALID_ARGS;
81 Handles.emplace(Hid,
false);
87 GroupComposition = Comp;
88 Handles.emplace(Hid,
false);
108 auto H = Handles.find(Hid);
109 if (H == Handles.end()) {
111 (uint32_t)
Loc.Col <<
"," << (uint32_t)
Loc.Row <<
")" <<
113 " group event=" << GroupEvent <<
114 " (" << XAie_EventGetString(GroupEvent) <<
115 "), invalid handle." << std::endl;
116 RC = XAIE_INVALID_ARGS;
121 if (
State.Running == 0) {
124 Handles[Hid] =
false;
144 auto H = Handles.find(Hid);
145 if (H == Handles.end()) {
147 (uint32_t)
Loc.Col <<
"," << (uint32_t)
Loc.Row <<
")" <<
149 " group event=" << GroupEvent <<
150 " (" << XAie_EventGetString(GroupEvent) <<
151 "), invalid handle." << std::endl;
152 RC = XAIE_INVALID_ARGS;
156 Handles[Hid] =
false;
165 std::map<const XAieGroupEventHandle *, bool>::iterator
it;
166 for (
it = Handles.begin();
it != Handles.end();
172 if (
it == Handles.end()) {
173 if (
State.Running == 1) {
197 auto H = Handles.find(Hid);
198 if (H == Handles.end()) {
200 (uint32_t)
Loc.Col <<
"," << (uint32_t)
Loc.Row <<
")" <<
202 " group event=" << GroupEvent <<
203 " (" << XAie_EventGetString(GroupEvent) <<
204 "), invalid handle." << std::endl;
205 RC = XAIE_INVALID_ARGS;
210 if (
State.Reserved == 1 && Handles.empty()) {
219 const XAie_EvntMod *EvntMod;
221 TileType = XAie_GetTileTypefromLoc(
AieHd->dev(),
Loc);
223 if (
Mod == XAIE_PL_MOD) {
224 EvntMod = &
AieHd->dev()->DevProp.DevMod[TileType].EvntMod[0U];
226 EvntMod = &
AieHd->dev()->DevProp.DevMod[TileType].EvntMod[
Mod];
229 for (uint8_t i = 0; i < EvntMod->NumGroupEvents; i++) {
230 if (Event == EvntMod->Group[i].GroupEvent) {
231 return EvntMod->Group[i].GroupOff;
237 XAie_Events GroupEvent;
238 uint32_t GroupComposition;
240 std::map<const XAieGroupEventHandle *, bool> Handles;
251 vRscs.push_back(Rsc);
252 RC =
AieHd->rscMgr()->request(*
this);
255 (uint32_t)
Loc.Col <<
"," << (uint32_t)
Loc.Row <<
")" <<
256 " Mod=" <<
Mod <<
" resource not available.\n";
266 RC =
AieHd->rscMgr()->free(*
this);
271 uint32_t lConfig = GroupComposition;
274 lConfig = 0xFFFFFFFFU;
276 return XAie_EventGroupControl(
dev(),
Loc,
Mod, GroupEvent,
280 return XAie_EventGroupReset(
dev(),
Loc,
Mod, GroupEvent);
297 static AieRC getGroupId(std::shared_ptr<XAieDevHandle> DevHd,
303 if (Module == XAIE_CORE_MOD) {
304 EIds = DevHd->XAieGroupEventMapCore;
305 EIdsTotal =
sizeof(DevHd->XAieGroupEventMapCore)/
306 sizeof(DevHd->XAieGroupEventMapCore[0]);
307 }
else if (Module == XAIE_MEM_MOD) {
308 if (Event >= XAIE_EVENT_GROUP_0_MEM_TILE) {
309 EIds = DevHd->XAieGroupEventMapMemTile;
310 EIdsTotal =
sizeof(DevHd->XAieGroupEventMapMemTile)/
311 sizeof(DevHd->XAieGroupEventMapMemTile[0]);
313 EIds = DevHd->XAieGroupEventMapMem;
314 EIdsTotal =
sizeof(DevHd->XAieGroupEventMapMem)/
315 sizeof(DevHd->XAieGroupEventMapMem[0]);
318 EIds = DevHd->XAieGroupEventMapPl;
319 EIdsTotal =
sizeof(DevHd->XAieGroupEventMapPl)/
320 sizeof(DevHd->XAieGroupEventMapPl[0]);
322 for (i = 0; i < EIdsTotal; i++) {
323 if (Event == EIds[i]) {
328 if (i >= EIdsTotal) {
329 RC = XAIE_INVALID_ARGS;
331 " Mod=" << Module <<
" " << Event <<
332 " invalid." << std::endl;
348 std::shared_ptr<XAieGroupEvent> gEPtr):
349 XAieRsc(DevHd), GroupEventPtr(gEPtr), GroupComposition(0) {
350 State.Initialized = 1;
351 State.Configured = 1;
363 GroupComposition = Comp;
372 return GroupComposition;
380 return GroupEventPtr->getEvent();
384 return GroupEventPtr->attachHandle(
this, GroupComposition);
387 return GroupEventPtr->removeHandle(
this);
390 return GroupEventPtr->startHandle(
this);
393 return GroupEventPtr->stopHandle(
this);
396 std::shared_ptr<XAieGroupEvent> GroupEventPtr;
397 uint32_t GroupComposition;
static std::ostream & log(LogLevel Lvl=LogLevel::FAL_MAX)
Definition xaiefal-log.hpp:50
class for group event resource reference
Definition xaiefal-groupevent.hpp:344
AieRC _stop()
Definition xaiefal-groupevent.hpp:392
void setGroupEvents(uint32_t Comp)
Definition xaiefal-groupevent.hpp:362
AieRC _start()
Definition xaiefal-groupevent.hpp:389
AieRC _reserve()
Definition xaiefal-groupevent.hpp:383
XAieGroupEventHandle(std::shared_ptr< XAieDevHandle > DevHd, std::shared_ptr< XAieGroupEvent > gEPtr)
Definition xaiefal-groupevent.hpp:347
XAieGroupEventHandle()=delete
AieRC _release()
Definition xaiefal-groupevent.hpp:386
XAie_Events getEvent() const
Definition xaiefal-groupevent.hpp:379
uint32_t getGroupEvents() const
Definition xaiefal-groupevent.hpp:371
AieRC stopHandle(const XAieGroupEventHandle *Hid)
Definition xaiefal-groupevent.hpp:141
AieRC removeHandle(const XAieGroupEventHandle *Hid)
Definition xaiefal-groupevent.hpp:194
AieRC _stop()
Definition xaiefal-groupevent.hpp:279
AieRC _release()
Definition xaiefal-groupevent.hpp:263
AieRC attachHandle(const XAieGroupEventHandle *Hid, uint32_t Comp)
Definition xaiefal-groupevent.hpp:60
AieRC _reserve()
Definition xaiefal-groupevent.hpp:243
AieRC _start()
Definition xaiefal-groupevent.hpp:270
XAieGroupEvent(std::shared_ptr< XAieDevHandle > DevHd, XAie_LocType Loc, XAie_ModuleType Mod, XAie_Events gEvent)
Definition xaiefal-groupevent.hpp:22
XAie_Events getEvent() const
Definition xaiefal-groupevent.hpp:42
uint32_t getRscIdfromEvent(XAie_Events Event)
Definition xaiefal-groupevent.hpp:217
AieRC startHandle(const XAieGroupEventHandle *Hid)
Definition xaiefal-groupevent.hpp:105
XAieRscType Type
Definition xaiefal-rsc-base.hpp:399
std::vector< XAieUserRsc > vRscs
Definition xaiefal-rsc-base.hpp:403
XAieRscState State
Definition xaiefal-rsc-base.hpp:398
XAie_DevInst * dev()
Definition xaiefal-rsc-base.hpp:373
AieRC release()
Definition xaiefal-rsc-base.hpp:188
AieRC reserve()
Definition xaiefal-rsc-base.hpp:161
AieRC start()
Definition xaiefal-rsc-base.hpp:239
uint32_t preferredId
Definition xaiefal-rsc-base.hpp:401
uint32_t reservedId
Definition xaiefal-rsc-base.hpp:402
std::shared_ptr< XAieDevHandle > AieHd
Definition xaiefal-rsc-base.hpp:400
AieRC stop()
Definition xaiefal-rsc-base.hpp:269
XAieSingleTileRsc()=delete
XAie_LocType Loc
Definition xaiefal-rsc-base.hpp:594
XAie_ModuleType Mod
Definition xaiefal-rsc-base.hpp:595
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of it
Definition license.txt:89
Definition xaiefal-base.hpp:23
@ XAIE_GROUPEVENT
Definition xaiefal-rsc-group.hpp:35
@ FAL_ERROR
Definition xaiefal-log.hpp:14
@ FAL_WARN
Definition xaiefal-log.hpp:13
Data needed to make a resource request.
Definition xaiefal-rsc-base.hpp:27
uint32_t RscId
Definition xaiefal-rsc-base.hpp:41
XAieRscType RscType
Definition xaiefal-rsc-base.hpp:37
XAie_LocType Loc
Definition xaiefal-rsc-base.hpp:29
XAie_ModuleType Mod
Definition xaiefal-rsc-base.hpp:33
#define _XAIEFAL_MUTEX_ACQUIRE(...)
Definition xaiefal-common.hpp:27
#define _XAIEFAL_MUTEX_DECLARE(...)
Definition xaiefal-common.hpp:28
#define XAIE_RSC_ID_ANY
Definition xaiefal-common.hpp:7