summaryrefslogtreecommitdiff
path: root/board/isee/common/igep_test.h
blob: 30aa0a291f19fd8c5665bcc5edc8548ee9ede3f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* Header file for Test Functions to help header code */

#ifndef __TEST_HEADER__
#define __TEST_HEADER__

/* Magics that are involved */
#define SPL_MAGIC_ID  					0xdadd
#define UB_MAGIC_ID 					0xbebb
#define SPL_MAGIC_ID_COUNTER  			0xdadadada
#define UB_MAGIC_ID_COUNTER 			0xbebabeba
#define SPL_START_TEST_OFF				0
#define UB_START_TEST_OFF				58
#define EEPROM_TEST_STRUCT_OFF			116
#define EEPROM_ISEE_BOARD_STRUCT_OFF	121
#define SPL_TEST_COUNTER_OFF			126
#define UB_TEST_COUNTER_OFF				127
#define KNOWN_CRC_CUSTOM_1MB			0x1997c7c7

#define KNOWN_CRC_CUSTOM_1MB_1			0x79f08ba2
#define KNOWN_CRC_CUSTOM_1MB_2			0x177dfc20
#define KNOWN_CRC_CUSTOM_1MB_3			0xa5be2ae0
#define KNOWN_CRC_CUSTOM_1MB_4			0xa8ced8e3


/* CRC PATTERNS FOR RAM TEST */
#define CRC_PATTERN1					0x0000AAAA
#define CRC_PATTERN2					0x00005555
#define CRC_PATTERN3					0x0000CCCC
#define CRC_PATTERN4					0x33330000
#define CRC_PATTERN5					0x99990000
#define CRC_PATTERN6					0x66660000

/* Structs that are involved */
/* SPL / UBOOT RESULT TEST STRUCT */ 
struct __attribute__((packed)) igep_bootloaders_test  {
    u16 magic_id;               /* SPL or uboot magic id for result of test struct*/
    u16 test;                   /* Results of test */
    uint64_t cpuid;             /* CPU ID */
    u32 crc32;                  /* CRC32 of the entire struct */
};

/* SPL / UBOOT COUNTER TEST STRUCT */
struct __attribute__((packed)) igep_bootloaders_counter  {
    u32 magic_id;               /* SPL or uboot magic id for counter test struct */
    uint64_t count;             /* Counter */
    u32 crc32;                  /* CRC32 of the entire struct */
};

/* Functions that are involved */
int test_eeprom(void);
int burn_test(char* t, uint64_t count, int offset);
int burn_test_counter(char* t2, int offset);
int test_counter_check(int offset);
uint64_t test_counter_get(int offset);
int save_test(uint16_t test, uint32_t id, uint64_t cpuid);
uint16_t load_test(uint32_t id);
int erase_eeprom_counter (uint32_t id, int offset);
#endif