The entry tone
A tone of 440 Hz through the sound service, at a time that the process names. The design: The timed stream, and sound through virtio-snd in the repository.
Who uses it. A principal starts it from the console: start("tone"). Its grant Sound_Device gives it the stream ring of the sound service, which the root service starts for it; it is the one process that plays while it runs, so a second start("tone") is refused.
What it does, in order:
- 1. It makes a sample region of REGION_PAGES pages from its own budget, writes 500 ms of a tone of 440 Hz in it, and lends it to the sound service with
Attach, with the right Read only. - 2. It lends the region a second time and sends
Attachagain, which the service refuses, and aStartwith a value, which it refuses. It sendsStart, and asks for the tone at 500 ms after the frame 0 of the stream. - 3. It sends six records that the service must refuse, and checks the status and the error record of each: over the tone, late, too far, an unknown format, too many frames, and frames past the region.
- 4. It waits for the completion of the tone, and checks that the tone played at the frame of its time. The tool then finds the tone at that frame in the output of the machine.
- 5. It keeps the stream until it is stopped: the device plays silence.
What a reader sees. No window: its lines on the log, each case ending with "as it must", and the tone on the sound output of the machine.
The stop: with no stream ring, no sample region, a refused Attach or Start, or a case that does not get its refusal, it writes the reason on the log and stops with Failed.
tone module with an entry
- Hash
6d65a6f4a108342c3a522142273dcd1ff1e2cd0e3c7c4851a5b73e5631d665cf- Size
49152 bytes- Exports
0- Imports
0- Imported by
0- License
- MIT
A tone of 440 Hz through the sound service, at a time that the process names
| Fact | Value |
|---|---|
| Kind | Modules with an entry |
| Source | src/modules/demonstrations/tone |
| Boot image | yes: in the boot image, 49152 bytes in this build |
| Build settings | none: the defaults of the source |
| Imports | none |
| Imported by | none |
Neighbours
It imports no module, and no module imports it. The module graph shows it with the other modules that have no edge.
Exports
| Export | What it does |
|---|---|
entry() |
entry
entry()
- Form
- The entry of the module: one parameter, an address, fixed by the contract.
src/modules/demonstrations/tone/main.odin:197
Read from the source of the module, as the build reads it to describe the exports (tools/modustool/build/describe.odin).
What the root service gives it
| What | Value | As the root service says |
|---|---|---|
| Grants | It plays a tone through the sound service of the sound device, its one client while it runs. See: The timed stream, and sound through virtio-snd in the repository | |
| Other terms of its start grant set | none | |
| Budget that it asks for |
| What the process needs besides its region: the same as counters. |
The start grant set is read from start_grant_sets in src/modules/system/root/start_grant_sets.odin. The stated budget is read from the constant MODULE_BUDGET of the source of the module (its line); the build adds the counted parts and writes the sum in the module (tools/modustool/build/budget_count.odin); the root service accepts it up to the largest budget of a process, and adds the limits of processor time and of log records (src/modules/system/root/budgets.odin).
