Example #1
0
/*!
 * ======== VirtQueue_startup ========
 */
Void VirtQueue_startup()
{
    hostProcId      = MultiProc_getId("HOST");
    dspProcId       = MultiProc_getId("DSP");
    sysm3ProcId     = MultiProc_getId("CORE0");
    appm3ProcId     = MultiProc_getId("CORE1");

    /* Initilize the IpcPower module */
    IpcPower_init();

    /*
     *  DSP can be used to prototype communications with CORE0 instead of
     *  HOST
     */
    if (MultiProc_self() == dspProcId) {
        memset((void *)RP_MSG_A9_SYSM3_VRING_DA, 0,
                RP_MSG_RING_SIZE * 2 + RP_MSG_BUFS_SPACE);
        InterruptM3_intRegister(VirtQueue_isr);

        InterruptM3_intSend(sysm3ProcId, (UInt)RP_MSG_MBOX_READY);
        InterruptM3_intSend(sysm3ProcId, (0xA0000000));
        InterruptM3_intSend(appm3ProcId, (UInt)RP_MSG_MBOX_READY);
        InterruptM3_intSend(appm3ProcId, (0xA0000000));

        buf_addr = (Ptr)RP_MSG_A9_SYSM3_VRING_DA;
    }
    else if (MultiProc_self() == sysm3ProcId)
        InterruptM3_intRegister(VirtQueue_isr);
    else if (MultiProc_self() == appm3ProcId)
        InterruptM3_intRegister(VirtQueue_isr);
}
Example #2
0
/*!
 * ======== VirtQueue_startup ========
 */
Void VirtQueue_startup()
{
    hostProcId      = MultiProc_getId("HOST");
#ifndef SMP
    dsp1ProcId       = MultiProc_getId("DSP1");
    sysm3ProcId     = MultiProc_getId("CORE0");
    appm3ProcId     = MultiProc_getId("CORE1");
#endif

#ifdef DSP
    intInfo.intVectorId = DSPEVENTID;
#else
    /* Initilize the IpcPower module */
    IpcPower_init();
#endif

    /*
     * Wait for HLOS (Virtio device) to indicate that priming of host's receive
     * buffers is complete, indicating that host is ready to send.
     *
     * Though this is a Linux Virtio configuration status, it must be
     * implemented by each non-Linux HLOS as well.
     */
    Log_print1(Diags_USER1, "VirtQueue_startup: VDEV status: 0x%x\n",
              Resource_getVdevStatus(VIRTIO_ID_RPMSG));
    Log_print0(Diags_USER1, "VirtQueue_startup: Polling VDEV status...\n");
    while (Resource_getVdevStatus(VIRTIO_ID_RPMSG) != VRING_BUFS_PRIMED);
    Log_print1(Diags_USER1, "VirtQueue_startup: VDEV status: 0x%x\n",
              Resource_getVdevStatus(VIRTIO_ID_RPMSG));

    InterruptProxy_intRegister(hostProcId, &intInfo, (Fxn)VirtQueue_isr, NULL);
    Log_print0(Diags_USER1, "Passed VirtQueue_startup\n");
}
Example #3
0
/*
 *  ======== tsk1_func ========
 *  Receive and return messages until the die request comes.
 */
Void tsk1_func(UArg arg0, UArg arg1) {
    UInt16 hostProcId = MultiProc_getId("MPU");
    while (Ipc_attach(hostProcId) < 0);
    UInt16 appProcId = MultiProc_getId("AppM3");
    while (Ipc_attach(appProcId) < 0);

    comInitCoPro();
    computationThread();
    comClear();

    Ipc_detach(appProcId);
    Ipc_detach(hostProcId);
}
Example #4
0
Int IpcResource_release(IpcResource_Handle handle,
                        IpcResource_ResHandle resHandle)
{
    Int status;
    Char msg[sizeof(IpcResource_Req) + sizeof(IpcResource_FreeData)];
    IpcResource_Req *req = (Void *)msg;
    IpcResource_FreeData *rel = (Void *)req->data;

    if (!handle) {
        System_printf("IpcResource_release: handle is NULL\n");
        return IpcResource_E_INVALARGS;
    }

    req->reqType = IpcResource_ReqType_FREE;
    rel->resHandle = resHandle;

    status = MessageQCopy_send(MultiProc_getId("HOST"), handle->remote,
                      handle->endPoint, req, sizeof(msg));
    if (status) {
        System_printf("IpcResource_release: MessageQCopy_send "
                      "failed status %d\n", status);
    }

    return status;
}
/*
 *  ======== Server_init ========
 */
Void Server_init(Void)
{
    Registry_Result result;

    if (curInit++ != 0) {
        return;  /* already initialized */
    }

    /* register with xdc.runtime to get a diags mask */
    result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
    Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);

    /* initialize module state */
    Module.hostProcId = MultiProc_getId("HOST");
    Module.lineId = SystemCfg_LineId;
    Module.eventId = SystemCfg_AppEventId;
    Module.semH = NULL;
    Module.heapH = NULL;
    Module.head = 0;
    Module.tail = 0;
    Module.error = 0;
    Module.rcmServerH = NULL;

    RcmServer_init();
}
Example #6
0
/*!
 *  ======== Interrupt_intSend ========
 *  Send interrupt to the remote processor, identifying this core as source.
 *  If CORE0 BIT POS, we add DNUM to identify this core as the source;
 *  Otherwise, we just use the localIntId as the source bit position.
 */
Void Interrupt_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
                          UArg arg)
{
    UInt32 val;
    volatile UInt32 *ipcgr = (volatile UInt32 *)Interrupt_IPCGR0;
    volatile UInt32 *ipcgrh = (volatile UInt32 *)Interrupt_IPCGRH;
    UInt pos;

    Assert_isTrue((intInfo != NULL), NULL);
    pos = MAP_TO_BITPOS(intInfo->localIntId);

    /*
     *  bit 0 is set to generate the interrupt.
     *  bits 4-7 are set to specify the interrupt generation source.
     *  The convention is that bit 4 (SRCS0) is used for core 0,
     *  bit 5 (SRCS1) for core 1, etc... .
     */
    val = (1 << pos) | 1;
    Log_print3(Diags_USER1,
        "Interrupt_intSend: setting bit %d in SRCS as 0x%x to for rprocId #%d",
        (IArg)pos, (IArg)val, (IArg)remoteProcId);

    if (remoteProcId == MultiProc_getId("HOST"))
    {
        /* Interrupt is to be generated on the Host processor.  Go through
         * IPCGRH register
         */
        *ipcgrh = val;
    }
    else
    {
        /* Interrupt is to be generated on another DSP. */
        ipcgr[MAP_RPROCID_TO_COREID(remoteProcId)] =  val;
    }
}
Example #7
0
/*
 *  ======== taskLoad ========
 */
Void task(UArg arg1, UArg arg2)
{   
    UInt count = 1;
    Int status = Ipc_S_SUCCESS;
    UInt16 remoteProcId = MultiProc_getId("HOST");
    
    do {
        status = Ipc_attach(remoteProcId);
    } while (status < 0);
    
    Notify_registerEvent(remoteProcId, 0, SHUTDOWN,
                         (Notify_FnNotifyCbck)notifyCallbackFxn, 0);

    
    while (shutdownFlag == FALSE) {        
        Semaphore_pend(sem, BIOS_WAIT_FOREVER);
        
        /* Benchmark how long it takes to flip all the bits */
        Log_write1(UIABenchmark_start, (xdc_IArg)"Reverse");
        reverseBits(buffer, sizeof(buffer));
        Log_write1(UIABenchmark_stop, (xdc_IArg)"Reverse");
        
        Log_print1(Diags_USER1, "count = %d", count++);        
    }
    
    /* Start shutdown process */
    Notify_unregisterEvent(remoteProcId, 0, SHUTDOWN,
                           (Notify_FnNotifyCbck)notifyCallbackFxn, 0);
    
    do {
        status = Ipc_detach(remoteProcId);
    } while (status < 0);

    Ipc_stop();
}
Example #8
0
Int IpcResource_disconnect(IpcResource_Handle handle)
{
    Int status;
    IpcResource_Req req;

    if (!handle) {
        System_printf("IpcResource_disconnect: handle is NULL\n");
    }

    req.resType = 0;
    req.reqType = IpcResource_REQ_TYPE_DISCONN;

    status = MessageQCopy_send(MultiProc_getId("HOST"), IpcResource_server,
                        handle->endPoint, &req, sizeof(req));
    if (status) {
        System_printf("IpcResource_disconnect: MessageQCopy_send "
                      "failed status %d\n", status);
        return status;
    }

    status = MessageQCopy_delete(&handle->msgq);
    if (status) {
        System_printf("IpcResource_disconnect: MessageQCopy_delete "
                      "failed status %d\n", status);
        return status;
    }

    Memory_free(NULL, handle, sizeof(*handle));

    return 0;
}
Example #9
0
Void Audio_systemProcInit (Void)
{
    Int32   status;
    Int16   procId;
    Int16   state;

    /* 
     * SysLink_setup is the first APIs needs to be called by user side
     * application to use any SysLink functionality 
     */
    SysLink_setup ();

    procId = MultiProc_getId ("DSP");

    status = ProcMgr_open (&procMgrHandle, procId);
    if (0 > status) {
        AUDIO_ERROR_PRINT(("AUDIO: ProcMgr_open() Failed \n"));
        goto EXIT;
    }

    state = ProcMgr_getState (procMgrHandle);

EXIT:
    return;
}
Example #10
0
Void copyTaskFxn(UArg arg0, UArg arg1)
{
    MessageQCopy_Handle    handle;
    Char                   buffer[128];
    UInt32                 myEndpoint = 0;
    UInt32                 remoteEndpoint;
    UInt16                 dstProc;
    UInt16                 len;
    Int                    i;

    System_printf("copyTask %d: Entered...:\n", arg0);

    dstProc = MultiProc_getId("HOST");

    /* Create the messageQ for receiving (and get our endpoint for sending). */
    handle = MessageQCopy_create(arg0, &myEndpoint);

    NameMap_register("rpmsg-client-sample", arg0);

    for (i = 0; i < APP_NUM_ITERATIONS; i++) {
       /* Await a character message: */
       MessageQCopy_recv(handle, (Ptr)buffer, &len, &remoteEndpoint,
                         MessageQCopy_FOREVER);

       buffer[len] = '\0';
       System_printf("copyTask %d: Received data: %s, len:%d\n", i + 1,
                      buffer, len);

       /* Send data back to remote endpoint: */
       MessageQCopy_send(dstProc, remoteEndpoint, myEndpoint, (Ptr)buffer, len);
    }

    /* Teardown our side: */
    MessageQCopy_delete(&handle);
}
Example #11
0
/*!
 *  ======== InterruptHost_intRegister ======== 
 */
Void InterruptHost_intRegister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
                              Fxn func, UArg arg)
{
    UInt        key;
    Hwi_Params  hwiAttrs;
    
    /* Make sure that we're trying to talk to the HOST */
    Assert_isTrue(remoteProcId == MultiProc_getId("DSP"), 
            ti_sdo_ipc_Ipc_A_invArgument);
    
    /* Disable global interrupts */
    key = Hwi_disable();

    InterruptHost_intClear(remoteProcId, intInfo);

    /* Register interrupt for communication between ARM and DSP */
    Hwi_Params_init(&hwiAttrs);
    hwiAttrs.maskSetting = Hwi_MaskingOption_SELF;
    hwiAttrs.arg         = arg;
    Hwi_create(HOSTINT,
               (Hwi_FuncPtr)func,
               &hwiAttrs,
               NULL);
               
    /* Enable the mailbox interrupt to the DSP */
    REG32(MAILBOX_IRQENABLE_GPP) = 0x4; /* Mailbox 0 */

    /* Restore global interrupts */
    Hwi_restore(key);

    /* Unmask IVA_2_IRQ[10] to allow interrupt to come into DSP */
    Hwi_enableInterrupt(HOSTINT);
}
Example #12
0
/*
 *  ======== IpcMgr_ipcStartup ========
 *  Initialize MessageQ Transport stack built over RPMSG.
 *  This ends up calling RPMessage_init().
 *
 *  Use for stacks built on MessageQ/TransportRpmsg only.
 */
Void IpcMgr_ipcStartup(Void)
{
    UInt procId = MultiProc_getId("HOST");
    Int status;

    /* TransportRpmsgSetup will busy wait until host kicks ready to recv: */
    status = TransportRpmsgSetup_attach(procId, 0);
    Assert_isTrue(status >= 0, NULL);

    /* Sets up to communicate with host's NameServer: */
    status = NameServerRemoteRpmsg_attach(procId, 0);
    Assert_isTrue(status >= 0, NULL);

#ifdef IpcMgr_USEDEH
    /*
     * When using DEH, initialize the Watchdog timers if not already done
     * (i.e. late-attach)
     */
#ifdef IpcMgr_DSP
    Watchdog_init((Void (*)(Void))ti_sysbios_family_c64p_Exception_handler);
#elif IpcMgr_IPU
    Watchdog_init(ti_sysbios_family_arm_m3_Hwi_excHandlerAsm__I);
#endif
#endif
}
Example #13
0
/*!
 * ======== OffloadM3_init ========
 *
 * Initialize the OffloadM3 module, currently supported only on SysM3
 */
Void OffloadM3_init()
{
    Task_Params taskParams;
    Semaphore_Params mutexParams;

    sysm3ProcId = MultiProc_getId("CORE0");
    if (MultiProc_self() != sysm3ProcId)
        return;

    Semaphore_Params_init(&mutexParams);
    mutexParams.mode = Semaphore_Mode_BINARY;
    module.mutex = Semaphore_create(1, NULL, NULL);

    module.created = FALSE;
    module.semaphores[OFFLOAD_CREATE_IDX] = Semaphore_create(0, NULL, NULL);
    module.semaphores[OFFLOAD_DELETE_IDX] = Semaphore_create(0, NULL, NULL);

    Task_Params_init(&taskParams);
    taskParams.instance->name = "OffloadM3_createTask";
    taskParams.priority = xdc_runtime_knl_Thread_Priority_NORMAL;
    taskParams.arg0 = (UArg)module.semaphores[OFFLOAD_CREATE_IDX];
    module.tasks[OFFLOAD_CREATE_IDX] = Task_create(OffloadM3_createTask, &taskParams, NULL);

    Task_Params_init(&taskParams);
    taskParams.instance->name = "OffloadM3_deleteTask";
    taskParams.priority = xdc_runtime_knl_Thread_Priority_HIGHEST;
    taskParams.arg0 = (UArg)module.semaphores[OFFLOAD_DELETE_IDX];
    module.tasks[OFFLOAD_DELETE_IDX] = Task_create(OffloadM3_deleteTask, &taskParams, NULL);
}
Example #14
0
/*!
 *  ======== NotifySetup_attach ========
 */
Int NotifySetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
{
    NotifyDriverShm_Params notifyShmParams;
    NotifyDriverShm_Handle shmDrvHandle;
    ti_sdo_ipc_Notify_Handle notifyHandle;
    Error_Block eb;

    Assert_isTrue(remoteProcId != MultiProc_getId("HOST"), NULL);

    /* Initialize the error block */
    Error_init(&eb);

    /* init params and set default values */
    NotifyDriverShm_Params_init(&notifyShmParams);
    notifyShmParams.intVectorId = NotifySetup_dspIntVectId;
    notifyShmParams.localIntId = NotifySetup_SRCS_BITPOS_CORE0;
    notifyShmParams.sharedAddr = sharedAddr;
    notifyShmParams.remoteProcId = remoteProcId;

    shmDrvHandle = NotifyDriverShm_create(&notifyShmParams, &eb);
    if (shmDrvHandle == NULL) {
        return (Notify_E_FAIL);
    }

    notifyHandle = ti_sdo_ipc_Notify_create(
            NotifyDriverShm_Handle_upCast(shmDrvHandle), remoteProcId, 0, NULL,
            &eb);
    if (notifyHandle == NULL) {
        NotifyDriverShm_delete(&shmDrvHandle);

        return (Notify_E_FAIL);
    }

    return (Notify_S_SUCCESS);
}
Example #15
0
/*
 *  ======== IpcMgr_rpmsgStartup ========
 *  Initialize the RPMSG module. This calls VirtQueue_startup().
 *
 *  Use for stacks built on RPMessage only.
 */
Void IpcMgr_rpmsgStartup(Void)
{
    Assert_isTrue(MultiProc_self() != MultiProc_getId("HOST"), NULL);
    RPMessage_init(MultiProc_getId("HOST"));

#ifdef IpcMgr_USEDEH
    /*
     * When using DEH, initialize the Watchdog timers if not already done
     * (i.e. late-attach)
     */
#ifdef IpcMgr_DSP
    Watchdog_init((Void (*)(Void))ti_sysbios_family_c64p_Exception_handler);
#elif IpcMgr_IPU
    Watchdog_init(ti_sysbios_family_arm_m3_Hwi_excHandlerAsm__I);
#endif
#endif
}
Example #16
0
Int IpcResource_setConstraints(IpcResource_Handle handle,
                               IpcResource_ResHandle resHandle,
                               UInt32 action,
                               Void *constraints)
{
    Char msg[MAXMSGSIZE];
    IpcResource_Ack *ack = (Void *)msg;
    IpcResource_Req *req = (Void *)msg;
    UInt16 rlen = sizeof(IpcResource_ConstraintData);
    UInt16 alen = sizeof(*ack);
    UInt16 len;
    UInt32 remote;
    Int status;

    if (!handle) {
        System_printf("IpcResource_setConstraints: Invalid paramaters\n");
        return IpcResource_E_INVALARGS;
    }

    if (rlen && !constraints) {
        System_printf("IpcResource_setConstraints: needs parameters\n");
        return IpcResource_E_INVALARGS;
    }

    req->resType = 0;
    req->reqType = action;
    req->resHandle = resHandle;

    memcpy(req->resParams, constraints, rlen);
    status = MessageQCopy_send(MultiProc_getId("HOST"), IpcResource_server,
                        handle->endPoint, req, sizeof(*req) + rlen);
    if (status) {
        System_printf("IpcResource_setConstraints: MessageQCopy_send "
                      "failed status %d\n", status);
        status = IpcResource_E_FAIL;
        goto end;
    }

    if (action == IpcResource_REQ_TYPE_REL_CONSTRAINTS)
        goto end;

    status = MessageQCopy_recv(handle->msgq, ack, &len, &remote,
                               handle->timeout);
    if (status) {
        System_printf("IpcResource_setConstraints: MessageQCopy_recv "
                      "failed status %d\n", status);
        status = (status == MessageQCopy_E_TIMEOUT) ? IpcResource_E_TIMEOUT :
                 IpcResource_E_FAIL;
        goto end;
    }

    Assert_isTrue(len == (rlen + alen), NULL);

    status = _IpcResource_translateError(ack->status);

end:
    return status;
}
Example #17
0
/*!
 * ======== NotifySetup_numIntLines ========
 * If remoteProc is HOST, say "0" so that Ipc_start skips the attach.
 */
UInt16 NotifySetup_numIntLines(UInt16 remoteProcId)
{
    UInt16 retval = 1;

    if (remoteProcId == MultiProc_getId("HOST")) {
        retval = 0;
    }

    return (retval);
}
Example #18
0
/*!
 * ======== VirtQueue_startup ========
 */
Void VirtQueue_startup()
{
    hostProcId      = MultiProc_getId("HOST");
#ifndef SMP
    dspProcId       = MultiProc_getId("DSP");
    sysm3ProcId     = MultiProc_getId("CORE0");
    appm3ProcId     = MultiProc_getId("CORE1");
#endif

    /* Initilize the IpcPower module */
    IpcPower_init();

#if defined(M3_ONLY) && !defined(SMP)
    if (MultiProc_self() == sysm3ProcId) {
        OffloadM3_init();
    }
#endif

    InterruptProxy_intRegister(VirtQueue_isr);
}
Example #19
0
Int dvsdk_grapx_display_rpc_display_toggle (Int instID)
{
  Int status;
    
  Assert_isTrue((MultiProc_self() != MultiProc_getId("VPSS-M3")), Assert_E_assertFailed);
  status = dvsdk_grapx_display_rpc_remote_mode_init();
  if (status >= 0) {
    status = dvsdk_grapx_display_exec_rpc(instID, g_RemoteStubContext.nDisplayToggelFxnIdx);
  }
  return status;  
}
/*
 *  ======== Processor_getCoreId ========
 */
UInt32 Processor_getCoreId(String name)
{
    UInt16 coreId = MultiProc_getId(name);

    if (coreId == MultiProc_INVALIDID) {
        return (Processor_INVALIDID);
    }
    else {
        return ((UInt32)coreId);
    }
}
Example #21
0
IpcResource_Handle IpcResource_connect(UInt timeout)
{
    UInt16 dstProc;
    UInt16 len;
    UInt32 remote;
    IpcResource_Handle handle;
    IpcResource_Req req;
    IpcResource_Ack ack;
    Int status;

    handle = Memory_alloc(NULL, sizeof(*handle), 0, NULL);
    if (!handle) {
        System_printf("IpcResource_connect: No memory");
        return NULL;
    }

    handle->timeout = (!timeout) ? DEFAULT_TIMEOUT :
                      (timeout == IpcResource_FOREVER) ? MessageQCopy_FOREVER :
                      timeout;

    dstProc = MultiProc_getId("HOST");

    handle->msgq= MessageQCopy_create(MessageQCopy_ASSIGN_ANY,
                                      &handle->endPoint);
    req.resType = 0;
    req.reqType = IpcResource_REQ_TYPE_CONN;
    req.resHandle = 0;
    status = MessageQCopy_send(dstProc, IpcResource_server,
                      handle->endPoint, &req, sizeof(req));
    if (status) {
        System_printf("IpcResource_connect: MessageQCopy_send "
                      " failed status %d\n", status);
        goto err;
    }

    status = MessageQCopy_recv(handle->msgq, &ack, &len, &remote,
                               handle->timeout);
    if (status) {
        System_printf("IpcResource_connect: MessageQCopy_recv "
                      "failed status %d\n", status);
        goto err;
    }
    status = _IpcResource_translateError(ack.status);
    if (status) {
        System_printf("IpcResource_connect: A9 Resource Manager "
                      "failed status %d\n", status);
        goto err;
    }

    return handle;
err:
    Memory_free(NULL, handle, sizeof(*handle));
    return NULL;
}
Example #22
0
/*
 *  ======== IPC_threadGeneratedInit ========
 */
Void IPC_threadGeneratedInit()
{
    Int status;
    UInt16 masterId;

    masterId = MultiProc_getId("HOST");

    do {
        status = Ipc_attach(masterId);
    } while (status < 0);

}
Example #23
0
void platform_init()
{
	Int status = 0;
	UInt16 hostId = 0, sysProcId = 0;

    /* clear HSDIVDER_CLKOUT2_DIV */
    set_ivahd_opp(0);

	/* Set up interprocessor notifications */
	DEBUG("Setting up IPC");
	status = Ipc_start();
	if (status < 0) {
	    ERROR("Ipc_start failed: %08x", status);
	    return;
	}

	/* attach to host */
	hostId = MultiProc_getId("MPU");
	DEBUG("APPM3: IPC attaching to MPU, hostId = %d", hostId);
	do {
	    status = Ipc_attach(hostId);
	    DEBUG("APPM3: IPC attaching... %08x", status);
	} while (status < 0);

	/* attach to other M3.. do we need this? */
	sysProcId = MultiProc_getId("SysM3");
	DEBUG("APPM3: IPC attaching to SysM3, sysProcId = %d", sysProcId);

	do {
	    status = Ipc_attach(sysProcId);
	    DEBUG("APPM3: IPC attaching... %08x", status);
	} while (status < 0);

	/* maybe above stuff should move into dce_init().. */
	dce_init();
	DEBUG("APPM3: Completed IPC setup and Server Bringup");

    return;
}
Example #24
0
/*!
 *  ======== InterruptM3_intRegister ========
 */
Void InterruptM3_intRegister(Hwi_FuncPtr fxn)
{
    Hwi_Params  hwiAttrs;
    UInt        key;

    hostProcId      = MultiProc_getId("HOST");
    dspProcId       = MultiProc_getId("DSP");
    sysm3ProcId     = MultiProc_getId("CORE0");
    appm3ProcId     = MultiProc_getId("CORE1");

    /* Disable global interrupts */
    key = Hwi_disable();

    userFxn = fxn;
    Hwi_Params_init(&hwiAttrs);
    hwiAttrs.maskSetting = Hwi_MaskingOption_LOWER;

    if (Core_getId() == 0) {
        Hwi_create(M3INT_MBX,
                   (Hwi_FuncPtr)InterruptM3_isr,
                   &hwiAttrs,
                   NULL);
        /* InterruptM3_intEnable won't enable the Hwi */
        Hwi_enableInterrupt(M3INT_MBX);
    }
    else {
        Hwi_create(M3INT,
                   (Hwi_FuncPtr)InterruptM3_isr,
                   &hwiAttrs,
                   NULL);
    }

    /* Enable the mailbox interrupt to the M3 core */
    InterruptM3_intEnable();

    /* Restore global interrupts */
    Hwi_restore(key);
}
Example #25
0
/*
 *  ======== Server_init ========
 */
Void Server_init(Void)
{
    Registry_Result result;

    /* register with xdc.runtime to get a diags mask */
    result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
    Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);

    /* initialize module object state */
    Module.hostProcId = MultiProc_getId("HOST");
    Module.slaveQue = NULL;
    Module.hostGateMPHandle = NULL;
    Module.slaveGateMPHandle = NULL;
}
/*
 *  ======== Processor_getCoreId ========
 */
UInt32 Processor_getCoreId(String name)
{
#if MESSAGEQ_ENABLED
    UInt16 coreId = MultiProc_getId(name);

    if (coreId == MultiProc_INVALIDID) {
        return (Processor_INVALIDID);
    }
    else {
        return (coreId);
    }
#else
    return (0);
#endif
}
Example #27
0
/*!
 * ======== NotifySetup_sharedMemReq ========
 */
SizeT NotifySetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
{
    SizeT memReq;
    NotifyDriverShm_Params params;

    Assert_isTrue(remoteProcId != MultiProc_getId("HOST"), NULL);

    NotifyDriverShm_Params_init(&params);
    params.sharedAddr      = sharedAddr;
    params.intVectorId     = NotifySetup_dspIntVectId;
    params.remoteProcId    = remoteProcId;

    memReq = NotifyDriverShm_sharedMemReq(&params);

    return(memReq);
}
Example #28
0
/*
 *  ======== IPC_threadGeneratedReset ========
 */
Void IPC_threadGeneratedReset()
{
    Int status;
    UInt16 masterId;

    masterId = MultiProc_getId("HOST");

    do {
        status = Ipc_detach(masterId);
    } while (status < 0);

    do {
        status = Ipc_stop();
    } while (status < 0);

    do {
        status = Ipc_start();
    } while (status < 0);
}
Example #29
0
/*
 *  ======== Interrupt_Module_startup ========
 */
Int Interrupt_Module_startup(Int phase)
{
    volatile UInt32 *kick0 = (volatile UInt32 *)Interrupt_KICK0;
    volatile UInt32 *kick1 = (volatile UInt32 *)Interrupt_KICK1;
    UInt16 procId = MultiProc_self();

    /*
     * If this assert fails, the MultiProc config has changed to break
     * an assumption in Linux rpmsg driver, that HOST is listed first in
     * MultiProc ID configuration.
     */
    Assert_isTrue(0 == MultiProc_getId("HOST"), NULL);

    /*
     *  Wait for Startup to be done (if MultiProc id not yet set) because a
     *  user fxn should set it
     */
    if (!Startup_Module_startupDone() && procId == MultiProc_INVALIDID) {
        return (Startup_NOTDONE);
    }

    if (!Interrupt_enableKick) {
        /* Do not unlock the kick registers */
        return (Startup_DONE);
    }

    /*
     * Only write to the KICK registers if:
     * - This core is the SR0 owner
     * - There is no SR0 and this core has procId '1' (IPC 3.x: this case).
     */
    /* TODO: What if CORE0 is not started, but the others are? */
    if (DNUM == 0) {
        if (Interrupt_KICK0 && Interrupt_KICK1){
            /* unlock the KICK mechanism in the Bootcfg MMRs if defined */
            kick0[0] = 0x83e70b13;      /* must be written with this value */
            kick1[0] = 0x95a4f1e0;      /* must be written with this value */
        }
    }

    return (Startup_DONE);
}
Example #30
0
/*
 *  ======== tsk0_func ========
 *  Send an interrupt to the DSP processor and wait on semaphore.
 */
Void tsk0_func(UArg arg0, UArg arg1)
{   
    Int   i = 1;
    Int status;    
    Int16 remoteProcId = MultiProc_getId("DSP");
    
    while (i <= NUMLOOPS) {
        /* Send an event to the DSP */
        status = Notify_sendEvent(dspProcId, LINE_0, EVENTID, i, TRUE);
        
        /* Continue until remote side is up */      
        if (status < 0) {
            continue;
        }
        
        System_printf("Sent request #%d to DSP (lineId = 0)\n", i);

        /* Wait to be released by the cbFxn posting the semaphore */
        Semaphore_pend(semHandle, BIOS_WAIT_FOREVER);
        
        System_printf("Received request #%d from DSP (lineId = 1)\n", seq);        
        
        /* Send an event to the DSP */
        status = Notify_sendEvent(dspProcId, LINE_1, EVENTID, i, TRUE);
        
        /* Continue until remote side is up */      
        if (status < 0) {
            continue;
        }

        System_printf("Sent request #%d to DSP (lineId = 1)\n", i);
        
        /* Wait to be released by the cbFxn posting the semaphore */
        Semaphore_pend(semHandle, BIOS_WAIT_FOREVER);
        System_printf("Received request #%d from DSP (lineId = 0)\n", seq);        
        
        /* increment for next iteration */
        i++;
    }
    System_printf("Test completed\n");
    BIOS_exit(0);
}