⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 soc2udip.c

📁 lwip在ucos上的移植
💻 C
📖 第 1 页 / 共 2 页
字号:
	udr_UDIInt(udrs, &NumberOfRanges);	udr_UDIInt(udrs, &NumberOfChips);	udr_inline(udrs, NumberOfChips * sizeof(UDIInt32) );	udr_UDIError(udrs, &tip_errno);	udr_sendnow(udrs);	break;    }/*----------------------------------------------------------- UDICreateProcess*/    case UDICreateProcess_c:    {        UDIPId	pid;		/* out */        udrs->udr_op = UDR_ENCODE;	/* send all "out" parameters */        tip_errno = UDICreateProcess(&pid);        udr_UDIPId(udrs, &pid);        udr_UDIError(udrs, &tip_errno);	/* send any TIP error */        udr_sendnow(udrs);	break;    }/*------------------------------------------------------- UDIInitializeProcess*/    case UDIInitializeProcess_c:    {	char*		ProcessMemory_p;	/* In */	UDIInt		NumberOfRanges;		/* In */	UDIResource	EntryPoint;		/* In */	char*		StackSizes_p;		/* In */	UDIInt		NumberOfStacks;		/* In */	char		*ArgString = sbuf;	/* In */	int		cnt;	udr_UDIInt(udrs, &NumberOfRanges); /* recv all "in" parameters */	ProcessMemory_p = udr_getpos(udrs);	udr_inline(udrs, NumberOfRanges * sizeof(UDIMemoryRange) );    	udr_UDIResource(udrs, &EntryPoint);    	udr_UDIInt(udrs, &NumberOfStacks);	StackSizes_p = udr_getpos(udrs);	udr_inline(udrs, NumberOfStacks * sizeof(CPUSizeT) );    	udr_string(udrs, ArgString);        udrs->udr_op = UDR_ENCODE;	/* send all "out" parameters */	tip_errno = UDIInitializeProcess( ProcessMemory_p, NumberOfRanges,		EntryPoint, StackSizes_p, NumberOfStacks, ArgString);        udr_UDIError(udrs, &tip_errno);	/* send any TIP error */        udr_sendnow(udrs);	break;    }/*------------------------------------------------------- UDISetCurrentProcess*/    case UDISetCurrentProcess_c:    {        UDIPId   pid;			/* in */        udr_UDIPId(udrs, &pid);		/* recv all "in" parameters */        udrs->udr_op = UDR_ENCODE;	/* send all "out" parameters */        tip_errno = UDISetCurrentProcess(pid);        udr_UDIError(udrs, &tip_errno);	/* send any TIP error */        udr_sendnow(udrs);	break;    }/*---------------------------------------------------------- UDIDestroyProcess*/    case UDIDestroyProcess_c:    {        UDIPId   pid;			/* in */        udr_UDIPId(udrs, &pid);		/* recv all "in" parameters */        udrs->udr_op = UDR_ENCODE;	/* send all "out" parameters */        tip_errno = UDIDestroyProcess(pid);        udr_UDIError(udrs, &tip_errno);	/* send any TIP error */        udr_sendnow(udrs);	break;    }/*-------------------------------------------------------------------- UDIRead*/    case UDIRead_c:    {        UDIResource	from;		/* in - source address on target */        UDIHostMemPtr	to_dfe;		/* out - destination adds on dfe host */        UDICount	count;		/* in -- count of objects */        UDISizeT	size;		/* in -- size of each object */        UDICount	count_done;	/* out - count actually transferred */        UDIBool		host_endian;	/* in -- flag for endian information */	char*		count_done_p;	char*		to_dfe_p;        udr_UDIResource(udrs, &from);	/* recv all "in" parameters */        udr_UDICount(udrs, &count);        udr_UDISizeT(udrs, &size);        udr_UDIBool(udrs, &host_endian);        udrs->udr_op = UDR_ENCODE;	/* send all "out" parameters */	udr_work(udrs, count_done, 0);	/* nothing to send yet */	count_done_p = udr_getpos(udrs);	udr_inline(udrs, sizeof(UDICount));/* make space for count_done */	to_dfe_p = udr_getpos(udrs);        tip_errno = UDIRead (from, to_dfe_p, count, size, 		&count_done, host_endian);	udr_inline(udrs,count_done*size);/* make space in socket buffer */        udr_UDIError(udrs, &tip_errno);	/* send any TIP error */	udr_setpos(udrs, count_done_p);	/* restore count_done stream position */        udr_UDICount(udrs, &count_done);        udr_sendnow(udrs);	break;    }/*------------------------------------------------------------------- UDIWrite*/    case UDIWrite_c:    {        UDIHostMemPtr	from_dfe;	/* in -- source address on DFE host */        UDIResource	to;		/* in -- destination adds on target */        UDICount	count;		/* in -- count of objects */        UDISizeT	size;		/* in -- size of each object */        UDICount	count_done;	/* out - count actually transferred */        UDIBool		host_endian;	/* in -- flag for endian information */	int		byte_count;	char*		from_dfe_p;        udr_UDIResource(udrs, &to);	/* recv all "in" parameters */        udr_UDICount(udrs, &count);        udr_UDISizeT(udrs, &size);        udr_UDIBool(udrs, &host_endian);	from_dfe_p = udr_getpos(udrs);	/* fake DFE host address */	byte_count = size * count;	udr_readnow(udrs, byte_count);	/* read all data available from the 					   socket into the stream buffer */        udrs->udr_op = UDR_ENCODE;	/* send all "out" parameters */        tip_errno = UDIWrite( from_dfe_p, to, count, size, 		&count_done, host_endian );        udr_UDICount(udrs, &count_done);        udr_UDIError(udrs, &tip_errno);	/* send any TIP error */        udr_sendnow(udrs);	break;    }/*-------------------------------------------------------------------- UDICopy*/    case UDICopy_c:    {        UDIResource	from;		/* in -- dest. address on target */        UDIResource	to;		/* in -- source address on target */        UDICount	count;		/* in -- count of objects */        UDISizeT	size;		/* in -- size of each object */        UDICount	count_done;	/* out - count actually transferred */        UDIBool		direction;	/* in -- high-to-low or reverse */        udr_UDIResource(udrs, &from);	/* recv all "in" parameters */        udr_UDIResource(udrs, &to);        udr_UDICount(udrs, &count);        udr_UDISizeT(udrs, &size);        udr_UDIBool(udrs, &direction);        udrs->udr_op = UDR_ENCODE;	/* send all "out" parameters */        tip_errno = UDICopy(from, to, count, size, &count_done, direction );        udr_UDICount(udrs, &count_done);        udr_UDIError(udrs, &tip_errno);	/* send any TIP error */        udr_sendnow(udrs);	break;    }/*----------------------------------------------------------------- UDIExecute*/    case UDIExecute_c:    {        udrs->udr_op = UDR_ENCODE;	/* send all "out" parameters */        tip_errno = UDIExecute();        udr_UDIError(udrs, &tip_errno);	/* send any TIP error */        udr_sendnow(udrs);	break;    }/*-------------------------------------------------------------------- UDIStep*/    case UDIStep_c:    {        UDIUInt32	steps;		/* in -- number of steps */        UDIStepType	steptype;       /* in -- type of stepping to be done */        UDIRange	range;          /* in -- range if StepInRange is TRUE */        udr_UDIInt32(udrs, &steps);	/* recv all "in" parameters */        udr_UDIStepType(udrs, &steptype);        udr_UDIRange(udrs, &range);        udrs->udr_op = UDR_ENCODE;	/* send all "out" parameters */        tip_errno = UDIStep(steps, steptype, range);        udr_UDIError(udrs, &tip_errno);	/* send any TIP error */        udr_sendnow(udrs);	break;    }/*-------------------------------------------------------------------- UDIWait*/    case UDIWait_c:    {        UDIInt32   maxtime;     /* in -- maximum time to wait for completion */        UDIPId     pid;        /* out -- pid of process which stopped if any */        UDIUInt32  stop_reason;/* out -- PC where process stopped */            udr_UDIInt32(udrs, &maxtime);        udrs->udr_op = UDR_ENCODE;	/* send all "out" parameters */        tip_errno = UDIWait(maxtime, &pid, &stop_reason);        udr_UDIPId(udrs, &pid);        udr_UDIUInt32(udrs, &stop_reason);        udr_UDIError(udrs, &tip_errno);	/* send any TIP error */        udr_sendnow(udrs);	break;    }/*----------------------------------------------------------- UDISetBreakpoint*/    case UDISetBreakpoint_c:    {        UDIResource	addr;		/* in -- where breakpoint gets set */        UDIInt32	passcount;	/* in -- passcount for breakpoint  */        UDIBreakType	type;		/* in -- breakpoint type */        UDIBreakId	break_id;	/* out - assigned break id */        udr_UDIResource(udrs, &addr); /* recv all "in" parameters */        udr_UDIInt32(udrs, &passcount);        udr_UDIBreakType(udrs, &type);            udrs->udr_op = UDR_ENCODE;	/* send all "out" parameters */        tip_errno = UDISetBreakpoint (addr, passcount, type, &break_id);        udr_UDIBreakId(udrs, &break_id);        udr_UDIError(udrs, &tip_errno);	/* send any TIP error */        udr_sendnow(udrs);	break;    }/*--------------------------------------------------------- UDIQueryBreakpoint*/    case UDIQueryBreakpoint_c:    {        UDIBreakId	break_id;	/* in -- assigned break id */        UDIResource	addr;		/* out - where breakpoint was set */        UDIInt32	passcount;	/* out - trigger passcount */        UDIBreakType	type;		/* out - breakpoint type */        UDIInt32	current_count;	/* out - current breakpoint count */        udr_UDIBreakId(udrs, &break_id);/* recv all "in" parameters */        udrs->udr_op = UDR_ENCODE;	/* send all "out" parameters */        tip_errno = UDIQueryBreakpoint (break_id, &addr, &passcount,		&type, &current_count);        udr_UDIResource(udrs, &addr);        udr_UDIInt32(udrs, &passcount);        udr_UDIBreakType(udrs, &type);        udr_UDIInt32(udrs, &current_count);        udr_UDIError(udrs, &tip_errno);	/* send any TIP error */        udr_sendnow(udrs);	break;    }/*--------------------------------------------------------- UDIClearBreakpoint*/    case UDIClearBreakpoint_c:    {        UDIBreakId	break_id;	/* in -- assigned break id */        udr_UDIBreakId(udrs, &break_id);/* recv all "in" parameters */        udrs->udr_op = UDR_ENCODE;	/* send all "out" parameters */        tip_errno = UDIClearBreakpoint (break_id);        udr_UDIError(udrs, &tip_errno);	/* send any TIP error */        udr_sendnow(udrs);	break;    }/*--------------------------------------------------------------- UDIGetStdout*/    case UDIGetStdout_c:    {        UDIHostMemPtr	buf_dfe;	/* out -- dfe buffer to be filled */        UDISizeT	bufsize;	/* in  -- buffer size in bytes */        UDISizeT	count_done;	/* out -- number of bytes written */	char*		buf_dfe_p;        char*		count_done_p;        udr_UDISizeT(udrs, &bufsize);	/* recv all "in" parameters */        udrs->udr_op = UDR_ENCODE;	/* send all "out" parameters */	udr_work(udrs, count_done, 0);	/* nothing to send yet */	count_done_p = udr_getpos(udrs);	udr_inline(udrs,sizeof(UDISizeT));/* make space for count_done */	buf_dfe_p = udr_getpos(udrs);	/* get start of string buffer */        tip_errno = UDIGetStdout(buf_dfe_p, bufsize, &count_done);	udr_inline(udrs, count_done);	/* leave space for string */        udr_UDIError(udrs, &tip_errno);	/* send any TIP error */	udr_setpos(udrs, count_done_p);	/* restore count_done stram position */        udr_UDISizeT(udrs, &count_done);        udr_sendnow(udrs);	break;    }/*--------------------------------------------------------------- UDIGetStderr*/    case UDIGetStderr_c:    {        UDIHostMemPtr	buf_dfe;	/* out -- dfe buffer to be filled */        UDISizeT	bufsize;	/* in  -- buffer size in bytes */        UDISizeT	count_done;	/* out -- number of bytes written */        char*		buf_dfe_p;        char*		count_done_p;        udr_UDISizeT(udrs, &bufsize);	/* recv all "in" parameters */        udrs->udr_op = UDR_ENCODE;	/* send all "out" parameters */	udr_work(udrs, count_done, 0);	/* nothing to send yet */	count_done_p = udr_getpos(udrs);	udr_inline(udrs,sizeof(UDISizeT));/* make space for count_done */	buf_dfe_p = udr_getpos(udrs);	/* get start of string buffer */        tip_errno = UDIGetStderr(buf_dfe_p, bufsize, &count_done);	udr_inline(udrs, count_done);	/* leave space for string */        udr_UDIError(udrs, &tip_errno);	/* send any TIP error */	udr_setpos(udrs, count_done_p);	/* restore count_done stram position */        udr_UDISizeT(udrs, &count_done);        udr_sendnow(udrs);	break;    }/*---------------------------------------------------------------- UDIPutStdin*/    case UDIPutStdin_c:    {        UDIHostMemPtr buf_dfe;		/* in -- buffer to be filled */        UDISizeT      count;		/* in -- buffer size in bytes */        UDISizeT      count_done;	/* out - number bytes written to buf */	char*	buf_dfe_p;		/* pointer to incoming stream data */	udr_UDISizeT(udrs, &count);	/* recv all "in" parameters */	buf_dfe_p = udr_getpos(udrs);	/* get start of stream buffer */        udrs->udr_op = UDR_ENCODE;	/* send all "out" parameters */        tip_errno = UDIPutStdin (buf_dfe_p, count, &count_done);        udr_UDISizeT(udrs, &count_done);        udr_UDIError(udrs, &tip_errno);	/* send any TIP error */        udr_sendnow(udrs);	break;    }/*--------------------------------------------------------------- UDIStdinMode*/    case UDIStdinMode_c:    {        UDIMode		mode;		/* out - */        udrs->udr_op = UDR_ENCODE;	/* send all "out" parameters */        tip_errno = UDIStdinMode (&mode);        udr_UDIMode(udrs, &mode);        udr_UDIError(udrs, &tip_errno);	/* send any TIP error */        udr_sendnow(udrs);	break;    }/*---------------------------------------------------------------- UDIPutTrans*/    case UDIPutTrans_c:    {        UDIHostMemPtr buf;		/* in -- buffer to be filled */        UDISizeT      count;		/* in -- buffer size in bytes */        UDISizeT      count_done;	/* out - number bytes written to buf */	udr_UDISizeT(udrs, &count);	/* recv all "in" parameters */ 	buf = udr_getpos(udrs);	/* get start of stream buffer */        udrs->udr_op = UDR_ENCODE;	/* send all "out" parameters */        tip_errno = UDIPutTrans (buf, count, &count_done);        udr_UDISizeT(udrs, &count_done);        udr_UDIError(udrs, &tip_errno);	/* send any TIP error */        udr_sendnow(udrs);	break;    }/*---------------------------------------------------------------- UDIGetTrans*/    case UDIGetTrans_c:    {        UDIHostMemPtr	buf_dfe;	/* out -- dfe buffer to be filled */        UDISizeT	bufsize;	/* in  -- buffer size in bytes */        UDISizeT	count_done;	/* out -- number of bytes written */        char*		buf_dfe_p;        char*		count_done_p;        udr_UDISizeT(udrs, &bufsize);	/* recv all "in" parameters */        udrs->udr_op = UDR_ENCODE;	/* send all "out" parameters */	udr_work(udrs, count_done, 0);	/* nothing to send yet */	count_done_p = udr_getpos(udrs);	udr_inline(udrs,sizeof(UDISizeT));/* make space for count_done */	buf_dfe_p = udr_getpos(udrs);	/* get start of string buffer */        tip_errno = UDIGetTrans (buf_dfe_p, bufsize, &count_done);	udr_inline(udrs, count_done);	/* leave space for string */        udr_UDIError(udrs, &tip_errno);	/* send any TIP error */	udr_setpos(udrs, count_done_p);	/* restore count_done stram position */        udr_UDISizeT(udrs, &count_done);        udr_sendnow(udrs);	break;    }/*--------------------------------------------------------------- UDITransMode*/    case UDITransMode_c:    {        UDIMode		mode;		/* in  -- selected mode */        udr_UDIMode(udrs, &mode);	/* recv all "in" parameters */        udrs->udr_op = UDR_ENCODE;	/* send all "out" parameters */        tip_errno = UDITransMode(&mode);        udr_UDIError(udrs, &tip_errno);	/* send any TIP error */        udr_sendnow(udrs);    }/*-------------------------------------------------------------------- UDITest*/    case UDITest_c:    {        UDISizeT	cnt;        UDIHostMemPtr	str_p;        UDIHostMemPtr	iarray_dfe;	UDISizeT	r_cnt;    	UDIInt16	scnt;	UDIInt32	array[4];        udr_UDISizeT(udrs, &cnt);        udr_UDIInt16(udrs, &scnt);        udr_bytes(udrs, (char*)array, 4*sizeof(UDIInt32));        udr_string(udrs, sbuf);        udrs->udr_op = UDR_ENCODE;	/* send all "out" parameters */	r_cnt = cnt;	cnt = array[3]; array[3] = array[0]; array[0] = cnt;	cnt = array[2]; array[2] = array[1]; array[1] = cnt;	tip_errno = 0;        udr_UDISizeT(udrs, &r_cnt);	scnt = -1* scnt;        udr_UDIInt16(udrs, &scnt);        udr_bytes(udrs, (char*)array, 4*sizeof(UDIInt32));	for(cnt=0; cnt< strlen(sbuf);cnt++)sbuf[cnt] -= 32;        udr_string(udrs, sbuf);        udr_UDIError(udrs, &tip_errno);	/* send any TIP error */        udr_sendnow(udrs);	if(scnt == 3)	{   fprintf(stderr,"TIP-ipc test sleep(30) seconds\n");	    sleep(30);	}	break;    }  } }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -