/*****************************************************************************
 函 数 名  : drv_hifi_fill_mb_info
 功能描述  : 填充Hifi邮箱地址信息
 输入参数  : addr
 输出参数  : 无
 返 回 值  : void
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2012年8月29日
    作    者   : 刘慈红 lKF71598
    修改内容   : 新生成函数

*****************************************************************************/
void drv_hifi_fill_mb_info(unsigned int* addr)
{
    CARM_HIFI_DYN_ADDR_SHARE_STRU *mb_addr;
    BSP_DDR_SECT_QUERY  ddr_sec_query = {0};
    BSP_DDR_SECT_INFO   ddr_sec_info = {0};

    mb_addr = (CARM_HIFI_DYN_ADDR_SHARE_STRU*)(addr);

    mb_addr->uwProtectWord = HIFI_MB_ADDR_PROTECT;

    mb_addr->stCarmHifiMB.uwProtectWord         = HIFI_MB_ADDR_PROTECT;
    mb_addr->stCarmHifiMB.uwHifi2CarmMailBoxLen = (unsigned long)MAILBOX_QUEUE_SIZE(HIFI, CCPU, MSG);
    mb_addr->stCarmHifiMB.uwCarm2HifiMailBoxLen = (unsigned long)MAILBOX_QUEUE_SIZE(CCPU, HIFI, MSG);
    mb_addr->stCarmHifiMB.uwHifiCarmHeadAddr    = (unsigned long)MAILBOX_HEAD_ADDR(HIFI, CCPU, MSG);
    mb_addr->stCarmHifiMB.uwHifiCarmBodyAddr    = (unsigned long)MAILBOX_QUEUE_ADDR(HIFI, CCPU, MSG);
    mb_addr->stCarmHifiMB.uwCarmHifiHeadAddr    = (unsigned long)MAILBOX_HEAD_ADDR(CCPU, HIFI, MSG);
    mb_addr->stCarmHifiMB.uwCarmHifiBodyAddr    = (unsigned long)MAILBOX_QUEUE_ADDR(CCPU, HIFI, MSG);

    mb_addr->stAarmHifiMB.uwProtectWord         = HIFI_MB_ADDR_PROTECT;
    mb_addr->stAarmHifiMB.uwHifi2AarmMailBoxLen = (unsigned long)MAILBOX_QUEUE_SIZE(HIFI, ACPU, MSG);
    mb_addr->stAarmHifiMB.uwAarm2HifiMailBoxLen = (unsigned long)MAILBOX_QUEUE_SIZE(ACPU, HIFI, MSG);
    mb_addr->stAarmHifiMB.uwHifiAarmHeadAddr    = (unsigned long)MAILBOX_HEAD_ADDR(HIFI, ACPU, MSG);
    mb_addr->stAarmHifiMB.uwHifiAarmBodyAddr    = (unsigned long)MAILBOX_QUEUE_ADDR(HIFI, ACPU, MSG);
    mb_addr->stAarmHifiMB.uwAarmHifiHeadAddr    = (unsigned long)MAILBOX_HEAD_ADDR(ACPU, HIFI, MSG);
    mb_addr->stAarmHifiMB.uwAarmHifiBodyAddr    = (unsigned long)MAILBOX_QUEUE_ADDR(ACPU, HIFI, MSG);

    /*设置nv地址*/
    ddr_sec_query.enSectType = BSP_DDR_SECT_TYPE_NV;
    if (BSP_OK == BSP_DDR_GetSectInfo(&ddr_sec_query, &ddr_sec_info))
    {
        mb_addr->uwNvBaseAddrPhy = (char*)ddr_sec_info.pSectPhysAddr;
        mb_addr->uwNvBaseAddrVirt = (char*)ddr_sec_info.pSectVirtAddr;

        printk("drv_hifi_fill_nv_info:phy addr = %p, virt addr = %p.\n",mb_addr->uwNvBaseAddrPhy, mb_addr->uwNvBaseAddrVirt);
    }
}
/*****************************************************************************
* 函 数 名  : mdrv_get_fix_ddr_addr
*
* 功能描述  :DDR内存段查询接口。
*
* 输入参数  : pstSectQuery: 需要查询内存段的属性,类型
*             pstSectInfo:  查询到的内存段信息
*
* 输出参数  : 无
* 返 回 值  :  无
****************************************************************************/
int mdrv_get_fix_ddr_addr (BSP_DDR_SECT_QUERY_S *pstSectQuery, BSP_DDR_SECT_INFO_S *pstSectInfo)
{
    return BSP_DDR_GetSectInfo(pstSectQuery, pstSectInfo);
}