Hi!
Even though my problem isn't concerning realtime yet, i hope that you will be able to 
help out. 
I have that some of you have maked some programs accessing IO, and thats where my 
problem is right now.
I am trying to make a realtime device driver ARCNET. The project is in its early 
stages and i just start out with trying to make a device driver then later on, make it 
realtime.
But it is givin me some problems when i try to write/read to the ISA-netcard.
The ISA-card is at adress 0x300 (the card is I/O mapped).
The ISA-card have some internal RAM. 
My problem is like this : i write something to the internal RAM via a data-register, 
then i write "something" else to the data-register, the i read from the internal RAM 
(same adress as i wrote to earlier) (this read should put data into the 
data-register), but i only read the "something" that i temporary wrote to the 
data-register before.
I can easily register my ISA-card to port 0x300.
I have put the source code at the buttom of this email.

Does somebody have any idea to help me out ?

Thanks in advance 
Michael

//source-code starts here 

#ifndef __KERNEL__
#  define __KERNEL__
#endif
#ifndef MODULE
#  define MODULE
#endif

#include <linux/module.h>
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/ioport.h>
#include <linux/errno.h>
#include <asm/system.h>
#include <asm/bitops.h>
#include <asm/io.h>

#define ADRESS 0x300

/* Define adress for most used regsters*/
#define STATUS 0
#define INTMASK 0
#define COMMAND 1
#define DIAG 1
#define ADR_PTR_H 2
#define ADR_PTR_L 3
#define DATA 4
#define SUBADR 5
#define CONFIG 6
#define REG7 7
#define READ 0x80 //NO DMA
#define WRITE 0x0 //NO DMA

/*funktion til at initialisere isa-kortet*/
void init_card(void){
  int value;
  void *io_base;
  io_base = ioremap(ADRESS,8);
  writeb(1,io_base+SUBADR);                   //prepare to write NODEID 
  writeb(241,io_base+REG7);                    //NODEID=241
  writeb(0x7,io_base+DATA);                   //put 0x7 into data-register
  writeb(WRITE,io_base+ADR_PTR_H); //prepare to write
  writeb(0x11,io_base+ADR_PTR_L);     //write to odd adr
  writeb(0xff,io_base+DATA);             // put something else into data-register than 
what was written
  writeb(READ,io_base+ADR_PTR_H);  //prepare to read
  writeb(0x11,io_base+ADR_PTR_L);     //read at adr=0x11 
  value=readb(io_base+DATA);
  printk("First READ gives : %X \n",value);
  iounmap(io_base);
}

int init_module(void){
  int errno;  
  char *nam="test driver";
  request_region(ADRESS,8,nam); 
  init_card();
  return 0;
}

void cleanup_module(void){
  release_region(ADRESS,8);
}





-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/

Reply via email to