
#ifndef __DIAG_H__
#define __DIAG_H__

#define DIAG_1MB 0x100000
#define DIAG_2MB 0x200000
#define DIAG_4MB 0x400000
#define DIAG_8MB 0x800000
#define DIAG_16MB 0x1000000
#define DIAG_32MB 0x2000000

#define MEMORY_TEST_CONSTANT			1
#define MEMORY_TEST_RANDOM			2
#define MEMORY_TEST_RANDOM_COMPLEMENTED		3

void	diag_printf (const char *fmt, ...);
u8	diag_enter_shell(void);
void	diag_restore_shell(void);

void	diag_run1(void);
void	diag_run2(void);
void	diag_ram_pattern_test(u8 quickTest);
#ifdef CONFIG_NVS_SIZE
void	diag_nvs_pattern_test(void);
#endif
u8	diag_quick_ram_test(u32 offset);
#ifdef CONFIG_MMC_SPI
void	diag_card_slot_test(void);
#endif
#ifdef CONFIG_CMD_W1
void	diag_probe_w1(void);
#endif
void	diag_rom_checksum_test(void);

#if defined(CONFIG_DIAG_NOR_FLASH) || defined(CONFIG_DIAG_SPI_FLASH)
#define DIAG_FLASH
#endif /* defined(CONFIG_DIAG_NOR_FLASH) || defined(CONFIG_DIAG_SPI_FLASH) */

#ifdef DIAG_FLASH
#define DIAG_FLASHBUFF	CONFIG_DIAGMEM_BASE
int	diag_erase_all_flash(int doit, int full);
void	diag_flash_test(int full);

//These need to be defined by each diag flash implementation.
int	diag_do_flash_erase(int full, int *quit);
int	diag_do_one_flash_test(int test, int full, int *quit);
#endif /* DIAG_FLASH */

#ifdef CONFIG_DIAG_USB
int diag_usb_test(void);
#endif /* CONFIG_DIAG_USB */

void	diag_print_percentage(char *);
void	diag_update_percentage(int percent);

int	diag_epi3_erase_personality_area(int);


u8	diag_query_quit(void);
u8	diag_test_quit(void);
void	diag_restore_shell(void);
u8	diag_enter_shell(void);

void	diag_decimal_out(long decimalLong);
void	diag_hexbyte_out(u8 hexByte);
void	diag_hex2byte_out(u16 hexLong);
void	diag_hex4byte_out(u32 hexLong);

void	diagnostics2(void);
void	diagnostics(void);

void	diag_printf(const char *fmt, ...);
void	diag_printf_always (const char *fmt, ...);

void	diag_epi3_menu_run(void);
void	diag_idprom_menu_run(void);

void	diag_memtest_init_make_data(int testType, u16 testValue);
void	diag_memtest_make_data(void * destPt, u32 byteCount, int testType, u16 testValue, void (*percent_callback)(int), int *quit);

#endif
