int main (int argc, char *argv[]) { int val; printf(" ______________________________________ \n"); printf(" | | \n"); printf(" | VMOD-TTL Testing program | \n"); printf(" |______________________________________| \n"); printf(" | | \n"); printf(" | Created by: Samuel I. Gonsalvez | \n"); printf(" | Email: [email protected] | \n"); printf(" |______________________________________| \n"); printf("\n"); printf("%s\n", git_version); printf("%s\n", libvmod_version_s); if (argc == 2) { device = atoi(argv[1]); } else { printf("\n Please use: test_read_write <lun_of_the_device>.\n"); exit(-1); } if(vmodttl_open (device) < 0) { perror("open failed"); return -1; } val = 0; while(1){ if(val) { vmodttl_write(device, 1, 0x43); val = 0; }else{ vmodttl_write(device, 1, 0xe1); val = 1; } usleep(250); //sleep(1); } vmodttl_close(device); return 0; }
void write_channel(int pd) { int chan = 0; int val = 0; printf("Please, give the number of the channel [0 -> A, 1 -> B, 2 -> AB]: "); scanf("%d", &chan); printf("Please, give the value to be written to the channel (hex): 0x"); scanf("%x", &val); if(vmodttl_write(pd, chan, val) < 0) printf("test_vmodttl: Write error"); }