I/O through a digiboard using inb and outb
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
I have a digiboard and have been successful
doing I/O through by using the standard method of creating devices (using
mknod), configuring the ports (using setserial) and then opening the ports
and performing I/O (using open("/dev/ttyS....,) and read() and write()).
However, when I try to use the port
for I/O from within a module in RTAI things do not go so well. Basically,
I am trying to access those ports using memory addresses (which match the
addresses set on the digiboard dipswitches). When load up the RTAI modules
(including this one) , the program does not recognize the port at all.
// some includes up here...
#define COM3 0x100
// the address given to COM3 as per
setserial
static const int BRDL = 0;
// Baud rate divisor register offset
static const int BRDH = 1;
static const int IER = 1;
static const int LCR = 3;
// line control register
static const int LCR_data = 0x03;
// 8 bits,
no parity, 1 stop bit
static const int LCR_access_baudrate = 0x80; //
allow access to the baud rate divisor registers
static const int baud19200high = 0;
static const int baud19200low = 6;
static const int IER_data = 0;
//
disable all COM interrupts
int init_module(void){ ... }
static void sample_timer(int t){ ... }
static void sample_timer_signal(void)
{
outb(LCR_access_baudrate, COM3+LCR);
// COM3: this line causes segmentation fault
outb(baud19200low, COM3+BRDL);
// Setup the baud
rate divisor
outb(baud19200high, COM3+BRDH);
outb(LCR_data, COM3+LCR);
// Access TX and RX data ports
outb(IER_data, COM3+IER);
// Setup interrupt masks
outb(data_byte,
COM3);
// more code down here...
Thanks a lot. Any help would be appreciated.
Raja Hayek.
[Index of Archives]
[Newbies FAQ]
[Linux Kernel Mentors]
[Linux Kernel Development]
[IETF Annouce]
[Git]
[Networking]
[Security]
[Bugtraq]
[Yosemite]
[MIPS Linux]
[ARM Linux]
[Linux RAID]
[Linux SCSI]
[Linux ACPI]