Visit Our UNIX and Linux User Community

how to read and write device registers

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers how to read and write device registers
# 1  
Old 01-04-2006
Bug how to read and write device registers

hello friends,
While in the process of writing device drivers,
i am facing problem in reading and writing device registers.I got base address of those mapped device registers. Can i add offset of those registers to that Base address to get access of those registers or do i have to use readl or writel sort of apis.
thanks in advance
# 2  
Old 01-04-2006
It's bad enough when someone asks a shell scripting question but can't be bothered to mention what computer, what os, what language, etc. But this really takes the cake. Smilie

Some systems have a separate I/O address space with special instructions to access them. Those special instructions are usually encapsulated into routines to be called by the driver. I don't remember the names but readl and writel does not seem to right a bell. However, they might be right for your os. If your computer really maps the registers into memory and you know the address, you probably can do stuff like:

char status;
char *StatusReg = (char *) 0xFF123456;
status = *StatusReg;

I thought that this technique was passť, but maybe your computer uses it. If your device uses a collection of registers and you know the base address where one of them resides, the others are usually right next to them in ascending addresses. And this tends to be true whether the registers are mapped into the same address space as memory, or have an address space of their own. But beware, some registers can be read-only while other might be write-only. If a device has both read-only and write-only registers, it is not unusual for two registers to share the same address.

Previous Thread | Next Thread
Test Your Knowledge in Computers #304
Difficulty: Easy
sed is a stream editor and is used to perform basic text transformations on an input stream (a file or input from a pipeline).
True or False?

10 More Discussions You Might Find Interesting

1. Solaris

Write to 1 failed [No space left on device] Error

Running a installation on Solaris 11 and getting error write to 1 failed If anyone can advise ? ORIGINAL_PATH="${PATH}" # prepend /usr/xpg4/bin to PATH as needed temporaryPath=`expr "${PATH}:" : '\(/usr/xpg4/bin:\)'` if then PATH="/usr/xpg4/bin:${PATH}" seem to have... (6 Replies)
Discussion started by: Mpumi
6 Replies

2. UNIX for Advanced & Expert Users

Sed: couldn't write 1378 items to stdout: No space left on device

Hi , In file first line start with "",when trying to remove using sed i am getting the below error .Please advise sed -e 's///g' -e 's/$]//g' segment1.txt >>segment_m1 sed: couldn't write 1378 items to stdout: No space left on device Thanks, Mohan (1 Reply)
Discussion started by: mohan705
1 Replies

3. Shell Programming and Scripting

Write to 1 failed [No space left on device]

I am getting error in a shell script having a simple date command. Error is " write to 1 failed ". We saw that /tmp folder was 100% full. When we cleared some space in /tmp folder then script worked fine. Why does date command(or any other command) require space in /tmp folder? Which settings... (6 Replies)
Discussion started by: mahish20
6 Replies

4. Solaris

visudo: write error: No space left on device

Hi All, This is Sandeep Gupta, I am facing a problem with sudo command. Whenever i am executing the command "visudo" i am getting the error "visudo: write error: No space left on device". but i have checked on my Solaris Box everything is ok, i have enough free space on my box, and also... (13 Replies)
Discussion started by: Sandeepgupta
13 Replies

5. Debian

Write permission for USB device

Hello, I need to run an application in wine that requires write permission to a USB device. Wine users must not have root privileges. On FreeBSD this could be accomplished by adding the user to the wheel group but I am using Debian 6.0. From looking at the passwd file it is not obvious what... (6 Replies)
Discussion started by: snorkack59
6 Replies

6. Hardware

how to write data into a device file?

Hi, I am working in device drivers. I am new to device drivers. i have invoked chardev.c. the driver is insmoded. now i want to write something into this and i want to look what i have written. but i don't know how to write and see. please help me (0 Replies)
Discussion started by: boidi
0 Replies

7. IP Networking

read/write,write/write lock with smbclient fails

Hi, We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies

8. Shell Programming and Scripting

Find all files with group read OR group write OR user write permission

I need to find all the files that have group Read or Write permission or files that have user write permission. This is what I have so far: find . -exec ls -l {} \; | awk '/ {print $1 " " $3 " " $4 " " $9}' It shows me all files where group read = true, group write = true... (5 Replies)
Discussion started by: shunter63
5 Replies

9. UNIX for Dummies Questions & Answers

cat: write error: No space left on device

I am trying to create new files under my directory...but i getting the following message... cat: write error: No space left on device How do we handle this error. I am not getting this error when I login as the super user (3 Replies)
Discussion started by: igandu
3 Replies

10. UNIX for Dummies Questions & Answers

how to read or write device files

hi everybody, i am working in device drivers.As a beginner to this field ,i dont know how to read or write device files. Will copy_to_user and copy_from_user help me? I have created a device file using mknod command .Can anybody help me in this regard :confused thanks in advance sriram (1 Reply)
Discussion started by:
1 Replies

Featured Tech Videos