spaleed_bb.c File Reference

#include <linux/kernel.h>
#include <math.h>
#include "/home/czubanowski/Gxsm/pci32/dspC32/spa/spacmd.h"

Go to the source code of this file.

Classes

struct  BB_GATEGEN
struct  SCANP
struct  SPALEED

Defines

#define BB_TEST_CNT
#define BB_POLLING_MODE
#define BB_MEM_BASE   0xcd000
#define BB_MEM_AUTOPROBE   0
#define BB_MEM_BASE_START   0xc0000
#define BB_MEM_BASE_END   0xe0000
#define BB_MEM_SIZE   0x400
#define BB_IRQLINE   5
#define BB_XY_DEFLECTON_BOARD   3
#define BB_ENERGY_BOARD   1
#define BB_PCI20001C1   (0x1+0x2+0x8+0x10)
#define BB_PCI20001C2   (0x1+0x4+0x8+0x10)
#define BB_IDMSK   0x1f
#define BB_PCI20006M2   0xe2
#define BB_PCI20006M3   0xe3
#define BB_PCI20007M   0xea
#define BB_BASE_MODULE(N)   ( spa[BB_CARD_NO].BB_membase + (((N)&3)<<8) )
#define BB_MODULE_PRESENT(M)   (readb( BB_BASE_MODULE(0) ) & (1<<(8-(M))))
#define BB_IRQ_STATUS   readb( BB_BASE_MODULE(0) + 0x40 )
#define BB_DAC_X(X, N)   writew( (X), BB_BASE_MODULE(N) + 0x0d)
#define BB_DAC_Y(X, N)   writew( (X), BB_BASE_MODULE(N) + 0x15)
#define BB_DAC_OUT(N)   writeb(0xff, BB_BASE_MODULE(N) + 0x1b)
#define BB_TMR_MODULE_ID   2
#define BB_TMR_BASE   ( BB_BASE_MODULE(BB_TMR_MODULE_ID) )
#define BB_TMR_RTGREG   ( BB_TMR_BASE + 0x04 )
#define BB_TMR_RTGREG_LO   ( BB_TMR_RTGREG )
#define BB_TMR_RTGREG_HI   ( BB_TMR_RTGREG + 1)
#define BB_TMR_CNT0REG   ( BB_TMR_BASE + 0x08 )
#define BB_TMR_CNT1REG   ( BB_TMR_BASE + 0x09 )
#define BB_TMR_CNT2REG   ( BB_TMR_BASE + 0x0A )
#define BB_TMR_CNT3REG   ( BB_TMR_BASE + 0x06 )
#define BB_TMR_RTGCNT3CTRL   ( BB_TMR_BASE + 0x07 )
#define BB_TMR_CNT012CTRL   ( BB_TMR_BASE + 0x0B )
#define BB_TMR_CNTGATECTRL   ( BB_TMR_BASE + 0x0C )
#define BB_CRTL_MSK   0x40
#define AD_MAX_VOLT   10.
#define DA_MAX_VOLT   10.
#define DA_MAX_VAL   0x7ffe
#define UDA_MAX_VAL   0xffff
#define U2FLT(X)   ((X)*(float)(DA_MAX_VAL)/AD_MAX_VOLT)
#define U2INT(X)   (int)((X)*(float)(DA_MAX_VAL)/AD_MAX_VOLT)
#define INT2U(X)   ((float)(X)/DA_MAX_VAL*AD_MAX_VOLT)
#define UNI_U2FLT(X)   ((X)*(float)(UDA_MAX_VAL)/AD_MAX_VOLT)
#define UNI_U2INT(X)   (int)((X)*(float)(UDA_MAX_VAL)/AD_MAX_VOLT)
#define UNI_INT2U(X)   ((float)(X)/UDA_MAX_VAL*AD_MAX_VOLT)
#define DPRAMBASE   (volatile int*) (spa[BB_CARD_NO].dsp->virtual_dpram)
#define CMD_BUFFER   (volatile int*) (DPRAMBASE+0x00)
#define CMD_PARM   (volatile int*) (DPRAMBASE+0x01)
#define BUFFER   (volatile int*) (DPRAMBASE+DSP_BUFFER_START)
#define BUFFERL   (volatile unsigned long*) (DPRAMBASE+DSP_BUFFER_START)
#define DPRAML   (volatile unsigned long*) (DPRAMBASE)
#define LCDBUFFER   (volatile unsigned long*) (DPRAMBASE+DSP_LCDBUFFER)
#define MAXSCANPOINTS   (DSP_DATA_REG_LEN)
#define DSPack   spa[BB_CARD_NO].dsp->SrvReqAck=TRUE
#define MD_CMD   0x08
#define MD_SCAN   0x10
#define MD_BLK   0x80
#define LEDPORT(X)   *((unsigned long*)(DPRAMBASE+DSP_USR_DIO))=X
#define MAX_BB_CARDS   1
#define BB_CARD_NO   0

Functions

void LCDclear (void)
int LCDprintf (const char *format,...)
void scan2d (void)
void linescan (int n, float y)
unsigned long ChanneltronCounts (float x, float y)
int GetParamI (unsigned int N)
float GetParamF (unsigned int N)
void BB_SetVolt (double x, double y)
void BB_SetEnergy (double En)
unsigned long BB_CntRead (void)
double BB_InitCnt (double gate)
void BB_SetCnt (void)
int BB_ReadyCnt (void)
static void bb_gate_interrupt (int irq, void *dev_id, struct pt_regs *regs)
void bb_test_counting (double E, double ms)
int InitEmu (struct dspsim_thread_data *dsp)
void ExitEmu (void)
void ServiceRequest (struct dspsim_thread_data *dsp)

Variables

static int irq_count = 0
static int timeout_count = 0
static SPALEED spa [MAX_BB_CARDS]


Define Documentation

#define AD_MAX_VOLT   10.
 

Definition at line 108 of file spaleed_bb.c.

Referenced by ServiceRequest().

#define BB_BASE_MODULE  )     ( spa[BB_CARD_NO].BB_membase + (((N)&3)<<8) )
 

Definition at line 61 of file spaleed_bb.c.

Referenced by InitEmu().

#define BB_CARD_NO   0
 

Definition at line 164 of file spaleed_bb.c.

Referenced by bb_gate_interrupt(), BB_InitCnt(), BB_SetCnt(), BB_SetVolt(), bb_test_counting(), ChanneltronCounts(), InitEmu(), linescan(), scan2d(), and ServiceRequest().

#define BB_CRTL_MSK   0x40
 

Definition at line 91 of file spaleed_bb.c.

Referenced by BB_CntRead().

#define BB_DAC_OUT  )     writeb(0xff, BB_BASE_MODULE(N) + 0x1b)
 

Definition at line 72 of file spaleed_bb.c.

Referenced by BB_SetEnergy(), and BB_SetVolt().

#define BB_DAC_X X,
 )     writew( (X), BB_BASE_MODULE(N) + 0x0d)
 

Definition at line 70 of file spaleed_bb.c.

Referenced by BB_SetEnergy(), and BB_SetVolt().

#define BB_DAC_Y X,
 )     writew( (X), BB_BASE_MODULE(N) + 0x15)
 

Definition at line 71 of file spaleed_bb.c.

Referenced by BB_SetEnergy(), and BB_SetVolt().

#define BB_ENERGY_BOARD   1
 

Definition at line 49 of file spaleed_bb.c.

Referenced by BB_SetEnergy().

#define BB_IDMSK   0x1f
 

Definition at line 55 of file spaleed_bb.c.

Referenced by InitEmu().

#define BB_IRQ_STATUS   readb( BB_BASE_MODULE(0) + 0x40 )
 

Definition at line 64 of file spaleed_bb.c.

#define BB_IRQLINE   5
 

Definition at line 46 of file spaleed_bb.c.

Referenced by ExitEmu().

#define BB_MEM_AUTOPROBE   0
 

Definition at line 42 of file spaleed_bb.c.

Referenced by InitEmu().

#define BB_MEM_BASE   0xcd000
 

Definition at line 40 of file spaleed_bb.c.

Referenced by InitEmu().

#define BB_MEM_BASE_END   0xe0000
 

Definition at line 44 of file spaleed_bb.c.

Referenced by InitEmu().

#define BB_MEM_BASE_START   0xc0000
 

Definition at line 43 of file spaleed_bb.c.

Referenced by InitEmu().

#define BB_MEM_SIZE   0x400
 

Definition at line 45 of file spaleed_bb.c.

Referenced by InitEmu().

#define BB_MODULE_PRESENT  )     (readb( BB_BASE_MODULE(0) ) & (1<<(8-(M))))
 

Definition at line 63 of file spaleed_bb.c.

#define BB_PCI20001C1   (0x1+0x2+0x8+0x10)
 

Definition at line 53 of file spaleed_bb.c.

Referenced by InitEmu().

#define BB_PCI20001C2   (0x1+0x4+0x8+0x10)
 

Definition at line 54 of file spaleed_bb.c.

Referenced by InitEmu().

#define BB_PCI20006M2   0xe2
 

Definition at line 57 of file spaleed_bb.c.

#define BB_PCI20006M3   0xe3
 

Definition at line 58 of file spaleed_bb.c.

#define BB_PCI20007M   0xea
 

Definition at line 59 of file spaleed_bb.c.

#define BB_POLLING_MODE
 

Definition at line 36 of file spaleed_bb.c.

#define BB_TEST_CNT
 

Definition at line 35 of file spaleed_bb.c.

#define BB_TMR_BASE   ( BB_BASE_MODULE(BB_TMR_MODULE_ID) )
 

Definition at line 77 of file spaleed_bb.c.

#define BB_TMR_CNT012CTRL   ( BB_TMR_BASE + 0x0B )
 

Definition at line 88 of file spaleed_bb.c.

Referenced by BB_CntRead(), and BB_SetCnt().

#define BB_TMR_CNT0REG   ( BB_TMR_BASE + 0x08 )
 

Definition at line 82 of file spaleed_bb.c.

Referenced by BB_CntRead(), and BB_SetCnt().

#define BB_TMR_CNT1REG   ( BB_TMR_BASE + 0x09 )
 

Definition at line 83 of file spaleed_bb.c.

Referenced by BB_CntRead(), and BB_SetCnt().

#define BB_TMR_CNT2REG   ( BB_TMR_BASE + 0x0A )
 

Definition at line 84 of file spaleed_bb.c.

#define BB_TMR_CNT3REG   ( BB_TMR_BASE + 0x06 )
 

Definition at line 85 of file spaleed_bb.c.

#define BB_TMR_CNTGATECTRL   ( BB_TMR_BASE + 0x0C )
 

Definition at line 89 of file spaleed_bb.c.

Referenced by BB_SetCnt().

#define BB_TMR_MODULE_ID   2
 

Definition at line 75 of file spaleed_bb.c.

#define BB_TMR_RTGCNT3CTRL   ( BB_TMR_BASE + 0x07 )
 

Definition at line 87 of file spaleed_bb.c.

Referenced by BB_ReadyCnt(), and BB_SetCnt().

#define BB_TMR_RTGREG   ( BB_TMR_BASE + 0x04 )
 

Definition at line 78 of file spaleed_bb.c.

#define BB_TMR_RTGREG_HI   ( BB_TMR_RTGREG + 1)
 

Definition at line 80 of file spaleed_bb.c.

Referenced by BB_ReadyCnt(), and BB_SetCnt().

#define BB_TMR_RTGREG_LO   ( BB_TMR_RTGREG )
 

Definition at line 79 of file spaleed_bb.c.

Referenced by BB_SetCnt().

#define BB_XY_DEFLECTON_BOARD   3
 

Definition at line 48 of file spaleed_bb.c.

Referenced by BB_SetVolt().

#define BUFFER   (volatile int*) (DPRAMBASE+DSP_BUFFER_START)
 

Definition at line 129 of file spaleed_bb.c.

#define BUFFERL   (volatile unsigned long*) (DPRAMBASE+DSP_BUFFER_START)
 

Definition at line 130 of file spaleed_bb.c.

Referenced by linescan(), scan2d(), and ServiceRequest().

#define CMD_BUFFER   (volatile int*) (DPRAMBASE+0x00)
 

Definition at line 127 of file spaleed_bb.c.

Referenced by InitEmu(), and ServiceRequest().

#define CMD_PARM   (volatile int*) (DPRAMBASE+0x01)
 

Definition at line 128 of file spaleed_bb.c.

Referenced by GetParamF(), and GetParamI().

#define DA_MAX_VAL   0x7ffe
 

Definition at line 110 of file spaleed_bb.c.

#define DA_MAX_VOLT   10.
 

Definition at line 109 of file spaleed_bb.c.

#define DPRAMBASE   (volatile int*) (spa[BB_CARD_NO].dsp->virtual_dpram)
 

Definition at line 125 of file spaleed_bb.c.

#define DPRAML   (volatile unsigned long*) (DPRAMBASE)
 

Definition at line 131 of file spaleed_bb.c.

#define DSPack   spa[BB_CARD_NO].dsp->SrvReqAck=TRUE
 

Definition at line 135 of file spaleed_bb.c.

Referenced by ServiceRequest().

#define INT2U  )     ((float)(X)/DA_MAX_VAL*AD_MAX_VOLT)
 

Definition at line 117 of file spaleed_bb.c.

#define LCDBUFFER   (volatile unsigned long*) (DPRAMBASE+DSP_LCDBUFFER)
 

Definition at line 132 of file spaleed_bb.c.

Referenced by LCDclear(), and LCDprintf().

#define LEDPORT  )     *((unsigned long*)(DPRAMBASE+DSP_USR_DIO))=X
 

Definition at line 141 of file spaleed_bb.c.

Referenced by InitEmu().

#define MAX_BB_CARDS   1
 

Definition at line 163 of file spaleed_bb.c.

#define MAXSCANPOINTS   (DSP_DATA_REG_LEN)
 

Definition at line 133 of file spaleed_bb.c.

Referenced by linescan(), scan2d(), and ServiceRequest().

#define MD_BLK   0x80
 

Definition at line 139 of file spaleed_bb.c.

#define MD_CMD   0x08
 

Definition at line 137 of file spaleed_bb.c.

Referenced by InitEmu(), and ServiceRequest().

#define MD_SCAN   0x10
 

Definition at line 138 of file spaleed_bb.c.

Referenced by ServiceRequest().

#define U2FLT  )     ((X)*(float)(DA_MAX_VAL)/AD_MAX_VOLT)
 

Definition at line 115 of file spaleed_bb.c.

#define U2INT  )     (int)((X)*(float)(DA_MAX_VAL)/AD_MAX_VOLT)
 

Definition at line 116 of file spaleed_bb.c.

Referenced by BB_SetEnergy(), and ServiceRequest().

#define UDA_MAX_VAL   0xffff
 

Definition at line 111 of file spaleed_bb.c.

#define UNI_INT2U  )     ((float)(X)/UDA_MAX_VAL*AD_MAX_VOLT)
 

Definition at line 122 of file spaleed_bb.c.

#define UNI_U2FLT  )     ((X)*(float)(UDA_MAX_VAL)/AD_MAX_VOLT)
 

Definition at line 120 of file spaleed_bb.c.

#define UNI_U2INT  )     (int)((X)*(float)(UDA_MAX_VAL)/AD_MAX_VOLT)
 

Definition at line 121 of file spaleed_bb.c.


Function Documentation

unsigned long BB_CntRead void   ) 
 

Definition at line 603 of file spaleed_bb.c.

References BB_CRTL_MSK, BB_TMR_CNT012CTRL, BB_TMR_CNT0REG, and BB_TMR_CNT1REG.

Referenced by ChanneltronCounts().

static void bb_gate_interrupt int  irq,
void *  dev_id,
struct pt_regs *  regs
[static]
 

Definition at line 688 of file spaleed_bb.c.

References BB_CARD_NO, irq_count, spa, and SPALEED::waitq.

double BB_InitCnt double  gate  ) 
 

Definition at line 625 of file spaleed_bb.c.

References BB_CARD_NO, SPALEED::bb_gate_reg, factor(), BB_GATEGEN::hb0, BB_GATEGEN::hb1, BB_GATEGEN::lb0, BB_GATEGEN::lb1, and spa.

Referenced by bb_test_counting(), linescan(), scan2d(), and ServiceRequest().

int BB_ReadyCnt void   ) 
 

Definition at line 682 of file spaleed_bb.c.

References BB_TMR_RTGCNT3CTRL, and BB_TMR_RTGREG_HI.

Referenced by ChanneltronCounts().

void BB_SetCnt void   ) 
 

Definition at line 660 of file spaleed_bb.c.

References BB_CARD_NO, BB_TMR_CNT012CTRL, BB_TMR_CNT0REG, BB_TMR_CNT1REG, BB_TMR_CNTGATECTRL, BB_TMR_RTGCNT3CTRL, BB_TMR_RTGREG_HI, BB_TMR_RTGREG_LO, and spa.

Referenced by ChanneltronCounts().

void BB_SetEnergy double  En  ) 
 

Definition at line 597 of file spaleed_bb.c.

References BB_DAC_OUT, BB_DAC_X, BB_DAC_Y, BB_ENERGY_BOARD, and U2INT.

Referenced by bb_test_counting(), linescan(), scan2d(), and ServiceRequest().

void BB_SetVolt double  x,
double  y
 

Definition at line 584 of file spaleed_bb.c.

References BB_CARD_NO, BB_DAC_OUT, BB_DAC_X, BB_DAC_Y, BB_XY_DEFLECTON_BOARD, SCANP::rotmxx, SCANP::rotmxy, SCANP::rotmyx, SCANP::rotmyy, SCANP::rotoffx, SCANP::rotoffy, SPALEED::scanp, and spa.

Referenced by ChanneltronCounts(), linescan(), scan2d(), and ServiceRequest().

void bb_test_counting double  E,
double  ms
 

Definition at line 214 of file spaleed_bb.c.

References BB_CARD_NO, BB_InitCnt(), BB_SetEnergy(), ChanneltronCounts(), irq_count, KDEBUG, SCANP::ms, SPALEED::scanp, spa, and timeout_count.

unsigned long ChanneltronCounts float  x,
float  y
 

Definition at line 526 of file spaleed_bb.c.

References BB_CARD_NO, BB_CntRead(), BB_ReadyCnt(), BB_SetCnt(), BB_SetVolt(), SPALEED::bb_timeout_flg, SCANP::ms, mysleep(), scanp, spa, timeout(), SPALEED::timeout_tmr, waitq, and wakeups.

Referenced by bb_test_counting(), linescan(), scan2d(), and ServiceRequest().

void ExitEmu void   ) 
 

Definition at line 340 of file spaleed_bb.c.

References BB_IRQLINE, irq_count, KDEBUG, and timeout_count.

float GetParamF unsigned int  N  ) 
 

Definition at line 354 of file spaleed_bb.c.

References CMD_PARM.

Referenced by ServiceRequest().

int GetParamI unsigned int  N  ) 
 

Definition at line 348 of file spaleed_bb.c.

References CMD_PARM.

Referenced by ServiceRequest().

int InitEmu struct dspsim_thread_data dsp  ) 
 

Definition at line 227 of file spaleed_bb.c.

References BB_BASE_MODULE, BB_CARD_NO, BB_IDMSK, BB_MEM_AUTOPROBE, BB_MEM_BASE, BB_MEM_BASE_END, BB_MEM_BASE_START, BB_MEM_SIZE, SPALEED::BB_membase, BB_PCI20001C1, BB_PCI20001C2, SPALEED::dsp, KDEBUG, SPALEED::major, SPALEED::minor, pcdsp_major, and spa.

void LCDclear void   ) 
 

Definition at line 359 of file spaleed_bb.c.

References DSP_LCDBUFFERLEN, and LCDBUFFER.

Referenced by InitEmu(), and ServiceRequest().

int LCDprintf const char *  format,
  ...
 

Definition at line 365 of file spaleed_bb.c.

References LCDBUFFER.

Referenced by InitEmu(), and ServiceRequest().

void linescan int  n,
float  y
 

Definition at line 497 of file spaleed_bb.c.

References BB_CARD_NO, BB_InitCnt(), BB_SetEnergy(), BB_SetVolt(), BUFFERL, ChanneltronCounts(), SCANP::E, SCANP::len, MAXSCANPOINTS, SCANP::ms, mysleep(), SCANP::N, scanp, SPALEED::scanp, and spa.

Referenced by ServiceRequest().

void scan2d void   ) 
 

Definition at line 468 of file spaleed_bb.c.

References BB_CARD_NO, BB_InitCnt(), BB_SetEnergy(), BB_SetVolt(), BUFFERL, ChanneltronCounts(), SCANP::E, SCANP::lenxy, MAXSCANPOINTS, SCANP::ms, mysleep(), SCANP::Nx, SCANP::Ny, SPALEED::scanp, scanp, and spa.

Referenced by ServiceRequest().

void ServiceRequest struct dspsim_thread_data dsp  ) 
 

Definition at line 374 of file spaleed_bb.c.

References SCANP::alpha, BB_CARD_NO, BB_InitCnt(), BB_SetEnergy(), BB_SetVolt(), BUFFERL, SPALEED::chanhv, ChanneltronCounts(), SPALEED::chanrepeller, CMD_BUFFER, SPALEED::cryfocus, DSP_alpha, DSP_CMD_GETCNT, DSP_CMD_SCAN2D, DSP_CMD_SCAN_PARAM, DSP_CMD_SCAN_START, DSP_CMD_SPACTRL_SET, DSP_CMD_SWAPDPRAM, DSP_E, DSP_len, DSP_LXY, DSP_ms, DSP_MXX, DSP_MXY, DSP_MYX, DSP_MYY, DSP_N, DSP_NX, DSP_NY, DSP_SPACTRL_CHANHV, DSP_SPACTRL_CHANREPELLER, DSP_SPACTRL_CRYFOCUS, DSP_SPACTRL_EXTRACTOR, DSP_SPACTRL_FILAMENT, DSP_SPACTRL_GROWING, DSP_SPACTRL_GUNANODE, DSP_SPACTRL_GUNFOCUS, DSP_SPACTRL_SMPDIST, DSP_SPACTRL_SMPTEMP, DSP_X0, DSP_Y0, DSPack, SCANP::E, SPALEED::extractor, FALSE, SPALEED::filament, GetParamF(), GetParamI(), SPALEED::growing, SPALEED::gunanode, SPALEED::gunfocus, KDEBUG, SPALEED::LastSPAMode, SCANP::len, SCANP::lenxy, linescan(), MD_CMD, MD_SCAN, SCANP::ms, SCANP::N, SCANP::Nx, SCANP::Ny, REQD_DSP, SCANP::rotmxx, SCANP::rotmxy, SCANP::rotmyx, SCANP::rotmyy, SCANP::rotoffx, SCANP::rotoffy, scan2d(), scanp, SPALEED::scanp, SPALEED::smpdist, SPALEED::smptemp, spa, SPALEED::SPAMode, SCANP::X0, and SCANP::Y0.


Variable Documentation

int irq_count = 0 [static]
 

Definition at line 101 of file spaleed_bb.c.

Referenced by bb_gate_interrupt(), bb_test_counting(), and ExitEmu().

SPALEED spa[MAX_BB_CARDS] [static]
 

Definition at line 210 of file spaleed_bb.c.

Referenced by bb_gate_interrupt(), BB_InitCnt(), BB_SetCnt(), BB_SetVolt(), bb_test_counting(), calc_spaparam(), ChanneltronCounts(), InitEmu(), linescan(), scan2d(), and ServiceRequest().

int timeout_count = 0 [static]
 

Definition at line 102 of file spaleed_bb.c.

Referenced by bb_test_counting(), and ExitEmu().


Generated on Sat Apr 1 09:04:45 2006 for GXSM by  doxygen 1.4.6