FreeRTOS/Demo/RISC-V_RV64_PolarFire_SoftConsole/polarfire_hal/platform/mpfs_hal/common/nwc/mss_ddr_debug.c
/***************************************************************************/
/**
 *
 * @param DDR_word_ptr  Address
 * @param no_access  Number of addresses
 * @param pattern bit mask with patterns you want to test against
 * @return
 */
@param DDR_word_ptr  Address
@param no_access  Number of addresses
@param pattern bit mask with patterns you want to test against
@return
@param DDR_word_ptr Address @param no_access Number of addresses @param pattern bit mask with patterns you want to test against @return
uint32_t ddr_read_write_fn (uint64_t* DDR_word_ptr, uint32_t no_access,\
                                                               uint32_t pattern)
{
    uint32_t error_cnt = 0U;
    uint8_t pattern_mask;
    for (unsigned i=0; i < 1; i++)
    {
        for (uint32_t pattern_shift=0U; pattern_shift < MAX_NO_PATTERNS;\
                                                                pattern_shift++)
        {
            pattern_mask = (uint8_t)(0x01U << pattern_shift);
            if(pattern & pattern_mask)
            {
#ifdef DEBUG_DDR_INIT
                uprint32(g_debug_uart,"\n\r\t Pattern: 0x", pattern_shift);
#endif
#if TEST_64BIT_ACCESS == 1
                error_cnt += ddr_write ((uint64_t *)DDR_word_ptr,\
                        no_access, pattern_mask, DDR_64_BIT);
                error_cnt += ddr_read ((uint64_t *)DDR_word_ptr, \
                        no_access, pattern_mask, DDR_64_BIT);
#endif
#if TEST_32BIT_ACCESS == 1
                error_cnt += ddr_write ((uint64_t *)DDR_word_ptr,\
                        no_access, pattern_mask, DDR_32_BIT);
                error_cnt += ddr_read ((uint64_t *)DDR_word_ptr, \
                        no_access, pattern_mask, DDR_32_BIT);
#endif
            }
        }
        DDR_word_ptr++; 
    }
    return error_cnt;
}
uint32_t ddr_read_write_fn ( uint64_t * DDR_word_ptr , uint32_t no_access , uint32_t pattern ) { uint32_t error_cnt = 0U ; uint8_t pattern_mask ; for ( unsigned i = 0 ; i < 1 ; i ++ ) { for ( uint32_t pattern_shift = 0U ; pattern_shift < MAX_NO_PATTERNS ; pattern_shift ++ ) { pattern_mask = ( uint8_t ) ( 0x01U << pattern_shift ) ; if ( pattern & pattern_mask ) { #ifdef DEBUG_DDR_INIT uprint32 ( g_debug_uart , " \n \r \t " , pattern_shift ) ; #endif #if TEST_64BIT_ACCESS == 1 error_cnt += ddr_write ( ( uint64_t * ) DDR_word_ptr , no_access , pattern_mask , DDR_64_BIT ) ; error_cnt += ddr_read ( ( uint64_t * ) DDR_word_ptr , no_access , pattern_mask , DDR_64_BIT ) ; #endif #if TEST_32BIT_ACCESS == 1 error_cnt += ddr_write ( ( uint64_t * ) DDR_word_ptr , no_access , pattern_mask , DDR_32_BIT ) ; error_cnt += ddr_read ( ( uint64_t * ) DDR_word_ptr , no_access , pattern_mask , DDR_32_BIT ) ; #endif } } DDR_word_ptr ++ ; } return error_cnt ; }
@param DDR_word_ptr  Address
 @param no_access  Number of addresses
 @param pattern bit mask with patterns you want to test against
 @return
@param DDR_word_ptr Address @param no_access Number of addresses @param pattern bit mask with patterns you want to test against @return
/* write the pattern */ /* read back and verifies */ /* write the pattern */ /* read back and verifies */ /* increment the address */