LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 06-24-2014, 12:47 PM   #1
ar1234mo
LQ Newbie
 
Registered: Jun 2014
Posts: 7

Rep: Reputation: Disabled
Serial port module in kernel.


Hi,
I consulted a old thread which talked about this http://www.linuxquestions.org/questi...959/page2.html
I am doing an expermient with TDMA on wifi for which I need access to serial port so that I can log receiving data from Wifi.I figured if I can just have a RTS pin toggled on demand I can do my work.

Reading te post I first recompiled my kernel to modularize serial port.Now if I insmod and serial_core.ko and 8250.ko the serial mode starts working (I test using a loopback test) the dmesg at that time says
"Serial :8250/16550 driver ,4 ports IRQ sharing disbaled"
:serial8250.o: ttyS0 at MMIO 0x70006000 (irq=68) is a Xscale"
SO i assume the port address is 0x70006000
no here is the kernel code I have written.Right now I am just trying to make a square wave to see if I can toggle a pin on deman

Code:
Code:
#include <linux/module.h>
#include <linux/version.h>
#include <linux/types.h>
#include <linux/delay.h>
#include <asm/io.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/serial_reg.h>
#define MOD_NAME "serialmodule"
#define SERIAL_PORT_BASE 0x70006000


int __init enter_module(void)

{

	int n=0;
	int err;



 

 if(!request_region(SERIAL_PORT_BASE,8,MOD_NAME)) 

return 0;

else { 

printk("working");

	 //turn off dlab

  outb((~(UART_LCR_DLAB)), SERIAL_PORT_BASE+UART_LCR);

	 

	 //disable interrupts

    outb((~(UART_IER_MSI|UART_IER_RLSI|UART_IER_THRI|UART_IER_RDI)), SERIAL_PORT_BASE+UART_IER);

			while(n<50)

	{ 

		outb((~(UART_MCR_RTS)), SERIAL_PORT_BASE+UART_MCR);

		

		msleep(500);

		

		

		outb(UART_MCR_RTS, SERIAL_PORT_BASE+UART_MCR);

		msleep(500);

                n++;

	}

	return 0;}

}



void __exit cleanup_module1(void)

{ release_region(SERIAL_PORT_BASE, 8);

}



module_init(enter_module);

module_exit(cleanup_module1);



MODULE_LICENSE("GPL");

MODULE_AUTHOR("ARul Moondra_ISIS");

MODULE_DESCRIPTION("RTS SQAURE WAVE");

This never enters the "else" block also when I rmmod see in dmesg "trying to free nonexistent resource <000000070006000-00000000700060007>"

Can some one help me.I am using trimslice by compulab with kernel 3.1.10

Last edited by ar1234mo; 06-24-2014 at 12:50 PM.
 
Old 06-26-2014, 11:05 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 (pre-systemd)
Posts: 2,176

Rep: Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555
MMIO refers to mapping I/O space to memory space, so that the I/O instructions (inb, outb, etc) are not used. The memory address is not fixed so you can't use a fixed value in your code.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading TV remote signal using custom IR module connected on serial port. hack_tick Linux - Kernel 3 10-07-2011 02:33 PM
Is a USBtty (USB serial port) treated the same as tty (normal serial port) in C? spudgunner Programming 1 11-12-2010 01:19 PM
writing to serial port from kernel DonnoWhatToDo Programming 5 08-17-2010 03:54 AM
[Kernel Module] Accessing the serial port Moepi Programming 1 09-23-2007 03:51 PM
Slackware kernel with Serial port support as module maartenvdbent Slackware 16 06-11-2006 10:54 AM


All times are GMT -5. The time now is 05:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration