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.
 
 
 

67 lines
2.2 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 66000000
  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 726
  21. /* Packet structure used in message to start sampling on NerdJack */
  22. typedef struct __attribute__ ((__packed__)) {
  23. char word[4];
  24. unsigned int period; //CHANGED FROM TYPE LONG. With 64 bit compilers longs are 8 bytes and nerdjack expects a 4 byte value
  25. //since the int type is 4 bytes this works but should be changed to use defined datatypes rather than rely on compiler data types
  26. unsigned short channelbit;
  27. unsigned char precision;
  28. unsigned char prescaler;
  29. } getPacket;
  30. /* Open/close TCP/IP connection to the NerdJack */
  31. int nerd_open(const char *address, int port);
  32. int nerd_close_conn(int data_fd);
  33. /* Generate the command word for the NerdJack */
  34. int nerd_generate_command(getPacket * command, int *channel_list,
  35. int channel_count, int precision,
  36. unsigned long period);
  37. /* Send given command to NerdJack */
  38. int nerd_send_command(const char *address, void *command, int length);
  39. /* Get the version string from NerdJack */
  40. int nerd_get_version(const char *address);
  41. /* Stream data out of the NerdJack */
  42. int nerd_data_stream(int data_fd, int numChannels, int *channel_list,
  43. int precision, int convert, int lines, int showmem,
  44. unsigned short *currentcount, unsigned int period,
  45. int wasreset);
  46. /* Detect the IP Address of the NerdJack and return in ipAddress */
  47. int nerdjack_detect(char *ipAddress);
  48. /* Choose the best ScanConfig and ScanInterval parameters for the
  49. desired scanrate. Returns -1 if no valid config found */
  50. int nerdjack_choose_scan(double desired_rate, double *actual_rate,
  51. unsigned long *period);
  52. #endif