download firmware file to device

Can someone please tell me how I can write a file to a device driver ? I
need to download firmware file to my device, If you can either tell me
how to be able to read a file from my driver, or point me to an example
driver which does this, I would appreciate it. I am writing Device
Driver for Win 2K. User application use fopen/fwrite/fread/fclose API
for downloading firmware to a device(PCI bus) .

Thanks in Advance.

Regards

Vivek kumar

Either compile the firmware file into your driver as a large array of hex bytes. During your driver initialization you simply “fetch” the starting address and give it to your device in the proper manner. You can also place the firmware in the registry and load it from there, or wait till an application runs that uses an IOCTL to send the file to the driver. There is lot’s of ways that this can be done.


The personal opinion of
Gary G. Little
wrote in message news:xxxxx@ntdev…
Can someone please tell me how I can write a file to a device driver ? I need to download firmware file to my device, If you can either tell me how to be able to read a file from my driver, or point me to an example driver which does this, I would appreciate it. I am writing Device Driver for Win 2K. User application use fopen/fwrite/fread/fclose API for downloading firmware to a device(PCI bus) .

Thanks in Advance.

Regards

Vivek kumar

Vivek,

Here is how you can do it.

Open a handle to the device,

Use the handle to send an IOCTL to the device driver to write few bytes
at a time.

Write an application that continuously write the few bytes of firmware
to the device driver.

Let the driver use WRITE_REGISTER_BUFFER_UCHAR to write these bytes to
the mapped device memory.

Thanks & Regards,
Vijay P


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@wipro.com
Sent: Monday, November 15, 2004 2:51 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] download firmware file to device

Can someone please tell me how I can write a file to a device driver ? I
need to download firmware file to my device, If you can either tell me
how to be able to read a file from my driver, or point me to an example
driver which does this, I would appreciate it. I am writing Device
Driver for Win 2K. User application use fopen/fwrite/fread/fclose API
for downloading firmware to a device(PCI bus) .

Thanks in Advance.

Regards

Vivek kumar


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Usually firmware download is from DriverEntry ( PASSIVE_LEVEL ), and using
Zw*File*() api’s you can read firmware files from disk and download (
meaning write to PortIO or memory mapped resources ).

-pro
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of xxxxx@wipro.com
Sent: Sunday, November 14, 2004 11:51 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] download firmware file to device

Can someone please tell me how I can write a file to a device driver ? I
need to download firmware file to my device, If you can either tell me how
to be able to read a file from my driver, or point me to an example driver
which does this, I would appreciate it. I am writing Device Driver for Win
2K. User application use fopen/fwrite/fread/fclose API for downloading
firmware to a device(PCI bus) .

Thanks in Advance.

Regards

Vivek kumar


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

ZwCreateFile/ZwWriteFile

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: xxxxx@wipro.com
To: Windows System Software Devs Interest List
Sent: Monday, November 15, 2004 10:50 AM
Subject: [ntdev] download firmware file to device

Can someone please tell me how I can write a file to a device driver ? I need to download firmware file to my device, If you can either tell me how to be able to read a file from my driver, or point me to an example driver which does this, I would appreciate it. I am writing Device Driver for Win 2K. User application use fopen/fwrite/fread/fclose API for downloading firmware to a device(PCI bus) .

Thanks in Advance.

Regards

Vivek kumar


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Uh no, driver entry is the wrong place for anything except a legacy NT4
style driver. StartDevice would be the right place.

=====================
Mark Roddy


From: Prokash Sinha [mailto:xxxxx@garlic.com]
Sent: Monday, November 15, 2004 11:19 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] download firmware file to device

Usually firmware download is from DriverEntry ( PASSIVE_LEVEL ), and using
Zw*File*() api’s you can read firmware files from disk and download (
meaning write to PortIO or memory mapped resources ).

-pro

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of xxxxx@wipro.com
Sent: Sunday, November 14, 2004 11:51 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] download firmware file to device

Can someone please tell me how I can write a file to a device driver ? I
need to download firmware file to my device, If you can either tell me how
to be able to read a file from my driver, or point me to an example driver
which does this, I would appreciate it. I am writing Device Driver for Win
2K. User application use fopen/fwrite/fread/fclose API for downloading
firmware to a device(PCI bus) .

Thanks in Advance.

Regards

Vivek kumar


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

During DriverEntry a PNP driver can’t access its device, so how is it
that it would download firmware? Depending on the boot phase it also
may not be able to read files off the file system.

Why not have the user-mode application send you the firmware as part of
an I/O control buffer instead of trying to read it from a file?

-p


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Prokash Sinha
Sent: Monday, November 15, 2004 8:19 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] download firmware file to device

Usually firmware download is from DriverEntry ( PASSIVE_LEVEL ), and
using Zw*File*() api’s you can read firmware files from disk and
download ( meaning write to PortIO or memory mapped resources ).

-pro

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of
xxxxx@wipro.com
Sent: Sunday, November 14, 2004 11:51 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] download firmware file to device

Can someone please tell me how I can write a file to a device
driver ? I need to download firmware file to my device, If you can
either tell me how to be able to read a file from my driver, or point me
to an example driver which does this, I would appreciate it. I am
writing Device Driver for Win 2K. User application use
fopen/fwrite/fread/fclose API for downloading firmware to a device(PCI
bus) .

Thanks in Advance.

Regards

Vivek kumar


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag
argument: ‘’
To unsubscribe send a blank email to
xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

For PnP enabled ( which is a must by the way :slight_smile: yes DriverEntry is not the right place, but there are drivers which like to do handshaking with the other end after downloading firmware from DriverInitialization ( whatever be the form >, and only becomes alive if all are Okay. Have seen and designed(ported ) two of them to NT4.0. So may be the closest I was thinking would be in AddDevice(), but then for multifunction it would be called multipletimes, again would be a bad idea, well of course it could verify by putting one extra field to the extension, and check (though I dont like those kinds including static vars :)…

-pro

AddDevice is not the correct time b/c your device is not fully powered
yet. If it is a PCI device, the bars are accessible, but the remainder
of the device outside of config space is not. For any pnp driver, you
must wait for start to complete back to your FDO before you attempt to
touch your hw outside of config space.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Programmers
Society Prokash Sinha
Sent: Monday, November 15, 2004 5:28 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] download firmware file to device

For PnP enabled ( which is a must by the way :slight_smile: yes DriverEntry is not
the right place, but there are drivers which like to do handshaking with
the other end after downloading firmware from DriverInitialization (
whatever be the form >, and only becomes alive if all are Okay. Have
seen and designed(ported ) two of them to NT4.0. So may be the closest I
was thinking would be in AddDevice(), but then for multifunction it
would be called multipletimes, again would be a bad idea, well of course
it could verify by putting one extra field to the extension, and check
(though I dont like those kinds including static vars :)…

-pro


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Thanks to both p and d for pointing out a logical bug when it comes down to
PnP type device.
So for start time equals boot, sure Zw*() might not work as peter pointed
out…

And yes, it should wait for the PNP start device to be finished.

Also the firmware download I mentioned was for (sort of remote ) device(s),
forgot most of the
detail, and it was on nt4.0 so was bit hodge-podge I suppose to todays std.

-pro

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Doron Holan
Sent: Monday, November 15, 2004 5:36 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] download firmware file to device

AddDevice is not the correct time b/c your device is not fully powered
yet. If it is a PCI device, the bars are accessible, but the remainder
of the device outside of config space is not. For any pnp driver, you
must wait for start to complete back to your FDO before you attempt to
touch your hw outside of config space.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Programmers
Society Prokash Sinha
Sent: Monday, November 15, 2004 5:28 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] download firmware file to device

For PnP enabled ( which is a must by the way :slight_smile: yes DriverEntry is not
the right place, but there are drivers which like to do handshaking with
the other end after downloading firmware from DriverInitialization (
whatever be the form >, and only becomes alive if all are Okay. Have
seen and designed(ported ) two of them to NT4.0. So may be the closest I
was thinking would be in AddDevice(), but then for multifunction it
would be called multipletimes, again would be a bad idea, well of course
it could verify by putting one extra field to the extension, and check
(though I dont like those kinds including static vars :)…

-pro


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com