/*
 * main.c
 */

#include "stdio.h"
#include "C6747.h"
#include "nandflash.h"

void TEST_execute( Int16 ( *funchandle )( ), char *testname, Int16 testid )
{
    Int16 status;

    /* Display test ID */
    printf( "\n%02d  Testing %s...\n", testid, testname );

    /* Call test function */
    status = funchandle( );

    /* Check for test fail */
    if ( status != 0 )
    {
        /* Print error message */
        printf( "     FAIL... error code %d... quitting\n", status );

        /* Software Breakpoint to Code Composer */
        SW_BREAKPOINT;
    }
    else
    {
        /* Print error message */
        printf( "    PASS\n" );
    }
}

extern Int16 nandflash_test();

int main(void) {
	   C6747_init();
	   FLASH_init( );

	   TEST_execute(  nandflash_test,  "nandflash", 1 );

	   printf( "\n***ALL Tests Passed***\n" );
	   SW_BREAKPOINT;

	return 0;
}
