The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problem with read & write EltonSky High Level Programming 11 08-31-2006 02:35 PM
cat: write error: No space left on device igandu UNIX for Dummies Questions & Answers 3 08-10-2006 02:21 AM
how to read or write device files sriram.ec UNIX for Dummies Questions & Answers 1 01-03-2006 05:27 PM
read, write & STDOUT_FILENO.... M3xican High Level Programming 2 07-17-2002 04:41 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-04-2006
sriram.ec sriram.ec is offline
Registered User
  
 

Join Date: Dec 2005
Posts: 22
Smile 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
sriram
  #2 (permalink)  
Old 01-04-2006
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
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.

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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:24 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0