kspi.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // kspi.h :
  2. //
  3. #if !defined(AGD_KSPI_H__C0C2E2F9_77AA_4807_9B26_08F970CFD563__INCLUDED_)
  4. #define AGD_KSPI_H__C0C2E2F9_77AA_4807_9B26_08F970CFD563__INCLUDED_
  5. #include <linux/kernel.h>
  6. #include <linux/spi/spidev.h>
  7. #include <linux/syscalls.h>
  8. #include "defines.h"
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif // __cplusplus
  12. /////////////////////////////////////////////////////////////////////////////
  13. // kspi.h - Declarations:
  14. int kspi_write_mode (struct file *pf, unsigned char mode);
  15. int kspi_read_mode (struct file *pf, unsigned char *mode);
  16. int kspi_write_bits_per_word(struct file *pf, unsigned char bits);
  17. int kspi_read_bits_per_word (struct file *pf, unsigned char *bits);
  18. int kspi_write_max_speed_hz (struct file *pf, unsigned int speed);
  19. int kspi_read_max_speed_hz (struct file *pf, unsigned int *speed);
  20. /////////////////////////////////////////////////////////////////////////////
  21. int kspi_tx (struct file *pf, const void *pData, size_t nCbData);
  22. int kspi_rx (struct file *pf, void *pData, size_t nCbData);
  23. int kspi_tx_rx (struct file *pf, const void *pTx, void *pRx, size_t nCb);
  24. int kspi_rx_byte (struct file *pf, unsigned char *rx);
  25. int kspi_tx_byte (struct file *pf, unsigned char tx);
  26. int kspi_tx_rx_byte (struct file *pf, unsigned char tx, unsigned char *rx);
  27. /////////////////////////////////////////////////////////////////////////////
  28. bool KSpiInit(struct file *pf);
  29. void KSpiExit(void);
  30. /////////////////////////////////////////////////////////////////////////////
  31. #ifdef __cplusplus
  32. }
  33. #endif // __cplusplus
  34. #endif // !defined(AGD_KSPI_H__C0C2E2F9_77AA_4807_9B26_08F970CFD563__INCLUDED_)