12#include <irx_imports.h>
14#define MODNAME "FPGA_loader"
26typedef char *(*fpga_strop_t)(
char *name);
28static char *fpgald_path(
char *name);
29static char *fpgald_basename(
char *name);
31static fpga_strop_t ops_12[2] = {&fpgald_path, &fpgald_basename};
32static char buf_17[8192];
34static int fpgald_wait(acC448Reg c448, acUint32 flag,
int verbose)
49 if ( (flag & fbit) != 0 )
54 sr = (c448[0x3800] & 0xFF00) >> 8;
55 if ( (sr & fbit) != 0 )
59 if (
count < 0 && verbose )
61 printf(
"acfpgald:wait: TIMEDOUT %02x %02x\n", sr, (
unsigned int)fbit);
70static char *fpgald_path(
char *name)
74 str = strchr(name,
':');
80static char *fpgald_basename(
char *name)
88 str = strchr(name,
':');
92 str_v4 = strrchr(str_v3,
'/');
95 str_v6 = strrchr(str_v3,
'\\');
107#define acFpgaLoader _start
109int acFpgaLoader(
int argc,
char **argv)
122 if ( fpgald_path(name) == name )
129 if ( fd < 0 && prog )
134 while ( (
unsigned int)index < 2 )
140 v9 = (
char *)op(prog);
143 memcpy(buf_17, prog, v9 - prog);
144 strcpy(&buf_17[v9 - prog], op(name));
145 fd = open(buf_17, 1);
155 printf(
"acfpgald:open: error %d\n", fd);
164 *((
volatile acUint16 *)0xB2416008) = 0;
165 fpgald_wait((acC448Reg)0xB2415000, 0x30u, 0);
166 *((
volatile acUint16 *)0xB241600A) = 0;
168 errors = fpgald_wait((acC448Reg)0xB2415000, 0x20u, 1);
175 ret_v13 = read(fd, buf_17, 0x2000);
179 ptr = (acUint8 *)buf_17;
188 while ( bytecount >= 0 )
195 *((
volatile acUint16 *)0xB2416014) = 0;
196 *(acUint16 *)(2 * ret_v18 + 0xB2415000 + 0x1018) = 0;
197 *((
volatile acUint16 *)0xB2416016) = 0;
202 *((
volatile acUint16 *)0xB2416014) = 0;
209 if ( errors + fpgald_wait((acC448Reg)0xB2415000, 0x10u, 1) > 0 )
218 while ( ret_v19 >= 0 )
221 *((
volatile acUint16 *)0xB2416016) = 0;
222 *((
volatile acUint16 *)0xB2416014) = 0;
225 *((
volatile acUint16 *)0xB2416012) = 0;
u32 count
start sector of fragmented bd/file