/****************************************************/
/*                                                  */
/* This is an example of use of the rockhard module */
/*                                                  */
/* Some parts are missing, so do not compile it!    */
/*                                                  */
/****************************************************/

#include <Error.h>
#include <rockhard.h>

/* read the entire ROCK and write it in a file */

int main()
{
 ROCKH_id rock_id;
 int err;
 unsigned char afifo;

 /* open the rock */
 
 err = rockh_open(0x50010000,0x100000,0x09,0,&rock_id);
 if (err!=ROCKH_ERROR_OK)
   {
     printf("Error opening ROCK!: %s",ErrorGetMessage());
     return 1;
   }

 /* read the ROCK */
 for (i=0; i<100; i++)
   {
     ROCKH_INTERNAL_regs ainternal;
     ROCKH_INFO_regs ainfo;

     rockh_readpage_internal(rock_id,ainternal);
     rockh_readpage_info(rock_id,ainfo);

     fwrite(&ainternal,sizeof(ainternal),1,outfile);
     fwrite(&ainfo,sizeof(ainfo),1,outfile);

     wait(1000); /* wait a sec */
   }

 /* close the rock */
 rockh_close(rock_id);

}