Skip to content

Commit

Permalink
work on compatibility to pev
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk-zimoch committed Aug 18, 2016
1 parent fa39e5d commit dc17997
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ifcDev.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
#include <dbAccess.h>
#include <epicsExport.h>

#include "pev.h"

#define I2CEXEC_OK 0x0200000
#define I2CEXEC_MASK 0x0300000
#define BIT_31_SET 0x80000000

#include "pevCompat.h"

long ifc1210Init(){ pev_init(0); return 0; }
struct {
long number;
Expand Down
84 changes: 83 additions & 1 deletion pevCompat.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ FILE* pevDebugFile = NULL;
#define error(fmt, ...) fprintf(stderr, "%s: " fmt "\n", __FUNCTION__, ##__VA_ARGS__)

/* pev compatibility mode */
extern int toscaDevConfigure(const char* name, const char* resource, size_t address, size_t size, const char* flags);
extern int toscaDevConfigure(const char* name, const char* resource, size_t addr, size_t size, const char* flags);

static const iocshArg * const pevConfigureArgs[] = {
&(iocshArg) { "card", iocshArgInt },
Expand Down Expand Up @@ -82,3 +82,85 @@ static void pevRegistrar(void)
}

epicsExportRegistrar(pevRegistrar);

void* pev_init(int x)
{
printf("pev compatibility mode\n");
return (void*) -1;
}

void* pevx_init(int x)
{
printf("pevx compatibility mode\n");
return (void*) -1;
}

int pev_csr_rd(int addr)
{
return toscaCsrRead(addr & 0x7FFFFFFF);
}

void pev_csr_wr(int addr, int val)
{
debug ("pev_csr_wr(0x%x,0x%x) -> toscaCsrWrite(0x%x,0x%x)", addr, val, addr & 0x7FFFFFFF, val);
toscaCsrWrite(addr & 0x7FFFFFFF, val);
}

void pev_csr_set(int addr, int val)
{
toscaCsrSet(addr & 0x7FFFFFFF, val);
}

int pev_elb_rd(int addr)
{
fprintf(stderr, "%s not implemented\n", __FUNCTION__);
return -1;
}

int pev_smon_rd(int addr)
{
fprintf(stderr, "%s not implemented\n", __FUNCTION__);
return -1;
}

int pev_bmr_read(unsigned int card, unsigned int addr, unsigned int *val, unsigned int count)
{
fprintf(stderr, "%s not implemented\n", __FUNCTION__);
return -1;
}

float pev_bmr_conv_11bit_u(unsigned short val)
{
fprintf(stderr, "%s not implemented\n", __FUNCTION__);
return 0.0/0.0;
}

float pev_bmr_conv_11bit_s(unsigned short val)
{
fprintf(stderr, "%s not implemented\n", __FUNCTION__);
return 0.0/0.0;
}

float pev_bmr_conv_16bit_u(unsigned short val)
{
fprintf(stderr, "%s not implemented\n", __FUNCTION__);
return 0.0/0.0;
}

int pev_elb_wr(int addr, int val)
{
fprintf(stderr, "%s not implemented\n", __FUNCTION__);
return -1;
}

void pev_smon_wr(int addr, int val)
{
fprintf(stderr, "%s not implemented\n", __FUNCTION__);
}

int pev_bmr_write(unsigned int card, unsigned int addr, unsigned int val, unsigned int count)
{
fprintf(stderr, "%s not implemented\n", __FUNCTION__);
return -1;
}

2 changes: 2 additions & 0 deletions pevCompat.dbd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
variable(pevDebug, int)
registrar(pevRegistrar)
14 changes: 14 additions & 0 deletions pevCompat.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
void* pev_init(int x);
void* pevx_init(int x);
int pev_csr_rd(int addr);
void pev_csr_wr(int addr, int val);
void pev_csr_set(int addr, int val);
int pev_elb_rd(int addr);
int pev_smon_rd(int addr);
int pev_bmr_read(unsigned int card, unsigned int addr, unsigned int *val, unsigned int count);
float pev_bmr_conv_11bit_u(unsigned short val);
float pev_bmr_conv_11bit_s(unsigned short val);
float pev_bmr_conv_16bit_u(unsigned short val);
int pev_elb_wr(int addr, int val);
void pev_smon_wr(int addr, int val);
int pev_bmr_write(unsigned int card, unsigned int addr, unsigned int val, unsigned int count);

0 comments on commit dc17997

Please sign in to comment.