void OSUptimeInfo(char *string) { OSTime Uptime; OSDate UpDate; CHAR8 str[6]; UserEnterCritical(); Uptime = OSUptime(); UpDate = OSUpDate(); UserExitCritical(); string += mem_cpy(string, "\n\rBRTOS UPTIME: "); // Só funciona até 255 dias if(UpDate.RTC_Day > 0) { string += mem_cpy(string,PrintDecimal(UpDate.RTC_Day, str)); string += mem_cpy(string, "d "); } string += mem_cpy(string,PrintDecimal(Uptime.RTC_Hour, str)); string += mem_cpy(string, "h "); string += mem_cpy(string,PrintDecimal(Uptime.RTC_Minute, str)); string += mem_cpy(string, "m "); string += mem_cpy(string,PrintDecimal(Uptime.RTC_Second, str)); string += mem_cpy(string, "s\n\r"); // End of string *string = '\0'; }
static bool PrintVCB() { VmonVenusId Venus; long VenusInit; long Time; VolumeId Volume; VCBStatistics Stats; int sum = ReadVCB(&Venus, &VenusInit, &Time, &Volume, &Stats); if (sum != 0) LogMsg(0,LogLevel,LogFile,"**** BAD VCB RECORD ****"); printf("%-12s: ","VCB"); PrintVenusId(&Venus); PrintDecimal(VenusInit); PrintDecimal(Time); printf("\n"); PrintHex(Volume); printf("\n"); PrintVCBStats(&Stats); printf("\n"); printf("=================================================\n"); if (sum) return mtrue; else return mfalse; }
static void PrintResOpArray(unsigned long size, ResOpEntry array[]) { for (int i=0; i<size; i++) { PrintDecimal((unsigned long) array[i].alloccount); PrintDecimal((unsigned long) array[i].dealloccount); printf("\n"); } }
static bool PrintAdviceCalls() { VmonVenusId Venus; long Time; UserId User; AdviceStatistics Stats; unsigned long Call_Size; AdviceCalls *Call_Stats; unsigned long Result_Size; AdviceResults *Result_Stats; int sum = ReadAdviceCall(&Venus, &Time, &User, &Stats, &Call_Size, &Call_Stats, &Result_Size, &Result_Stats); if (sum != 0) LogMsg(0,LogLevel,LogFile,"**** BAD ADVICE RECORD ****"); printf("%-12s: ","ADVICE"); PrintVenusId(&Venus); PrintDecimal(Time); PrintDecimal(User); printf("\n"); PrintAdviceStats(&Stats); printf("CallSize = %d\t Result_Size = %d\n", Call_Size, Result_Size); PrintAdviceCallsArray(Call_Size, Call_Stats); PrintAdviceResultsArray(Result_Size, Result_Stats); printf("\n"); printf("=================================================\n"); if (sum) return mtrue; else return mfalse; }
static bool PrintResEvent(void) { SmonViceId Vice; unsigned long Time; unsigned long Volid; long HighWaterMark; long AllocNumber; long DeallocNumber; unsigned long ResOpSize; ResOpEntry *ResOp; int sum = ReadResEvent(&Vice,&Time,&Volid,&HighWaterMark,&AllocNumber, &DeallocNumber,&ResOpSize,&ResOp); if (sum != 0) LogMsg(0,LogLevel,LogFile,"**** BAD RESOLUTION RECORD ****"); printf("%-12s: ","SRVRES"); PrintViceId(&Vice); PrintDecimal(Time); PrintHex(Volid); PrintDecimal(HighWaterMark); PrintDecimal(AllocNumber); PrintDecimal(DeallocNumber); printf("\n"); PrintResOpArray(ResOpSize,ResOp); printf("\n"); printf("=================================================\n"); delete [] ResOp; if (sum) return mtrue; else return mfalse; }
static void PrintSmonStats(SmonStatistics *stats) { PrintDecimal((unsigned long)stats->SystemCPU); PrintDecimal((unsigned long)stats->UserCPU); PrintDecimal((unsigned long)stats->IdleCPU); PrintDecimal((unsigned long)stats->BootTime); PrintDecimal((unsigned long)stats->TotalIO); printf("\n"); }
static void PrintAdviceResultsArray(unsigned long size, AdviceResults array[]) { printf("-----------\n"); printf("Advice Results (by error type):\n"); for (int i=0; i<size; i++) { PrintDecimal((unsigned long) i); PrintDecimal((unsigned long) array[i].count); printf("\n"); } }
static void PrintAdviceCallsArray(unsigned long size, AdviceCalls array[]) { printf("-----------\n"); printf("Advice Calls (by call type):\n"); for (int i=0; i<size; i++) { PrintDecimal((unsigned long) i); PrintDecimal((unsigned long) array[i].success); PrintDecimal((unsigned long) array[i].failures); printf("\n"); } }
static void PrintCallArray(unsigned long size, CallCountEntry *array) { if (size <= 1) return; for(int i=1; i<size; i++) { if (array[i].countent != 0) { printf("%-35s ",array[i].name); PrintDecimal(array[i].countent); PrintDecimal(array[i].countexit); PrintDecimal(array[i].tsec); PrintDecimal(array[i].tusec); PrintDecimal(array[i].counttime); printf("\n"); } } }
static void PrintSessionStats(SessionStatistics *stats) { printf("[%08d-%08d:%08d] [%08d-%08d:%08d]\n", stats->EntriesStart, stats->EntriesEnd, stats->EntriesHighWater, stats->BytesStart, stats->BytesEnd, stats->BytesHighWater); PrintDecimal(stats->RecordsCancelled); PrintDecimal(stats->RecordsAborted); PrintDecimal(stats->RecordsCommitted); printf("\n"); printf("%08d\t%08d\t%08d\n",stats->FidsRealloced,stats->BytesBackFetched, stats->CacheHighWater); printf("%08d\t%08d\t%08d\n",stats->SystemCPU,stats->UserCPU, stats->IdleCPU); }
/*Print the size of the syringe*/ void Print_Syringe_Size(uint16_t value) { LCD_SetTextColor(BLUE,WHITE); Print_Text_On(Line1,Position26); PrintDecimal(value,20); }
/*Print the Rate of injection in ml/hour*/ void PrintRate(uint16_t value) { Print_Text_On(Line4,Position14); LCD_SetTextColor(BLACK,WHITE); PrintDecimal(value,36); }
static void PrintHistogram(long size, HistoElem *array) { printf("["); for (int i=0; i<size; i++) { if (i>0 && i%8 == 0) printf("\n "); PrintDecimal(array[i].bucket); } printf("]\n"); }
static void PrintAdviceStats(AdviceStatistics *stats) { PrintDecimal(stats->NotEnabled); printf("\n"); PrintDecimal(stats->NotValid); printf("\n"); PrintDecimal(stats->Outstanding); printf("\n"); PrintDecimal(stats->ASRnotAllowed); printf("\n"); PrintDecimal(stats->ASRinterval); printf("\n"); PrintDecimal(stats->VolumeNull); printf("\n"); PrintDecimal(stats->TotalNumberAttempts); printf("\n"); }
static bool PrintVmonSession() { int sum; VmonVenusId Venus; VmonSessionId Session; VolumeId Volume; UserId User; VmonAVSG AVSG; unsigned long StartTime; unsigned long EndTime; unsigned long CETime; VmonSessionEventArray Events; SessionStatistics Stats; CacheStatistics CacheStats; sum = ReadSessionRecord(&Venus, &Session, &Volume, &User, &AVSG, &StartTime, &EndTime, &CETime, &Events, &Stats, &CacheStats); if (sum != 0) LogMsg(0,LogLevel,LogFile,"**** BAD SESSION RECORD ****"); printf("%-12s: ", "SESSION"); PrintVenusId(&Venus); PrintHex(Session); PrintHex(Volume); PrintDecimal(User); PrintDecimal(StartTime); PrintDecimal(EndTime); PrintDecimal(CETime); printf("\n"); PrintAVSG(&AVSG); printf("\n"); PrintEventArray(&Events); printf("\n"); PrintSessionStats(&Stats); printf("\n-----------\n"); PrintCacheStats(&CacheStats); printf("=================================================\n"); if (sum) return mtrue; else return mfalse; }
static void PrintSubtreeStats(LocalSubtreeStats *stats) { PrintDecimal(stats->SubtreeNum); printf("\n"); PrintDecimal(stats->MaxSubtreeSize); printf("\n"); PrintDecimal(stats->AvgSubtreeSize); printf("\n"); PrintDecimal(stats->MaxSubtreeHgt); printf("\n"); PrintDecimal(stats->AvgSubtreeHgt); printf("\n"); PrintDecimal(stats->MaxMutationNum); printf("\n"); PrintDecimal(stats->AvgMutationNum); printf("\n"); }
static bool PrintVmonOverflow() { VmonVenusId Venus; unsigned long VMStartTime; unsigned long VMEndTime; unsigned long VMCount; unsigned long RVMStartTime; unsigned long RVMEndTime; unsigned long RVMCount; int sum = ReadOverflow(&Venus, &VMStartTime, &VMEndTime, &VMCount, &RVMStartTime, &RVMEndTime, &RVMCount); if (sum != 0) LogMsg(0,LogLevel,LogFile,"**** BAD OVERFLOW RECORD ****"); printf("%-12s: ", "OVERFLOW"); PrintVenusId(&Venus); PrintDecimal(VMStartTime); PrintDecimal(VMEndTime); PrintDecimal(VMCount); PrintDecimal(RVMStartTime); PrintDecimal(RVMEndTime); PrintDecimal(RVMCount); printf("\n"); printf("=================================================\n"); if (sum) return mtrue; else return mfalse; }
void CheckBattery(void) { BatterySenseCycle(); if (!ClipOn()) { ChargeStatus = CHARGE_STATUS_OFF; CheckBatteryLow(); } else if (ChargeEnable) ChargingControl(); PrintDecimal(Read(BATTERY)); PrintString(CR); }
static bool PrintSrvOvrflw() { SmonViceId Vice; unsigned long Time; unsigned long StartTime; unsigned long EndTime; long Count; int sum = ReadSrvOverflow(&Vice,&Time,&StartTime,&EndTime,&Count); if (sum != 0) LogMsg(0,LogLevel,LogFile,"**** BAD SRVOVERFLOW RECORD ****"); printf("%-12s: ","SRVOVRFLW"); PrintViceId(&Vice); PrintDecimal(Time); PrintDecimal(StartTime); PrintDecimal(EndTime); PrintDecimal(Count); printf("\n"); if (sum) return mtrue; else return mfalse; }
static bool PrintVmonCommEvent() { VmonVenusId Venus; unsigned long ServerIPAddress; long SerialNumber; unsigned long Time; VmonCommEventType Type; int sum = ReadCommRecord(&Venus,&ServerIPAddress, &SerialNumber, &Time, &Type); if (sum != 0) LogMsg(0,LogLevel,LogFile,"**** BAD COMM RECORD ****"); printf("%-12s: ", "COMMEVENT"); PrintVenusId(&Venus); PrintHex(ServerIPAddress); PrintDecimal(Time); PrintDecimal(SerialNumber); PrintVCET(Type); printf("\n"); printf("=================================================\n"); if (sum) return mtrue; else return mfalse; }
/* 400 us when doing work else 40 us */ static void SoftwareFllCycleIsr(void) { // Get current dco_mod value ignoring reserved bits // this requires majority vote? ucs_dco_mod = (UCSCTL0 & MOD_MASK); count_d1 = count_d0; count_d0 = TA0R; /* check to make sure the value has been updated */ if ( ucs_dco_mod == ucs_dco_mod_saved ) { if ( count_d0 > count_d1 ) { count_diff = count_d0 - count_d1; } else { count_diff = 0xffff - count_d1; count_diff = count_d1 + count_d0; } PrintDecimal(count_diff); /* if there are more counts than expected then the SMCLK is running to slow */ if ( count_diff > EXPECTED_COUNTS + 3 ) { IncrementMod(); } else if ( count_diff < EXPECTED_COUNTS - 3 ) { DecrementMod(); } else { PrintString("."); } // Write the value to the register UCSCTL0 = (ucs_dco_mod & MOD_MASK); ucs_dco_mod_saved = ucs_dco_mod & MOD_MASK; } else { PrintString("$"); } }
// Core temperature Command //extern INT16S temperature; void usb_cmd_temp(char *param) { INT16S temperature_temp; CHAR8 string[8]; (void)*param; UserEnterCritical(); //temperature_temp = temperature; temperature_temp = 0; UserExitCritical(); PrintDecimal(temperature_temp, string); print_usb("\n\r"); print_usb((CHAR8*)&string[3]); print_usb(" degrees"); }
static bool PrintSrvCall() { SmonViceId Vice; unsigned long Time; unsigned long CBSize; CallCountEntry *CBCount; unsigned long ResSize; CallCountEntry *ResCount; unsigned long SmonSize; CallCountEntry *SmonCount; unsigned long VolDSize; CallCountEntry *VolDCount; unsigned long MultiSize; MultiCallEntry *MultiCount; SmonStatistics Stats; int sum = ReadSrvCall(&Vice, &Time, &CBSize, &CBCount, &ResSize, &ResCount, &SmonSize, &SmonCount, &VolDSize, &VolDCount, &MultiSize, &MultiCount, &Stats); if (sum != 0) LogMsg(0,LogLevel,LogFile,"**** BAD SRVCALL RECORD ****"); printf("%-12s: ","SRVCALL"); PrintViceId(&Vice); PrintDecimal(Time); printf("\n"); PrintCallArray(CBSize,CBCount); PrintCallArray(ResSize,ResCount); PrintCallArray(SmonSize,SmonCount); PrintCallArray(VolDSize,VolDCount); printf("mulitcalls\n"); PrintMultiArray(MultiSize,MultiCount); PrintSmonStats(&Stats); printf("=================================================\n"); RemoveCountArray(CBSize,CBCount); RemoveCountArray(ResSize,ResCount); RemoveCountArray(SmonSize,SmonCount); RemoveCountArray(VolDSize,VolDCount); RemoveMultiArray(MultiSize,MultiCount); if (sum) return mtrue; else return mfalse; }
// memoria total heap de tarefas // memoria total heap de filas void OSAvailableMemory(char *string) { uint16_t address = 0; CHAR8 str[8]; string += mem_cpy(string, "\n\r***** BRTOS Memory Info *****\n\r"); #if (!BRTOS_DYNAMIC_TASKS_ENABLED) string += mem_cpy(string, "STATIC TASK MEMORY HEAP: "); #else string += mem_cpy(string, "DYNAMIC MEMORY HEAP: "); #endif UserEnterCritical(); address = iStackAddress * sizeof(OS_CPU_TYPE); UserExitCritical(); #if (!BRTOS_DYNAMIC_TASKS_ENABLED) (void)PrintDecimal(address, str); #else (void)PrintDecimal((int16_t)OSGetUsedHeapSize(), str); #endif string += mem_cpy(string, &str[2]); string += mem_cpy(string, " of "); #if (!BRTOS_DYNAMIC_TASKS_ENABLED) string += mem_cpy(string, PrintDecimal(HEAP_SIZE, str)); #else string += mem_cpy(string, PrintDecimal(DYNAMIC_HEAP_SIZE, str)); #endif #if (!BRTOS_DYNAMIC_TASKS_ENABLED) string += mem_cpy(string, "\n\rQUEUE MEMORY HEAP: "); #else string += mem_cpy(string, "\n\rSTATIC QUEUE MEMORY HEAP: "); #endif UserEnterCritical(); address = iQueueAddress * sizeof(OS_CPU_TYPE); UserExitCritical(); (void)PrintDecimal(address, str); string += mem_cpy(string, &str[2]); string += mem_cpy(string, " of "); string += mem_cpy(string, PrintDecimal(QUEUE_HEAP_SIZE, str)); string += mem_cpy(string, "\n\r"); // End of string *string = '\0'; }
static bool PrintIotStatsCall() { VmonVenusId Venus; RPC2_Integer Time; IOT_STAT Stats; int sum = ReadIotStatsCall(&Venus, &Time, &Stats); if (sum != 0) LogMsg(0,LogLevel,LogFile,"**** BAD IOTSTATS RECORD ****"); printf("%-12s: ","IOTSTATS"); PrintVenusId(&Venus); PrintDecimal(Time); PrintIotStats(&Stats); printf("\n"); if (sum) return mtrue; else return mfalse; }
static bool PrintSubtreeStatsCall() { VmonVenusId Venus; RPC2_Integer Time; LocalSubtreeStats Stats; int sum = ReadSubtreeCall(&Venus, &Time, &Stats); if (sum != 0) LogMsg(0,LogLevel,LogFile,"**** BAD SUBTREE RECORD ****"); printf("%-12s: ","SUBTREE"); PrintVenusId(&Venus); PrintDecimal(Time); PrintSubtreeStats(&Stats); printf("\n"); if (sum) return mtrue; else return mfalse; }
static bool PrintRepairStatsCall() { VmonVenusId Venus; RPC2_Integer Time; RepairSessionStats Stats; int sum = ReadRepairCall(&Venus, &Time, &Stats); if (sum != 0) LogMsg(0,LogLevel,LogFile,"**** BAD REPARI RECORD ****"); printf("%-12s: ","REPAIR"); PrintVenusId(&Venus); PrintDecimal(Time); PrintRepairStats(&Stats); printf("\n"); if (sum) return mtrue; else return mfalse; }
static bool PrintRwsStatsCall() { VmonVenusId Venus; RPC2_Integer Time; ReadWriteSharingStats Stats; int sum = ReadRwsStatsCall(&Venus, &Time, &Stats); if (sum != 0) LogMsg(0,LogLevel,LogFile,"**** BAD RWSSTATS RECORD ****"); printf("%-12s: ","RWSSTATS"); PrintVenusId(&Venus); PrintDecimal(Time); PrintRwsStats(&Stats); printf("\n"); if (sum) return mtrue; else return mfalse; }
static bool PrintClientCalls() { VmonVenusId Venus; long Time; unsigned long sc_size; CallCountEntry *SrvCount; int sum = ReadClientCall(&Venus, &Time, &sc_size, &SrvCount); if (sum != 0) LogMsg(0,LogLevel,LogFile,"**** BAD CLIENTCALL RECORD ****"); printf("%-12s: ","CLNTCALL"); PrintVenusId(&Venus); PrintDecimal(Time); printf("\n"); PrintCallArray(sc_size,SrvCount); printf("\n"); printf("=================================================\n"); RemoveCountArray(sc_size,SrvCount); if (sum) return mtrue; else return mfalse; }
static bool PrintClientRVM() { VmonVenusId Venus; long Time; unsigned long sc_size; CallCountEntry *SrvCount; unsigned long msc_size; MultiCallEntry *MSrvCount; RvmStatistics Stats; int sum = ReadClientRVM(&Venus, &Time, &Stats); if (sum != 0) LogMsg(0,LogLevel,LogFile,"**** BAD CLIENTRVM RECORD ****"); printf("%-12s: ","CLNTRVM"); PrintVenusId(&Venus); PrintDecimal(Time); printf("\n"); PrintRvmStats(&Stats); printf("\n"); printf("=================================================\n"); if (sum) return mtrue; else return mfalse; }