;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ;; This file is part of 'M', a MIPS system emulator. ;; ;; ;; ;; (C) 2019 Stanislav Datskovskiy ( www.loper-os.org ) ;; ;; http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html ;; ;; ;; ;; You do not have, nor can you ever acquire the right to use, copy or ;; ;; distribute this software ; Should you use this software for any purpose, ;; ;; or copy and distribute it to anyone or in any manner, you are breaking ;; ;; the laws of whatever soi-disant jurisdiction, and you promise to ;; ;; continue doing so for the indefinite future. In any case, please ;; ;; always : read and understand any software ; verify any PGP signatures ;; ;; that you use - for any purpose. ;; ;; ;; ;; See also http://trilema.com/2015/a-new-software-licensing-paradigm . ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Real-Time Clock Device ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;----------------------------------------------------------------------------- ;; Real-Time Clock MMIO: DECLARE_BUS_DEVICE RTC, 0x430, 0x434 ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ; Epoch Time: 'Sec. since 00:00:00 Thursday, 1 January 1970' %define RTC_REG_EPOCH_LO 0 ; Lower 32 bits of RTC Epoch Time %define RTC_REG_EPOCH_HI 4 ; Upper 32 bits of RTC Epoch Time ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- _PD_Read_Word_RTC: ; Word reads from RTC: sub eax, RTC_BASE ; Adjust for base of RTC MMIO cmp eax, RTC_REG_EPOCH_LO ; Word at 0x0: Low 32 bits of time je .rtc_epoch_low_word cmp eax, RTC_REG_EPOCH_HI ; Word at 0x4: High 32 bits of time je .rtc_epoch_high_word .rtc_undefined_reg: ; If unknown reg (how?) : ACHTUNG "Read Unknown RTC Reg?" xor eax, eax ; ... return 0 always. ret ; Fin. .rtc_epoch_low_word: ; Get LOW 32 bits of Epoch Time : call _Get_Epoch_Time ; Retrieve epoch time from host mov eax, edx ; eax := low word ret ; Fin. .rtc_epoch_high_word: ; Get HIGH 32 bits of Epoch Time : call _Get_Epoch_Time ; Retrieve epoch time from host shr rdx, 32 ; get high word mov eax, edx ; eax := high word ret ; Fin. ;----------------------------------------------------------------------------- _PD_Write_Word_RTC: ; Word writes to RTC do nothing! ret ;----------------------------------------------------------------------------- _PD_Read_Byte_RTC: xor eax, eax ; Read Byte from RTC: always 0 ret ;----------------------------------------------------------------------------- _PD_Write_Byte_RTC: ret ; Fin. ;----------------------------------------------------------------------------- _Device_Init_RTC: ; Needs no init. ret ;----------------------------------------------------------------------------- _Device_Shutdown_RTC: ; Needs no shutdown. ret ;-----------------------------------------------------------------------------