Changeset 41708 in vbox for trunk/src/VBox/Devices/PC
- Timestamp:
- Jun 14, 2012 1:35:50 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 78516
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevRTC.cpp
r41667 r41708 5 5 6 6 /* 7 * Copyright (C) 2006-201 1Oracle Corporation7 * Copyright (C) 2006-2012 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 44 44 * Header Files * 45 45 *******************************************************************************/ 46 #define LOG_GROUP LOG_GROUP_DEV_RTC 46 #define LOG_GROUP LOG_GROUP_DEV_RTC 47 47 #include <VBox/vmm/pdmdev.h> 48 48 #include <VBox/log.h> … … 57 57 58 58 #include "VBoxDD.h" 59 59 60 struct RTCState; 60 61 typedef struct RTCState RTCState; … … 110 111 #define REG_B_UIE 0x10 111 112 112 #define CMOS_BANK_LOWER_LIMIT 0x0E113 #define CMOS_BANK_UPPER_LIMIT 0x7F114 #define CMOS_BANK2_LOWER_LIMIT 0x80115 #define CMOS_BANK2_UPPER_LIMIT 0xFF113 #define CMOS_BANK_LOWER_LIMIT 0x0E 114 #define CMOS_BANK_UPPER_LIMIT 0x7F 115 #define CMOS_BANK2_LOWER_LIMIT 0x80 116 #define CMOS_BANK2_UPPER_LIMIT 0xFF 116 117 117 118 /** The saved state version. */ … … 285 286 * Dumps the cmos Bank Info.} 286 287 */ 287 static DECLCALLBACK(void) CMOSBankInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)288 static DECLCALLBACK(void) rtcCmosBankInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 288 289 { 289 290 RTCState *pThis = PDMINS_2_DATA(pDevIns, RTCState *); 290 uint16_t u16ByteCount = 0; 291 292 pHlp->pfnPrintf(pHlp, "First CMOS bank, offsets 0x0E - 0x7F"); 293 pHlp->pfnPrintf(pHlp, "\nOffset %02x : --- use 'info rtc' to show CMOS clock ---", 0); 294 for (u16ByteCount = CMOS_BANK_LOWER_LIMIT; u16ByteCount <= CMOS_BANK_UPPER_LIMIT; u16ByteCount++) 295 { 296 if ((u16ByteCount & 15) == 0) { 297 pHlp->pfnPrintf(pHlp, "\nOffset %02x : ", u16ByteCount); 298 } else if ((u16ByteCount & 15) == 8) { 291 292 pHlp->pfnPrintf(pHlp, "First CMOS bank, offsets 0x0E - 0x7F\n" 293 "Offset %02x : --- use 'info rtc' to show CMOS clock ---\n", 0); 294 for (unsigned iCmos = CMOS_BANK_LOWER_LIMIT; iCmos <= CMOS_BANK_UPPER_LIMIT; iCmos++) 295 { 296 if ((iCmos & 15) == 0) 297 pHlp->pfnPrintf(pHlp, "Offset %02x : ", iCmos); 298 else if ((iCmos & 15) == 8) 299 299 pHlp->pfnPrintf(pHlp, "-"); 300 } else {300 else 301 301 pHlp->pfnPrintf(pHlp, " "); 302 } 303 pHlp->pfnPrintf(pHlp, "%02x", pThis->cmos_data[u16ByteCount]); 304 } 305 pHlp->pfnPrintf(pHlp, "\n"); 302 pHlp->pfnPrintf(pHlp, "%02x\n", pThis->cmos_data[iCmos]); 303 } 306 304 } 307 305 … … 310 308 * Dumps the cmos Bank2 Info.} 311 309 */ 312 static DECLCALLBACK(void) CMOSBank2Info(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)310 static DECLCALLBACK(void) rtcCmosBank2Info(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 313 311 { 314 312 RTCState *pThis = PDMINS_2_DATA(pDevIns, RTCState *); 315 uint16_t u16ByteCount = 0; 316 317 pHlp->pfnPrintf(pHlp, "Second CMOS bank, offsets 0x80 - 0xFF"); 318 for (u16ByteCount = CMOS_BANK2_LOWER_LIMIT; u16ByteCount <= CMOS_BANK2_UPPER_LIMIT; u16ByteCount++) 319 { 320 if ((u16ByteCount & 15) == 0) { 321 pHlp->pfnPrintf(pHlp, "\nOffset %02x : ", u16ByteCount); 322 } else if ((u16ByteCount & 15) == 8) { 313 314 pHlp->pfnPrintf(pHlp, "Second CMOS bank, offsets 0x80 - 0xFF\n"); 315 for (uint16_t iCmos = CMOS_BANK2_LOWER_LIMIT; iCmos <= CMOS_BANK2_UPPER_LIMIT; iCmos++) 316 { 317 if ((iCmos & 15) == 0) 318 pHlp->pfnPrintf(pHlp, "Offset %02x : ", iCmos); 319 else if ((iCmos & 15) == 8) 323 320 pHlp->pfnPrintf(pHlp, "-"); 324 } else {321 else 325 322 pHlp->pfnPrintf(pHlp, " "); 326 } 327 pHlp->pfnPrintf(pHlp, "%02x", pThis->cmos_data[u16ByteCount]); 328 } 329 pHlp->pfnPrintf(pHlp, "\n"); 323 pHlp->pfnPrintf(pHlp, "%02x\n", pThis->cmos_data[iCmos]); 324 } 330 325 } 331 326 … … 334 329 * Dumps the cmos RTC Info.} 335 330 */ 336 static DECLCALLBACK(void) CMOSRTCInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)331 static DECLCALLBACK(void) rtcCmosClockInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 337 332 { 338 333 RTCState *pThis = PDMINS_2_DATA(pDevIns, RTCState *); 339 uint8_t u8Sec = 0; 340 uint8_t u8Min = 0; 341 uint8_t u8Hr = 0; 342 uint8_t u8Day = 0; 343 uint8_t u8Month = 0; 344 uint8_t u8Year = 0; 345 346 u8Sec = from_bcd(pThis, pThis->cmos_data[RTC_SECONDS]); 347 u8Min = from_bcd(pThis, pThis->cmos_data[RTC_MINUTES]); 348 u8Hr = from_bcd(pThis, pThis->cmos_data[RTC_HOURS] & 0x7f); 334 uint8_t u8Sec = from_bcd(pThis, pThis->cmos_data[RTC_SECONDS]); 335 uint8_t u8Min = from_bcd(pThis, pThis->cmos_data[RTC_MINUTES]); 336 uint8_t u8Hr = from_bcd(pThis, pThis->cmos_data[RTC_HOURS] & 0x7f); 349 337 if ( !(pThis->cmos_data[RTC_REG_B] & 0x02) 350 338 && (pThis->cmos_data[RTC_HOURS] & 0x80)) 351 339 u8Hr += 12; 352 u 8Day= from_bcd(pThis, pThis->cmos_data[RTC_DAY_OF_MONTH]);353 u 8Month = from_bcd(pThis, pThis->cmos_data[RTC_MONTH]) ;354 u 8Year= from_bcd(pThis, pThis->cmos_data[RTC_YEAR]);340 uint8_t u8Day = from_bcd(pThis, pThis->cmos_data[RTC_DAY_OF_MONTH]); 341 uint8_t u8Month = from_bcd(pThis, pThis->cmos_data[RTC_MONTH]) ; 342 uint8_t u8Year = from_bcd(pThis, pThis->cmos_data[RTC_YEAR]); 355 343 pHlp->pfnPrintf(pHlp, "Time: Hr:%u Min:%u Sec:%u, Day:%u Month:%u Year:%u\n", u8Hr, u8Min, u8Sec, u8Day, u8Month, u8Year); 356 } 357 358 #endif 344 /** @todo r=bird: missing REG A-D. */ 345 } 346 347 #endif /* IN_RING3 */ 359 348 360 349 … … 1248 1237 /* 1249 1238 * Register debugger info callback. 1250 */ 1251 PDMDevHlpDBGFInfoRegister(pDevIns, "cmos", "Display CMOS Bank 1 Info.. " 1252 "'cmos'. No argument.", CMOSBankInfo); 1253 PDMDevHlpDBGFInfoRegister(pDevIns, "cmos2", "Display CMOS Bank 2 Info.. " 1254 "'cmos2'. No argument", CMOSBank2Info); 1255 PDMDevHlpDBGFInfoRegister(pDevIns, "rtc", "Display CMOS RTC info " 1256 "'rtc'. No argument", CMOSRTCInfo); 1239 */ 1240 PDMDevHlpDBGFInfoRegister(pDevIns, "cmos1", "Display CMOS Bank 1 Info (0x0e-0x7f). No arguments. See also rtc.", rtcCmosBankInfo); 1241 PDMDevHlpDBGFInfoRegister(pDevIns, "cmos2", "Display CMOS Bank 2 Info (0x0e-0x7f). No arguments.", rtcCmosBank2Info); 1242 PDMDevHlpDBGFInfoRegister(pDevIns, "rtc", "Display CMOS RTC (0x00-0x0d). No arguments. See also cmos1 & cmos2", rtcCmosClockInfo); 1257 1243 return VINF_SUCCESS; 1258 1244 }
Note:
See TracChangeset
for help on using the changeset viewer.