package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_danube.c
/*
 *  Description:
 *    Download PPE firmware binary code.
 *  Input:
 *    src       --- u32 *, binary code buffer
 *    dword_len --- unsigned int, binary code length in DWORD (32-bit)
 *  Output:
 *    int       --- 0:    Success
 *                  else:           Error Code
 */
Download PPE firmware binary code.
Download PPE firmware binary code .
static inline int pp32_download_code(u32 *code_src, unsigned int code_dword_len, u32 *data_src, unsigned int data_dword_len)
{
    volatile u32 *dest;
    if ( code_src == 0 || ((unsigned long)code_src & 0x03) != 0
        || data_src == 0 || ((unsigned long)data_src & 0x03) != 0 )
        return -1;
    if ( code_dword_len <= CDM_CODE_MEMORYn_DWLEN(0) )
        IFX_REG_W32(0x00, CDM_CFG);
    else
        IFX_REG_W32(0x04, CDM_CFG);
    dest = CDM_CODE_MEMORY(0, 0);
    while ( code_dword_len-- > 0 )
        IFX_REG_W32(*code_src++, dest++);
    dest = CDM_DATA_MEMORY(0, 0);
    while ( data_dword_len-- > 0 )
        IFX_REG_W32(*data_src++, dest++);
    return 0;
}
static inline int pp32_download_code ( u32 * code_src , unsigned int code_dword_len , u32 * data_src , unsigned int data_dword_len ) { volatile u32 * dest ; if ( code_src == 0 || ( ( unsigned long ) code_src & 0x03 ) != 0 || data_src == 0 || ( ( unsigned long ) data_src & 0x03 ) != 0 ) return -1 ; if ( code_dword_len <= CDM_CODE_MEMORYn_DWLEN ( 0 ) ) IFX_REG_W32 ( 0x00 , CDM_CFG ) ; else IFX_REG_W32 ( 0x04 , CDM_CFG ) ; dest = CDM_CODE_MEMORY ( 0 , 0 ) ; while ( code_dword_len -- > 0 ) IFX_REG_W32 ( * code_src ++ , dest ++ ) ; dest = CDM_DATA_MEMORY ( 0 , 0 ) ; while ( data_dword_len -- > 0 ) IFX_REG_W32 ( * data_src ++ , dest ++ ) ; return 0 ; }
Description:
    Download PPE firmware binary code.
Description : Download PPE firmware binary code .
/*  copy code   */ /*  copy data   */