3 @brief Library file for the vmod12a2 driver
4 @author Juan David Gonzalez Cobas
12 #include "libvmod12a22dioaio.h"
13 #include <gm/moduletypes.h>
14 #include <dioaiolib.h>
16 #define VMOD12A2_MAX_MODULES 64
19 * @brief Get a handle for a vmod12a2 device and channel
21 * A channel is selected by giving the LUN for the board
22 * and the channel number. The handle returned allows
23 * further reference to the same channel
25 * @param carrier_lun - carrier LUN for vmod card
26 * @param channel - selected channel for reading
28 * @return >0 - on success, device file descriptor number
29 * @return <0 - if failure
32 int vmod12a2_get_handle(unsigned int carrier_lun
)
34 if(carrier_lun
< 0 || carrier_lun
>= VMOD12A2_MAX_MODULES
){
35 fprintf(stderr
, "libvmod12a22dioaio : Invalid lun %d\n", carrier_lun
);
42 * @brief perform a digital-to-analog conversion
44 * The output voltage depends on hardware configuration (default
45 * -10V..10V, configurable by jumpers to 0-10V range).
47 * @param fd Device handle identifying board
48 * @param channel Channel on the board to write to
49 * @param datum Digital 12-bit value (0x000-0xfff)
51 * @return 0 on success, <0 on failure
53 int vmod12a2_convert(int fd
, int channel
, int datum
)
58 ret
= DioChannelWrite(IocVMOD12A2
, fd
, channel
, 2, datum
);
60 DioGetErrorMessage(ret
, &error
);
61 fprintf(stderr
, "libvmod12a22dioaio : %s\n", error
);
67 * @brief close a channel handle
69 * @param fd - Handle to close
71 int vmod12a2_close(int fd
)