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

📄 smutillib.c

📁 the vxworks system kernel souce packeg.there may be something you need .
💻 C
📖 第 1 页 / 共 2 页
字号:
void smUtilTasClear    (    char *	adrs			/* address to be tested and set */    )    {    int         tmp;            /* temp storage */    if (smUtilTasClearRtn != NULL)        {	(*smUtilTasClearRtn) (adrs);        }    else        {	*adrs = 0;        CACHE_PIPE_FLUSH ();                    /* CACHE FLUSH   [SPR 68334] */        tmp = *adrs;                            /* BRIDGE FLUSH  [SPR 68334] */        }    }/******************************************************************************* smUtilIntGen - interrupt the destination cpu.** smUtilIntGen() gets called by the shared memory libraries to interrupt a* CPU to notify it of an incoming packet or an event.  smUtilIntGen() provides* the following methods for interrupting the destination CPU:* mail box interrupts (SM_INT_MAILBOX), bus interrupts (SM_INT_BUS), user* defined procedure 1 (SM_INT_USER1), user defined procedure 2 (SM_INT_USER2),* and none (SM_INT_NONE).  Refer to smLib.h for the actual values.* * RETURNS: OK if successful, otherwise ERROR.*/STATUS smUtilIntGen    (    SM_CPU_DESC *	pCpuDesc,	/* local addr of destination */					/* cpu descriptor */    int			cpuNum 		/* destination cpu number */    )    {    volatile int	bogus;		/* bogus space */    char * 		pMailbox = NULL;/* mailbox */    int			intType;	/* interrupt type */    int			intArg1;    int			intArg2;    int			intArg3;    /* appease the Diab gods (SPR 71120) */    if (cpuNum == 0)        ;    intType = ntohl (pCpuDesc->intType);	/* byte swap */    /* polling needs no arguments */    if (intType == SM_INT_NONE)        {    	return (OK);				/* destination polling */        }    /* Bus interrupts use 2 arguments */    intArg1 = ntohl (pCpuDesc->intArg1);    intArg2 = ntohl (pCpuDesc->intArg2);    if (intType == SM_INT_BUS)	{	return (sysBusIntGen (intArg1, intArg2));	}    /* all other methods use all 3 arguments */    intArg3 = ntohl (pCpuDesc->intArg3);    if ((intType >= SM_INT_MAILBOX_1) && (intType <= SM_INT_MAILBOX_R4))	{	/* For mailboxes, arg1 is addrSpaceId, arg2 is address */	if (sysBusToLocalAdrs (intArg1, (char *) intArg2, &pMailbox) == ERROR)	    {	    if (smUtilVerbose)	        {		logMsg ("smUtilIntGen:unable to calculate mailbox [0x%x]\n",			intArg2, 0, 0, 0, 0, 0);	        }	    return (ERROR);	    }	}    switch (intType)	{    	case SM_INT_MAILBOX_1:	    *pMailbox = (char) intArg3;            CACHE_PIPE_FLUSH ();                 /* CACHE FLUSH  [SPR 68334] */	    bogus = *(volatile char *) pMailbox; /* BRIDGE FLUSH [SPR 68334] */	    break;    	case SM_INT_MAILBOX_2:	    *(short *) pMailbox = (short) intArg3;            CACHE_PIPE_FLUSH ();                 /* CACHE FLUSH  [SPR 68334] */	    bogus = *(volatile short *) pMailbox; /* BRIDGE FLUSH [SPR 68334]*/	    break;     	case SM_INT_MAILBOX_4:	    *(long *) pMailbox = (long) intArg3;            CACHE_PIPE_FLUSH ();                 /* CACHE FLUSH  [SPR 68334] */	    bogus = *(volatile long *) pMailbox; /* BRIDGE FLUSH [SPR 68334] */	    break;    	case SM_INT_MAILBOX_R1:	    bogus = *(volatile char *) pMailbox;	    break;    	case SM_INT_MAILBOX_R2:	    bogus = *(volatile short *) pMailbox;	    break;    	case SM_INT_MAILBOX_R4:	    bogus = *(volatile long *) pMailbox;	    break;	case SM_INT_USER_1:	    if (smUtilUser1Rtn != NULL)	        {		return (*smUtilUser1Rtn)(intArg1, intArg2, intArg3);	        }	    return ERROR;	case SM_INT_USER_2:	    if (smUtilUser2Rtn != NULL)	        {		return (*smUtilUser2Rtn)(intArg1, intArg2, intArg3);	        }	    return ERROR;	default:	    printf ("smUtilIntGen:Unknown intType [%x]\n", intType);	    return (ERROR);			/* unknown interrupt type */	}    return (OK);    }/******************************************************************************* smUtilIntConnect - connect the shared memory interrupts** This routine connects up how this CPU (ie mailbox, bus or polling task) gets* notified of incoming shared memory packets or shared memory events.** RETURNS: OK if successful, otherwise ERROR.*/STATUS smUtilIntConnect    (    int			priorityType,	/* handler priority LOW or HIGH */    FUNCPTR		routine,	/* routine to connect */    int                 param,          /* unit number */    int                 intType,        /* interrupt method */    int                 intArg1,        /* interrupt argument #1 */    int                 intArg2,        /* interrupt argument #2 */    int                 intArg3         /* interrupt argument #3 */    )    {    STATUS              status = ERROR; /* return status */    /* appease the Diab gods (SPR 71120) */    if (intArg3 == 0)        ;    if (priorityType == LOW_PRIORITY)	{	smUtilNetRoutine.routine = routine;	smUtilNetRoutine.param   = param;	}    else	{	smUtilObjRoutine.routine = routine;	smUtilObjRoutine.param   = param;	}    switch (intType)        {        case SM_INT_BUS:                        /* bus interrupts */            if ((intConnect (INUM_TO_IVEC (intArg2), smUtilIntRoutine, 0)		 != ERROR) && (sysIntEnable (intArg1) != ERROR))		{                status = OK;		}            break;        case SM_INT_NONE:                       /* polling */           if ((taskIdVerify (smUtilPollTaskID) == OK)   ||                ((smUtilPollTaskID =                 taskSpawn ("tsmPollTask", smUtilPollTaskPriority,                             smUtilPollTaskOptions, smUtilPollTaskStackSize,                             (FUNCPTR) smUtilPollTask, 0, 0, 0, 0, 0, 0, 0,                             0, 0, 0)) != ERROR))                {            	status = OK;                }            break;        case SM_INT_MAILBOX_1:                  /* mailbox interrupts */        case SM_INT_MAILBOX_2:        case SM_INT_MAILBOX_4:        case SM_INT_MAILBOX_R1:        case SM_INT_MAILBOX_R2:        case SM_INT_MAILBOX_R4:            if ((sysMailboxConnect ((FUNCPTR) smUtilIntRoutine, 0) != ERROR) &&                (sysMailboxEnable ((char *) intArg2) != ERROR))                {                status = OK;                }            break;        case SM_INT_USER_1:        case SM_INT_USER_2:	    /* No special action, user code does it all */	    status = OK;	    break;        default:            logMsg ("smUtilIntConnect:Unknown interrupt type %d\n",                    intType, 0, 0, 0, 0, 0);            break;        }    return (status);    }/******************************************************************************* smUtilIntRoutine - generic shared memory interrupt handler** This routine is connected to the shared memory interrupts. It calls* dedicated handlers for incoming shared memory packets or shared* memory objects events.** RETURNS: N/A*/void smUtilIntRoutine (void)    {    /* call each routine stored in the list */    if (smUtilObjRoutine.routine != NULL)        {	(* smUtilObjRoutine.routine) (smUtilObjRoutine.param);        }    if (smUtilNetRoutine.routine != NULL)        {	(* smUtilNetRoutine.routine) (smUtilNetRoutine.param);        }    }/******************************************************************************* smUtilPollTask - task level generic shared memory events handler** This task handles the shared memory events.  It calls dedicated * handlers for incomming shared memory packets or shared memory * objects events.** RETURNS: N/A*/LOCAL void smUtilPollTask (void)    {    FOREVER	{	if (smUtilObjRoutine.routine != NULL)	    {	    (* smUtilObjRoutine.routine) (smUtilObjRoutine.param);	    }	if (smUtilNetRoutine.routine != NULL)	    {	    (* smUtilNetRoutine.routine) (smUtilNetRoutine.param);	    }	}    }

⌨️ 快捷键说明

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