Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Enumerations | Functions
via-cuda.c File Reference
#include <stdarg.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/adb.h>
#include <linux/cuda.h>
#include <linux/spinlock.h>
#include <linux/interrupt.h>
#include <asm/macintosh.h>
#include <asm/macints.h>
#include <asm/mac_via.h>
#include <asm/io.h>
#include <linux/init.h>

Go to the source code of this file.

Macros

#define RS   0x200 /* skip between registers */
 
#define B   0 /* B-side data */
 
#define A   RS /* A-side data */
 
#define DIRB   (2*RS) /* B-side direction (1=output) */
 
#define DIRA   (3*RS) /* A-side direction (1=output) */
 
#define T1CL   (4*RS) /* Timer 1 ctr/latch (low 8 bits) */
 
#define T1CH   (5*RS) /* Timer 1 counter (high 8 bits) */
 
#define T1LL   (6*RS) /* Timer 1 latch (low 8 bits) */
 
#define T1LH   (7*RS) /* Timer 1 latch (high 8 bits) */
 
#define T2CL   (8*RS) /* Timer 2 ctr/latch (low 8 bits) */
 
#define T2CH   (9*RS) /* Timer 2 counter (high 8 bits) */
 
#define SR   (10*RS) /* Shift register */
 
#define ACR   (11*RS) /* Auxiliary control register */
 
#define PCR   (12*RS) /* Peripheral control register */
 
#define IFR   (13*RS) /* Interrupt flag register */
 
#define IER   (14*RS) /* Interrupt enable register */
 
#define ANH   (15*RS) /* A-side data, no handshake */
 
#define TREQ   0x08 /* Transfer request (input) */
 
#define TACK   0x10 /* Transfer acknowledge (output) */
 
#define TIP   0x20 /* Transfer in progress (output) */
 
#define SR_CTRL   0x1c /* Shift register control bits */
 
#define SR_EXT   0x0c /* Shift on external clock */
 
#define SR_OUT   0x10 /* Shift out if 1 */
 
#define IER_SET   0x80 /* set bits in IER */
 
#define IER_CLR   0 /* clear bits in IER */
 
#define SR_INT   0x04 /* Shift register full/empty */
 
#define WAIT_FOR(cond, what)
 

Enumerations

enum  cuda_state {
  idle, sent_first_byte, sending, reading,
  read_done, awaiting_reply
}
 

Functions

void cuda_poll (void)
 
int cuda_request (struct adb_request *req, void(*done)(struct adb_request *), int nbytes,...)
 
int __init find_via_cuda (void)
 
 device_initcall (via_cuda_start)
 

Macro Definition Documentation

#define A   RS /* A-side data */

Definition at line 37 of file via-cuda.c.

#define ACR   (11*RS) /* Auxiliary control register */

Definition at line 47 of file via-cuda.c.

#define ANH   (15*RS) /* A-side data, no handshake */

Definition at line 51 of file via-cuda.c.

macro LIST comment endm macro data LDR LDR STR data LDR LDR STRH data LDR LDR STRB reg LDR LDR STR CMP BNE NOP B   0 /* B-side data */

Definition at line 36 of file via-cuda.c.

#define DIRA   (3*RS) /* A-side direction (1=output) */

Definition at line 39 of file via-cuda.c.

#define DIRB   (2*RS) /* B-side direction (1=output) */

Definition at line 38 of file via-cuda.c.

#define IER   (14*RS) /* Interrupt enable register */

Definition at line 50 of file via-cuda.c.

#define IER_CLR   0 /* clear bits in IER */

Definition at line 65 of file via-cuda.c.

#define IER_SET   0x80 /* set bits in IER */

Definition at line 64 of file via-cuda.c.

#define IFR   (13*RS) /* Interrupt flag register */

Definition at line 49 of file via-cuda.c.

#define PCR   (12*RS) /* Peripheral control register */

Definition at line 48 of file via-cuda.c.

#define RS   0x200 /* skip between registers */

Definition at line 35 of file via-cuda.c.

#define SR   (10*RS) /* Shift register */

Definition at line 46 of file via-cuda.c.

#define SR_CTRL   0x1c /* Shift register control bits */

Definition at line 59 of file via-cuda.c.

#define SR_EXT   0x0c /* Shift on external clock */

Definition at line 60 of file via-cuda.c.

#define SR_INT   0x04 /* Shift register full/empty */

Definition at line 66 of file via-cuda.c.

#define SR_OUT   0x10 /* Shift out if 1 */

Definition at line 61 of file via-cuda.c.

#define T1CH   (5*RS) /* Timer 1 counter (high 8 bits) */

Definition at line 41 of file via-cuda.c.

#define T1CL   (4*RS) /* Timer 1 ctr/latch (low 8 bits) */

Definition at line 40 of file via-cuda.c.

#define T1LH   (7*RS) /* Timer 1 latch (high 8 bits) */

Definition at line 43 of file via-cuda.c.

#define T1LL   (6*RS) /* Timer 1 latch (low 8 bits) */

Definition at line 42 of file via-cuda.c.

#define T2CH   (9*RS) /* Timer 2 counter (high 8 bits) */

Definition at line 45 of file via-cuda.c.

#define T2CL   (8*RS) /* Timer 2 ctr/latch (low 8 bits) */

Definition at line 44 of file via-cuda.c.

#define TACK   0x10 /* Transfer acknowledge (output) */

Definition at line 55 of file via-cuda.c.

#define TIP   0x20 /* Transfer in progress (output) */

Definition at line 56 of file via-cuda.c.

#define TREQ   0x08 /* Transfer request (input) */

Definition at line 54 of file via-cuda.c.

#define WAIT_FOR (   cond,
  what 
)
Value:
do { \
int x; \
for (x = 1000; !(cond); --x) { \
if (x == 0) { \
printk("Timeout waiting for " what "\n"); \
return -ENXIO; \
} \
udelay(100); \
} \
} while (0)

Definition at line 249 of file via-cuda.c.

Enumeration Type Documentation

enum cuda_state
Enumerator:
idle 
sent_first_byte 
sending 
reading 
read_done 
awaiting_reply 

Definition at line 68 of file via-cuda.c.

Function Documentation

void cuda_poll ( void  )

Definition at line 433 of file via-cuda.c.

int cuda_request ( struct adb_request req,
void(*)(struct adb_request *)  done,
int  nbytes,
  ... 
)

Definition at line 362 of file via-cuda.c.

device_initcall ( via_cuda_start  )
int __init find_via_cuda ( void  )

Definition at line 144 of file via-cuda.c.