Some annotations
This commit is contained in:
parent
3405e89c9a
commit
27ced06ac9
|
@ -1,7 +1,10 @@
|
|||
"use strict";
|
||||
|
||||
|
||||
/** @constructor */
|
||||
/**
|
||||
* @constructor
|
||||
* @param {CPU} cpu
|
||||
*/
|
||||
function ACPI(cpu)
|
||||
{
|
||||
if(!ENABLE_ACPI)
|
||||
|
@ -61,12 +64,12 @@ function ACPI(cpu)
|
|||
});
|
||||
|
||||
// ACPI status
|
||||
io.register_read(0xb004, this, function(data)
|
||||
io.register_read(0xb004, this, function()
|
||||
{
|
||||
dbg_log("b004 read");
|
||||
return 1;
|
||||
});
|
||||
io.register_read(0xb005, this, function(data)
|
||||
io.register_read(0xb005, this, function()
|
||||
{
|
||||
dbg_log("b005 read");
|
||||
return 0;
|
||||
|
|
|
@ -11,7 +11,7 @@ Bus.Connector = function()
|
|||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {function()} fn
|
||||
* @param {function(*=)} fn
|
||||
* @param {Object} this_value
|
||||
*/
|
||||
Bus.Connector.prototype.register = function(name, fn, this_value)
|
||||
|
@ -54,7 +54,7 @@ Bus.Connector.prototype.unregister = function(name, fn)
|
|||
* Send ("emit") a message
|
||||
*
|
||||
* @param {string} name
|
||||
* @param {Object=} value
|
||||
* @param {*=} value
|
||||
*/
|
||||
Bus.Connector.prototype.send = function(name, value)
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {CPU} dev
|
||||
*/
|
||||
function DMA(dev)
|
||||
{
|
||||
|
|
|
@ -51,6 +51,7 @@ var
|
|||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {CPU} cpu
|
||||
*/
|
||||
function FPU(cpu)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ var HPET_ADDR = 0xFED00000,
|
|||
* http://wiki.osdev.org/HPET
|
||||
*
|
||||
* @constructor
|
||||
* @param {CPU} cpu
|
||||
*/
|
||||
function HPET(cpu)
|
||||
{
|
||||
|
|
|
@ -15,7 +15,13 @@ var /** @const */
|
|||
/** @const */
|
||||
IDE_CALLBACK_ATAPI = 2;
|
||||
|
||||
/** @constructor */
|
||||
/**
|
||||
* @constructor
|
||||
* @param {CPU} cpu
|
||||
* @param {boolean} is_cd
|
||||
* @param {number} nr
|
||||
* @param {Bus.Connector} bus
|
||||
* */
|
||||
function IDEDevice(cpu, buffer, is_cd, nr, bus)
|
||||
{
|
||||
/** @const */
|
||||
|
|
22
src/io.js
22
src/io.js
|
@ -5,6 +5,7 @@
|
|||
* Devices register their ports here
|
||||
*
|
||||
* @constructor
|
||||
* @param {Memory} memory
|
||||
*/
|
||||
function IO(memory)
|
||||
{
|
||||
|
@ -92,7 +93,7 @@ IO.prototype.empty_port_write = function(x)
|
|||
/**
|
||||
* @param {number} port_addr
|
||||
* @param {Object} device
|
||||
* @param {function():number} r8
|
||||
* @param {function():number=} r8
|
||||
* @param {function():number=} r16
|
||||
* @param {function():number=} r32
|
||||
*/
|
||||
|
@ -125,7 +126,7 @@ IO.prototype.register_read = function(port_addr, device, r8, r16, r32)
|
|||
/**
|
||||
* @param {number} port_addr
|
||||
* @param {Object} device
|
||||
* @param {function(number)} w8
|
||||
* @param {function(number)=} w8
|
||||
* @param {function(number)=} w16
|
||||
* @param {function(number)=} w32
|
||||
*/
|
||||
|
@ -154,7 +155,7 @@ IO.prototype.register_write = function(port_addr, device, w8, w16, w32)
|
|||
this.ports[port_addr].device = device;
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* > Any two consecutive 8-bit ports can be treated as a 16-bit port;
|
||||
* > and four consecutive 8-bit ports can be treated as a 32-bit port
|
||||
* > http://css.csail.mit.edu/6.858/2012/readings/i386/s08_01.htm
|
||||
|
@ -163,6 +164,13 @@ IO.prototype.register_write = function(port_addr, device, w8, w16, w32)
|
|||
*
|
||||
* Register the write of 2 or 4 consecutive 8-bit ports, 1 or 2 16-bit
|
||||
* ports and 0 or 1 32-bit ports
|
||||
*
|
||||
* @param {number} port_addr
|
||||
* @param {!Object} device
|
||||
* @param {function():number} r8_1
|
||||
* @param {function():number} r8_2
|
||||
* @param {function():number=} r8_3
|
||||
* @param {function():number=} r8_4
|
||||
*/
|
||||
IO.prototype.register_read_consecutive = function(port_addr, device, r8_1, r8_2, r8_3, r8_4)
|
||||
{
|
||||
|
@ -200,6 +208,14 @@ IO.prototype.register_read_consecutive = function(port_addr, device, r8_1, r8_2,
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} port_addr
|
||||
* @param {!Object} device
|
||||
* @param {function(number)} w8_1
|
||||
* @param {function(number)} w8_2
|
||||
* @param {function(number)=} w8_3
|
||||
* @param {function(number)=} w8_4
|
||||
*/
|
||||
IO.prototype.register_write_consecutive = function(port_addr, device, w8_1, w8_2, w8_3, w8_4)
|
||||
{
|
||||
dbg_assert(arguments.length === 4 || arguments.length === 6);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {number} memory_size
|
||||
*/
|
||||
function Memory(memory_size)
|
||||
{
|
||||
|
|
|
@ -52,7 +52,11 @@
|
|||
/** @const */ var STOP_PAGE = 0x80;
|
||||
|
||||
|
||||
/** @constructor */
|
||||
/**
|
||||
* @constructor
|
||||
* @param {CPU} cpu
|
||||
* @param {Bus.Connector} bus
|
||||
*/
|
||||
function Ne2k(cpu, bus)
|
||||
{
|
||||
/** @const */
|
||||
|
|
|
@ -17,7 +17,10 @@ var
|
|||
/** @const */ PCI_CONFIG_ADDRESS = 0xCF8,
|
||||
/** @const */ PCI_CONFIG_DATA = 0xCFC;
|
||||
|
||||
/** @constructor */
|
||||
/**
|
||||
* @constructor
|
||||
* @param {CPU} cpu
|
||||
*/
|
||||
function PCI(cpu)
|
||||
{
|
||||
var
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* http://stanislavs.org/helppc/8259.html
|
||||
*
|
||||
* @constructor
|
||||
* @param {CPU} cpu
|
||||
* @param {PIC=} master
|
||||
*/
|
||||
function PIC(cpu, master)
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {CPU} cpu
|
||||
* @param {Bus.Connector} bus
|
||||
*/
|
||||
function PS2(cpu, bus)
|
||||
{
|
||||
|
|
|
@ -23,6 +23,9 @@ var DLAB = 0x80;
|
|||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {CPU} cpu
|
||||
* @param {number} port
|
||||
* @param {Bus.Connector} bus
|
||||
*/
|
||||
function UART(cpu, port, bus)
|
||||
{
|
||||
|
|
|
@ -20,6 +20,9 @@ var
|
|||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {CPU} cpu
|
||||
* @param {Bus.Connector} bus
|
||||
* @param {number} vga_memory_size
|
||||
*/
|
||||
function VGAScreen(cpu, bus, vga_memory_size)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
|
||||
/** @constructor */
|
||||
/**
|
||||
* @constructor
|
||||
* @param {CPU} cpu
|
||||
* @param {Bus.Connector} bus
|
||||
* @param {FS} filesystem
|
||||
*/
|
||||
function VirtIO(cpu, bus, filesystem)
|
||||
{
|
||||
// http://ozlabs.org/~rusty/virtio-spec/virtio-0.9.5.pdf
|
||||
|
|
Loading…
Reference in a new issue