/*****************************************************

DISPLAY_ERRORLOG.C

Z-World, 2001

Program to display the contents of the error log buffer.
errors are logged if ENABLE_ERROR_LOGGING at the top of the
RabbitBIOSc is #defined to 1.

The other programs in this directory can be used to generate
run-time errors or watchdog timeouts.

When a Dynamic C cold boot takes place, the error log header in
RAM is zeroed out to initialize it, but first it's contents are
copied to an address in the BIOS code before the BIOS in RAM is
copied to flash. This means that on the second cold boot, the data
structure in flash will be zeroed out. The configuration of the
log buffer may still be read, and the log buffer entries are not
affected.

Because the fatal exception mechanism resets the processor by
causing a watchdog time-out, the number of watchdog timeouts
reported is the number of actual WDTOs plus the number of
fatal exceptions.

The meaning of the status byte is as follows:
bit 0   - An error has occurred since deployment
bit 1   - The count of SW resets has rolled over.
bit 2   - The count of HW resets has rolled over.
bit 3   - The count of WDTOs has rolled over.
bit 4   - The count of exceptions has rolled over.
bit 5-7 - Not used

The index of the last exception is the index from the
start of the error log entries. If this index does
not equal the total exception count minus one, the error
log entries have wrapped around the log buffer. The index
of the last exception is reported as -1 when none occurred.
******************************************************/
main()
{
	int j;

	printf("%s\n",errlogGetHeaderInfo());
	
	for(j=0;j<ERRLOG_NUM_ENTRIES;j++)
	{
 	   if(!errlogGetNthEntry(j))
 	   {
			printf("Entry %d:\n",j);
			printf("%s\n",errlogFormatEntry());
			printf("%s\n",errlogFormatStackDump());
			printf("%s\n",errlogFormatRegDump());
		}
		else
		{
			printf("Checksum Error\n");
		}
	}
}
	
