*** empty log message ***
r1263 | dcl | 2006-11-09 11:07:17 +1100 (Thu, 09 Nov 2006) | 2 lines
This commit is contained in:
@@ -13,12 +13,12 @@ OBJECTS =
|
|||||||
LIBS =
|
LIBS =
|
||||||
LIBFLAGS =
|
LIBFLAGS =
|
||||||
DDK_DIR = /home/dcl/nitest/nimhddk_linux26
|
DDK_DIR = /home/dcl/nitest/nimhddk_linux26
|
||||||
OBJECTS += $(DDK_DIR)/osiBus.o
|
DEV_DIR = /home/dcl/nitest/NI660x
|
||||||
OBJECTS += $(DDK_DIR)/Linux26/osiUserCode.o
|
OBJECTS += $(DEV_DIR)/osiBus.o
|
||||||
TIO_DIR = /home/dcl/nitest/NI660x
|
OBJECTS += $(DEV_DIR)/osiUserCode.o
|
||||||
OBJECTS += $(TIO_DIR)/tTIO.o
|
OBJECTS += $(DEV_DIR)/tTIO.o
|
||||||
IFLAGS = -I$(DDK_DIR)
|
IFLAGS = -I$(DDK_DIR)
|
||||||
IFLAGS += -I$(TIO_DIR)/ChipObjects/
|
IFLAGS += -I$(DEV_DIR)/ChipObjects/
|
||||||
CXXFLAGS += -DkLittleEndian=1 -DREGISTER_LEVEL_PROGRAMMING=1
|
CXXFLAGS += -DkLittleEndian=1 -DREGISTER_LEVEL_PROGRAMMING=1
|
||||||
LIBFLAGS += $(OBJECTS)
|
LIBFLAGS += $(OBJECTS)
|
||||||
CXXFLAGS += $(IFLAGS)
|
CXXFLAGS += $(IFLAGS)
|
||||||
@@ -39,7 +39,7 @@ Monitor : $(OBJS)
|
|||||||
|
|
||||||
Monitor.o: Monitor.c Monitor.h params.h utility.h sock.h device.h
|
Monitor.o: Monitor.c Monitor.h params.h utility.h sock.h device.h
|
||||||
|
|
||||||
device.o: device.c device.h params.h sock.h
|
device.o: device.c device.h params.h sock.h hware.h
|
||||||
|
|
||||||
display.o: display.c display.h utility.h params.h sock.h device.h
|
display.o: display.c display.h utility.h params.h sock.h device.h
|
||||||
|
|
||||||
|
|||||||
@@ -351,9 +351,9 @@ void put_page(int n)
|
|||||||
"<tr><th align=\"right\">Field</th>\r\n"
|
"<tr><th align=\"right\">Field</th>\r\n"
|
||||||
"<th align=\"left\">Value</th></tr>\r\n");
|
"<th align=\"left\">Value</th></tr>\r\n");
|
||||||
buffer.length += strlen(bp);
|
buffer.length += strlen(bp);
|
||||||
show_text(&buffer, "State", device->state == counter_stopped ? "STOPPED" :
|
show_text(&buffer, "State", device->state == device_stopped ? "STOPPED" :
|
||||||
device->state == counter_running ? "RUNNING" :
|
device->state == device_running ? "RUNNING" :
|
||||||
device->state == counter_paused ? "PAUSED" : "IDLE");
|
device->state == device_paused ? "PAUSED" : "IDLE");
|
||||||
show_text(&buffer, "Direction", pp->direction == COUNT_UP ? "UP" : "DOWN");
|
show_text(&buffer, "Direction", pp->direction == COUNT_UP ? "UP" : "DOWN");
|
||||||
show_int(&buffer, "Scan", pp->poll_period);
|
show_int(&buffer, "Scan", pp->poll_period);
|
||||||
show_int(&buffer, "Sample", pp->sample_period);
|
show_int(&buffer, "Sample", pp->sample_period);
|
||||||
@@ -362,7 +362,7 @@ void put_page(int n)
|
|||||||
show_time(&buffer, "Current Time", &device->current_time, false);
|
show_time(&buffer, "Current Time", &device->current_time, false);
|
||||||
{
|
{
|
||||||
struct timeval tv = device->stop_time;
|
struct timeval tv = device->stop_time;
|
||||||
if (device->state == counter_running || device->state == counter_paused)
|
if (device->state == device_running || device->state == device_paused)
|
||||||
{
|
{
|
||||||
tv = device->current_time;
|
tv = device->current_time;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,7 +89,6 @@ static void initMite(iBus *bus);
|
|||||||
|
|
||||||
static CARD* card[10];
|
static CARD* card[10];
|
||||||
#else
|
#else
|
||||||
static int make_dout_task(pHWARE ptr);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int hware_ctor(const char* device_name, pHWARE* ptr)
|
int hware_ctor(const char* device_name, pHWARE* ptr)
|
||||||
@@ -101,6 +100,7 @@ int hware_ctor(const char* device_name, pHWARE* ptr)
|
|||||||
int error = 0;
|
int error = 0;
|
||||||
bool flag = false;
|
bool flag = false;
|
||||||
char text_string[] = DEFAULT_DEVICE;
|
char text_string[] = DEFAULT_DEVICE;
|
||||||
|
char port_range[40];
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *text;
|
const char *text;
|
||||||
|
|
||||||
@@ -119,8 +119,6 @@ int hware_ctor(const char* device_name, pHWARE* ptr)
|
|||||||
if (flag)
|
if (flag)
|
||||||
{
|
{
|
||||||
hware->channel_number = *name - '0';
|
hware->channel_number = *name - '0';
|
||||||
hware->sync_line_number = mapping[hware->channel_number].sync_num;
|
|
||||||
hware->output_line_number = mapping[hware->channel_number].outp_num;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -141,6 +139,8 @@ int hware_ctor(const char* device_name, pHWARE* ptr)
|
|||||||
++text;
|
++text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hware->sync_line_number = mapping[hware->channel_number].sync_num;
|
||||||
|
hware->output_line_number = mapping[hware->channel_number].outp_num;
|
||||||
#ifdef REGISTER_LEVEL_PROGRAMMING
|
#ifdef REGISTER_LEVEL_PROGRAMMING
|
||||||
if (card[hware->card_number] == NULL)
|
if (card[hware->card_number] == NULL)
|
||||||
{
|
{
|
||||||
@@ -381,6 +381,7 @@ int hware_ctor(const char* device_name, pHWARE* ptr)
|
|||||||
// Create a DAQmx task
|
// Create a DAQmx task
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
DAQmxErrChk (DAQmxCreateTask("",&hware->taskHandle));
|
DAQmxErrChk (DAQmxCreateTask("",&hware->taskHandle));
|
||||||
|
DAQmxErrChk (DAQmxCreateTask("",&hware->taskHandle_dout));
|
||||||
|
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
// Create a DAQmx device within the task
|
// Create a DAQmx device within the task
|
||||||
@@ -393,10 +394,22 @@ int hware_ctor(const char* device_name, pHWARE* ptr)
|
|||||||
hware->count32,
|
hware->count32,
|
||||||
DAQmx_Val_CountUp));
|
DAQmx_Val_CountUp));
|
||||||
|
|
||||||
|
/*********************************************/
|
||||||
|
// Create the digital channel within the task
|
||||||
|
/*********************************************/
|
||||||
|
snprintf(port_range, sizeof(port_range), "DEV%d/LINE%d",
|
||||||
|
hware->card_number, hware->channel_number);
|
||||||
|
DAQmxErrChk (DAQmxCreateDOChan(hware->taskHandle_dout,
|
||||||
|
port_range,
|
||||||
|
"",
|
||||||
|
DAQmx_Val_ChanPerLine));
|
||||||
|
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
// Start the DAQmx task
|
// Start the DAQmx task
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
DAQmxErrChk (DAQmxStartTask(hware->taskHandle));
|
DAQmxErrChk (DAQmxStartTask(hware->taskHandle));
|
||||||
|
DAQmxErrChk (DAQmxStartTask(hware->taskHandle_dout));
|
||||||
|
hware_outp(hware, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -582,7 +595,6 @@ int hware_outp(pHWARE hware, int value)
|
|||||||
if (value < 0)
|
if (value < 0)
|
||||||
{
|
{
|
||||||
// set the disabled line to logic low
|
// set the disabled line to logic low
|
||||||
if (hware->taskHandle_dout != 0) {
|
|
||||||
data = 0;
|
data = 0;
|
||||||
DAQmxWriteDigitalLines(hware->taskHandle_dout,
|
DAQmxWriteDigitalLines(hware->taskHandle_dout,
|
||||||
1,
|
1,
|
||||||
@@ -592,18 +604,9 @@ int hware_outp(pHWARE hware, int value)
|
|||||||
&data,
|
&data,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
/*********************************************/
|
|
||||||
// DAQmx Stop Code
|
|
||||||
/*********************************************/
|
|
||||||
DAQmxStopTask(hware->taskHandle_dout);
|
|
||||||
DAQmxClearTask(hware->taskHandle_dout);
|
|
||||||
hware->taskHandle_dout = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (hware->taskHandle_dout == 0)
|
|
||||||
DAQmxErrChk (make_dout_task(hware));
|
|
||||||
if (value > 0)
|
if (value > 0)
|
||||||
data = 1;
|
data = 1;
|
||||||
else
|
else
|
||||||
@@ -807,32 +810,4 @@ void initMite(iBus *bus)
|
|||||||
bus->destroyAddressSpace(Bar0);
|
bus->destroyAddressSpace(Bar0);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
int make_dout_task(pHWARE ptr)
|
|
||||||
{
|
|
||||||
int error = 0;
|
|
||||||
char port_range[40];
|
|
||||||
/*********************************************/
|
|
||||||
// Create a DAQmx task to hold the counter
|
|
||||||
/*********************************************/
|
|
||||||
DAQmxErrChk (DAQmxCreateTask("",&ptr->taskHandle_dout));
|
|
||||||
|
|
||||||
/*********************************************/
|
|
||||||
// Create the digital channel within the task
|
|
||||||
/*********************************************/
|
|
||||||
snprintf(port_range, sizeof(port_range), "DEV%d/LINE%d",
|
|
||||||
ptr->card_number, ptr->channel_number);
|
|
||||||
DAQmxErrChk (DAQmxCreateDOChan(ptr->taskHandle_dout,
|
|
||||||
port_range,
|
|
||||||
"",
|
|
||||||
DAQmx_Val_ChanPerLine));
|
|
||||||
|
|
||||||
/*********************************************/
|
|
||||||
// Start the DAQmx task
|
|
||||||
/*********************************************/
|
|
||||||
DAQmxErrChk (DAQmxStartTask(ptr->taskHandle_dout));
|
|
||||||
return error;
|
|
||||||
|
|
||||||
Error:
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
struct device_private_t;
|
struct device_private_t;
|
||||||
typedef struct device_private_t* pHWARE;
|
typedef struct device_private_t* pHWARE;
|
||||||
|
typedef unsigned long long HWARE_VALUE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a 64-bit counter and start it counting
|
* Create a 64-bit counter and start it counting
|
||||||
@@ -39,7 +40,7 @@ int hware_ctor(const char* card_name, pHWARE* ptr);
|
|||||||
* 0 OK
|
* 0 OK
|
||||||
* !0 Error
|
* !0 Error
|
||||||
*/
|
*/
|
||||||
int hware_read(pHWARE hware, unsigned long long* value);
|
int hware_read(pHWARE hware, HWARE_VALUE* value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select the source
|
* Select the source
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ bool param_set(pPARAMETERS pp, char* name, char* value)
|
|||||||
pp->source = strtol(value, NULL, 10);
|
pp->source = strtol(value, NULL, 10);
|
||||||
if (pp->source < 1)
|
if (pp->source < 1)
|
||||||
pp->source = 0;
|
pp->source = 0;
|
||||||
else if (pp->source > 1000)
|
else if (pp->source > 3)
|
||||||
pp->source = 0;
|
pp->source = 0;
|
||||||
dbg_printf(0, "=>%d\n", pp->source);
|
dbg_printf(0, "=>%d\n", pp->source);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user