Hi Abdalla,
What is the communications port with the device: serial, TCP/IP, GPIB, etc.? If it is one of those then you need to use the asynOctetSyncIO interface.
This is the definition of the asynOctetSyncIO::writeRead method:
asynStatus (*writeRead)(asynUser *pasynUser,
const char *write_buffer, size_t write_buffer_len,
char *read_buffer, size_t read_buffer_len,
double timeout,
size_t *nbytesOut, size_t *nbytesIn, int *eomReason);
You can put your struct type data in the write_buffer, and specify the length with write_buffer_len.
Depending on how complex the device is you may be able to use StreamDevice to talk to it, and not need to write your own driver.
The asynGenericPointer interface requires that both ends of the communication channel know exactly what structure type is being passed. It is used, for example, for communication between areaDetector drivers and plugins, where the data structure is an NDArray. It is also used for communication between the motor record device support and the Model3 motor drivers using a MotorStatus structure.
Mark
________________________________
From: Abdalla Ahmad <Abdalla.Ahmad at sesame.org.jo>
Sent: Tuesday, April 20, 2021 5:11 AM
To: tech-talk at aps.anl.gov; Mark Rivers
Subject: How to use asyGenericPointerSyncIO interface?
Hi
We want to write a driver for a device we have in which its command interface consists of bytes in a specific order (like C structs), for example first byte is command type, 2nd byte is address and then followed by 4 bytes as the data; 6 bytes in total. Is asyGenericPointerSyncIO the correct choice? I could not see anywhere in the sync IO interfaces where I pass the struct size (Like in the write/read system calls). How does the write/read operations work with these interfaces and how do they detect how many bytes to write? Do I need to use the void pointers inside the asynUser structure?
Thanks!
Abdalla
- References:
- How to use asyGenericPointerSyncIO interface? Abdalla Ahmad via Tech-talk
- Navigate by Date:
- Prev:
How to use asyGenericPointerSyncIO interface? Abdalla Ahmad via Tech-talk
- Next:
asyn: No rule to make target 'ipSNCServer.o'; Does configure/RELEASE have multiple pointers to ... Hu, Yong via Tech-talk
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
<2021>
2022
2023
2024
- Navigate by Thread:
- Prev:
How to use asyGenericPointerSyncIO interface? Abdalla Ahmad via Tech-talk
- Next:
asyn: No rule to make target 'ipSNCServer.o'; Does configure/RELEASE have multiple pointers to ... Hu, Yong via Tech-talk
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
<2021>
2022
2023
2024
|