ccspi.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*****************************************************************************
  2. *
  3. * spi.h - CC3000 Host Driver Implementation.
  4. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. *
  13. * Redistributions in binary form must reproduce the above copyright
  14. * notice, this list of conditions and the following disclaimer in the
  15. * documentation and/or other materials provided with the
  16. * distribution.
  17. *
  18. * Neither the name of Texas Instruments Incorporated nor the names of
  19. * its contributors may be used to endorse or promote products derived
  20. * from this software without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  23. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  24. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  25. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  26. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  27. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  28. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  29. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  30. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  31. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  32. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33. *
  34. *****************************************************************************/
  35. #ifndef __CC3000_SPI_H__
  36. #define __CC3000_SPI_H__
  37. //*****************************************************************************
  38. //
  39. // If building with a C++ compiler, make all of the definitions in this header
  40. // have a C binding.
  41. //
  42. //*****************************************************************************
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46. typedef void (*gcSpiHandleRx)(void *p);
  47. typedef void (*gcSpiHandleTx)(void);
  48. extern unsigned char wlan_tx_buffer[];
  49. //*****************************************************************************
  50. //
  51. // Prototypes for the APIs.
  52. //
  53. //*****************************************************************************
  54. // the arguments must be of type pin_obj_t* and SPI_HandleTypeDef*
  55. extern void SpiInit(void *spi, const void *pin_cs, const void *pin_en, const void *pin_irq);
  56. extern void SpiOpen(gcSpiHandleRx pfRxHandler);
  57. extern void SpiClose(void);
  58. extern void SpiPauseSpi(void);
  59. extern void SpiResumeSpi(void);
  60. extern long SpiWrite(unsigned char *pUserBuffer, unsigned short usLength);
  61. extern void SpiConfigureHwMapping(void);
  62. extern void SpiCleanGPIOISR(void);
  63. extern void SSIConfigure(unsigned long ulSSIFreq, unsigned long bForceGpioConfiguration, unsigned long uiReconfigureSysClock);
  64. extern int init_spi(void);
  65. extern long ReadWlanInterruptPin(void);
  66. extern void WriteWlanPin(unsigned char val);
  67. //*****************************************************************************
  68. //
  69. // Mark the end of the C bindings section for C++ compilers.
  70. //
  71. //*****************************************************************************
  72. #ifdef __cplusplus
  73. }
  74. #endif // __cplusplus
  75. #endif