Sponsored Content
Top Forums UNIX for Dummies Questions & Answers how to read and write device registers Post 94818 by Perderabo on Wednesday 4th of January 2006 07:58:30 AM
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.
 

10 More Discussions You Might Find Interesting

1. 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: sriram.ec
1 Replies

2. 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

3. 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 '/-...rw..w./ {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

4. 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

5. 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

6. 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

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

8. 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

9. 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

10. 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
MODBUS_WRITE_AND_REA(3) 					 Libmodbus Manual					   MODBUS_WRITE_AND_REA(3)

NAME
modbus_write_and_read_registers - write and read many registers in a single transaction SYNOPSIS
int modbus_write_and_read_registers(modbus_t *ctx, int write_addr, int write_nb, const uint16_t *src, int read_addr, int read_nb, const uint16_t *dest); DESCRIPTION
The modbus_write_and_read_registers() function shall write the content of the write_nb holding registers from the array src to the address write_addr of the remote device then shall read the content of the read_nb holding registers to the address read_addr of the remote device. The result of reading is stored in dest array as word values (16 bits). You must take care to allocate enough memory to store the results in dest (at least nb * sizeof(uint16_t)). The function uses the Modbus function code 0x17 (write/read registers). RETURN VALUE
The modbus_write_and_read_registers() function shall return the number of read registers if successful. Otherwise it shall return -1 and set errno. ERRORS
EMBMDATA Too many registers requested, Too many registers to write SEE ALSO
modbus_read_registers(3) modbus_write_register(3) modbus_write_registers(3) AUTHORS
The libmodbus documentation was written by Stephane Raimbault <stephane.raimbault@gmail.com[1]> NOTES
1. stephane.raimbault@gmail.com mailto:stephane.raimbault@gmail.com libmodbus 3.0.3 05/26/2012 MODBUS_WRITE_AND_REA(3)
All times are GMT -4. The time now is 11:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy