-
+ 1232CD80AD35A8A65C9767C3A9CDBE9CE5024F93F609B1F2AF4CE225B436366E5B31596F698344AB45B25633382C983AA839B0CE017976614186021A46F11FAB
m/devices/rtc.asm
(0 . 0)(1 . 70)
571 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
572 ;; ;;
573 ;; This file is part of 'M', a MIPS system emulator. ;;
574 ;; ;;
575 ;; (C) 2019 Stanislav Datskovskiy ( www.loper-os.org ) ;;
576 ;; http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html ;;
577 ;; ;;
578 ;; You do not have, nor can you ever acquire the right to use, copy or ;;
579 ;; distribute this software ; Should you use this software for any purpose, ;;
580 ;; or copy and distribute it to anyone or in any manner, you are breaking ;;
581 ;; the laws of whatever soi-disant jurisdiction, and you promise to ;;
582 ;; continue doing so for the indefinite future. In any case, please ;;
583 ;; always : read and understand any software ; verify any PGP signatures ;;
584 ;; that you use - for any purpose. ;;
585 ;; ;;
586 ;; See also http://trilema.com/2015/a-new-software-licensing-paradigm . ;;
587 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
588
589 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
590 ;; Real-Time Clock Device ;;
591 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
592
593 ;-----------------------------------------------------------------------------
594 ;; Real-Time Clock MMIO:
595 DECLARE_BUS_DEVICE RTC, 0x430, 0x434
596 ;-----------------------------------------------------------------------------
597
598 ;-----------------------------------------------------------------------------
599 ; Epoch Time: 'Sec. since 00:00:00 Thursday, 1 January 1970'
600 %define RTC_REG_EPOCH_LO 0 ; Lower 32 bits of RTC Epoch Time
601 %define RTC_REG_EPOCH_HI 4 ; Upper 32 bits of RTC Epoch Time
602 ;-----------------------------------------------------------------------------
603
604 ;-----------------------------------------------------------------------------
605 _PD_Read_Word_RTC: ; Word reads from RTC:
606 sub eax, RTC_BASE ; Adjust for base of RTC MMIO
607 cmp eax, RTC_REG_EPOCH_LO ; Word at 0x0: Low 32 bits of time
608 je .rtc_epoch_low_word
609 cmp eax, RTC_REG_EPOCH_HI ; Word at 0x4: High 32 bits of time
610 je .rtc_epoch_high_word
611 .rtc_undefined_reg: ; If unknown reg (how?) :
612 ACHTUNG "Read Unknown RTC Reg?"
613 xor eax, eax ; ... return 0 always.
614 ret ; Fin.
615 .rtc_epoch_low_word: ; Get LOW 32 bits of Epoch Time :
616 call _Get_Epoch_Time ; Retrieve epoch time from host
617 mov eax, edx ; eax := low word
618 ret ; Fin.
619 .rtc_epoch_high_word: ; Get HIGH 32 bits of Epoch Time :
620 call _Get_Epoch_Time ; Retrieve epoch time from host
621 shr rdx, 32 ; get high word
622 mov eax, edx ; eax := high word
623 ret ; Fin.
624 ;-----------------------------------------------------------------------------
625 _PD_Write_Word_RTC: ; Word writes to RTC do nothing!
626 ret
627 ;-----------------------------------------------------------------------------
628 _PD_Read_Byte_RTC:
629 xor eax, eax ; Read Byte from RTC: always 0
630 ret
631 ;-----------------------------------------------------------------------------
632 _PD_Write_Byte_RTC:
633 ret ; Fin.
634 ;-----------------------------------------------------------------------------
635 _Device_Init_RTC: ; Needs no init.
636 ret
637 ;-----------------------------------------------------------------------------
638 _Device_Shutdown_RTC: ; Needs no shutdown.
639 ret
640 ;-----------------------------------------------------------------------------