<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: USBHostLite Read/Write calls in LPCXpresso IDE</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/USBHostLite-Read-Write-calls/m-p/536979#M5336</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by tybls on Fri Jul 08 10:18:09 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I had a feeling that the write function was not working properly as there is no reason to be opening the read file for a pure write command. Thanks zero.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jun 2016 01:42:06 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-16T01:42:06Z</dc:date>
    <item>
      <title>USBHostLite Read/Write calls</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/USBHostLite-Read-Write-calls/m-p/536977#M5334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by tybls on Fri Jul 08 07:11:32 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Previous posts on the subject.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://http://knowledgebase.nxp.com/showthread.php?t=2064&amp;amp;highlight=USBHostLite"&gt;http://knowledgebase.nxp.com/showthread.php?t=2064&amp;amp;highlight=USBHostLite&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With the USBHostLite example I am a little confused on the &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Main_Write (void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Main_Read (void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;calls, Main_Write says "This function is used by the user to write data to disk" and Main_Read says "This function is used by the user to read data from the disk"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It is a little confusing because the function reads data from the flash drive (or whatever mass storage device you are using) and puts it in the UserBuffer.(correct me if I am wrong please). So in turn Main_Write should data from the UserBuffer to the flash drive(to my understanding from the description).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then why does Main_Write call the the same functions as Main_Read?? It seems to me that in main() if you call Main_Read and then Wain_Write it should perform the same task(roughly) at Main_copy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am sure I just don't understanding the purpose of the Main_read/Main_Write functions as they are not doing do what I expected. Can anyone clear it up? Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:42:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/USBHostLite-Read-Write-calls/m-p/536977#M5334</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: USBHostLite Read/Write calls</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/USBHostLite-Read-Write-calls/m-p/536978#M5335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Ex-Zero on Fri Jul 08 08:17:59 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: tybls&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;I am sure I just don't understanding the purpose of the Main_read/Main_Write functions as they are not doing do what I expected. Can anyone clear it up? Thanks!&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Main_Read is used to read your read file (FILENAME_R) to UserBuffer&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Main_Copy is used to read your read file (FILENAME_R) to UserBuffer and then write UserBuffer to write file (FILENAME_W)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Main_Write is used to check if we have understood this and are able to reduce this nonsense to something working like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
void&amp;nbsp; Main_Write (unsigned char * string_to_write, int bytes_to_write)
{
 USB_INT32S&amp;nbsp; fdw;
 USB_INT32U&amp;nbsp; tot_bytes_written;
 USB_INT32U&amp;nbsp; bytes_written;

&amp;nbsp; fdw = FILE_Open(FILENAME_W, RDWR);
&amp;nbsp; if (fdw &amp;gt; 0)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; tot_bytes_written = 0;
&amp;nbsp;&amp;nbsp; PRINT_Log("Writing to %s...\n", FILENAME_W);
&amp;nbsp;&amp;nbsp; bytes_written = FILE_Write(fdw, string_to_write, bytes_to_write);
&amp;nbsp;&amp;nbsp; FILE_Close(fdw);
&amp;nbsp;&amp;nbsp; PRINT_Log("Write completed\n");
&amp;nbsp; }
&amp;nbsp; else
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; PRINT_Log("Could not open file %s\n", FILENAME_W);
&amp;nbsp;&amp;nbsp; return;
&amp;nbsp; }
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:42:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/USBHostLite-Read-Write-calls/m-p/536978#M5335</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: USBHostLite Read/Write calls</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/USBHostLite-Read-Write-calls/m-p/536979#M5336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by tybls on Fri Jul 08 10:18:09 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I had a feeling that the write function was not working properly as there is no reason to be opening the read file for a pure write command. Thanks zero.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:42:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/USBHostLite-Read-Write-calls/m-p/536979#M5336</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:42:06Z</dc:date>
    </item>
  </channel>
</rss>

