57 lines
1.4 KiB
C++
57 lines
1.4 KiB
C++
// SPDX-License-Identifier: MIT
|
|
/**
|
|
Copyright (c) 2021 - 2022 Beckhoff Automation GmbH & Co. KG
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "AdsDevice.h"
|
|
#include <array>
|
|
|
|
namespace Beckhoff
|
|
{
|
|
namespace Ads
|
|
{
|
|
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;
|
|
};
|
|
|
|
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);
|
|
}
|
|
};
|
|
}
|
|
}
|