You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

62 lines
1.8 KiB

  1. /*
  2. * Labjack Tools
  3. * Copyright (c) 2003-2007 Jim Paris <jim@jtan.com>
  4. *
  5. * This is free software; you can redistribute it and/or modify it and
  6. * it is provided under the terms of version 2 of the GNU General Public
  7. * License as published by the Free Software Foundation; see COPYING.
  8. */
  9. #ifndef NERDJACK_H
  10. #define NERDJACK_H
  11. #include <stdint.h>
  12. #include <stdlib.h>
  13. #include "netutil.h"
  14. #define NERDJACK_CHANNELS 12
  15. #define NERDJACK_CLOCK_RATE 54000000
  16. #define NERDJACK_DATA_PORT 49155
  17. #define NERDJACK_UDP_RECEIVE_PORT 49156
  18. #define NERDJACK_COMMAND_PORT 49157
  19. #define NERDJACK_PACKET_SIZE 1460
  20. #define NERDJACK_NUM_SAMPLES 724
  21. typedef struct __attribute__ ((__packed__))
  22. {
  23. char word[4];
  24. unsigned short channelbit;
  25. unsigned char precision;
  26. unsigned long period;
  27. unsigned char prescaler;
  28. } getPacket;
  29. /* Open/close TCP/IP connection to the NerdJack */
  30. int nerd_open (const char *address, int port);
  31. int nerd_close_conn (int data_fd);
  32. /* Generate the command word for the NerdJack */
  33. int nerd_generate_command (getPacket * command, int *channel_list,
  34. int channel_count, int precision,
  35. unsigned long period);
  36. /* Send given command to NerdJack */
  37. int nerd_send_command (const char *address, void *command, int length);
  38. /* Stream data out of the NerdJack */
  39. int nerd_data_stream (int data_fd, int numChannels, int *channel_list,
  40. int precision, int convert, int lines, int showmem,
  41. unsigned short *currentcount, unsigned int period);
  42. /* Detect the IP Address of the NerdJack and return in ipAddress */
  43. int nerdjack_detect (char *ipAddress);
  44. /* Choose the best ScanConfig and ScanInterval parameters for the
  45. desired scanrate. Returns -1 if no valid config found */
  46. int nerdjack_choose_scan (double desired_rate, double *actual_rate,
  47. unsigned long *period);
  48. #endif