主题中讨论的其他器件:TDA4VH
您好、ti
我正在使用 SDK 8.6并尝试通过远程服务在 MCU2_0上读取 eMMC 数据。 但是、当使用 MMCSD_READ 函数时、串行端口上没有响应、并且会卡在那里。 您是否知道导致此问题的原因?
下面是我的测试案例代码:
A72端的代码:
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <unistd.h>
#include <utils/remote_service/include/app_mmcsd.h>
#include <utils/remote_service/include/app_remote_service.h>
#include <utils/ipc/include/app_ipc.h>
#define APP_REMOTE_SERVICE_CSP_EMMC_NAME "csp_emmc_remote_service"
static int CheckRcoreState()
{
char *value = NULL;
// memset(value, 0, sizeof(value));
appRemoteServiceRun(APP_IPC_CPU_MCU2_0, APP_REMOTE_SERVICE_CSP_EMMC_NAME, 0, (void *)value, 258, 0);
for (uint8_t i = 0; i < 20; i++)
{
printf("%02x", value[i]);
}
printf("\n");
// printf("%s\n", (char *)value);
// memset(value, 0, sizeof(value));
return 0;
}
int csp_emmc_main(int argc, char *argv[])
{
CheckRcoreState();
return 0;
}
MCU2_0端上的代码:
#include <stdio.h>
#include <string.h>
#include <utils/console_io/include/app_log.h>
#include <utils/remote_service/include/app_remote_service.h>
#include <utils/mem/include/app_mem.h>
#include <utils/ipc/include/app_ipc.h>
#include <utils/remote_service/include/app_mmcsd.h>
#include <utils/perf_stats/include/app_perf_stats.h>
#include <utils/misc/include/app_misc.h>
#include <ti/osal/TaskP.h>
#include <ti/osal/SemaphoreP.h>
#include <ti/drv/mmcsd/MMCSD.h>
#include <ti/drv/mmcsd/MMCSDver.h>
/* #define APP_REMOTE_SERVICE_TEST_DEBUG */
#define APP_REMOTE_SERVICE_CSP_EMMC_NAME "csp_emmc_remote_service"
MMCSD_Params params;
int32_t appCspEmmcHandler(char *service_name, uint32_t cmd, void *prm, uint32_t prm_size, uint32_t flags)
{
uint8_t buffer[SECTORSIZE];
appLogPrintf("REMOTE_SERVICE_EMMC: %s service received 0x%08x command and parameters of size %d bytes with %08x flags\n",
service_name,
cmd,
prm_size,
flags);
if (prm == NULL)
{
appLogPrintf("REMOTE_SERVICE_EMMC:The pointer passed in is NULL!!!\n");
return -1;
}
appLogPrintf("REMOTE_SERVICE_EMMC:The a72 request:%s\n", (char *)prm);
appLogPrintf("MMCSD: 1 Init ... !!!\n");
uint32_t index = MMCSD_INSTANCE_EMMC;
MMCSD_Error ret;
MMCSD_Handle handle;
uint8_t i;
// uint8_t buffer[SECTORSIZE];
appLogPrintf("MMCSD: MMCSD_INSTANCE_EMMC is %d\n", MMCSD_INSTANCE_EMMC);
ret = MMCSD_init();
appLogPrintf("MMCSD: 2 Init ... !!!\n");
ret = MMCSD_Params_init(¶ms);
appLogPrintf("MMCSD: 3 Init ... !!!\n");
ret = MMCSD_open(index, params, &handle);
appLogPrintf("MMCSD: 4 Init ... !!!\n");
if (ret != 0)
{
appLogPrintf("MMCSD: ERROR Open Mmc %d wrong!!!\n", index);
}
appLogPrintf("MMCSD: 5 Init ... !!!\n");
ret = MMCSD_read(handle, buffer, 38, READBLKNUM);
appLogPrintf("MMCSD: 6 Init ... !!!\n");
// for (i = 0; i < 20; i++)
// {
// appLogPrintf("%02x", buffer[i]);
// }
appLogPrintf("MMCSD: 7 Init ... !!!\n");
appLogPrintf("\n");
appLogPrintf("MMCSD: 8 Init ... !!!\n");
MMCSD_close(params);
appLogPrintf("MMCSD: 9 Init ... !!!\n");
appLogPrintf("MMCSD: Init ... Done !!!\n");
appLogPrintf("REMOTE_SERVICE_EMMC:The a72 request:%s\n", (char *)prm);
// memcpy(prm, buffer, SECTORSIZE);
return 0;
}
int32_t appRemoteServiceCspEmmcInit()
{
int32_t status = 0;
status = appRemoteServiceRegister(APP_REMOTE_SERVICE_CSP_EMMC_NAME, appCspEmmcHandler);
if (status != 0)
{
appLogPrintf("REMOTE_SERVICE_EMMC: ERROR: Unable to register remote service csp handler\n");
}
appLogPrintf("REMOTE_SERVICE_EMMC: SUCCESS: Able to register remote service csp handler\n");
return status;
}
int32_t appRemoteServiceCspEmmcDeInit()
{
int32_t status = 0;
status = appRemoteServiceUnRegister(APP_REMOTE_SERVICE_CSP_EMMC_NAME);
if (status != 0)
{
appLogPrintf("REMOTE_SERVICE_EMMC: ERROR: Unable to register remote service csp handler\n");
}
return status;
}
打印日志:
root@j784s4-evm:~# ./csp_emmc.out
APP: Init ... !!!
MEM: Init ... !!!
MEM: Initialized DMA HEAP (fd=4) !!!
MEM: Init ... Done !!!
IPC: Init ... !!!
IPC: Init ... Done !!!
REMOTE_SERVICE: Init ... !!!
REMOTE_SERVICE: Init ... Done !!!
56.137266 s: GTC Frequency = 200 MHz
APP: Init ... Done !!!
56.142564 s: VX_ZONE_INIT:Enabled
56.142576 s: VX_ZONE_ERROR:Enabled
56.142582 s: VX_ZONE_WARNING:Enabled
56.143383 s: VX_ZONE_INIT:[tivxInitLocal:130] Initialization Done !!!
56.144813 s: VX_ZONE_INIT:[tivxHostInitLocal:93] Initialization Done for HOST !!!
[MCU2_0] 56.144916 s: REMOTE_SERVICE_EMMC: csp_emmc_remote_service service received 0x00000000 command and parameters of size 0 bytes with 00000000
flags
[MCU2_0] 56.144984 s: REMOTE_SERVICE_EMMC:The a72 request:
[MCU2_0] 56.145010 s: MMCSD: 1 Init ... !!!
[MCU2_0] 56.145030 s: MMCSD: MMCSD_INSTANCE_EMMC is 0
[MCU2_0] 56.145069 s: MMCSD: 2 Init ... !!!
[MCU2_0] 56.145091 s: MMCSD: 3 Init ... !!!
[MCU2_0] 60.711597 s: MMCSD: 4 Init ... !!!
[MCU2_0] 60.711631 s: MMCSD: 5 Init ... !!!