
2007/10/02
You need ACPI toolkit to compile the examples.

============================================================================

      Find PSD and get pointer to ACPI function


   PACPIFUNCTION APIENTRY InitACPICall (char *Component)


      Parameters

  Component - ASCIIZ name for print in debug log

  return    Pointer to ACPI function if success, else NULL

  Example:

#include <psd.h>
#include <acpi.h>
#include <acpiapi.h>
#include <ipdc.h>
#include <acpifun.h>

PACPIFUNCTION PSD = NULL;                   // Pointer to ACPI function

void 
MyInitDriver(
    void)
{
    PSD = (PACPIFUNCTION)InitACPICall("MyDriver");
    if (PSD)
    {
        PSD->AcpiOsPrintf("MyDriver can work with ACPI\n");   
    }
}

============================================================================

             Filling ACPI info about given PCI device

    ACPI_STATUS FindPCIDevice(PKNOWNDEVICE f)

             Parameters

  f      ACPI PCI device struct

  return ACPI status

  Example:

#include <psd.h>
#include <acpi.h>
#include <acpiapi.h>
#include <ipdc.h>
#include <acpifun.h>

PACPIFUNCTION PSD = NULL;                   // Pointer to ACPI function

void 
MyInitDriver(
    void)
{
    KNOWNDEVICE MyDevice;
    ACPI_STATUS Status;
    char DevName[6];
    ACPI_BUFFER Buffer;



    PSD = (PACPIFUNCTION)InitACPICall("MyDriver");
    if (PSD)
    {
        MyDevice.PciId.Bus      = 1;
        MyDevice.PciId.Device   = 2;
        MyDevice.PciId.Function = 3;

        Status = PSD->FindPCIDevice(&MyDevice);
        if (Status == AE_OK)
        {
            Buffer.Length = 5;
            Buffer.Pointer = DevName;
            PSD->AcpiGetName(MyDevice.Handle, ACPI_SINGLE_NAME, &Buffer);
            PSD->AcpiOsPrintf("Dev: [%s] IRQs PIC:%s APIC:%x\n",DevName,MyDevice.PicIrq,MyDevice.ApicIrq);
        }
    }
}



eCo Software Developer Connection
http://ecomstation.ru/developer
