/* * ======== write8 ========= */ Void LoggerSys_write8(LoggerSys_Object *obj, Log_Event evt, Types_ModuleId mid, IArg a1, IArg a2, IArg a3, IArg a4, IArg a5, IArg a6, IArg a7, IArg a8) { Log_EventRec evrec; if (!obj->enabled) { return; } LoggerSys_TimestampProxy_get64(&evrec.tstamp); evrec.serial = 0; evrec.evt = Types_makeEvent(Log_getEventId(evt), mid); evrec.arg[0] = a1; evrec.arg[1] = a2; evrec.arg[2] = a3; evrec.arg[3] = a4; evrec.arg[4] = a5; evrec.arg[5] = a6; evrec.arg[6] = a7; evrec.arg[7] = a8; Log_doPrint(&evrec); }
/* * ======== write8 ========= * * Odd serial numbers indicate a new record, even serial numbers indicate * an "extension" to the previous record. 0 is a sentinal for no record, * but only if it doesn't follow a -1 (0xffffffff). If a serial number * of 0 follows a serial number of 0xffffffff, it's an extension, otherwise * it's a "no record". */ Void LoggerBuf_write8(LoggerBuf_Object *obj, Log_Event evt, Types_ModuleId mid, IArg a1, IArg a2, IArg a3, IArg a4, IArg a5, IArg a6, IArg a7, IArg a8) { /* part1 */ IArg key; Int adv; Int32 ser; LoggerBuf_Entry *e; /* Do nothing if the instance is disabled. */ if (!obj->enabled) { return; } /* * If event level filtering is enabled, and the event isn't a high enough * level, drop the record and return. */ if (LoggerBuf_filterByLevel && LoggerBuf_filterOutEvent(Log_getMask(evt))) { return; } /* * If all of the following are true: * - A logger has been specified to route status events to * - This is a status event * - This logger is NOT the status logger * Pass the event to the status logger and return. * * Otherwise, continue to log the event. */ /*if ((LoggerBuf_statusLogger != NULL) && (Log_getMask(evt) & Diags_STATUS) && (LoggerBuf_statusLogger != xdc_runtime_LoggerBuf_Handle_to_xdc_runtime_ILogger(obj))) { ILogger_write8(LoggerBuf_statusLogger, evt, mid, a1, a2, a3, a4, a5, a6, a7, a8); return; } key = Gate_enterModule();*/ /* * Record new serial number even if the buffer is FULL. We do this * because the buffer might become un-FULL at some later time, and * a reader (decoder) of the buffer needs to know if events have * been missed. */ ser = obj->serial; obj->serial += 2; adv = obj->advance; if (adv == LoggerBuf_FULL) { goto leave; } e = obj->curEntry; if (e == obj->endEntry) { if (adv == LoggerBuf_WRAP) { obj->curEntry = obj->entryArr; } else { obj->advance = LoggerBuf_FULL; } } else { obj->curEntry = e + 1; } LoggerBuf_TimestampProxy_get64(&e->tstamp); e->serial = ser; e->evt = Types_makeEvent(Log_getEventId(evt), mid); e->arg1 = a1; e->arg2 = a2; e->arg3 = a3; e->arg4 = a4; /* part 2 */ /* * We intentionally don't check for a "new" FULL condition here * since we want to write only the "extension" record, so a decoder * can know that this is an incomplete record and therefore throw * it away. By not checking for FULL here, we end up just overwriting * the "starter" record (that was written above) of a two-entry record * with the "extension" record. */ e = obj->curEntry; if (e == obj->endEntry) { if (adv == LoggerBuf_WRAP) { obj->curEntry = obj->entryArr; } else { obj->advance = LoggerBuf_FULL; } } else { obj->curEntry = e + 1; } e->serial = ser + 1; e->evt = ~0; e->arg1 = a5; e->arg2 = a6; e->arg3 = a7; e->arg4 = a8; leave: return; //Gate_leaveModule(key); }
/* * ======== write4 ========= */ Void LoggerBuf_write4(LoggerBuf_Object *obj, Log_Event evt, Types_ModuleId mid, IArg a1, IArg a2, IArg a3, IArg a4) { IArg key; Int adv; Int32 ser; LoggerBuf_Entry *e; /* Do nothing if the instance is disabled. */ if (!obj->enabled) { return; } /* * If event level filtering is enabled, and the event isn't a high enough * level, drop the record and return. */ if (LoggerBuf_filterByLevel && LoggerBuf_filterOutEvent(Log_getMask(evt))) { return; } /* * If all of the following are true: * - A logger has been specified to route status events to * - This is a status event * - This logger is NOT the status logger * Pass the event to the status logger and return. * * Otherwise, continue to log the event. */ /* if ((LoggerBuf_statusLogger != NULL) && (Log_getMask(evt) & Diags_STATUS) && (LoggerBuf_statusLogger != xdc_runtime_LoggerBuf_Handle_to_xdc_runtime_ILogger(obj))) { ILogger_write4(LoggerBuf_statusLogger, evt, mid, a1, a2, a3, a4); return; } */ // key = Gate_enterModule(); /* * Record new serial number even if the buffer is FULL. We do this * because a reader (decoder) of the buffer needs to know if events * have been missed, and the buffer might become un-FULL at some * later time. */ ser = obj->serial; obj->serial += 2; adv = obj->advance; if (adv == LoggerBuf_FULL) { goto leave; } e = obj->curEntry; if (e == obj->endEntry) { if (adv == LoggerBuf_WRAP) { obj->curEntry = obj->entryArr; } else { obj->advance = LoggerBuf_FULL; } } else { obj->curEntry = e + 1; } LoggerBuf_TimestampProxy_get64(&e->tstamp); e->serial = ser; e->evt = Types_makeEvent(Log_getEventId(evt), mid); e->arg1 = a1; e->arg2 = a2; e->arg3 = a3; e->arg4 = a4; leave: return; }