parport.c File Reference

#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <netinet/in.h>
#include <netdb.h>
#include <err.h>
#include <sys/io.h>
#include "parport.h"
#include <cmdparser.h>

Include dependency graph for parport.c:

Go to the source code of this file.

Defines

#define dPARPORT_CONTROL   0x37A
#define dPARPORT_DATA   0x378
#define dPARPORT_STATUS   0x379

Functions

void fPARPORT_Init (void)
unsigned char fPARPORT_Read (void)
static void fPARPORT_SetAccess (u_long *map, u_int bit, int allow)
void fPARPORT_Write (unsigned char uc_byte)
 mycmd_init (ppwrite, ppcmd,"data","write parport")
 mycmd_init (ppread, ppcmd,"","read parport")
 mycmd_init (ppinit, ppcmd,"","init parport")
static int ppcmd (int argc, char **argv)


Define Documentation

#define dPARPORT_CONTROL   0x37A

Definition at line 64 of file parport.c.

#define dPARPORT_DATA   0x378

Definition at line 62 of file parport.c.

Referenced by fPARPORT_Write().

#define dPARPORT_STATUS   0x379

Definition at line 63 of file parport.c.

Referenced by fPARPORT_Read().


Function Documentation

void fPARPORT_Init ( void   ) 

Definition at line 97 of file parport.c.

Referenced by fJTAG_Init(), and ppcmd().

00098 {
00099   unsigned long iomap[32];
00100         
00101         iopl(3);
00102         return;
00103 }

unsigned char fPARPORT_Read ( void   ) 

Definition at line 122 of file parport.c.

References dPARPORT_STATUS.

Referenced by fJTAG_Wiggle(), and ppcmd().

00123 {
00124   return(inb(dPARPORT_STATUS));
00125 }

static void fPARPORT_SetAccess ( u_long *  map,
u_int  bit,
int  allow 
) [static]

Definition at line 76 of file parport.c.

00077 {
00078   unsigned int  word;
00079   unsigned int  shift;
00080   unsigned long mask;
00081 
00082   word = bit / 32;
00083   shift = bit - (word * 32);
00084 
00085   mask = 0x000000001 << shift;
00086   if (allow)
00087     map[word] &= ~mask;
00088   else
00089     map[word] |= mask;
00090 }

void fPARPORT_Write ( unsigned char  uc_byte  ) 

Definition at line 110 of file parport.c.

References dPARPORT_DATA.

Referenced by fJTAG_Wiggle(), and ppcmd().

00111 {
00112   outb(uc_byte,dPARPORT_DATA);
00113   
00114   return;
00115 }

mycmd_init ( ppwrite  ,
ppcmd  ,
"data"  ,
"write parport"   
)

mycmd_init ( ppread  ,
ppcmd  ,
""  ,
"read parport"   
)

mycmd_init ( ppinit  ,
ppcmd  ,
""  ,
"init parport"   
)

static int ppcmd ( int  argc,
char **  argv 
) [static]

Definition at line 129 of file parport.c.

References fPARPORT_Init(), fPARPORT_Read(), and fPARPORT_Write().

00130 {
00131         int i;
00132 if (!strcmp(argv[0],"ppinit")) fPARPORT_Init();
00133 else if (!strcmp(argv[0],"ppread")) printf("0x%02x\n",fPARPORT_Read());
00134 else if (!strcmp(argv[0],"ppwrite")) {
00135         if (argc != 2) return -1;
00136         fPARPORT_Write(strtoul(argv[1],0,0));
00137  }
00138 return 0;       
00139 }

Here is the call graph for this function:


Generated on Fri Nov 5 07:24:51 2010 for ejtag debug tools for loongson 232 cpu by  doxygen 1.5.6