VirtualBox

Changeset 41709 in vbox for trunk/src/VBox/Devices/PC


Ignore:
Timestamp:
Jun 14, 2012 1:49:17 PM (13 years ago)
Author:
vboxsync
Message:

Moved the code to the right placed.

File:
1 edited

Legend:

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

    r41708 r41709  
    279279    return ((a >> 4) * 10) + (a & 0x0f);
    280280}
    281 
    282 #ifdef IN_RING3
    283 
    284 /**
    285  * @callback_method_impl{FNDBGFHANDLERDEV,
    286  *      Dumps the cmos Bank Info.}
    287  */
    288 static DECLCALLBACK(void) rtcCmosBankInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
    289 {
    290     RTCState *pThis = PDMINS_2_DATA(pDevIns, RTCState *);
    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             pHlp->pfnPrintf(pHlp, "-");
    300         else
    301             pHlp->pfnPrintf(pHlp, " ");
    302         pHlp->pfnPrintf(pHlp, "%02x\n", pThis->cmos_data[iCmos]);
    303     }
    304 }
    305 
    306 /**
    307  * @callback_method_impl{FNDBGFHANDLERDEV,
    308  *      Dumps the cmos Bank2 Info.}
    309  */
    310 static DECLCALLBACK(void) rtcCmosBank2Info(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
    311 {
    312     RTCState *pThis = PDMINS_2_DATA(pDevIns, RTCState *);
    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)
    320             pHlp->pfnPrintf(pHlp, "-");
    321         else
    322             pHlp->pfnPrintf(pHlp, " ");
    323         pHlp->pfnPrintf(pHlp, "%02x\n", pThis->cmos_data[iCmos]);
    324     }
    325 }
    326 
    327 /**
    328  * @callback_method_impl{FNDBGFHANDLERDEV,
    329  *      Dumps the cmos RTC Info.}
    330  */
    331 static DECLCALLBACK(void) rtcCmosClockInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
    332 {
    333     RTCState *pThis = PDMINS_2_DATA(pDevIns, RTCState *);
    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);
    337     if (   !(pThis->cmos_data[RTC_REG_B] & 0x02)
    338         && (pThis->cmos_data[RTC_HOURS] & 0x80))
    339         u8Hr += 12;
    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]);
    343     pHlp->pfnPrintf(pHlp, "Time: Hr:%u Min:%u Sec:%u, Day:%u Month:%u Year:%u\n", u8Hr, u8Min, u8Sec, u8Day, u8Month, u8Year);
    344     /** @todo r=bird: missing REG A-D. */
    345 }
    346 
    347 #endif /* IN_RING3 */
    348281
    349282
     
    535468
    536469#ifdef IN_RING3
     470
     471/* -=-=-=-=-=- Debug Info Handlers  -=-=-=-=-=- */
     472
     473/**
     474 * @callback_method_impl{FNDBGFHANDLERDEV,
     475 *      Dumps the cmos Bank Info.}
     476 */
     477static DECLCALLBACK(void) rtcCmosBankInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     478{
     479    RTCState *pThis = PDMINS_2_DATA(pDevIns, RTCState *);
     480
     481    pHlp->pfnPrintf(pHlp,
     482                    "First CMOS bank, offsets 0x0E - 0x7F\n"
     483                    "Offset %02x : --- use 'info rtc' to show CMOS clock ---", 0);
     484    for (unsigned iCmos = CMOS_BANK_LOWER_LIMIT; iCmos <= CMOS_BANK_UPPER_LIMIT; iCmos++)
     485    {
     486        if ((iCmos & 15) == 0)
     487            pHlp->pfnPrintf(pHlp, "Offset %02x : %02x", iCmos, pThis->cmos_data[iCmos]);
     488        else if ((iCmos & 15) == 8)
     489            pHlp->pfnPrintf(pHlp, "-%02x", pThis->cmos_data[iCmos]);
     490        else if ((iCmos & 15) == 15)
     491            pHlp->pfnPrintf(pHlp, " %02x\n", pThis->cmos_data[iCmos]);
     492        else
     493            pHlp->pfnPrintf(pHlp, " %02x", pThis->cmos_data[iCmos]);
     494    }
     495}
     496
     497/**
     498 * @callback_method_impl{FNDBGFHANDLERDEV,
     499 *      Dumps the cmos Bank2 Info.}
     500 */
     501static DECLCALLBACK(void) rtcCmosBank2Info(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     502{
     503    RTCState *pThis = PDMINS_2_DATA(pDevIns, RTCState *);
     504
     505    pHlp->pfnPrintf(pHlp, "Second CMOS bank, offsets 0x80 - 0xFF\n");
     506    for (uint16_t iCmos = CMOS_BANK2_LOWER_LIMIT; iCmos <= CMOS_BANK2_UPPER_LIMIT; iCmos++)
     507    {
     508        if ((iCmos & 15) == 0)
     509            pHlp->pfnPrintf(pHlp, "Offset %02x : %02x", iCmos, pThis->cmos_data[iCmos]);
     510        else if ((iCmos & 15) == 8)
     511            pHlp->pfnPrintf(pHlp, "-%02x", pThis->cmos_data[iCmos]);
     512        else if ((iCmos & 15) == 15)
     513            pHlp->pfnPrintf(pHlp, " %02x\n", pThis->cmos_data[iCmos]);
     514        else
     515            pHlp->pfnPrintf(pHlp, " %02x", pThis->cmos_data[iCmos]);
     516    }
     517}
     518
     519/**
     520 * @callback_method_impl{FNDBGFHANDLERDEV,
     521 *      Dumps the cmos RTC Info.}
     522 */
     523static DECLCALLBACK(void) rtcCmosClockInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     524{
     525    RTCState *pThis = PDMINS_2_DATA(pDevIns, RTCState *);
     526    uint8_t u8Sec   = from_bcd(pThis, pThis->cmos_data[RTC_SECONDS]);
     527    uint8_t u8Min   = from_bcd(pThis, pThis->cmos_data[RTC_MINUTES]);
     528    uint8_t u8Hr    = from_bcd(pThis, pThis->cmos_data[RTC_HOURS] & 0x7f);
     529    if (   !(pThis->cmos_data[RTC_REG_B] & 0x02)
     530        && (pThis->cmos_data[RTC_HOURS] & 0x80))
     531        u8Hr += 12;
     532    uint8_t u8Day   = from_bcd(pThis, pThis->cmos_data[RTC_DAY_OF_MONTH]);
     533    uint8_t u8Month = from_bcd(pThis, pThis->cmos_data[RTC_MONTH]) ;
     534    uint8_t u8Year  = from_bcd(pThis, pThis->cmos_data[RTC_YEAR]);
     535    pHlp->pfnPrintf(pHlp, "Time: %02u:%02u:%02u  Date:%02u-%02u-%02u\n",
     536                    u8Hr, u8Min, u8Sec, u8Year, u8Month, u8Day);
     537    /** @todo r=bird: missing REG A-D. */
     538}
     539
     540
    537541
    538542/* -=-=-=-=-=- Timers and their support code  -=-=-=-=-=- */
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