week 10 linux device drivers Flashcards

to learn

1
Q

what is a device driver

A

View from user space:
Have special file in /dev associated with it, together with five
systems calls:
open: make device available
read: read from device
write: write to device
ioctl: Perform operations on device (optional)
close: make device unavailable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what are the five systems calls in a device driver.

A

open
read
write
ioctl
close

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what is the open system call

A

make device available

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what is the read system call

A

read from device

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what is the write system call

A

write to device

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what is the ioctl system call

A

Perform operations on device (optional)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what is the close system call

A

makes device unavailable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

for device drivers there is one optional system call, what is it?

A

ioctl -> Perform operations on device (optional)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

how can you list the the available options of a file in linux on the kernel side

A

linux/fs.h lists all available operations on files
Each file may have functions associated with it which are called
when corresponding system calls are made

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what does kernel also keep track of

A

Physical dependencies between devices ,Example:
devices connected to a USB-hub
Buses: Channels between processor and one or more devices.
Can be either physical (eg pci, usb), or logical
Classes: Sets of devices of the same type, eg keyboards, mice

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what is physical dependencies between devices in a kernel

A

. Example:
devices connected to a USB-hub

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what are buses in a kernel

A

Channels between processor and one or more devices.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what are classes in a kernel

A

Classes: Sets of devices of the same type, eg keyboards, mice

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what are the the types of buses in a a kernel

A

Can be either physical (eg pci, usb), or logical

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

how to handle interrupts in a device driver

A

Normal cycle of interrupt handling for devices: Device sends interrupt
CPU selects appropriate interrupt handler
Interrupt handler processes interrupt
Two important tasks to be done:
Data to be transferred to/from device
Waking up processes which wait for data transfer to be finished Interrupt handler clears interrupt bit of device
Necessary for next interrupt to arrive

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

describe the 2 halves of interrupt processing:

A

Interrupt processing time must be as short as possible
Data transfer fast, rest of processing slow
⇒ Separate interrupt processing in two halves:
Top Half is called directly by interrupt handler
Only transfers data between device and appropriate kernel
buffer and schedules software interrupt to start Bottom half
Bottom half still runs in interrupt context and does the rest of
the processing (eg working through the protocol stack, and
waking up processes)

17
Q

describe top half in interrupt processing

A

Top Half is called directly by interrupt handler
Only transfers data between device and appropriate kernel
buffer and schedules software interrupt to start Bottom half

18
Q

describe bottom half in interrupt processing

A

Bottom half still runs in interrupt context and does the rest of
the processing (eg working through the protocol stack, and
waking up processes)