FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > FPGA

FPGA comp.arch.fpga newsgroup (usenet)

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-14-2007, 08:47 AM
Bathala
Guest
 
Posts: n/a
Default using fstream to access File on Compact Flash Card

Specification
EDK version:8.2i
FPGA Board: Virtex II Pro
Compiler : mb-g++

I'm tring to create a file stream using ifstream instr("ba1.bits")
or ifstream instr("a:\\ba1.bits") to create a file stream from
CF card.

In addition I've added #include <stdio.h> which is necessary to
ensure that microblaze compiler recognizes the the c++ sections of
code.

I've amended the file ....\EDK\sw\lib\sw_services\xilfatfs_v1_00_a
\src\include\sysace_stdio.h uncommenting the following lines

#define SYSACE_FILE FILE
// typedef void FILE;

#define fopen sysace_fopen
#define fclose sysace_fclose
#define fread sysace_fread
#define fwrite sysace_fwrite

File cannot be read...

Alternatively I tried using sysace_fopen directly -> char array ->
streambuf


streambuf * pbuf;

void myrun(void * mybuf) {
sysace_fread( (void *) mybuf, 1, 1, outfile);
// pbuf->sputn (charbuffin,sizeof(charbuffin)-1);
}


Int main (){
void *mainbuf;

if ((outfile = sysace_fopen("file.txt", "r")) == NULL)
{
xil_printf("Couldn't open the file\r\n");
}
else{

for (int i=0;i<4;i++){
myrun(mainbuf);
pbuf->sputc( (char *) mainbuf);
usleep(1000);
}
return 0;
}

System hangs at this point.........

Please do let me know how file from CF card ->input stream?

Priyantha


Reply With Quote
  #2 (permalink)  
Old 12-14-2007, 05:05 PM
Thomas
Guest
 
Posts: n/a
Default Re: using fstream to access File on Compact Flash Card

Hi Priyantha -

Try replacing "file.txt" with "a:\\file.txt". To the standalone OS, the
CF drive looks like the "a:\" drive.

Thomas Werne

Bathala wrote:
> Specification
> EDK version:8.2i
> FPGA Board: Virtex II Pro
> Compiler : mb-g++
>
> I'm tring to create a file stream using ifstream instr("ba1.bits")
> or ifstream instr("a:\\ba1.bits") to create a file stream from
> CF card.
>
> In addition I've added #include <stdio.h> which is necessary to
> ensure that microblaze compiler recognizes the the c++ sections of
> code.
>
> I've amended the file ....\EDK\sw\lib\sw_services\xilfatfs_v1_00_a
> \src\include\sysace_stdio.h uncommenting the following lines
>
> #define SYSACE_FILE FILE
> // typedef void FILE;
>
> #define fopen sysace_fopen
> #define fclose sysace_fclose
> #define fread sysace_fread
> #define fwrite sysace_fwrite
>
> File cannot be read...
>
> Alternatively I tried using sysace_fopen directly -> char array ->
> streambuf
>
>
> streambuf * pbuf;
>
> void myrun(void * mybuf) {
> sysace_fread( (void *) mybuf, 1, 1, outfile);
> // pbuf->sputn (charbuffin,sizeof(charbuffin)-1);
> }
>
>
> Int main (){
> void *mainbuf;
>
> if ((outfile = sysace_fopen("file.txt", "r")) == NULL)
> {
> xil_printf("Couldn't open the file\r\n");
> }
> else{
>
> for (int i=0;i<4;i++){
> myrun(mainbuf);
> pbuf->sputc( (char *) mainbuf);
> usleep(1000);
> }
> return 0;
> }
>
> System hangs at this point.........
>
> Please do let me know how file from CF card ->input stream?
>
> Priyantha
>
>



--
All personal and professional opinions presented herein are my
own and do not, in any way, represent the opinion or policy of JPL
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing compact flash????????? sachink321@gmail.com FPGA 5 04-10-2006 12:33 AM
C H S in a Compact flash sachink321@gmail.com FPGA 2 04-07-2006 01:43 PM
WIFI Compact Flash eziggurat@gmail.com FPGA 2 02-17-2006 02:09 AM
Compact Flash FPGA card Iwo Mergler FPGA 4 05-13-2004 10:14 AM


All times are GMT +1. The time now is 05:51 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved