Google
  Web www.spinics.net

AT91RM9200 IrDA driver problem!!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Hi!everybody,I am using HSDL-3201 irda adapter to communicate ,I have written  its driver under 
AT91RM9200DK according to ep7211_ir.c. I want to use irtty+dongle style.In /drivers/net/irda/ directory,I add its driver like the following,additionally I add "IRDA_AT91RM9200_DONGLE=13"in the "net/irda/irda.h".Now I have compiled it successfully but I don't know if HSDL-3201 can work.In "/proc/devices"which device is it linking to .Can anyone give me some advice?I will appreciate it very much! 
 
#include <linux/module.h>#include <linux/delay.h>#include <linux/tty.h>#include <linux/init.h>#include <linux/spinlock.h>
#include <net/irda/irda.h>#include <net/irda/irda_device.h>
#include <asm/arch-at91rm9200/at91rm9200_usart.h>#include <asm/arch-at91rm9200/gpio.h>
#define MIN_DELAY 25      /* 15 us, but wait a little more to be sure */#define MAX_DELAY 10000   /* 1 ms */
static void at91_ir_open(dongle_t *self, struct qos_info *qos);static void at91_ir_close(dongle_t *self);static int  at91_ir_change_speed(struct irda_task *task);static int  at91_ir_reset(struct irda_task *task);
static DEFINE_SPINLOCK(at91_lock);
static struct dongle_reg dongle = { .type = IRDA_AT91RM9200_DONGLE, .open = at91_ir_open, .close = at91_ir_close, .reset = at91_ir_reset, .change_speed = at91_ir_change_speed, .owner = THIS_MODULE,};
static void at91_ir_open(dongle_t *self, struct qos_info *qos){ unsigned int  flags;
 spin_lock_irqsave(&at91_lock, flags);
 /* Turn on the SIR encoder. */ at91_sys_write(AT91_US_CR+AT91_US_RXEN,AT91_PIN_PA22); at91_sys_write(AT91_US_CR+AT91_US_TXEN,AT91_PIN_PA23); at91_sys_write(AT91_US_MR+AT91_US_USMODE_IRDA,AT91_PIN_PA22); at91_sys_write(AT91_US_MR+AT91_US_USMODE_IRDA,AT91_PIN_PA23); at91_sys_write(AT91_US_IF,AT91_PIN_PA22);        at91_sys_write(AT91_US_IF,AT91_PIN_PA23);
 
 /* XXX: We should disable modem status interrupts on the first  UART (interrupt #14). */
 spin_unlock_irqrestore(&at91_lock, flags);}
static void at91_ir_close(dongle_t *self){ unsigned int  flags;
 spin_lock_irqsave(&at91_lock, flags);
 /* Turn off the SIR encoder. */  at91_sys_write(AT91_US_CR+AT91_US_RXDIS,AT91_PIN_PA22); at91_sys_write(AT91_US_CR+AT91_US_TXDIS,AT91_PIN_PA23); /* XXX: If we've disabled the modem status interrupts, we should  reset them back to their original state. */
 spin_unlock_irqrestore(&at91_lock, flags);}
/* * Function at91_ir_change_speed (task) * *    Change speed of the AT91 I/R port. We don't really have to do anything *    for the AT91 as long as the rate is being changed at the serial port *    level. */static int at91_ir_change_speed(struct irda_task *task){ irda_task_next_state(task, IRDA_TASK_DONE); return 0;}
/* * Function at91_ir_reset (task) * *      Reset the AT91 I/R. We don't really have to do anything. * */static int at91_ir_reset(struct irda_task *task){ irda_task_next_state(task, IRDA_TASK_DONE); return 0;}
/* * Function at91_ir_init(void) * *    Initialize AT91 I/R module * */static int __init at91_ir_init(void){        printk(KERN_INFO "at91rm9200 irda driver loaded!\n"); return irda_device_register_dongle(&dongle);}
/* * Function at91_ir_cleanup(void) * *    Cleanup at91rm9200 I/R module * */static void __exit at91_ir_cleanup(void){ irda_device_unregister_dongle(&dongle);}
MODULE_AUTHOR("STONE <jianzhengzhou@xxxxxxxxxxxx>");MODULE_DESCRIPTION("AT91RM9200 irda driver");MODULE_LICENSE("GPL");MODULE_ALIAS("irda-dongle-13"); /* IRDA_AT91RM9200_IR */  module_init(at91_ir_init);module_exit(at91_ir_cleanup);
 

-------------------------------------------------------------------
谁和你最有缘?你需要改名吗?解开你的怪梦!( http://ad4.sina.com.cn/sina/limeng3/mail_zhuiyu/2007/mail_zhuiyu_20070326.html )

===================================================================
注册新浪2G免费邮箱( http://mail.sina.com.cn/chooseMode.html
-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php

[Site Home]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux ARM Kernel]     [Linux MIPS]     [ECOS]     [Tools]     [DDR & Rambus]     [Monitors]

Powered by Linux