motor: added a change to drvMAXv from Austin Rose. Implemented absolute encoder register interface and extra configuration parameter to MAXvConfig function call (supports SSI interface).

This commit is contained in:
mp49
2011-09-23 15:42:04 +00:00
parent 51b8556485
commit 3925deff0c
2 changed files with 22 additions and 5 deletions
+19 -4
View File
@@ -87,6 +87,7 @@ HeadURL: $URL$
* configuration string argument and in readbuf().
* 21 02-04-11 rls - Added counter to send_mess()'s "waiting for message
* acknowledgement" loop to prevent infinite loop.
* 22 09-23-11 ajr - Added configuration word MAXvConfig.
*
*/
@@ -162,6 +163,10 @@ static double quantum;
static char **initstring = 0;
static epicsUInt32 MAXv_brd_size; /* card address boundary */
/* First 8-bits [0..7] used to indicate absolute or */
/* incremental position registers to be read */
static int configurationFlags[MAXv_NUM_CARDS] = {0};
/*----------------functions-----------------*/
/* Common local function declarations. */
@@ -327,6 +332,8 @@ static int set_status(int card, int signal)
bool got_encoder;
msta_field status;
int absoluteAxis = (configurationFlags[card] & (1 << signal));
int rtn_state;
motor_info = &(motor_state[card]->motor_info[signal]);
@@ -443,7 +450,10 @@ static int set_status(int card, int signal)
motor_info->velocity = atoi(q_buf);
/* Get encoder position */
motorData = pmotor->encPos[signal];
if (absoluteAxis)
motorData = pmotor->absPos[signal];
else
motorData = pmotor->encPos[signal];
motor_info->encoder_position = motorData;
@@ -930,7 +940,8 @@ MAXvSetup(int num_cards, /* maximum number of cards in rack */
}
RTN_VALUES MAXvConfig(int card, /* number of card being configured */
const char *initstr) /* configuration string */
const char *initstr, /* configuration string */
int config) /* initialization configuration */
{
if (card < 0 || card >= MAXv_num_cards)
{
@@ -938,6 +949,7 @@ RTN_VALUES MAXvConfig(int card, /* number of card being configur
epicsThreadSleep(5.0);
return(ERROR);
}
if (strlen(initstr) > INITSTR_SIZE)
{
errlogPrintf("\n*** MAXvConfig ERROR ***\n");
@@ -945,8 +957,11 @@ RTN_VALUES MAXvConfig(int card, /* number of card being configur
epicsThreadSleep(5.0);
return(ERROR);
}
strcpy(initstring[card], initstr);
/* get the configuation flags */
configurationFlags[card] = config;
return(OK);
}
@@ -1336,7 +1351,7 @@ extern "C"
static void configMAXvCallFunc(const iocshArgBuf *args)
{
MAXvConfig(args[0].ival, args[1].sval);
MAXvConfig(args[0].ival, args[1].sval, args[2].ival);
}
static void OmsMAXvRegister(void)
+3 -1
View File
@@ -156,7 +156,9 @@ struct MAXv_motor
epicsUInt32 msg_semaphore;
epicsUInt32 queue_flush_mbox;
epicsUInt32 gpio;
epicsUInt32 naA0[19]; /* N/A byte offset 0xA0 - 0xEB. */
epicsUInt32 naA0[2]; /* N/A byte offset 0xA0 - 0xA7. */
epicsUInt32 absPos[8];
epicsUInt32 naC8[9]; /* N/A byte offset 0xC8 - 0xEB. */
epicsUInt32 flash_pgm_ptr;
epicsUInt32 outPutIndex;
epicsUInt32 outGetIndex;