Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Overlapped and ReadFile() question

Overlapped and ReadFile() question

Scheduled Pinned Locked Moved C / C++ / MFC
questionperformancehelp
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kitty5
    wrote on last edited by
    #1

    HAPPY FRIDAY!!!:-D In the ReadFile() function there's an option where you can set it to be overlapped (i.e. be used in asynchronous I/O operations). If you want to be asynchronous you have to set the "Overlapped" struct's offset member... However, it says that: "Offset - File position at which to start the transfer. The file position is a byte offset from the start of the file. The calling process must set this member before calling the ReadFile function. This member is used only when the device is a file. Otherwise, this member must be zero." Here is where my confusion comes from... I have a FIFO, from a device that I'm communicating with, which is 1K by 32-bit word large. I need to make ReadFile() asynchronous because of speed constraints. Can I set the "Offset" if I'm reading from a FIFO? Will FIFO be considered a "File" in this case? The theory is to send an initial command to fill the FIFO upto 0x155 32-bit words. Then initiate ReadFile(). While this is doing it's thing I'm going to send another command that fills the FIFO with another 0x155 32-bit words. Then initiate ReadFile() on that set of words. While this is happening send a third command, issue a ReadFile()... After this go back and check to see if the 1st ReadFile() issued has completed, etc. is this possible? or am I dreaming... Thanks!

    Kitty5

    Z 1 Reply Last reply
    0
    • K kitty5

      HAPPY FRIDAY!!!:-D In the ReadFile() function there's an option where you can set it to be overlapped (i.e. be used in asynchronous I/O operations). If you want to be asynchronous you have to set the "Overlapped" struct's offset member... However, it says that: "Offset - File position at which to start the transfer. The file position is a byte offset from the start of the file. The calling process must set this member before calling the ReadFile function. This member is used only when the device is a file. Otherwise, this member must be zero." Here is where my confusion comes from... I have a FIFO, from a device that I'm communicating with, which is 1K by 32-bit word large. I need to make ReadFile() asynchronous because of speed constraints. Can I set the "Offset" if I'm reading from a FIFO? Will FIFO be considered a "File" in this case? The theory is to send an initial command to fill the FIFO upto 0x155 32-bit words. Then initiate ReadFile(). While this is doing it's thing I'm going to send another command that fills the FIFO with another 0x155 32-bit words. Then initiate ReadFile() on that set of words. While this is happening send a third command, issue a ReadFile()... After this go back and check to see if the 1st ReadFile() issued has completed, etc. is this possible? or am I dreaming... Thanks!

      Kitty5

      Z Offline
      Z Offline
      Zac Howland
      wrote on last edited by
      #2

      Are you opening up a serial port to use with ReadFile?

      If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

      K 1 Reply Last reply
      0
      • Z Zac Howland

        Are you opening up a serial port to use with ReadFile?

        If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

        K Offline
        K Offline
        kitty5
        wrote on last edited by
        #3

        Zac Howland wrote:

        Are you opening up a serial port to use with ReadFile?

        I've created a handle to the device which is plugged in to one of the PCI slots. The card is a PCI/Altera-485 LVDS card. I'm trying to get data from the Xilinx's DMA FIFO. -- modified at 10:49 Friday 11th August, 2006

        Kitty5

        Z 1 Reply Last reply
        0
        • K kitty5

          Zac Howland wrote:

          Are you opening up a serial port to use with ReadFile?

          I've created a handle to the device which is plugged in to one of the PCI slots. The card is a PCI/Altera-485 LVDS card. I'm trying to get data from the Xilinx's DMA FIFO. -- modified at 10:49 Friday 11th August, 2006

          Kitty5

          Z Offline
          Z Offline
          Zac Howland
          wrote on last edited by
          #4

          This is just a guess, but I would imagine that the card would treat the FIFO like a buffer stream. That is, you will always be reading from the top fo the stream, so you would always pass in 0 to ReadFile.

          If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups