Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

re.c File Reference

#include "re.h"
#include "nv_hw.h"
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <string.h>
#include <SDL/SDL_syswm.h>
#include "NVCtrl.h"
#include "NVCtrlLib.h"
#include "objects.h"
#include "regl.h"

Include dependency graph for re.c:

This graph shows which files directly or indirectly include this file:


Data Structures

struct  mapping
struct  fifo_descriptor
typedef mapping mapping

Defines

#define NV_DEV   "nvidia0"
#define MAPFILE   "maplist.txt"
#define TMPFILE   "regtmp.txt"
#define FIFO_SIZE1   0x102000
#define FIFO_SIZE2   0x103000
#define FIFO_SIZE3   0x101000
#define FIFO_SIZE_QUADRO2   0x400000
#define WTF_SIZE   0x100000
#define REGS_SIZE   0x004000
#define REGS_SIZE2   0x001000
#define ALL_REGS_SIZE   0x1000000
#define MAPPING_FIFO   1
 Here is a FIFO area.
#define MAPPING_REGS   2
 we have found the registers of the gfx card
#define MAPPING_NODUMP   4
 Nothing of interest here (e.g. unused memory).
#define MAPPING_AGP   8
 AGP Memory.
#define MAXPRINT   10
#define CMD   "head -1"
#define QUADRO_FIFO_OFFSET   0xbf400
#define ALLREG_START   0x2000
 offset of the 1. register from the start of the register mapping
#define ALLREG_SIZE   0x1000
 Size of the register address range in long words.

Functions

unsigned int * gpu_ofs_to_agp (unsigned long ofs)
void print_usage (char *argv0)
void parse_opts (int argc, char **argv)
 Parse command line options (if any).
static int must_ignore (int r)
static int regcmp (unsigned int *m1, unsigned int *m2, int size)
char * bit_pattern (unsigned int val)
int get_vidram ()
void init_card ()
 initialisize the card and mappings.
static void find_maps ()
 finds out the mapping available and determines their types
void print_fifo (int n, int before, int after)
int smart_zero_remover (unsigned int value)
void dumpreg_before ()
 Saves the content of the mapping containing all registers before running commands through the FIFO.
void dumpreg_after ()
 Saves the content of the mapping containing all registers after running commands through the FIFO.
void dump_before ()
 this is the starting point from which commands and register modifications will be displayed. This function doesn't output anything.
static void set_subchannel (int channel, unsigned int name)
void dump_after (int dump_startup)
 this is the end of the dump. This functions outputs the changes in the registers and in the fifo contents since dump_before() was called.
void redirect_output (const char *name)
void close_output ()
void let_it_snow ()

Variables

static mapping mappings [100]
 Storage for all found mappings.
static int ignore_regs [] = {0x25,0x3b,0x15c,0x15d,0x15e,0x16d}
static int init_ok = 0
static long agp_base = 0
 Base address of the AGP aperture.
static long agp_size = 0
 Size of the AGP aperture memory.
unsigned int * fb = NULL
 Adress of the display memory starting here.
unsigned int fb_size
 Size of the Video memory in Bytes equipped on board.
unsigned int * all_regs = NULL
 Mapping for all available registers.
unsigned int card_family = 0
int card_type = -1
data_print_store user_data_print [MAXPRINT]
static long allregmapping_before [ALLREG_SIZE/4]
static long allregmapping_after [ALLREG_SIZE/4]
static fifo_descriptor fifo_channels [8]
const char * dma_opcode_name [4]
static int fd

Define Documentation

#define ALL_REGS_SIZE   0x1000000
 

#define ALLREG_SIZE   0x1000
 

Size of the register address range in long words.

#define ALLREG_START   0x2000
 

offset of the 1. register from the start of the register mapping

#define CMD   "head -1"
 

#define FIFO_SIZE1   0x102000
 

#define FIFO_SIZE2   0x103000
 

#define FIFO_SIZE3   0x101000
 

#define FIFO_SIZE_QUADRO2   0x400000
 

#define MAPFILE   "maplist.txt"
 

#define MAXPRINT   10
 

#define QUADRO_FIFO_OFFSET   0xbf400
 

#define REGS_SIZE   0x004000
 

#define REGS_SIZE2   0x001000
 

#define TMPFILE   "regtmp.txt"
 

#define WTF_SIZE   0x100000
 


Typedef Documentation

typedef struct mapping mapping
 


Function Documentation

char* bit_pattern unsigned int  val  ) 
 

void close_output  ) 
 

void dump_after int  dump_startup  ) 
 

this is the end of the dump. This functions outputs the changes in the registers and in the fifo contents since dump_before() was called.

void dump_before  ) 
 

this is the starting point from which commands and register modifications will be displayed. This function doesn't output anything.

This function looks through the found mappings and stores away the data inside the mapping for future comparison (when dump_after() is called)

void dumpreg_after  ) 
 

Saves the content of the mapping containing all registers after running commands through the FIFO.

void dumpreg_before  ) 
 

Saves the content of the mapping containing all registers before running commands through the FIFO.

static void find_maps  )  [static]
 

finds out the mapping available and determines their types

This function looks in the maplist of /proc/<pid>/maps for mappings assigned to the nvidia card selected. It initialises the values for start and end address within renouveau's address space, the size and the absolute address.

The type of the Mapping is determined by the size of the mapping.

int get_vidram  ) 
 

unsigned int* gpu_ofs_to_agp unsigned long  ofs  ) 
 

void init_card  ) 
 

initialisize the card and mappings.

Deduce card type and family and look for mappings of the video memory and the registers.

Todo:
output von /proc/bus/pci/devices

void let_it_snow  ) 
 

static int must_ignore int  r  )  [static]
 

void parse_opts int  argc,
char **  argv
 

Parse command line options (if any).

You can call renouveau with the following options:

  • -f Print "after" values as IEEE 754 FP32
  • -i Print "after" values as INT32
  • -s Print "after" values as 2 INT16
  • -c Print "after" values as 4 INT8
  • -b Print "after" values as bit pattern

void print_fifo int  n,
int  before,
int  after
 

void print_usage char *  argv0  ) 
 

void redirect_output const char *  name  ) 
 

static int regcmp unsigned int *  m1,
unsigned int *  m2,
int  size
[static]
 

static void set_subchannel int  channel,
unsigned int  name
[static]
 

int smart_zero_remover unsigned int  value  ) 
 


Variable Documentation

long agp_base = 0 [static]
 

Base address of the AGP aperture.

long agp_size = 0 [static]
 

Size of the AGP aperture memory.

unsigned int* all_regs = NULL
 

Mapping for all available registers.

long allregmapping_after[ALLREG_SIZE/4] [static]
 

long allregmapping_before[ALLREG_SIZE/4] [static]
 

unsigned int card_family = 0
 

in which family belongs the card we are working with? See generic card types

int card_type = -1
 

const char* dma_opcode_name[4]
 

Initial value:

 {
    "METHOD",
    "JUMP",
    "NONINC_METHOD",
    "CALL",
}

unsigned int* fb = NULL
 

Adress of the display memory starting here.

unsigned int fb_size
 

Size of the Video memory in Bytes equipped on board.

int fd [static]
 

fifo_descriptor fifo_channels[8] [static]
 

int ignore_regs[] = {0x25,0x3b,0x15c,0x15d,0x15e,0x16d} [static]
 

int init_ok = 0 [static]
 

mapping mappings[100] [static]
 

Storage for all found mappings.

data_print_store user_data_print[MAXPRINT]
 


Generated on Sat Aug 19 20:40:54 2006 for Renouveau by  doxygen 1.4.4