URL
https://opencores.org/ocsvn/tv80/tv80/trunk
[/] [tv80/] [trunk/] [sc_env/] [env_memory.cpp] - Diff between revs 92 and 93
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 92 |
Rev 93 |
Line 24... |
Line 24... |
void inline readline(FILE *fh, char *buf)
|
void inline readline(FILE *fh, char *buf)
|
{
|
{
|
int c = 1;
|
int c = 1;
|
|
|
while (c) {
|
while (c) {
|
c = read (buf, 1, 1, fh);
|
c = fread (buf, 1, 1, fh);
|
if (c && (*buf == '\n'))
|
if (c && (*buf == '\n'))
|
c = 0;
|
c = 0;
|
else buf++;
|
else buf++;
|
}
|
}
|
}
|
}
|
Line 53... |
Line 53... |
*/
|
*/
|
void env_memory::load_ihex(char *filename)
|
void env_memory::load_ihex(char *filename)
|
{
|
{
|
FILE *fh;
|
FILE *fh;
|
char line[80];
|
char line[80];
|
|
char *lp;
|
|
int rlen, addr, rtyp;
|
|
|
fh = fopen (filename, "r");
|
fh = fopen (filename, "r");
|
|
|
readline (fh, line);
|
readline (fh, line);
|
|
while (strlen(line) > 0) {
|
|
printf ("DEBUG: strlen(line)=%d\n", strlen(line));
|
|
sscanf (line, "%2x%2x%2x", &rlen, &addr, &rtyp);
|
|
printf ("DEBUG: rlen=%d addr=%d rtyp=%d\n", rlen, addr, rtyp);
|
|
lp = line + 6;
|
|
for (int c=0; c<rlen; c++) {
|
|
}
|
|
}
|
|
|
fclose (fh);
|
fclose (fh);
|
}
|
}
|
|
|
No newline at end of file
|
No newline at end of file
|
© copyright 1999-2025
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.