SLUSBCatalog.sleela
lib/operating-system/usb/SLUSBCatalog.sleela · 99 line(s) · sleela
<< lib/operating-system/usb/SLUSBCatalog.sleela
SLeeLa Standard Library Definition.
Definition: Defines SLUSBCatalog — a by-name factory for USB host controllers
and devices. USB host-controller silicon comes from a finite set of vendors
(Intel, AMD, ASMedia, VIA, Renesas, Texas Instruments, Fresco Logic), and
the catalogue returns representative, correctly-specified SLUSBDevice
instances — a root/host controller for the machine, or a class device
(keyboard/mouse HID, mass-storage key, hub) to attach to it.
Family: operating-system. Produces SLUSBDevice. >>
#sleela 2.5
material;
class SLUSBCatalog {
< ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
<< Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
or catalog can read and (where appropriate) override this record.
Values are faithful to the subject's real origin where publicly known. >>
String metaVersion = "1.0.0";
int metaId = 10944;
String metaAuthor = "Kiro Agent";
String metaDate = "2026-10-16";
String metaCopyright = "SLeeLa project";
String metaTrademark = "none";
String metaCorporation = "none";
< metaOrigin: National | <nation> | International | Galactic >
String metaOrigin = "International";
String metaBirthDate = "2026-10-10";
< metaScienceRating: maturity/robustness on a 1..10 scale >
int metaScienceRating = 9;
< metaNationalSchedule: a real, citable instrument or "none" >
String metaNationalSchedule = "none";
String getMetaVersion() { return metaVersion; }
void setMetaVersion(String v) { metaVersion = v; }
int getMetaId() { return metaId; }
void setMetaId(int v) { metaId = v; }
String getAuthor() { return metaAuthor; }
void setAuthor(String v) { metaAuthor = v; }
String getDate() { return metaDate; }
void setDate(String v) { metaDate = v; }
String getCopyright() { return metaCopyright; }
void setCopyright(String v) { metaCopyright = v; }
String getTrademark() { return metaTrademark; }
void setTrademark(String v) { metaTrademark = v; }
String getCorporation() { return metaCorporation; }
void setCorporation(String v) { metaCorporation = v; }
String getOrigin() { return metaOrigin; }
void setOrigin(String v) { metaOrigin = v; }
String getBirthDate() { return metaBirthDate; }
void setBirthDate(String v) { metaBirthDate = v; }
int getScienceRating() { return metaScienceRating; }
void setScienceRating(int v) { metaScienceRating = v; }
String getNationalSchedule() { return metaNationalSchedule; }
void setNationalSchedule(String v) { metaNationalSchedule = v; }
void configure() {}
< A USB host controller (root hub) from a named vendor at a generation. >
SLUSBDevice controller(String vendor, String genName, int ports) {
SLUSBDevice d = new SLUSBDevice();
d.configureByName(vendor, controllerPart(vendor), genName, d.UC_CONTROLLER);
d.setPorts(ports);
return d;
}
< A USB hub from a named vendor. >
SLUSBDevice hub(String vendor, String genName, int ports) {
SLUSBDevice d = new SLUSBDevice();
d.configureByName(vendor, vendor + " Hub", genName, d.UC_HUB);
d.setPorts(ports);
return d;
}
< A HID device (keyboard/mouse), typically USB 2.0 Type-A. >
SLUSBDevice hid(String vendor, String part) {
SLUSBDevice d = new SLUSBDevice();
d.configure(vendor, part, d.USB_2_0, d.UC_HID);
return d;
}
< A mass-storage flash drive at a given generation. >
SLUSBDevice flashDrive(String vendor, String part, String genName) {
SLUSBDevice d = new SLUSBDevice();
d.configureByName(vendor, part, genName, d.UC_MASS);
return d;
}
boolean knownController(String vendor) {
return vendor == "Intel" || vendor == "AMD" || vendor == "ASMedia"
|| vendor == "VIA" || vendor == "Renesas" || vendor == "Texas Instruments"
|| vendor == "Fresco Logic";
}
String controllerPart(String vendor) {
if (vendor == "Intel") { return "xHCI Root Hub"; }
if (vendor == "AMD") { return "xHCI Controller"; }
if (vendor == "ASMedia") { return "ASM3242"; }
if (vendor == "Renesas") { return "uPD720201"; }
if (vendor == "VIA") { return "VL805"; }
return vendor + " xHCI";
}
}