Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ1093
Page ↗
Q1093FWIntelASIC interview problem

Bounded MMIO command driver

TechniquesFirmware & ValidationFirmware / Validationbounded mmio command driver
DifficultyMedium
TopicFirmware & Validation
LanguageC
Requirements4 checkpoints
01

Problem

A test engine starts through one command register and reports DONE or ERROR in a status register. Write a C driver that issues one command and polls with a fixed bound.

Starting declarationC
enum rc { OK, BUSY, HWERR, TIMEOUT };
enum rc run_cmd(volatile uint32_t *cmd,
volatile uint32_t *status, uint32_t value);
// status bits: BUSY=1,DONE=2,ERROR=4; DONE/ERROR W1C

Example input and output

Use this case to check your interpretation
Input
The first status-register read has BUSY set.
Output
Return BUSY with zero writes to cmd or status.
Explanation

The driver checks the initial BUSY bit before clearing stale flags or issuing the command, so it exits without modifying MMIO.

02

Requirements (4)

  • If the first status read has BUSY set, return BUSY without writing either register.
  • Clear old DONE and ERROR by writing bits 2|4 to status, then write value to cmd exactly once.
  • Read status at most 100 times; ERROR has priority over DONE if both are observed.
  • Return HWERR on ERROR, OK on DONE, and TIMEOUT after 100 reads with neither; do no extra MMIO after returning.