map/das-dn/third_party/AdsLib/RouterAccess.h

57 lines
1.4 KiB
C
Raw Normal View History

2024-12-03 10:36:06 +08:00
// SPDX-License-Identifier: MIT
/**
Copyright (c) 2021 - 2022 Beckhoff Automation GmbH & Co. KG
*/
#pragma once
#include "AdsDevice.h"
2024-12-09 09:41:04 +08:00
#include <array>
2024-12-03 10:36:06 +08:00
2024-12-09 09:41:04 +08:00
namespace Beckhoff
2024-12-03 10:36:06 +08:00
{
2024-12-09 09:41:04 +08:00
namespace Ads
2024-12-03 10:36:06 +08:00
{
struct RouterAccess {
RouterAccess(const std::string& gw, AmsNetId netid, uint16_t port);
bool PciScan(uint64_t pci_id, std::ostream& os) const;
private:
AdsDevice device;
};
2024-12-09 09:41:04 +08:00
struct SearchPciBusReq {
SearchPciBusReq(const uint64_t quad)
: leVendorID(Beckhoff::htole<uint16_t>(static_cast<uint16_t>(quad >> 48)))
, leDeviceID(Beckhoff::htole<uint16_t>(static_cast<uint16_t>(quad >> 32)))
, leSubVendorID(Beckhoff::htole<uint16_t>(static_cast<uint16_t>(quad >> 16)))
, leSubSystemID(Beckhoff::htole<uint16_t>(static_cast<uint16_t>(quad)))
{}
private:
const uint16_t leVendorID;
const uint16_t leDeviceID;
const uint16_t leSubVendorID;
const uint16_t leSubSystemID;
};
struct SearchPciSlotResNew {
static constexpr size_t MAXBASEADDRESSES = 6;
std::array<uint32_t, MAXBASEADDRESSES> leBaseAddresses;
uint32_t leSize[MAXBASEADDRESSES];
uint32_t leBusNumber;
uint32_t leSlotNumber;
uint16_t leBoardIrq;
uint16_t lePciRegViaPorts;
};
struct SearchPciBusResNew {
static constexpr size_t MAXSLOTRESPONSE = 64;
uint32_t leFound;
std::array<SearchPciSlotResNew, MAXSLOTRESPONSE> slot;
uint32_t nFound() const
{
return Beckhoff::letoh(leFound);
}
};
2024-12-03 10:36:06 +08:00
}
}