int main() { int res; res = Bar8(6, 8, 0); printf("main: res = %d\n", res); return 0; }
EXPORT_SYM int Bar8( int one, int two, int stop ) { int sum=0; if ( stop == 0 ) { printf(" Bar8: once\n" ); sum = Bar8( one, two, 1 ); } else if ( stop == 1 ) { printf(" Bar8: twice\n" ); sum = Bar8( one, two, 2 ); } else { printf(" Bar8: thrice\n" ); sum = one+two; } return sum; }
// Returns 1 if passed, 0 if failed. // int memTest (CYG_ADDRWORD startAddr, CYG_ADDRWORD endAddr) { CYG_ADDRWORD badAddr; // Addr test failed at diag_printf("\nWalking 1's test: "); if (onesTest((CYG_ADDRWORD *)startAddr) == FAILED) goto failed; diag_printf("passed"); diag_printf("\n32-bit address test: "); if (Addr32((cyg_uint32 *)startAddr, (cyg_uint32 *)endAddr, &badAddr) == FAILED) goto failed; diag_printf("passed"); diag_printf("\n32-bit address bar test: "); if (Bar32((cyg_uint32 *)startAddr, (cyg_uint32 *)endAddr, &badAddr) == FAILED) goto failed; diag_printf("passed"); diag_printf("\n8-bit address test: "); if (Addr8((cyg_uint8 *)startAddr, (cyg_uint8 *)endAddr, &badAddr) == FAILED) goto failed; diag_printf("passed"); diag_printf("\nByte address bar test: "); if (Bar8((cyg_uint8 *)startAddr, (cyg_uint8 *)endAddr, &badAddr) == FAILED) goto failed; diag_printf("passed"); return 1; failed: diag_printf("failed"); dumpMem(badAddr); return 0; }