Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
TinkerOS 5.16
Browse files Browse the repository at this point in the history
  • Loading branch information
tinkeros committed Jul 29, 2024
1 parent abe6d6a commit b1b0655
Show file tree
Hide file tree
Showing 35 changed files with 1,378 additions and 131 deletions.
2 changes: 1 addition & 1 deletion Adam/ABlkDev/AHCIMount.HC
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public I64 SATARep(I64 bd_type=BDT_NULL, I64 *first_hdd=NULL)
"\n";
for (i = 0; i < AHCI_MAX_PORTS; i++)
{
if (Bt(&blkdev.ahci_hba->ports_implemented, i))
if (PCIBt(&blkdev.ahci_hba->ports_implemented, i))
{
port = &blkdev.ahci_hba->ports[i];
if (port->signature == AHCI_PxSIG_ATAPI && show_atapi ||
Expand Down
71 changes: 36 additions & 35 deletions Adam/Device/Comm.HC
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class CComm
device,
flags,
poll,
type;
type,
mmio;
CFifoU8 *RX_fifo;
};

Expand All @@ -53,10 +54,10 @@ public U0 CommHndlr(I64 port)
free_size-=f->in_ptr-f->out_ptr;
while (free_size>0)
{
stat=InU8(c->base+UART_IIR);
stat=MixedInU8(c->mmio,c->base+UART_IIR);
if (stat & 4) //RX
{
FifoU8Ins(c->RX_fifo,InU8(c->base+UART_RDR));
FifoU8Ins(c->RX_fifo,MixedInU8(c->mmio,c->base+UART_RDR));
free_size--;
}
else
Expand All @@ -80,10 +81,10 @@ public U0 PollCommHndlr(I64 port)
free_size-=f->in_ptr-f->out_ptr;
while (free_size>0)
{
stat=InU8(c->base+UART_LSR);
stat=MixedInU8(c->mmio,c->base+UART_LSR);
if (stat & 1) //RX
{
FifoU8Ins(c->RX_fifo,InU8(c->base+UART_RDR));
FifoU8Ins(c->RX_fifo,MixedInU8(c->mmio,c->base+UART_RDR));
free_size--;
}
else
Expand Down Expand Up @@ -157,23 +158,23 @@ public CComm *CommInit7n1(I64 port,I64 baud)
CLI
if (!c->RX_fifo)
c->RX_fifo=FifoU8New(COMM_RX_FIFO_SIZE);
OutU8(c->base+UART_LCR,0); //Set for IER
OutU8(c->base+UART_IER,0); //Disable all IRQ
OutU8(c->base+UART_LCR,0x80); //Enable baud rate control
OutU8(c->base+UART_BRDL,0x180/(baud/300) & 0xFF); //LSB
OutU8(c->base+UART_BRDH,0x180/(baud/300) / 256); //MSB
OutU8(c->base+UART_LCR,2); //7-none-1
InU8(c->base+UART_RDR); //read garbage
InU8(c->base+UART_LSR);
OutU8(c->base+UART_MCR,4);
OutU8(c->base+UART_IER,0); //Disable all IRQ
OutU8(c->base+UART_MCR,0xA); //out2 and rts
MixedOutU8(c->mmio,c->base+UART_LCR,0); //Set for IER
MixedOutU8(c->mmio,c->base+UART_IER,0); //Disable all IRQ
MixedOutU8(c->mmio,c->base+UART_LCR,0x80); //Enable baud rate control
MixedOutU8(c->mmio,c->base+UART_BRDL,0x180/(baud/300) & 0xFF); //LSB
MixedOutU8(c->mmio,c->base+UART_BRDH,0x180/(baud/300) / 256); //MSB
MixedOutU8(c->mmio,c->base+UART_LCR,2); //7-none-1
MixedInU8(c->mmio,c->base+UART_RDR); //read garbage
MixedInU8(c->mmio,c->base+UART_LSR);
MixedOutU8(c->mmio,c->base+UART_MCR,4);
MixedOutU8(c->mmio,c->base+UART_IER,0); //Disable all IRQ
MixedOutU8(c->mmio,c->base+UART_MCR,0xA); //out2 and rts
if (!c->poll) {
OutU8(0x21,InU8(0x21) & (0xFF-0x18)); //Enable 8259 IRQ 3 & 4
OutU8(c->base+UART_IER,1); //RX but no THR empty
MixedOutU8(c->mmio,c->base+UART_IER,1); //RX but no THR empty
}
else
OutU8(c->base+UART_IIR,0xC7);
MixedOutU8(c->mmio,c->base+UART_IIR,0xC7);
LBts(&c->flags,COMf_ENABLED);
POPFD
return c;
Expand All @@ -186,23 +187,23 @@ public CComm *CommInit8n1(I64 port,I64 baud)
CLI
if (!c->RX_fifo)
c->RX_fifo=FifoU8New(COMM_RX_FIFO_SIZE);
OutU8(c->base+UART_LCR,0); //Set for IER
OutU8(c->base+UART_IER,0); //Disable all IRQ
OutU8(c->base+UART_LCR,0x80); //Enable baud rate control
OutU8(c->base+UART_BRDL,0x180/(baud/300) & 0xFF); //LSB
OutU8(c->base+UART_BRDH,0x180/(baud/300) / 256); //MSB
OutU8(c->base+UART_LCR,3); //8-none-1
InU8(c->base+UART_RDR); //read garbage
InU8(c->base+UART_LSR);
OutU8(c->base+UART_MCR,4);
OutU8(c->base+UART_IER,0); //Disable all IRQ
OutU8(c->base+UART_MCR,0xA); //out2 and rts
MixedOutU8(c->mmio,c->base+UART_LCR,0); //Set for IER
MixedOutU8(c->mmio,c->base+UART_IER,0); //Disable all IRQ
MixedOutU8(c->mmio,c->base+UART_LCR,0x80); //Enable baud rate control
MixedOutU8(c->mmio,c->base+UART_BRDL,0x180/(baud/300) & 0xFF); //LSB
MixedOutU8(c->mmio,c->base+UART_BRDH,0x180/(baud/300) / 256); //MSB
MixedOutU8(c->mmio,c->base+UART_LCR,3); //8-none-1
MixedInU8(c->mmio,c->base+UART_RDR); //read garbage
MixedInU8(c->mmio,c->base+UART_LSR);
MixedOutU8(c->mmio,c->base+UART_MCR,4);
MixedOutU8(c->mmio,c->base+UART_IER,0); //Disable all IRQ
MixedOutU8(c->mmio,c->base+UART_MCR,0xA); //out2 and rts
if (!c->poll) {
OutU8(0x21,InU8(0x21) & (0xFF-0x18)); //Enable 8259 IRQ 3 & 4
OutU8(c->base+UART_IER,1); //RX but no THR empty
MixedOutU8(c->mmio,c->base+UART_IER,1); //RX but no THR empty
}
else
OutU8(c->base+UART_IIR,0xC7);
MixedOutU8(c->mmio,c->base+UART_IIR,0xC7);
LBts(&c->flags,COMf_ENABLED);
POPFD
return c;
Expand All @@ -218,15 +219,15 @@ public U0 PollComm(U8 *data)

public U0 CommPutChar(I64 port,U8 b, I64 timeout_ms=500)
{// Write 1 byte to com port
I64 base=comm_ports[port].base;
CComm *c=&comm_ports[port];
F64 timeout_time=tS+ToF64(timeout_ms)/1000.0;
while (!(InU8(base+UART_LSR) & 0x20))
while (!(MixedInU8(c->mmio,c->base+UART_LSR) & 0x20))
{
if (tS>timeout_time) throw('ComErr');
Yield;
}
OutU8(base+UART_THR,b);
while (!(InU8(base+UART_LSR) & 0x20))
MixedOutU8(c->mmio,c->base+UART_THR,b);
while (!(MixedInU8(c->mmio,c->base+UART_LSR) & 0x20))
{
if (tS>timeout_time) throw('ComErr');
Yield;
Expand Down
3 changes: 2 additions & 1 deletion Adam/Device/LPT.HC
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ LptInit;
U0 LptRep()
{
I64 i;
"LPT 1-3 are standard IO ports, the actual ports themselves may or may not exist.\n";

for (i=1; i<=MAX_LPT_NUM; i++)
{
"LPT 1-3 are standard IO ports, the actual ports themselves may or may not exist.\n";
if (lpt_ports[i].base)
{
"LPT %d - base 0x%08x\n",i,lpt_ports[i].base;
Expand Down
13 changes: 9 additions & 4 deletions Adam/Gr/GrScrn.HC
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
// because QEMU will have graphics glitches without it.
//
// You might get a decent speedup setting this to FALSE for
// VirtualBox, VMware, and some hardware!
Bool use_slower_safe_gfx=TRUE;
// VirtualBox, VMware, and some hardware! Set this to
// TRUE if you experience graphics glitches such as
// artifacts when moving the mouse.
//
// The default is FALSE = fast for real hardware.

Bool use_slower_safe_gfx=IsHypervisorPresent;

#define I_UPDATE_CACHE 0xfd
#define I_BLOT 0xfe
Expand Down Expand Up @@ -505,7 +510,7 @@ U0 GrDoLetterBox()
src=text.raw_scrn_image;
for (i=0; i<GR_HEIGHT; i++)
{
dst=output_dst2+dst_row*gr.pitch/4;
dst=output_dst2+dst_row*gr.pitch/8;
for (j=0; j<LETTER_BOX_BAR_WIDTH; j++)
{
*dst++=0;
Expand Down Expand Up @@ -856,4 +861,4 @@ public I64 GetFPS()
{//Return current target video FPS
return fps_master;
}
#help_index ""
#help_index ""
2 changes: 1 addition & 1 deletion Adam/Net/Http.HC
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define HTTP_ECONTENTLENGTH (-106)

#define HTTP_MAX_REDIRECTS 5
#define HTTP_USER_AGENT "Adam/Net/Http ($TX+CX,"TinkerOS V5.15",D="DD_OS_NAME_VERSION"$)"
#define HTTP_USER_AGENT "Adam/Net/Http ($TX+CX,"TinkerOS V5.16",D="DD_OS_NAME_VERSION"$)"

/**
* @param len_out (required) requires the content length, or -1 if unspecified
Expand Down
20 changes: 15 additions & 5 deletions Adam/Opt/Boot/BootHDIns.HC
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,13 @@ public U0 MakeAllDef(Bool install=FALSE, I64 width=-1, I64 height=-1, I64 do_mbr

if (HashFind("CUR_DRV_HINT",adam_task->hash_table,HTT_DEFINE_STR))
{

if (width>0 && height>0 && !CheckVidMode(width, height, scale))
{
"This resolution is not supported!\n";
return;
}
if (FB_WIDTH!=GR_WIDTH || FB_HEIGHT!=GR_HEIGHT || DO_SCALING
|| LETTER_BOX || WIDTH_SCALE>1 || HEIGHT_SCALE>1)
if (scale!=1 &&(FB_WIDTH!=GR_WIDTH || FB_HEIGHT!=GR_HEIGHT || DO_SCALING
|| LETTER_BOX || WIDTH_SCALE>1 || HEIGHT_SCALE>1))
res_ok=FALSE;

if (AHCIMode)
Expand Down Expand Up @@ -155,11 +154,22 @@ public U0 MakeAllDef(Bool install=FALSE, I64 width=-1, I64 height=-1, I64 do_mbr
return;
}
}
"Cannot make default config, from this kernel, use MakeAll and set options manually!\n";
"Can not make default config, from this kernel, use MakeAll and set options manually!\n";
}

public U0 MakeAllIns(I64 width=-1, I64 height=-1)
{//Try to automatically recompile both compiler and kernel and install
MakeAllDef(TRUE,width,height);
}
#help_index ""

public U0 Do640x480()
{//Try to recompile kernel with standard 640x480 resolution
MakeAllDef(TRUE,640,480,1);
}

public U0 Do800x600()
{//Try to recompile kernel with standard 800x600 resolution
MakeAllDef(TRUE,800,600,1);
}

#help_index ""
11 changes: 5 additions & 6 deletions Adam/Opt/Utils/SysRep.HC
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ start:
, SMBIOSStr(header, sys_info->product_name);
"Version:$$BLACK$$%s$$FG$$\n"
, SMBIOSStr(header, sys_info->version);
if (!verbose)
if (verbose<2)
{
"$$ID,-3$$";
break;
Expand All @@ -1071,7 +1071,6 @@ start:
"$$ID,-3$$";
break;
case SMBIOSt_ENCLOSURE:
if (!verbose) break;
if (verbose<2) break;
CSMBIOSEnclosureInfo *info = header;
"$$TR-C,\"Enclosure\"$$\n";
Expand Down Expand Up @@ -1354,7 +1353,7 @@ start:
}
else
"Unknown$$FG$$\n";
if (!verbose)
if (verbose==2)
{
"Serial Number:$$BLACK$$%s$$FG$$\n"
, SMBIOSStr(header, mem_info->serial_number);
Expand Down Expand Up @@ -1387,7 +1386,7 @@ start:
, SMBIOSStr(header, b_info->product);
"Version:$$BLACK$$%s$$FG$$\n"
, SMBIOSStr(header, b_info->version);
if (!verbose)
if (verbose==2)
{
"Type:$$BLACK$$%Z$$FG$$\n"
, b_info->board_type, "ST_SMBIOS_BASEBOARD_TYPES";
Expand Down Expand Up @@ -1471,7 +1470,7 @@ start:
"%d$$FG$$\n", bat_info->max_battery_data_error;
else
"Unknown$$FG$$\n";
if (!verbose)
if (verbose==2)
{
"Serial Number:$$BLACK$$";
if (bat_info->serial_number)
Expand Down Expand Up @@ -1579,5 +1578,5 @@ public U0 BIOSRep()

public U0 SysRepSurvey()
{//Display system info excluding sensative info
SysRep(,,,, TRUE);
SysRep(,,,,1);
}
Loading

0 comments on commit b1b0655

Please sign in to comment.