File indexing completed on 2025-05-11 08:23:43
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 #ifndef __MEMSCRUB_H__
0031 #define __MEMSCRUB_H__
0032
0033 #include <stdint.h>
0034
0035 #ifdef __cplusplus
0036 extern "C" {
0037 #endif
0038
0039 #define MEMSCRUB_ERR_OK 0
0040 #define MEMSCRUB_ERR_EINVAL -1
0041 #define MEMSCRUB_ERR_ERROR -2
0042
0043 extern void memscrub_register_drv(void);
0044
0045
0046
0047
0048 #define CONFIG_DELAY_BIT 8
0049 #define CONFIG_IRQD_BIT 7
0050 #define CONFIG_SERA_BIT 5
0051 #define CONFIG_LOOP_BIT 4
0052 #define CONFIG_MODE_BIT 2
0053 #define CONFIG_ES_BIT 1
0054 #define CONFIG_SCEN_BIT 0
0055
0056 #define CONFIG_DELAY (0xff << CONFIG_DELAY_BIT)
0057 #define CONFIG_IRQD (0x1 << CONFIG_IRQD_BIT)
0058 #define CONFIG_SERA (0x1 << CONFIG_SERA_BIT)
0059 #define CONFIG_LOOP (0x1 << CONFIG_LOOP_BIT)
0060 #define CONFIG_MODE (0x3 << CONFIG_MODE_BIT)
0061 #define CONFIG_ES (0x1 << CONFIG_ES_BIT)
0062 #define CONFIG_SCEN (0x1 << CONFIG_SCEN_BIT)
0063 #define CONFIG_MODE_SCRUB (0x0 << CONFIG_MODE_BIT)
0064 #define CONFIG_MODE_REGEN (0x1 << CONFIG_MODE_BIT)
0065 #define CONFIG_MODE_INIT (0x2 << CONFIG_MODE_BIT)
0066
0067 #define MEMSCRUB_OPTIONS_INTERRUPTDONE_ENABLE CONFIG_IRQD
0068 #define MEMSCRUB_OPTIONS_INTERRUPTDONE_DISABLE 0
0069 #define MEMSCRUB_OPTIONS_EXTERNALSTART_ENABLE CONFIG_ES
0070 #define MEMSCRUB_OPTIONS_EXTERNALSTART_DISABLE 0
0071 #define MEMSCRUB_OPTIONS_LOOPMODE_ENABLE CONFIG_LOOP
0072 #define MEMSCRUB_OPTIONS_LOOPMODE_DISABLE 0
0073 #define MEMSCRUB_OPTIONS_SECONDARY_MEMRANGE_ENABLE CONFIG_SERA
0074 #define MEMSCRUB_OPTIONS_SECONDARY_MEMRANGE_DISABLE 0
0075
0076
0077 extern int memscrub_init_start(uint32_t value, uint8_t delay, int options);
0078 extern int memscrub_scrub_start(uint8_t delay, int options);
0079 extern int memscrub_regen_start(uint8_t delay, int options);
0080 extern int memscrub_stop(void);
0081 extern int memscrub_active(void);
0082
0083
0084 extern int memscrub_range_set(uint32_t start, uint32_t end);
0085 extern int memscrub_range_get(uint32_t * start, uint32_t * end);
0086 extern int memscrub_secondary_range_set(uint32_t start, uint32_t end);
0087 extern int memscrub_secondary_range_get(uint32_t * start, uint32_t * end);
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097 typedef void (*memscrub_isr_t)(void *arg, uint32_t ahbaccess,
0098 uint32_t ahbstatus, uint32_t scrubstatus);
0099 extern int memscrub_isr_register(memscrub_isr_t isr, void * data);
0100 extern int memscrub_isr_unregister(void);
0101
0102 extern int memscrub_error_status(uint32_t *ahbaccess, uint32_t *ahbstatus,
0103 uint32_t *scrubstatus);
0104
0105
0106
0107
0108
0109
0110 #define AHBS_CECNT_BIT 22
0111 #define AHBS_UECNT_BIT 14
0112 #define AHBS_DONE_BIT 13
0113 #define AHBS_SEC_BIT 11
0114 #define AHBS_SBC_BIT 10
0115 #define AHBS_CE_BIT 9
0116 #define AHBS_NE_BIT 8
0117 #define AHBS_HW_BIT 7
0118 #define AHBS_HM_BIT 3
0119 #define AHBS_HS_BIT 0
0120
0121 #define AHBS_CECNT (0x3ff << AHBS_CECNT_BIT)
0122 #define AHBS_UECNT (0xff << AHBS_UECNT_BIT)
0123 #define AHBS_DONE (1 << AHBS_DONE_BIT)
0124 #define AHBS_SEC (1 << AHBS_SEC_BIT)
0125 #define AHBS_SBC (1 << AHBS_SBC_BIT)
0126 #define AHBS_CE (1 << AHBS_CE_BIT)
0127 #define AHBS_NE (1 << AHBS_NE_BIT)
0128 #define AHBS_HW (1 << AHBS_HW_BIT)
0129 #define AHBS_HM (0xf << AHBS_HM_BIT)
0130 #define AHBS_HS (0x7 << AHBS_HS_BIT)
0131
0132
0133
0134
0135 #define STAT_RUNCOUNT_BIT 22
0136 #define STAT_BLKCOUNT_BIT 14
0137 #define STAT_DONE_BIT 13
0138 #define STAT_BURSTLEN_BIT 1
0139 #define STAT_ACTIVE_BIT 0
0140
0141 #define STAT_RUNCOUNT (0x3ff << STAT_RUNCOUNT_BIT)
0142 #define STAT_BLKCOUNT (0xff << STAT_BLKCOUNT_BIT)
0143 #define STAT_DONE (0x1 << STAT_DONE_BIT)
0144 #define STAT_BURSTLEN (0xf << STAT_BURSTLEN_BIT)
0145 #define STAT_ACTIVE (0x1 << STAT_ACTIVE_BIT)
0146
0147
0148
0149
0150 #define AHBERC_CECNTT_BIT 22
0151 #define AHBERC_UECNTT_BIT 14
0152 #define AHBERC_CECTE_BIT 1
0153 #define AHBERC_UECTE_BIT 0
0154
0155 #define AHBERC_CECNTT (0x3ff << AHBERC_CECNTT_BIT)
0156 #define AHBERC_UECNTT (0xff << AHBERC_UECNTT_BIT)
0157 #define AHBERC_CECTE (0x1 << AHBERC_CECTE_BIT)
0158 #define AHBERC_UECTE (0x1 << AHBERC_UECTE_BIT)
0159
0160
0161
0162
0163 #define ETHRES_RECT_BIT 22
0164 #define ETHRES_BECT_BIT 14
0165 #define ETHRES_RECTE_BIT 1
0166 #define ETHRES_BECTE_BIT 0
0167
0168 #define ETHRES_RECT (0x3ff << ETHRES_RECT_BIT)
0169 #define ETHRES_BECT (0xff << ETHRES_BECT_BIT)
0170 #define ETHRES_RECTE (0x1 << ETHRES_RECTE_BIT)
0171 #define ETHRES_BECTE (0x1 << ETHRES_BECTE_BIT)
0172
0173 #define MEMSCRUB_OPTIONS_AHBERROR_CORTHRES_ENABLE AHBERC_CECTE
0174 #define MEMSCRUB_OPTIONS_AHBERROR_CORTHRES_DISABLE 0
0175 #define MEMSCRUB_OPTIONS_AHBERROR_UNCORTHRES_ENABLE AHBERC_UECTE
0176 #define MEMSCRUB_OPTIONS_AHBERROR_UNCORTHRES_DISABLE 0
0177 #define MEMSCRUB_OPTIONS_SCRUBERROR_RUNTHRES_ENABLE ETHRES_RECTE
0178 #define MEMSCRUB_OPTIONS_SCRUBERROR_RUNTHRES_DISABLE 0
0179 #define MEMSCRUB_OPTIONS_SCRUBERROR_BLOCKTHRES_ENABLE ETHRES_BECTE
0180 #define MEMSCRUB_OPTIONS_SCRUBERROR_BLOCKTHRES_DISABLE 0
0181 extern int memscrub_ahberror_setup(int uethres, int cethres, int options);
0182 extern int memscrub_scruberror_setup(int blkthres, int runthres,
0183 int options);
0184
0185 extern int memscrub_scrub_position(uint32_t * position);
0186
0187 #ifdef __cplusplus
0188 }
0189 #endif
0190
0191 #endif