Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions
n2.c File Reference
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/capability.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/in.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/moduleparam.h>
#include <linux/netdevice.h>
#include <linux/hdlc.h>
#include <asm/io.h>
#include "hd64570.h"
#include "hd64570.c"

Go to the source code of this file.

Data Structures

struct  port_s
 
struct  card_s
 

Macros

#define pr_fmt(fmt)   KBUILD_MODNAME ": " fmt
 
#define DEBUG_RINGS
 
#define USE_WINDOWSIZE   16384
 
#define USE_BUS16BITS   1
 
#define CLOCK_BASE   9830400 /* 9.8304 MHz */
 
#define MAX_PAGES   16 /* 16 RAM pages at max */
 
#define MAX_RAM_SIZE   0x80000 /* 512 KB */
 
#define MAX_RAM_SIZE   (MAX_PAGES * USE_WINDOWSIZE)
 
#define N2_IOPORTS   0x10
 
#define NEED_DETECT_RAM
 
#define NEED_SCA_MSCI_INTR
 
#define MAX_TX_BUFFERS   10
 
#define N2_PCR   0
 
#define PCR_RUNSCA   1 /* Run 64570 */
 
#define PCR_VPM   2 /* Enable VPM - needed if using RAM above 1 MB */
 
#define PCR_ENWIN   4 /* Open window */
 
#define PCR_BUS16   8 /* 16-bit bus */
 
#define N2_BAR   2
 
#define N2_PSR   4
 
#define WIN16K   0x00
 
#define WIN32K   0x20
 
#define WIN64K   0x40
 
#define PSR_WINBITS   0x60
 
#define PSR_DMAEN   0x80
 
#define PSR_PAGEBITS   0x0F
 
#define N2_MCR   6
 
#define CLOCK_OUT_PORT1   0x80
 
#define CLOCK_OUT_PORT0   0x40
 
#define TX422_PORT1   0x20
 
#define TX422_PORT0   0x10
 
#define DSR_PORT1   0x08
 
#define DSR_PORT0   0x04
 
#define DTR_PORT1   0x02
 
#define DTR_PORT0   0x01
 
#define sca_reg(reg, card)
 
#define sca_in(reg, card)   inb(sca_reg(reg, card))
 
#define sca_out(value, reg, card)   outb(value, sca_reg(reg, card))
 
#define sca_inw(reg, card)   inw(sca_reg(reg, card))
 
#define sca_outw(value, reg, card)   outw(value, sca_reg(reg, card))
 
#define port_to_card(port)   ((port)->card)
 
#define log_node(port)   ((port)->log_node)
 
#define phy_node(port)   ((port)->phy_node)
 
#define winsize(card)   (USE_WINDOWSIZE)
 
#define winbase(card)   ((card)->winbase)
 
#define get_port(card, port)
 

Typedefs

typedef struct port_s port_t
 
typedef struct card_s card_t
 

Functions

 module_init (n2_init)
 
 module_exit (n2_cleanup)
 
 MODULE_AUTHOR ("Krzysztof Halasa <khc@pm.waw.pl>")
 
 MODULE_DESCRIPTION ("RISCom/N2 serial port driver")
 
 MODULE_LICENSE ("GPL v2")
 
 module_param (hw, charp, 0444)
 
 MODULE_PARM_DESC (hw,"io,irq,ram,ports:io,irq,...")
 

Macro Definition Documentation

#define CLOCK_BASE   9830400 /* 9.8304 MHz */

Definition at line 47 of file n2.c.

#define CLOCK_OUT_PORT0   0x40

Definition at line 88 of file n2.c.

#define CLOCK_OUT_PORT1   0x80

Definition at line 87 of file n2.c.

#define DEBUG_RINGS

Definition at line 43 of file n2.c.

#define DSR_PORT0   0x04

Definition at line 92 of file n2.c.

#define DSR_PORT1   0x08

Definition at line 91 of file n2.c.

#define DTR_PORT0   0x01

Definition at line 94 of file n2.c.

#define DTR_PORT1   0x02

Definition at line 93 of file n2.c.

#define get_port (   card,
  port 
)
Value:
((card)->ports[port].valid ? \
&(card)->ports[port] : NULL)

Definition at line 147 of file n2.c.

#define log_node (   port)    ((port)->log_node)

Definition at line 143 of file n2.c.

#define MAX_PAGES   16 /* 16 RAM pages at max */

Definition at line 48 of file n2.c.

#define MAX_RAM_SIZE   0x80000 /* 512 KB */

Definition at line 52 of file n2.c.

#define MAX_RAM_SIZE   (MAX_PAGES * USE_WINDOWSIZE)

Definition at line 52 of file n2.c.

#define MAX_TX_BUFFERS   10

Definition at line 57 of file n2.c.

#define N2_BAR   2

Definition at line 72 of file n2.c.

#define N2_IOPORTS   0x10

Definition at line 54 of file n2.c.

#define N2_MCR   6

Definition at line 86 of file n2.c.

#define N2_PCR   0

Definition at line 64 of file n2.c.

#define N2_PSR   4

Definition at line 76 of file n2.c.

#define NEED_DETECT_RAM

Definition at line 55 of file n2.c.

#define NEED_SCA_MSCI_INTR

Definition at line 56 of file n2.c.

#define PCR_BUS16   8 /* 16-bit bus */

Definition at line 68 of file n2.c.

#define PCR_ENWIN   4 /* Open window */

Definition at line 67 of file n2.c.

#define PCR_RUNSCA   1 /* Run 64570 */

Definition at line 65 of file n2.c.

#define PCR_VPM   2 /* Enable VPM - needed if using RAM above 1 MB */

Definition at line 66 of file n2.c.

#define phy_node (   port)    ((port)->phy_node)

Definition at line 144 of file n2.c.

#define port_to_card (   port)    ((port)->card)

Definition at line 142 of file n2.c.

#define pr_fmt (   fmt)    KBUILD_MODNAME ": " fmt

Definition at line 19 of file n2.c.

#define PSR_DMAEN   0x80

Definition at line 81 of file n2.c.

#define PSR_PAGEBITS   0x0F

Definition at line 82 of file n2.c.

#define PSR_WINBITS   0x60

Definition at line 80 of file n2.c.

#define sca_in (   reg,
  card 
)    inb(sca_reg(reg, card))

Definition at line 137 of file n2.c.

#define sca_inw (   reg,
  card 
)    inw(sca_reg(reg, card))

Definition at line 139 of file n2.c.

#define sca_out (   value,
  reg,
  card 
)    outb(value, sca_reg(reg, card))

Definition at line 138 of file n2.c.

#define sca_outw (   value,
  reg,
  card 
)    outw(value, sca_reg(reg, card))

Definition at line 140 of file n2.c.

#define sca_reg (   reg,
  card 
)
Value:
(0x8000 | (card)->io | \
((reg) & 0x0F) | (((reg) & 0xF0) << 6))

Definition at line 135 of file n2.c.

#define TX422_PORT0   0x10

Definition at line 90 of file n2.c.

#define TX422_PORT1   0x20

Definition at line 89 of file n2.c.

#define USE_BUS16BITS   1

Definition at line 46 of file n2.c.

#define USE_WINDOWSIZE   16384

Definition at line 45 of file n2.c.

#define WIN16K   0x00

Definition at line 77 of file n2.c.

#define WIN32K   0x20

Definition at line 78 of file n2.c.

#define WIN64K   0x40

Definition at line 79 of file n2.c.

#define winbase (   card)    ((card)->winbase)

Definition at line 146 of file n2.c.

#define winsize (   card)    (USE_WINDOWSIZE)

Definition at line 145 of file n2.c.

Typedef Documentation

typedef struct card_s card_t
typedef struct port_s port_t

Function Documentation

MODULE_AUTHOR ( "Krzysztof Halasa <khc@pm.waw.pl>"  )
MODULE_DESCRIPTION ( "RISCom/N2 serial port driver )
module_exit ( n2_cleanup  )
module_init ( n2_init  )
MODULE_LICENSE ( "GPL v2 )
module_param ( hw  ,
charp  ,
0444   
)
MODULE_PARM_DESC ( hw  ,
io,
irq  ,
ram  ,
ports:io  ,
irq  ,
..."   
)