PUBLIC t_cm_error cm_SRV_allocateTraceBufferMemory(t_nmf_core_id coreId, t_cm_domain_id domainId) { t_ee_state *state = cm_EEM_getExecutiveEngine(coreId); state->traceDataHandle = cm_DM_Alloc(domainId, SDRAM_EXT16, TRACE_BUFFER_SIZE * sizeof(struct t_nmf_trace) / 2, CM_MM_ALIGN_WORD, TRUE); if (state->traceDataHandle == INVALID_MEMORY_HANDLE) return CM_NO_MORE_MEMORY; else { t_uint32 mmdspAddr; int i; state->traceDataAddr = (struct t_nmf_trace*)cm_DSP_GetHostLogicalAddress(state->traceDataHandle); cm_DSP_GetDspAddress(state->traceDataHandle, &mmdspAddr); cm_writeAttribute(state->instance, "rtos/commonpart/traceDataAddr", mmdspAddr); eeState[coreId].readTracePointer = 0; eeState[coreId].lastReadedTraceRevision = 0; for(i = 0; i < TRACE_BUFFER_SIZE; i++) state->traceDataAddr[i].revision = 0; return CM_OK; } }
PUBLIC EXPORT_SHARED t_cm_error CM_getServiceDescription( t_nmf_core_id coreId, t_cm_service_type *srcType, t_cm_service_description *srcDescr) { t_uint32 serviceReason; t_component_instance *ee; // Acknowledge interrupt (do it before resetting panicReason) cm_DSP_AcknowledgeDspIrq(coreId, DSP2ARM_IRQ_1); ee = cm_EEM_getExecutiveEngine(coreId)->instance; // Read panicReason serviceReason = cm_readAttributeNoError(ee, "rtos/commonpart/serviceReason"); if(serviceReason == MPC_SERVICE_PRINT) { *srcType = CM_MPC_SERVICE_PRINT; srcDescr->u.print.dspAddress = cm_readAttributeNoError(ee, "rtos/commonpart/serviceInfo0"); srcDescr->u.print.value1 = cm_readAttributeNoError(ee, "rtos/commonpart/serviceInfo1"); srcDescr->u.print.value2 = cm_readAttributeNoError(ee, "rtos/commonpart/serviceInfo2"); } else if(serviceReason != MPC_SERVICE_NONE) { t_uint32 panicThis; t_dup_char itfName; t_component_instance *instance; *srcType = CM_MPC_SERVICE_PANIC; srcDescr->u.panic.panicReason = (t_panic_reason)serviceReason; srcDescr->u.panic.panicSource = MPC_EE; srcDescr->u.panic.info.mpc.coreid = coreId; // Read panicThis panicThis = cm_readAttributeNoError(ee, "rtos/commonpart/serviceInfo0"); instance = getCorrespondingInstance(srcDescr->u.panic.panicReason, panicThis, &itfName, &srcDescr->u.panic.info.mpc.faultingComponent); LOG_INTERNAL(0, "Error: Panic(%s, %s), This=%x", cm_getDspName(coreId), reason_descrs[srcDescr->u.panic.panicReason].name, (void*)panicThis, 0, 0, 0); if(reason_descrs[srcDescr->u.panic.panicReason].interface != 0) { LOG_INTERNAL(0, ", interface=%s", itfName, 0, 0, 0, 0, 0); } if(reason_descrs[srcDescr->u.panic.panicReason].info1 != 0) { // Info 1 srcDescr->u.panic.info.mpc.panicInfo1 = cm_readAttributeNoError(ee, "rtos/commonpart/serviceInfo1"); LOG_INTERNAL(0, ", Info=%x", srcDescr->u.panic.info.mpc.panicInfo1, 0, 0, 0, 0, 0); } if(reason_descrs[srcDescr->u.panic.panicReason].PC != 0) { t_uint32 DspAddress = 0xFFFFFFFF; t_uint32 DspSize = 0x0; // PC need to be read in rtos/commonpart/serviceInfo1 srcDescr->u.panic.info.mpc.panicInfo1 = cm_readAttributeNoError(ee, "rtos/commonpart/serviceInfo1"); if(instance != 0) { cm_DSP_GetDspAddress(instance->memories[instance->Template->codeMemory->id], &DspAddress); cm_DSP_GetDspMemoryHandleSize(instance->memories[instance->Template->codeMemory->id], &DspSize); } if(DspAddress <= srcDescr->u.panic.info.mpc.panicInfo1 && srcDescr->u.panic.info.mpc.panicInfo1 < (DspAddress + DspSize)) LOG_INTERNAL(0, ", PC:off=%x <abs=%x>", srcDescr->u.panic.info.mpc.panicInfo1 - DspAddress, srcDescr->u.panic.info.mpc.panicInfo1, 0, 0, 0, 0); else LOG_INTERNAL(0, ", PC:<abs=%x>", srcDescr->u.panic.info.mpc.panicInfo1, 0, 0, 0, 0, 0); } if(reason_descrs[srcDescr->u.panic.panicReason].SP != 0) { srcDescr->u.panic.info.mpc.panicInfo2 = cm_readAttributeNoError(ee, "rtos/commonpart/serviceInfo2"); LOG_INTERNAL(0, ", SP=%x", srcDescr->u.panic.info.mpc.panicInfo2, 0, 0, 0, 0, 0); } LOG_INTERNAL(0, "\n", 0, 0, 0, 0, 0, 0); if(instance != 0) { LOG_INTERNAL(0, "Error: Component=%s<%s>\n", instance->pathname, instance->Template->name, 0, 0, 0, 0); } // We don't set rtos/commonpart/serviceReason = MPC_SERVICE_NONE, since we don't want the // MMDSP to continue execution, and we put in in Panic state cm_DSP_SetStatePanic(coreId); } else { *srcType = CM_MPC_SERVICE_NONE; } return CM_OK; }