用ARM對(duì)FPGA進(jìn)行配置的原理與方法
if (base == (void *) -1)
{
printf (Cannot mmap. );
return 0;
}
printf (Memory mapped at address %p. , base);
pioc = base + (addr MAP_MASK);
return 1;
}
int main (int argc, char **argv)
{
FILE *file;
char data[16];
int nbytes, i;
if (argc != 2)
{
printf (%s , argv[0]);
return -1;
}
file = fopen (argv[1], r);
if (!file)
{
printf (File %s not found. , argv[1]);
return -1;
}
if (!pioc_map ())
return -1;
pioc_setup ();
pioc_out_0 (nCONFIG);
for (i = 0; i 10000 pioc_in (nSTATUS); i++) { }
if (i == 10000)
{
printf (nSTATUS = 1 before attempting configuration. );
return -1;
}
pioc_out_1 (nCONFIG);
for (i = 0; i 10000 !pioc_in (nSTATUS); i++) { }
if (i == 10000)
{
printf (Timeout waiting for nSTATUS = 1. );
return -1;
}
while ((nbytes = fread (data, sizeof (char), sizeof (data), file)) > 0)
{
if (pioc_in (CONF_DONE))
{
printf (CONF_DONE = 1 while transmitting data. );
return -1;
}
評(píng)論