int ipc_func1(void*data)
{
	s32 ret = 0;
	ret = bsp_ipc_sem_create(IPC_SEM1_IPC_TEST);
	if(ret!=OK)
	{
		bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_IPC,"ipc_func1 bsp_ipc_sem_create fail\n");
	}
	while(1)
	{
		delay(2);
		
		ret = bsp_ipc_sem_take(IPC_SEM1_IPC_TEST,100);
		if(ret==OK)
		{
			bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_IPC,"ipc task1 take success\n");
			delay(2);
			ret = bsp_ipc_sem_give(IPC_SEM1_IPC_TEST);
		}
		else
		{
			bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_IPC,"ipc task1 take fail\n");
		}	
	}
}
/*测试多次take和give同一个信号量*/
s32 ipc_test_case02(void)
{
	s32 ret = 0,i = 0;
	ret = bsp_ipc_sem_give(IPC_SEM2_IPC_TEST);
	if(OK!=ret)
	{
		bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_IPC,"[%s], sem_give error\n",__FUNCTION__);
		return ret;
	}
	ret = bsp_ipc_sem_create(IPC_SEM2_IPC_TEST);
	if(OK!=ret)
	{
		bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_IPC,"[%s]: sem_create error\n",__FUNCTION__);
		return ERROR;
	}
	for(i=0;i<TEST_COUNT;i++)
	{
		ret = bsp_ipc_sem_take(IPC_SEM2_IPC_TEST,0);
		if(OK!=ret)
		{
			bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_IPC,"[%s]: sem_take error,loop i=%d\n",__FUNCTION__,i);
			return ERROR;
		}
		ret = bsp_ipc_sem_give(IPC_SEM2_IPC_TEST);
		if(OK!=ret)
		{
			bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_IPC,"[%s]: sem_give error,loop i=%d\n",__FUNCTION__,i);
			return ERROR;
		}
	}
	ret = bsp_ipc_sem_delete(IPC_SEM2_IPC_TEST);
	if(OK!=ret)
	{
		bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_IPC,"[%s], sem_delete error\n",__FUNCTION__);
		return ERROR;
	}
	return OK;
}
/********************************ST BEGIN****************************************/
s32 ipc_test_case01(void)
{
	s32 ret=0;
	ret = bsp_ipc_sem_create(IPC_SEM1_IPC_TEST);
	if(OK!=ret)
	{
		bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_IPC,"[%s], bsp_ipc_sem_create error\n",__FUNCTION__);
		return ERROR;
	}
	ret = bsp_ipc_sem_take(IPC_SEM1_IPC_TEST,10);
	if(OK!=ret)
	{
		bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_IPC,"[%s], bsp_ipc_sem_take error\n",__FUNCTION__);
		return ERROR;
	}
	ret = bsp_ipc_sem_give(IPC_SEM1_IPC_TEST);
	if(OK!=ret)
	{
		bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_IPC,"[%s], sem_give error\n",__FUNCTION__);
		return ERROR;
	}
	ret = bsp_ipc_int_send(DEST_CORE,TEST_INT_NUM);
	if(OK!=ret)
	{
		bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_IPC,"[%s], int send error\n",__FUNCTION__);
		return ERROR;
	}
	delay(100);
	ret = bsp_ipc_sem_take(IPC_SEM1_IPC_TEST,10);
	if(OK!=ret)
	{
		ret = bsp_ipc_sem_delete(IPC_SEM1_IPC_TEST);
		if(OK!=ret)
		{
			bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_IPC,"[%s], bsp_ipc_sem_delete error\n",__FUNCTION__);
			return ERROR;
		}
		return OK;
	}
	else
	{
		ret = bsp_ipc_sem_delete(IPC_SEM1_IPC_TEST);
		if(OK!=ret)
		{
			bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_IPC,"[%s], bsp_ipc_sem_delete error\n",__FUNCTION__);
			return ERROR;
		}
		return ERROR;
	}	
}
예제 #4
0
BSP_VOID BSP_IPC_SemGive(BSP_U32 u32SignalNum)
{
	(void)bsp_ipc_sem_give(u32SignalNum);
	return;
}
int mdrv_ipc_sem_give(unsigned int u32SignalNum)
{
	(void)bsp_ipc_sem_give(u32SignalNum);
	return MDRV_OK;
}
int mdrv_ipc_sem_give(unsigned int u32SignalNum)
{
	return bsp_ipc_sem_give(u32SignalNum);
}