drivers/accessibility/speakup/synth.c
Source file repositories/reference/linux-study-clean/drivers/accessibility/speakup/synth.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/accessibility/speakup/synth.c- Extension
.c- Size
- 13388 bytes
- Lines
- 578
- Domain
- Driver Families
- Bucket
- drivers/accessibility
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/ctype.hlinux/fs.hlinux/mm.hlinux/errno.hlinux/ioport.hlinux/interrupt.hlinux/delay.hlinux/kmod.hlinux/jiffies.hlinux/uaccess.hlinux/sched.hlinux/timer.hlinux/kthread.hspk_priv.hspeakup.hserialio.h
Detected Declarations
function _spk_do_catch_upfunction spk_do_catch_upfunction spk_do_catch_up_unicodefunction spk_synth_flushfunction spk_synth_get_indexfunction spk_synth_is_alive_nopfunction spk_synth_is_alive_restartfunction thread_wake_upfunction synth_startfunction spk_do_flushfunction synth_writefunction synth_utf8_getfunction synth_writeufunction synth_printffunction synth_putwcfunction synth_putwc_sfunction synth_putwsfunction synth_putws_sfunction spk_reset_index_countfunction synth_supports_indexingfunction synth_insert_next_indexfunction spk_get_index_countfunction synth_request_regionfunction synth_release_regionfunction synth_initfunction do_synth_initfunction synth_releasefunction synth_addfunction list_for_each_entryfunction synth_removeexport speakup_infoexport spk_do_catch_upexport spk_do_catch_up_unicodeexport spk_synth_flushexport spk_synth_get_indexexport spk_synth_is_alive_nopexport spk_synth_is_alive_restartexport synth_printfexport synth_putwcexport synth_putwc_sexport synth_putwsexport synth_putws_sexport synth_request_regionexport synth_release_regionexport synth_addexport synth_removeexport synth_current
Annotated Snippet
if (speakup_info.flushing) {
speakup_info.flushing = 0;
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
synth->flush(synth);
continue;
}
if (!unicode)
synth_buffer_skip_nonlatin1();
if (synth_buffer_empty()) {
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
break;
}
ch = synth_buffer_peek();
set_current_state(TASK_INTERRUPTIBLE);
full_time_val = full_time->u.n.value;
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
if (ch == '\n')
ch = synth->procspeech;
if (unicode)
ret = synth->io_ops->synth_out_unicode(synth, ch);
else
ret = synth->io_ops->synth_out(synth, ch);
if (!ret) {
schedule_timeout(msecs_to_jiffies(full_time_val));
continue;
}
if (time_after_eq(jiffies, jiff_max) && (ch == SPACE)) {
spin_lock_irqsave(&speakup_info.spinlock, flags);
jiffy_delta_val = jiffy_delta->u.n.value;
delay_time_val = delay_time->u.n.value;
full_time_val = full_time->u.n.value;
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
if (synth->io_ops->synth_out(synth, synth->procspeech))
schedule_timeout(
msecs_to_jiffies(delay_time_val));
else
schedule_timeout(
msecs_to_jiffies(full_time_val));
jiff_max = jiffies + jiffy_delta_val;
}
set_current_state(TASK_RUNNING);
spin_lock_irqsave(&speakup_info.spinlock, flags);
synth_buffer_getc();
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
}
synth->io_ops->synth_out(synth, synth->procspeech);
}
void spk_do_catch_up(struct spk_synth *synth)
{
_spk_do_catch_up(synth, 0);
}
EXPORT_SYMBOL_GPL(spk_do_catch_up);
void spk_do_catch_up_unicode(struct spk_synth *synth)
{
_spk_do_catch_up(synth, 1);
}
EXPORT_SYMBOL_GPL(spk_do_catch_up_unicode);
void spk_synth_flush(struct spk_synth *synth)
{
synth->io_ops->flush_buffer(synth);
synth->io_ops->synth_out(synth, synth->clear);
}
EXPORT_SYMBOL_GPL(spk_synth_flush);
unsigned char spk_synth_get_index(struct spk_synth *synth)
{
return synth->io_ops->synth_in_nowait(synth);
}
EXPORT_SYMBOL_GPL(spk_synth_get_index);
int spk_synth_is_alive_nop(struct spk_synth *synth)
{
synth->alive = 1;
return 1;
}
EXPORT_SYMBOL_GPL(spk_synth_is_alive_nop);
int spk_synth_is_alive_restart(struct spk_synth *synth)
{
if (synth->alive)
return 1;
if (synth->io_ops->wait_for_xmitr(synth) > 0) {
/* restart */
synth->alive = 1;
synth_printf("%s", synth->init);
return 2; /* reenabled */
}
Annotation
- Immediate include surface: `linux/types.h`, `linux/ctype.h`, `linux/fs.h`, `linux/mm.h`, `linux/errno.h`, `linux/ioport.h`, `linux/interrupt.h`, `linux/delay.h`.
- Detected declarations: `function _spk_do_catch_up`, `function spk_do_catch_up`, `function spk_do_catch_up_unicode`, `function spk_synth_flush`, `function spk_synth_get_index`, `function spk_synth_is_alive_nop`, `function spk_synth_is_alive_restart`, `function thread_wake_up`, `function synth_start`, `function spk_do_flush`.
- Atlas domain: Driver Families / drivers/accessibility.
- Implementation status: integration implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.