VirtualBox

Changeset 41582 in vbox


Ignore:
Timestamp:
Jun 5, 2012 3:07:17 PM (13 years ago)
Author:
vboxsync
Message:

PC/DevPCBios: Added support for CMOS RTC debugging info. Need to improve code and put some checks and balances..

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/DevPcBios.cpp

    r41580 r41582  
    4646#define CMOS_BANK2_LOWER_LIMIT 0x80
    4747#define CMOS_BANK2_UPPER_LIMIT 0xFF
     48
     49#define CMOS_RTC_OFFSET_SEC          0x0
     50#define CMOS_RTC_OFFSET_MIN          0x02
     51#define CMOS_RTC_OFFSET_HR           0x04
     52#define CMOS_RTC_OFFSET_DAY          0x07
     53#define CMOS_RTC_OFFSET_MONTH        0x08
     54#define CMOS_RTC_OFFSET_YEAR         0x09
    4855
    4956/** @page pg_devbios_cmos_assign    CMOS Assignments (BIOS)
     
    232239
    233240
     241static uint8_t bcd2bin(uint8_t val)
     242{
     243    return (val & 0x0f) + (val >>4) *10;
     244}
     245
    234246/**
    235247 * Write to CMOS memory.
     
    293305        pHlp->pfnPrintf(pHlp, "Off: 0x%02x Val: 0x%02x\n",u16ByteCount, u8CMOSByte);
    294306    }
    295        
    296 }
     307}
     308
     309
     310/**
     311 * @callback_method_impl{FNDBGFHANDLERDEV,
     312 *      Dumps the cmos RTC Info.}
     313 */
     314static DECLCALLBACK(void) CMOSRTCInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     315{
     316    uint8_t u8Sec;
     317    uint8_t u8Min;
     318    uint8_t u8Hr;
     319    uint8_t u8Day;
     320    uint8_t u8Month;
     321    uint8_t u8Year;
     322
     323    u8Sec = pcbiosCmosRead(pDevIns, CMOS_RTC_OFFSET_SEC);
     324    u8Min = pcbiosCmosRead(pDevIns, CMOS_RTC_OFFSET_MIN);
     325    u8Min = bcd2bin(u8Min);
     326    u8Hr  = pcbiosCmosRead(pDevIns, CMOS_RTC_OFFSET_HR);
     327   
     328    u8Day   = pcbiosCmosRead(pDevIns, CMOS_RTC_OFFSET_DAY);
     329    u8Month = pcbiosCmosRead(pDevIns, CMOS_RTC_OFFSET_MONTH);
     330   
     331    u8Year  = pcbiosCmosRead(pDevIns, CMOS_RTC_OFFSET_YEAR);
     332    u8Year = bcd2bin(u8Year);
     333    pHlp->pfnPrintf(pHlp, "Day:%u Month:%u Year:%u, Time: Hr:%u Min:%u Sec%u\n",u8Day, u8Month, u8Year, u8Hr, u8Min, u8Sec);
     334
     335         
     336}
     337
    297338/* -=-=-=-=-=-=- based on code from pc.c -=-=-=-=-=-=- */
    298339
     
    14761517    PDMDevHlpDBGFInfoRegister(pDevIns, "cmos2", "Display CMOS Bank 2 Info.. "
    14771518                              "'cmos2'. No argument", CMOSBank2Info);
     1519    PDMDevHlpDBGFInfoRegister(pDevIns, "rtc", "Display CMOS RTC info "
     1520                              "'rtc'. No argument", CMOSRTCInfo);
    14781521
    14791522    /*
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette