Implement BlkDevRep, remove BlkDevRep demo file.

This commit is contained in:
TomAwezome 2021-12-04 05:05:58 -05:00
parent 95d4d9e5c1
commit 102d8afafe
3 changed files with 30 additions and 14 deletions

View file

@ -1,14 +0,0 @@
U0 BlkDevRep()
{//Block Device Report.
I64 i;
for (i = 0; i < BLKDEVS_NUM; i++)
if (blkdev.blkdevs[i].bd_signature == BD_SIGNATURE_VAL)
//$LK,"ClassRep",A="MN:ClassRep"$() dumps any structure, automatically.
ClassRep(&blkdev.blkdevs[i],,, TRUE);
//The lastclass arg tells ClassRep the datatype.
//lastclass is a language feature of $LK,"CosmiC",A="FI:::/Doc/CosmiC.DD"$.
//See $LK,"::/Demo/LastClass.CC"$.
}
BlkDevRep;

View file

@ -222,3 +222,32 @@ CBlkDev *Letter2BlkDev(U8 drv_let=0, Bool except=TRUE)
else
return NULL;
}
U0 BlkDevRep()
{ // Block Device Report.
// blkdev.blkdevs[i].
I64 i;
CBlkDev *b = blkdev.blkdevs;
for (i = 0; i < BLKDEVS_NUM; i++)
{
if (b[i].bd_signature == BD_SIGNATURE_VAL)
{
"\nBlock Device #%d:\n", i;
"\tBlock Device Type:\t%Z\n", b[i].type, "ST_BLKDEV_TYPES";
"\tFirst Drive Letter:\t%C\n", b[i].first_drive_let;
if (b[i].ahci_port)
{
"\tAHCI Port number:\t%d\n", b[i].port_num;
"\tAHCI Port address:\t0x%X\n", b[i].ahci_port;
}
if (b[i].RAM_disk)
"\tRAM disk address:\t0x%X\n", b[i].RAM_disk;
if (b[i].file_disk_name)
"\tFile:\t\t\t\t%s\n", b[i].file_disk_name;
"\tBlock Size:\t\t\t%d\n", b[i].blk_size;
"\tDrive Max Block:\t0x%X\n", b[i].max_blk;
}
}
"\n";
}

View file

@ -305,6 +305,7 @@ public extern Bool BlkDevLock( CBlkDev *bd);
public extern CBlkDev *BlkDevNextFreeSlot(U8 first_drive_let, I64 type);
public extern Bool BlkDevUnlock(CBlkDev *bd, Bool reset=FALSE);
public extern U0 BlkDevsRelease();
public extern U0 BlkDevRep();
public extern Bool BlkRead( CDrive *drive, U8 *buf, I64 blk, I64 count);
public extern Bool BlkWrite( CDrive *drive, U8 *buf, I64 blk, I64 count);
public extern U0 BlkWriteZero(CDrive *drive, I64 blk, I64 count);