Dear all,
Wince: 6.0
Processor: intel mobile
Chipset : 82855GME and 82801DBM
i already raised a question reg this and Rob told to try Halgetbusdata, but
i am not getting it here are my codes anyone help me where i am wrong, this
is a console application.

I am new to this driver development without this i couldnt able to proceed
further. Please help me....

I just wanted to access the registers in the PCI with some bus/function/device

#include "stdafx.h"
#include <ceddk.h>


#define SMBUS_BUS_NO 0x0
#define SMBUS_DEVICE_NO 0x31
#define SMBUS_FUNCTION_NO 0x3

int _tmain(int argc, TCHAR *argv[], TCHAR *envp[])
{
int ret;
printf("In SMBus function");
PCI_SLOT_NUMBER slotNumber;
PCI_COMMON_CONFIG smbus_pci_config;
slotNumber.u.AsULONG = 0;
slotNumber.u.bits.DeviceNumber = SMBUS_DEVICE_NO;
slotNumber.u.bits.FunctionNumber = SMBUS_FUNCTION_NO;
ret=HalGetBusData(PCIConfiguration, SMBUS_BUS_NO, slotNumber.u.AsULONG,
&smbus_pci_config, sizeof(smbus_pci_config));

printf("In SMbus\n Vendor ID = %0x\n Device ID =
%0x\n",smbus_pci_config.VendorID,smbus_pci_config.DeviceID);
printf("In SMbus\ndecimal Vendor ID = %d\n Device ID =
%d\n",smbus_pci_config.VendorID,smbus_pci_config.DeviceID);
printf("\nret=%d\n",ret);
return 0;
}

in sources file i added
TARGETLIBS= \
$(_WINCEROOT)\PLATFORM\xxx\ceddk.lib

(without this it is reporting an error that Halgetbusdata is not defined)

RE: pci bus registers reading by Sankarraj

Sankarraj
Thu Nov 01 00:08:01 PDT 2007

i forget to mention the results are vendorid=1 deviceid=0 and ret=0...
i checked the return value for halgetbusdata if it is 0 then no pci bus is
present...???

"Sankarraj" wrote:

> Dear all,
> Wince: 6.0
> Processor: intel mobile
> Chipset : 82855GME and 82801DBM
> i already raised a question reg this and Rob told to try Halgetbusdata, but
> i am not getting it here are my codes anyone help me where i am wrong, this
> is a console application.
>
> I am new to this driver development without this i couldnt able to proceed
> further. Please help me....
>
> I just wanted to access the registers in the PCI with some bus/function/device
>
> #include "stdafx.h"
> #include <ceddk.h>
>
>
> #define SMBUS_BUS_NO 0x0
> #define SMBUS_DEVICE_NO 0x31
> #define SMBUS_FUNCTION_NO 0x3
>
> int _tmain(int argc, TCHAR *argv[], TCHAR *envp[])
> {
> int ret;
> printf("In SMBus function");
> PCI_SLOT_NUMBER slotNumber;
> PCI_COMMON_CONFIG smbus_pci_config;
> slotNumber.u.AsULONG = 0;
> slotNumber.u.bits.DeviceNumber = SMBUS_DEVICE_NO;
> slotNumber.u.bits.FunctionNumber = SMBUS_FUNCTION_NO;
> ret=HalGetBusData(PCIConfiguration, SMBUS_BUS_NO, slotNumber.u.AsULONG,
> &smbus_pci_config, sizeof(smbus_pci_config));
>
> printf("In SMbus\n Vendor ID = %0x\n Device ID =
> %0x\n",smbus_pci_config.VendorID,smbus_pci_config.DeviceID);
> printf("In SMbus\ndecimal Vendor ID = %d\n Device ID =
> %d\n",smbus_pci_config.VendorID,smbus_pci_config.DeviceID);
> printf("\nret=%d\n",ret);
> return 0;
> }
>
> in sources file i added
> TARGETLIBS= \
> $(_WINCEROOT)\PLATFORM\xxx\ceddk.lib
>
> (without this it is reporting an error that Halgetbusdata is not defined)

Re: pci bus registers reading by Ulrich

Ulrich
Thu Nov 01 01:28:27 PDT 2007

Sankarraj wrote:
> Wince: 6.0

I can only speak for CE 5 and 4.2, however...

> #define SMBUS_BUS_NO 0x0
> #define SMBUS_DEVICE_NO 0x31
> #define SMBUS_FUNCTION_NO 0x3
[...]
> PCI_SLOT_NUMBER slotNumber;
> PCI_COMMON_CONFIG smbus_pci_config;
> slotNumber.u.AsULONG = 0;
> slotNumber.u.bits.DeviceNumber = SMBUS_DEVICE_NO;
> slotNumber.u.bits.FunctionNumber = SMBUS_FUNCTION_NO;
> ret=HalGetBusData(PCIConfiguration, SMBUS_BUS_NO, slotNumber.u.AsULONG,
> &smbus_pci_config, sizeof(smbus_pci_config));

If you are sure about the bus/device/function triplet, this code should work
(what is the returnvalue from HalGetBusData?). Other than that, I'd suggest
you call the function in a loop with busses 0 to 7 and slots 0 to 31 (i.e.
256 combinations) and dump the information you receive. Maybe your device
is simply on a different bus...

Uli

--
Sator Laser GmbH
Geschäftsführer: Michael Wöhrmann, Amtsgericht Hamburg HR B62 932


Re: pci bus registers reading by Sankarraj

Sankarraj
Thu Nov 01 07:28:01 PDT 2007

Now i could able to read the deviceID etc i did a blunder the bus,function,
device are in decimal after i remove 0x it worked, thanks a lot Ulrich
Eckhardt!!!!
regards,
sankarraj