Machine-translated by Google. Questions are authored in English.
Top

Device Drivers Questions and Answers

41.

A driver works when called from one task and corrupts data when called from two. The cause is almost certainly

Answer: A

A fault that requires two callers to appear is by definition a concurrency fault, and driver state in file statics is where to look. Adding a mutex round the entry points confirms the diagnosis quickly even if it is not the final design.

Please log in or register to report this question.

Answer: B

Reading the buffer on the wrong edge of the completion flag, or before a DMA controller's final write has drained, leaves the last element stale. A barrier or the correct completion condition is the fix, and a wholly wrong address or interrupt would fail far more visibly.

Please log in or register to report this question.

43.

A driver's register write appears to have no effect, and reading the register back gives the old value. The first thing to check is

Answer: C

Correct answer: whether the peripheral's clock is enabled

A peripheral with no clock does not respond at all: writes are discarded and reads return whatever the bus leaves, which commonly looks like the old value. Enabling the clock is the first line of most initialisation routines and the first thing to check when a register appears not to exist.

Please log in or register to report this question.

Answer: D

Correct answer: both the assertion and the reason are true and the reason explains the assertion

Both are true and the reason gives the mechanism. Connecting a peripheral’s output to its own input means the data returned is known, so a failure can only be in the driver or the peripheral configuration. Bringing in the real device adds its own wiring, timing and configuration as possible causes, and debugging several at once is far harder.

Please log in or register to report this question.

Answer: A

Callbacks do avoid a task blocked per device, which is a real advantage in an event-driven design, but they very frequently run in interrupt context and that is their chief hazard. The reason is the opposite of the truth.

Please log in or register to report this question.

Answer: B

Raw counts keep the driver ignorant of the sensor's calibration, which is sometimes right, since the calibration may be a product-level matter. Where the conversion is a property of the device it belongs in the driver, and the choice has to be made deliberately.

Please log in or register to report this question.

Answer: C

Correct answer: clearing the device's interrupt flag

Acknowledging the device is exactly what a handler must do, and doing it promptly stops the interrupt reasserting. The other three all take an unbounded or long time - waiting on a bus, writing to a console, allocating memory - and any of them in a handler risks missing the next interrupt or hanging outright.

Please log in or register to report this question.

Answer: D

Correct answer: against a hardware abstraction layer rather than raw registers

Writing against an abstraction layer confines the device-specific detail to the layer, so porting means providing the layer for the new part rather than rewriting the driver. Assembler, published register addresses and file-scope statics all tie the code to one part in ways the port must undo.

Please log in or register to report this question.

Answer: A

A missing optional sensor should degrade the product rather than prevent it starting, and only the application knows which devices are essential. A driver that decides to halt takes that judgement away from the layer entitled to make it.

Please log in or register to report this question.

Answer: B

A device that never sets the bit, because it is absent or unclocked, hangs the system for ever otherwise. A timeout turns an unbounded hang into a reported failure, which is the difference between a diagnosable product and a dead one.

Please log in or register to report this question.

Loading…
Tags: Device Drivers Questions and Answers || Device Drivers MCQ Questions and Answers || Device Drivers GK Questions and Answers || Device Drivers GK MCQ Questions || Device Drivers Multiple Choice Questions and Answers || Device Drivers GK || GK on Device Drivers || Embedded Systems Questions and Answers || Embedded Systems MCQ Questions and Answers || Embedded Systems GK Questions and Answers || GK on Embedded Systems