Add PIT defines

This commit is contained in:
xmm15 2020-02-16 04:19:49 -06:00
parent e81fef25c4
commit 88e526cba5
11 changed files with 1598 additions and 1560 deletions

Binary file not shown.

Binary file not shown.

View File

@ -4,7 +4,7 @@
U0 MakeMyISO(U8 *_out_iso_filename) U0 MakeMyISO(U8 *_out_iso_filename)
{//Does everything with current drive. {//Does everything with current drive.
//If you have not recompiled $GREEN$Kernel$FG$ and defined your CD/DVD drive, use $LK,"Mount",A="MN:Mount"$. //If you have not recompiled $FG,2$Kernel$FG$ and defined your CD/DVD drive, use $LK,"Mount",A="MN:Mount"$.
U8 *out_iso_filename=FileNameAbs(_out_iso_filename); U8 *out_iso_filename=FileNameAbs(_out_iso_filename);
if (!DriveIsWritable) { if (!DriveIsWritable) {
"Drive must be writable. Install on Hard drive, first.\n"; "Drive must be writable. Install on Hard drive, first.\n";
@ -22,6 +22,7 @@ U0 MakeMyISO(U8 *_out_iso_filename)
CopyTree(BOOT_DIR, "/Distro" BOOT_DIR); CopyTree(BOOT_DIR, "/Distro" BOOT_DIR);
CopyTree("/Home", "/Distro/Home"); CopyTree("/Home", "/Distro/Home");
Del("/Distro/Home/Registry.CC");
CopyTree("/Zenith", "/Distro/Zenith"); CopyTree("/Zenith", "/Distro/Zenith");
CopyTree("/Apps", "/Distro/Apps"); CopyTree("/Apps", "/Distro/Apps");
CopyTree("/Compiler", "/Distro/Compiler"); CopyTree("/Compiler", "/Distro/Compiler");

13
src/Home/MakeHome.CC Executable file
View File

@ -0,0 +1,13 @@
Cd(__DIR__);;
//If these are not present in /Home, it uses the version in the root dir. You
//can make your own, modified, version of these files in your /Home directory.
#include "~/HomeLocalize"
#include "/Zenith/Boot/MakeBoot"
#include "/Zenith/Utils/MakeUtils"
#include "~/HomeWrappers"
MapFileLoad("::/Kernel/Kernel");
MapFileLoad("::/Compiler/Compiler");
#include "~/HomeKeyPlugIns"
#include "~/HomeSys"
Cd("..");;

Binary file not shown.

View File

@ -102,10 +102,10 @@ U0 TimersInit()
I64 i,*_q; I64 i,*_q;
U32 *_d; U32 *_d;
OutU8(0x43,0x34); OutU8(PIT_CMD, PIT_CMDF_CHANNEL0 | PIT_CMDF_OPMODE_RATE_GEN | PIT_CMDF_ACCESS_WORD);
OutU8(0x40,SYS_TIMER0_PERIOD); OutU8(PIT0,SYS_TIMER0_PERIOD);
OutU8(0x40,SYS_TIMER0_PERIOD>>8); OutU8(PIT0,SYS_TIMER0_PERIOD >> 8);

//High Precision Event Timer //High Precision Event Timer
if (PCIReadU16(0,31,0,0)==0x8086) {//Intel? if (PCIReadU16(0,31,0,0)==0x8086) {//Intel?
//D31 F0, config 0xF0=RCBA of PCI-LPC Bridge //D31 F0, config 0xF0=RCBA of PCI-LPC Bridge
@ -138,7 +138,7 @@ U0 Reboot(Bool format_ramdisks=FALSE)
Format('A',,FALSE,FSt_REDSEA); Format('A',,FALSE,FSt_REDSEA);
if (DriveIsWritable('B')) if (DriveIsWritable('B'))
Format('B',,FALSE,FSt_REDSEA); Format('B',,FALSE,FSt_REDSEA);
} }
CLI CLI
if (mp_count>1) if (mp_count>1)
MPHalt; MPHalt;

View File

@ -66,9 +66,10 @@ I64 SysTimerRead()
if (mp_count>1) if (mp_count>1)
while (LBts(&sys_semas[SEMA_SYS_TIMER],0)) while (LBts(&sys_semas[SEMA_SYS_TIMER],0))
PAUSE PAUSE
OutU8(0x43,0); //Latch Timer0 OutU8(PIT_CMD, PIT_CMDF_CHANNEL0); //Latch Timer0
if ((i=InU8(0x40)+InU8(0x40)<<8)==SYS_TIMER0_PERIOD) { if ((i=InU8(PIT0) + InU8(PIT0) << 8) == SYS_TIMER0_PERIOD)
if (InU8(0x20) & 1) {
if (InU8(0x20) & 1)
i=-1; i=-1;
} }
res=counts.timer+SYS_TIMER0_PERIOD-i; res=counts.timer+SYS_TIMER0_PERIOD-i;
@ -188,9 +189,9 @@ U0 Sound(I8 ona=0)
} else if (ona!=screencast.ona) { } else if (ona!=screencast.ona) {
screencast.ona=ona; screencast.ona=ona;
period=ClampI64(SYS_TIMER_FREQ/Ona2Freq(ona),1,U16_MAX); period=ClampI64(SYS_TIMER_FREQ/Ona2Freq(ona),1,U16_MAX);
OutU8(0x43,0xB6); OutU8(PIT_CMD,PIT_CMDF_CHANNEL2 | PIT_CMDF_OPMODE_SQUARE_WAVE | PIT_CMDF_ACCESS_WORD);
OutU8(0x42,period); OutU8(PIT2,period);
OutU8(0x42,period.u8[1]); OutU8(PIT2,period.u8[1]);
OutU8(0x61,3|InU8(0x61)); OutU8(0x61,3|InU8(0x61));
} }
if (!IsDebugMode && screencast.record) { if (!IsDebugMode && screencast.record) {

File diff suppressed because one or more lines are too long

View File

@ -549,6 +549,19 @@ class CAP16BitInit
CSysLimitBase ap_gdt_ptr; CSysLimitBase ap_gdt_ptr;
}; };
#help_index "Time/PIT"
//Programmable Interval Timer
#define PIT0 0x40
#define PIT1 0x41
#define PIT2 0x42
#define PIT_CMD 0x43
#define PIT_CMDF_OPMODE_RATE_GEN 0x04
#define PIT_CMDF_OPMODE_SQUARE_WAVE 0x06
#define PIT_CMDF_ACCESS_WORD 0x30
#define PIT_CMDF_CHANNEL0 0x00
#define PIT_CMDF_CHANNEL2 0x80
#help_index "Time/CPU Cycles;Time/HPET;Time/Jiffies" #help_index "Time/CPU Cycles;Time/HPET;Time/Jiffies"
//High Performance Event Timer //High Performance Event Timer
#define HPET_GCAP_ID (0xFED00000+0x00) #define HPET_GCAP_ID (0xFED00000+0x00)
@ -1495,7 +1508,7 @@ public class CWinMgrGlobals
#define ACf_INIT_IN_PROGRESS 0 #define ACf_INIT_IN_PROGRESS 0
#define ACf_LAST_WAS_KEYMAP 1 #define ACf_LAST_WAS_KEYMAP 1
#define AC_FILLINS_NUM 12 #define AC_FILLINS_NUM 12
public class CAutoCompleteGlobals public class CAutoCompleteGlobals
{ {
I64 col,row,old_col,old_row,num_words; I64 col,row,old_col,old_row,num_words;

Binary file not shown.

Binary file not shown.