logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

you will introduce a device driver into the Minix system that satisfies the stated requirements.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Project #2 – Device Drivers in Minix

Overview

For the next project, you will introduce a device driver into the Minix system that satisfies the stated requirements. This project is worth 50 points.

Getting Started

For this project, you may start from the “clean” version of Minix on absaroka in /home/605412/ or you may continue to build the new functionality in your image used in Project 1.

 

Here are some instructions to get an initial shell of the device driver in place. There are some instructions on the Minix 3 developer’s site describing how to add a very simple device driver to the system, so that is a good place to start. However, instead of adding a ‘hello’ driver to the system, use the current ‘hello’ driver as your starting place:

 

 

 

Here, edit the Makefile to change “hello” to “homework”, and change the ‘hello’ directory to ‘homework’; then go into the homework directory and change hello.c to homework.c.

 

 

 

And, here, also edit the Makefile to change “hello” to “homework” everywhere. Then, you can test building it:

 

 

 

 

 

 

 

At this point, do some general cleanup (change or delete the hello.h file, and perhaps change all instances of ‘hello’ in your homework.c file to ‘homework’) to get ready for your changes.

Next, you need to make sure your driver is in the system configuration. Edit the /etc/system.conf file (this time, not in /usr/src) as discussed in the Minix 3 device driver development page (http://wiki.minix3.org/doku.php? id=developersguide:start); again, you can copy the entry in that file for ‘hello’ and paste it at the end, changing ‘hello’ to ‘homework’. The other fields in that entry can be left as is.

Then, you need to create a character special device file that provides the user mode entry into your device driver. Create it with the ‘mknod’ command as specified in the documentation; and use major device number 65 (which appears to be otherwise unused).

 

 

 

 

 

Then, you can start your new service using the ‘service’ command:

 

 

 

With this in place, you can then start to modify the driver according to the homework requirements.

 

Objectives

After completion of this project, you will be able to:

 

 

 

Build a character device driver in Minix

Install the device driver into a running Minix system

Exercise the capability of the device driver

 

Deliverables

There are 2 deliverables that you must submit to successfully complete this project, both within a modified Minix system.

The first is a new device driver within the Minix system, and the second are some small user-level applications that will exercise the device driver. The details on these follows.

Device Driver Requirements

In this exercise, you shall add a device driver to the Minix operating system.

a. This driver shall be called ‘homework’. One of the nice things about Minix is it has the ‘reincarnation’ server, so when your server is built and written, you do not have to reboot your system to start and test your driver. You can use the “service” commands as described above and in the Minix 3 developer site.

b. This shall be a driver for a character device which stores an integer stored in one of five slots when write() is called, and will return the integer when read() is called.

i. For now, if no integer has been written to the device, the read() call return whatever is in the slot (be sure to initialize the slots to 0). Future assignments will differentiate between the slot containing 0 and an uninitialized slot, so you may want to put that logic in now (see HIOCCLEARSLOT below).

c. Your driver will support the ioctl() call. Three ioctl commands should be supported:

i. HIOCSLOT shall tak an argument that specifies which slot should be used. Only integers between 0 and 4 (inclusive) should be accepted; if the argument is outside the range, print an error to the console and make sure the system call returns the proper error code.

 

 

 

ii. HIOCCLEARSLOT should set the current slot to ‘invalid’ and set the value of the slot to 0.

iii. HIOCGETSLOT should return the current slot index (should be between 0 and 4). If the current slot is not valid, a return code of

-1 should be issued.

d. What should the open() and close() calls do? Implement them and clearly comment what they do.

e. Write some test programs (to read, write, and select/clear slots). Sample test programs to get you started are on absaroka in the /home/ 605412/Project2 directory. Make sure you can compile your test programs with no errors. The test programs should open the device via the character special device file that you create called “/dev/homework”.

f. Use the forums! Not only should you use the forums if you get stuck, but also share some of your significant successes (when you get unstuck) to help out your fellow students. Aside from sharing source code (posting small test program code is acceptable), you are allowed to collaborate with your fellow students through the forums as much as needed for this assignment.

 

 

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

610 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

833 Answers

Hire Me
expert
Husnain SaeedComputer science

777 Answers

Hire Me
expert
Atharva PatilComputer science

811 Answers

Hire Me

Get Free Quote!

275 Experts Online