loragw_usb.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. / _____) _ | |
  3. ( (____ _____ ____ _| |_ _____ ____| |__
  4. \____ \| ___ | (_ _) ___ |/ ___) _ \
  5. _____) ) ____| | | || |_| ____( (___| | | |
  6. (______/|_____)_|_|_| \__)_____)\____)_| |_|
  7. (C)2020 Semtech
  8. Description:
  9. Host specific functions to address the LoRa concentrator registers through
  10. a USB interface.
  11. Single-byte read/write and burst read/write.
  12. License: Revised BSD License, see LICENSE.TXT file include in the project
  13. */
  14. #ifndef _LORAGW_USB_H
  15. #define _LORAGW_USB_H
  16. /* -------------------------------------------------------------------------- */
  17. /* --- DEPENDANCIES --------------------------------------------------------- */
  18. #include <stdint.h> /* C99 types*/
  19. #include "loragw_com.h"
  20. #include "config.h" /* library configuration options (dynamically generated) */
  21. /* -------------------------------------------------------------------------- */
  22. /* --- PUBLIC CONSTANTS ----------------------------------------------------- */
  23. #define LGW_USB_SUCCESS 0
  24. #define LGW_USB_ERROR -1
  25. /* -------------------------------------------------------------------------- */
  26. /* --- PUBLIC FUNCTIONS PROTOTYPES ------------------------------------------ */
  27. /**
  28. *
  29. */
  30. int lgw_usb_open(const char * com_path, void **com_target_ptr);
  31. /**
  32. *
  33. */
  34. int lgw_usb_close(void *com_target);
  35. /**
  36. *
  37. */
  38. int lgw_usb_w(void *com_target, uint8_t spi_mux_target, uint16_t address, uint8_t data);
  39. /**
  40. *
  41. */
  42. int lgw_usb_r(void *com_target, uint8_t spi_mux_target, uint16_t address, uint8_t *data);
  43. /**
  44. *
  45. */
  46. int lgw_usb_wb(void *com_target, uint8_t spi_mux_target, uint16_t address, const uint8_t *data, uint16_t size);
  47. /**
  48. *
  49. */
  50. int lgw_usb_rb(void *com_target, uint8_t spi_mux_target, uint16_t address, uint8_t *data, uint16_t size);
  51. /**
  52. *
  53. */
  54. int lgw_usb_rmw(void *com_target, uint16_t address, uint8_t offs, uint8_t leng, uint8_t data);
  55. /**
  56. *
  57. **/
  58. int lgw_usb_set_write_mode(lgw_com_write_mode_t write_mode);
  59. /**
  60. *
  61. **/
  62. int lgw_usb_flush(void *com_target);
  63. /**
  64. *
  65. **/
  66. uint16_t lgw_usb_chunk_size(void);
  67. /**
  68. *
  69. **/
  70. int lgw_usb_get_temperature(void *com_target, float * temperature);
  71. #endif
  72. /* --- EOF ------------------------------------------------------------------ */