/* automatically generated by rust-bindgen 0.72.1 */

/* generated from: amdsmi-rocm-6.3.0.h */

pub const AMDSMI_LIB_VERSION_YEAR: u32 = 24;
pub const AMDSMI_LIB_VERSION_MAJOR: u32 = 7;
pub const AMDSMI_LIB_VERSION_MINOR: u32 = 1;
pub const AMDSMI_LIB_VERSION_RELEASE: u32 = 0;
impl amdsmi_status_t {
    #[doc = "```text\n!< Call succeeded\n```"]
    pub const AMDSMI_STATUS_SUCCESS: amdsmi_status_t = amdsmi_status_t(0);
    #[doc = "```text\n!< Invalid parameters\n```"]
    pub const AMDSMI_STATUS_INVAL: amdsmi_status_t = amdsmi_status_t(1);
    #[doc = "```text\n!< Command not supported\n```"]
    pub const AMDSMI_STATUS_NOT_SUPPORTED: amdsmi_status_t = amdsmi_status_t(2);
    #[doc = "```text\n!< Not implemented yet\n```"]
    pub const AMDSMI_STATUS_NOT_YET_IMPLEMENTED: amdsmi_status_t = amdsmi_status_t(3);
    #[doc = "```text\n!< Fail to load lib\n```"]
    pub const AMDSMI_STATUS_FAIL_LOAD_MODULE: amdsmi_status_t = amdsmi_status_t(4);
    #[doc = "```text\n!< Fail to load symbol\n```"]
    pub const AMDSMI_STATUS_FAIL_LOAD_SYMBOL: amdsmi_status_t = amdsmi_status_t(5);
    #[doc = "```text\n!< Error when call libdrm\n```"]
    pub const AMDSMI_STATUS_DRM_ERROR: amdsmi_status_t = amdsmi_status_t(6);
    #[doc = "```text\n!< API call failed\n```"]
    pub const AMDSMI_STATUS_API_FAILED: amdsmi_status_t = amdsmi_status_t(7);
    #[doc = "```text\n!< Timeout in API call\n```"]
    pub const AMDSMI_STATUS_TIMEOUT: amdsmi_status_t = amdsmi_status_t(8);
    #[doc = "```text\n!< Retry operation\n```"]
    pub const AMDSMI_STATUS_RETRY: amdsmi_status_t = amdsmi_status_t(9);
    #[doc = "```text\n!< Permission Denied\n```"]
    pub const AMDSMI_STATUS_NO_PERM: amdsmi_status_t = amdsmi_status_t(10);
    #[doc = "```text\n!< An interrupt occurred during execution of function\n```"]
    pub const AMDSMI_STATUS_INTERRUPT: amdsmi_status_t = amdsmi_status_t(11);
    #[doc = "```text\n!< I/O Error\n```"]
    pub const AMDSMI_STATUS_IO: amdsmi_status_t = amdsmi_status_t(12);
    #[doc = "```text\n!< Bad address\n```"]
    pub const AMDSMI_STATUS_ADDRESS_FAULT: amdsmi_status_t = amdsmi_status_t(13);
    #[doc = "```text\n!< Problem accessing a file\n```"]
    pub const AMDSMI_STATUS_FILE_ERROR: amdsmi_status_t = amdsmi_status_t(14);
    #[doc = "```text\n!< Not enough memory\n```"]
    pub const AMDSMI_STATUS_OUT_OF_RESOURCES: amdsmi_status_t = amdsmi_status_t(15);
    #[doc = "```text\n!< An internal exception was caught\n```"]
    pub const AMDSMI_STATUS_INTERNAL_EXCEPTION: amdsmi_status_t = amdsmi_status_t(16);
    #[doc = "```text\n!< The provided input is out of allowable or safe range\n```"]
    pub const AMDSMI_STATUS_INPUT_OUT_OF_BOUNDS: amdsmi_status_t = amdsmi_status_t(17);
    #[doc = "```text\n!< An error occurred when initializing internal data structures\n```"]
    pub const AMDSMI_STATUS_INIT_ERROR: amdsmi_status_t = amdsmi_status_t(18);
    #[doc = "```text\n!< An internal reference counter exceeded INT32_MAX\n```"]
    pub const AMDSMI_STATUS_REFCOUNT_OVERFLOW: amdsmi_status_t = amdsmi_status_t(19);
    #[doc = "```text\n!< Device busy\n```"]
    pub const AMDSMI_STATUS_BUSY: amdsmi_status_t = amdsmi_status_t(30);
    #[doc = "```text\n!< Device Not found\n```"]
    pub const AMDSMI_STATUS_NOT_FOUND: amdsmi_status_t = amdsmi_status_t(31);
    #[doc = "```text\n!< Device not initialized\n```"]
    pub const AMDSMI_STATUS_NOT_INIT: amdsmi_status_t = amdsmi_status_t(32);
    #[doc = "```text\n!< No more free slot\n```"]
    pub const AMDSMI_STATUS_NO_SLOT: amdsmi_status_t = amdsmi_status_t(33);
    #[doc = "```text\n!< Processor driver not loaded\n```"]
    pub const AMDSMI_STATUS_DRIVER_NOT_LOADED: amdsmi_status_t = amdsmi_status_t(34);
    #[doc = "```text\n!< No data was found for a given input\n```"]
    pub const AMDSMI_STATUS_NO_DATA: amdsmi_status_t = amdsmi_status_t(40);
    #[doc = "```text\n!< Not enough resources were available for the operation\n```"]
    pub const AMDSMI_STATUS_INSUFFICIENT_SIZE: amdsmi_status_t = amdsmi_status_t(41);
    #[doc = "```text\n!< An unexpected amount of data was read\n```"]
    pub const AMDSMI_STATUS_UNEXPECTED_SIZE: amdsmi_status_t = amdsmi_status_t(42);
    #[doc = "```text\n!< The data read or provided to function is not what was expected\n```"]
    pub const AMDSMI_STATUS_UNEXPECTED_DATA: amdsmi_status_t = amdsmi_status_t(43);
    #[doc = "```text\n!< System has different cpu than AMD\n```"]
    pub const AMDSMI_STATUS_NON_AMD_CPU: amdsmi_status_t = amdsmi_status_t(44);
    #[doc = "```text\n!< Energy driver not found\n```"]
    pub const AMDSMI_STATUS_NO_ENERGY_DRV: amdsmi_status_t = amdsmi_status_t(45);
    #[doc = "```text\n!< MSR driver not found\n```"]
    pub const AMDSMI_STATUS_NO_MSR_DRV: amdsmi_status_t = amdsmi_status_t(46);
    #[doc = "```text\n!< HSMP driver not found\n```"]
    pub const AMDSMI_STATUS_NO_HSMP_DRV: amdsmi_status_t = amdsmi_status_t(47);
    #[doc = "```text\n!< HSMP not supported\n```"]
    pub const AMDSMI_STATUS_NO_HSMP_SUP: amdsmi_status_t = amdsmi_status_t(48);
    #[doc = "```text\n!< HSMP message/feature not supported\n```"]
    pub const AMDSMI_STATUS_NO_HSMP_MSG_SUP: amdsmi_status_t = amdsmi_status_t(49);
    #[doc = "```text\n!< HSMP message is timedout\n```"]
    pub const AMDSMI_STATUS_HSMP_TIMEOUT: amdsmi_status_t = amdsmi_status_t(50);
    #[doc = "```text\n!< No Energy and HSMP driver present\n```"]
    pub const AMDSMI_STATUS_NO_DRV: amdsmi_status_t = amdsmi_status_t(51);
    #[doc = "```text\n!< file or directory not found\n```"]
    pub const AMDSMI_STATUS_FILE_NOT_FOUND: amdsmi_status_t = amdsmi_status_t(52);
    #[doc = "```text\n!< Parsed argument is invalid\n```"]
    pub const AMDSMI_STATUS_ARG_PTR_NULL: amdsmi_status_t = amdsmi_status_t(53);
    #[doc = "```text\n!< AMDGPU restart failed\n```"]
    pub const AMDSMI_STATUS_AMDGPU_RESTART_ERR: amdsmi_status_t = amdsmi_status_t(54);
    #[doc = "```text\n!< Setting is not available\n```"]
    pub const AMDSMI_STATUS_SETTING_UNAVAILABLE: amdsmi_status_t = amdsmi_status_t(55);
    #[doc = "```text\n!< The internal library error did not map to a status code\n```"]
    pub const AMDSMI_STATUS_MAP_ERROR: amdsmi_status_t = amdsmi_status_t(4294967294);
    #[doc = "```text\n!< An unknown error occurred\n```"]
    pub const AMDSMI_STATUS_UNKNOWN_ERROR: amdsmi_status_t = amdsmi_status_t(4294967295);
}
#[repr(transparent)]
#[doc = "```text\n @brief Error codes returned by amdsmi functions\n```"]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct amdsmi_status_t(pub ::std::os::raw::c_uint);
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct amdsmi_asic_info_t {
    pub market_name: [::std::os::raw::c_char; 256usize],
    pub vendor_id: u32,
    pub vendor_name: [::std::os::raw::c_char; 64usize],
    pub subvendor_id: u32,
    pub device_id: u64,
    pub rev_id: u32,
    pub asic_serial: [::std::os::raw::c_char; 32usize],
    pub oam_id: u32,
    pub num_of_compute_units: u32,
    pub target_graphics_version: u64,
    pub reserved: [u32; 15usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of amdsmi_asic_info_t"][::std::mem::size_of::<amdsmi_asic_info_t>() - 456usize];
    ["Alignment of amdsmi_asic_info_t"][::std::mem::align_of::<amdsmi_asic_info_t>() - 8usize];
    ["Offset of field: amdsmi_asic_info_t::market_name"]
        [::std::mem::offset_of!(amdsmi_asic_info_t, market_name) - 0usize];
    ["Offset of field: amdsmi_asic_info_t::vendor_id"]
        [::std::mem::offset_of!(amdsmi_asic_info_t, vendor_id) - 256usize];
    ["Offset of field: amdsmi_asic_info_t::vendor_name"]
        [::std::mem::offset_of!(amdsmi_asic_info_t, vendor_name) - 260usize];
    ["Offset of field: amdsmi_asic_info_t::subvendor_id"]
        [::std::mem::offset_of!(amdsmi_asic_info_t, subvendor_id) - 324usize];
    ["Offset of field: amdsmi_asic_info_t::device_id"]
        [::std::mem::offset_of!(amdsmi_asic_info_t, device_id) - 328usize];
    ["Offset of field: amdsmi_asic_info_t::rev_id"]
        [::std::mem::offset_of!(amdsmi_asic_info_t, rev_id) - 336usize];
    ["Offset of field: amdsmi_asic_info_t::asic_serial"]
        [::std::mem::offset_of!(amdsmi_asic_info_t, asic_serial) - 340usize];
    ["Offset of field: amdsmi_asic_info_t::oam_id"]
        [::std::mem::offset_of!(amdsmi_asic_info_t, oam_id) - 372usize];
    ["Offset of field: amdsmi_asic_info_t::num_of_compute_units"]
        [::std::mem::offset_of!(amdsmi_asic_info_t, num_of_compute_units) - 376usize];
    ["Offset of field: amdsmi_asic_info_t::target_graphics_version"]
        [::std::mem::offset_of!(amdsmi_asic_info_t, target_graphics_version) - 384usize];
    ["Offset of field: amdsmi_asic_info_t::reserved"]
        [::std::mem::offset_of!(amdsmi_asic_info_t, reserved) - 392usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct amdsmi_power_info_t {
    pub current_socket_power: u32,
    pub average_socket_power: u32,
    pub gfx_voltage: u32,
    pub soc_voltage: u32,
    pub mem_voltage: u32,
    pub power_limit: u32,
    pub reserved: [u32; 11usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of amdsmi_power_info_t"][::std::mem::size_of::<amdsmi_power_info_t>() - 68usize];
    ["Alignment of amdsmi_power_info_t"][::std::mem::align_of::<amdsmi_power_info_t>() - 4usize];
    ["Offset of field: amdsmi_power_info_t::current_socket_power"]
        [::std::mem::offset_of!(amdsmi_power_info_t, current_socket_power) - 0usize];
    ["Offset of field: amdsmi_power_info_t::average_socket_power"]
        [::std::mem::offset_of!(amdsmi_power_info_t, average_socket_power) - 4usize];
    ["Offset of field: amdsmi_power_info_t::gfx_voltage"]
        [::std::mem::offset_of!(amdsmi_power_info_t, gfx_voltage) - 8usize];
    ["Offset of field: amdsmi_power_info_t::soc_voltage"]
        [::std::mem::offset_of!(amdsmi_power_info_t, soc_voltage) - 12usize];
    ["Offset of field: amdsmi_power_info_t::mem_voltage"]
        [::std::mem::offset_of!(amdsmi_power_info_t, mem_voltage) - 16usize];
    ["Offset of field: amdsmi_power_info_t::power_limit"]
        [::std::mem::offset_of!(amdsmi_power_info_t, power_limit) - 20usize];
    ["Offset of field: amdsmi_power_info_t::reserved"]
        [::std::mem::offset_of!(amdsmi_power_info_t, reserved) - 24usize];
};
pub type amdsmi_process_handle_t = u32;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct amdsmi_proc_info_t {
    pub name: [::std::os::raw::c_char; 32usize],
    pub pid: amdsmi_process_handle_t,
    pub mem: u64,
    pub engine_usage: amdsmi_proc_info_t_engine_usage_,
    pub memory_usage: amdsmi_proc_info_t_memory_usage_,
    #[doc = "```text\n in bytes\n```"]
    pub container_name: [::std::os::raw::c_char; 32usize],
    pub reserved: [u32; 4usize],
}
#[doc = "```text\n in bytes\n```"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct amdsmi_proc_info_t_engine_usage_ {
    pub gfx: u64,
    pub enc: u64,
    pub reserved: [u32; 12usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of amdsmi_proc_info_t_engine_usage_"]
        [::std::mem::size_of::<amdsmi_proc_info_t_engine_usage_>() - 64usize];
    ["Alignment of amdsmi_proc_info_t_engine_usage_"]
        [::std::mem::align_of::<amdsmi_proc_info_t_engine_usage_>() - 8usize];
    ["Offset of field: amdsmi_proc_info_t_engine_usage_::gfx"]
        [::std::mem::offset_of!(amdsmi_proc_info_t_engine_usage_, gfx) - 0usize];
    ["Offset of field: amdsmi_proc_info_t_engine_usage_::enc"]
        [::std::mem::offset_of!(amdsmi_proc_info_t_engine_usage_, enc) - 8usize];
    ["Offset of field: amdsmi_proc_info_t_engine_usage_::reserved"]
        [::std::mem::offset_of!(amdsmi_proc_info_t_engine_usage_, reserved) - 16usize];
};
#[doc = "```text\n How much time the process spend using these engines in ns\n```"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct amdsmi_proc_info_t_memory_usage_ {
    pub gtt_mem: u64,
    pub cpu_mem: u64,
    pub vram_mem: u64,
    pub reserved: [u32; 10usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of amdsmi_proc_info_t_memory_usage_"]
        [::std::mem::size_of::<amdsmi_proc_info_t_memory_usage_>() - 64usize];
    ["Alignment of amdsmi_proc_info_t_memory_usage_"]
        [::std::mem::align_of::<amdsmi_proc_info_t_memory_usage_>() - 8usize];
    ["Offset of field: amdsmi_proc_info_t_memory_usage_::gtt_mem"]
        [::std::mem::offset_of!(amdsmi_proc_info_t_memory_usage_, gtt_mem) - 0usize];
    ["Offset of field: amdsmi_proc_info_t_memory_usage_::cpu_mem"]
        [::std::mem::offset_of!(amdsmi_proc_info_t_memory_usage_, cpu_mem) - 8usize];
    ["Offset of field: amdsmi_proc_info_t_memory_usage_::vram_mem"]
        [::std::mem::offset_of!(amdsmi_proc_info_t_memory_usage_, vram_mem) - 16usize];
    ["Offset of field: amdsmi_proc_info_t_memory_usage_::reserved"]
        [::std::mem::offset_of!(amdsmi_proc_info_t_memory_usage_, reserved) - 24usize];
};
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of amdsmi_proc_info_t"][::std::mem::size_of::<amdsmi_proc_info_t>() - 224usize];
    ["Alignment of amdsmi_proc_info_t"][::std::mem::align_of::<amdsmi_proc_info_t>() - 8usize];
    ["Offset of field: amdsmi_proc_info_t::name"]
        [::std::mem::offset_of!(amdsmi_proc_info_t, name) - 0usize];
    ["Offset of field: amdsmi_proc_info_t::pid"]
        [::std::mem::offset_of!(amdsmi_proc_info_t, pid) - 32usize];
    ["Offset of field: amdsmi_proc_info_t::mem"]
        [::std::mem::offset_of!(amdsmi_proc_info_t, mem) - 40usize];
    ["Offset of field: amdsmi_proc_info_t::engine_usage"]
        [::std::mem::offset_of!(amdsmi_proc_info_t, engine_usage) - 48usize];
    ["Offset of field: amdsmi_proc_info_t::memory_usage"]
        [::std::mem::offset_of!(amdsmi_proc_info_t, memory_usage) - 112usize];
    ["Offset of field: amdsmi_proc_info_t::container_name"]
        [::std::mem::offset_of!(amdsmi_proc_info_t, container_name) - 176usize];
    ["Offset of field: amdsmi_proc_info_t::reserved"]
        [::std::mem::offset_of!(amdsmi_proc_info_t, reserved) - 208usize];
};
#[doc = "```text\n @brief This structure holds version information.\n```"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct amdsmi_version_t {
    #[doc = "```text\n!< Last 2 digits of the Year released\n```"]
    pub year: u32,
    #[doc = "```text\n!< Major version\n```"]
    pub major: u32,
    #[doc = "```text\n!< Minor version\n```"]
    pub minor: u32,
    #[doc = "```text\n!< Patch, build or stepping version\n```"]
    pub release: u32,
    #[doc = "```text\n!< Full Build version string\n```"]
    pub build: *const ::std::os::raw::c_char,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of amdsmi_version_t"][::std::mem::size_of::<amdsmi_version_t>() - 24usize];
    ["Alignment of amdsmi_version_t"][::std::mem::align_of::<amdsmi_version_t>() - 8usize];
    ["Offset of field: amdsmi_version_t::year"]
        [::std::mem::offset_of!(amdsmi_version_t, year) - 0usize];
    ["Offset of field: amdsmi_version_t::major"]
        [::std::mem::offset_of!(amdsmi_version_t, major) - 4usize];
    ["Offset of field: amdsmi_version_t::minor"]
        [::std::mem::offset_of!(amdsmi_version_t, minor) - 8usize];
    ["Offset of field: amdsmi_version_t::release"]
        [::std::mem::offset_of!(amdsmi_version_t, release) - 12usize];
    ["Offset of field: amdsmi_version_t::build"]
        [::std::mem::offset_of!(amdsmi_version_t, build) - 16usize];
};
pub struct libamd_smi {
    __library: ::libloading::Library,
}
impl libamd_smi {
    pub unsafe fn new<P>(path: P) -> Result<Self, ::libloading::Error>
    where
        P: AsRef<::std::ffi::OsStr>,
    {
        let library = ::libloading::Library::new(path)?;
        Self::from_library(library)
    }
    pub unsafe fn from_library<L>(library: L) -> Result<Self, ::libloading::Error>
    where
        L: Into<::libloading::Library>,
    {
        let __library = library.into();
        Ok(libamd_smi { __library })
    }
}
