- Jan 14, 2006
- 20
- 0
- 0
hello, I'm (attempting) to write a driver for a motion control board for use in player/stage robot server.
player stage site
I have written most of the driver but cannot work out how to address the motion control card (which is fairly major!).
I have a programme which works in windows to interface with the motion controller car ( a PMC DCX PC100, its many many years old).
the code looks like this:
void dcxcmd(board,count,cmd,...)
int board,count,cmd;
{
int far *cmmdptr;
cmmdptr = &cmd; /* Set pointer to commands on PC stack. */
while(1)
{
/* Get present count from command block. */
movedata(DCXSEG+(board*0x100),CMDCNT,
FP_SEG(bytptr),FP_OFF(bytptr),1);
/* If count is nonzero, last command has not been processed by DCX. */
if (byt==0)
{
/* Move commands from PC stack to DCX dual port. */
movedata(FP_SEG(cmmdptr),FP_OFF(cmmdptr),
DCXSEG+(board*0x100),CMDBLK,count*6);
/* Set reply counter to 0. */
byt = 0;
movedata(FP_SEG(bytptr),FP_OFF(bytptr),
DCXSEG+(board*0x100),RPYCNT,1);
/* Set command counter tonumber of valid bytes in command block. */
byt = (unsigned char)count*6;
movedata(FP_SEG(bytptr),FP_OFF(bytptr),
DCXSEG+(board*0x100),CMDCNT,1);
return;
}
}
}
(sorry for the epic post this is turning into!)
How it works is buy moving bytes from the main system memory into 4kb of memory on the motion control card. Depending on where the data is put in the memory on the car changes what commands the card issues to the motors.
As you can see it uses the movedata() function, which I have been reliably informed is great for windows/dos, but does not work under Linux, and as Player runs in Linux that is a bit of a stumbling block. I am ok at programming but my no means an good. I was just wondering if anybody knew the equivalent command for Movedata() in Linux!
I have tried google, but only find where people say that movedata() is like memcpy() but memcpy is only for windows/dos too.
Thanks for any help offered!
again apologies for the epic post!
ps. should probably say that the motion control card is on the ISA bus!
player stage site
I have written most of the driver but cannot work out how to address the motion control card (which is fairly major!).
I have a programme which works in windows to interface with the motion controller car ( a PMC DCX PC100, its many many years old).
the code looks like this:
void dcxcmd(board,count,cmd,...)
int board,count,cmd;
{
int far *cmmdptr;
cmmdptr = &cmd; /* Set pointer to commands on PC stack. */
while(1)
{
/* Get present count from command block. */
movedata(DCXSEG+(board*0x100),CMDCNT,
FP_SEG(bytptr),FP_OFF(bytptr),1);
/* If count is nonzero, last command has not been processed by DCX. */
if (byt==0)
{
/* Move commands from PC stack to DCX dual port. */
movedata(FP_SEG(cmmdptr),FP_OFF(cmmdptr),
DCXSEG+(board*0x100),CMDBLK,count*6);
/* Set reply counter to 0. */
byt = 0;
movedata(FP_SEG(bytptr),FP_OFF(bytptr),
DCXSEG+(board*0x100),RPYCNT,1);
/* Set command counter tonumber of valid bytes in command block. */
byt = (unsigned char)count*6;
movedata(FP_SEG(bytptr),FP_OFF(bytptr),
DCXSEG+(board*0x100),CMDCNT,1);
return;
}
}
}
(sorry for the epic post this is turning into!)
How it works is buy moving bytes from the main system memory into 4kb of memory on the motion control card. Depending on where the data is put in the memory on the car changes what commands the card issues to the motors.
As you can see it uses the movedata() function, which I have been reliably informed is great for windows/dos, but does not work under Linux, and as Player runs in Linux that is a bit of a stumbling block. I am ok at programming but my no means an good. I was just wondering if anybody knew the equivalent command for Movedata() in Linux!
I have tried google, but only find where people say that movedata() is like memcpy() but memcpy is only for windows/dos too.
Thanks for any help offered!
again apologies for the epic post!
ps. should probably say that the motion control card is on the ISA bus!