modus
Menu
On this page

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. 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. 2. It lends the region a second time and sends Attach again, which the service refuses, and a Start with a value, which it refuses. It sends Start, and asks for the tone at 500 ms after the frame 0 of the stream.
  3. 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. 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. 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

FactValue
KindModules with an entry
Sourcesrc/modules/demonstrations/tone
Boot imageyes: in the boot image, 49152 bytes in this build
Build settingsnone: the defaults of the source
Importsnone
Imported bynone

Neighbours

It imports no module, and no module imports it. The module graph shows it with the other modules that have no edge.

Exports

ExportWhat it does
entry()

entry

entry()
Form
The entry of the module: one parameter, an address, fixed by the contract.
Source
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

WhatValueAs the root service says
GrantsIt 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 setnone
Budget that it asks for
  • working memory pages 204
  • pages of its threads 72
  • pages of the pictures of its window 0
  • pages of the module and its imports from the files of the build
  • processes 1
  • threads 1
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).