spi.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. /******************************************************************************
  2. *
  3. * @brief header file for SPI module utilities (SPI).
  4. *
  5. *******************************************************************************
  6. *
  7. * provide APIs for accessing SPI module (SPI)
  8. ******************************************************************************/
  9. #ifndef SPI_H_
  10. #define SPI_H_
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. /******************************************************************************
  15. * Includes
  16. ******************************************************************************/
  17. /******************************************************************************
  18. * Constants
  19. ******************************************************************************/
  20. /******************************************************************************
  21. * Macros
  22. ******************************************************************************/
  23. /* maximum number of SPIs */
  24. #define MAX_SPI_NO 2
  25. /******************************************************************************
  26. * define SPI register default value
  27. *
  28. *//*! @addtogroup spi_default_value
  29. * @{
  30. *******************************************************************************/
  31. #define SPI_C1_DEFAULT 0x04 /*!< SPI C1 register */
  32. #define SPI_C2_DEFAULT 0x00 /*!< SPI C2 register */
  33. #define SPI_BR_DEFAULT 0x00 /*!< SPI BR register */
  34. #define SPI_S_DEFAULT 0x20 /*!< SPI S register */
  35. #define SPI_M_DEFAULT 0x00 /*!< SPI M register */
  36. /*! @} End of spi_default_value */
  37. /******************************************************************************
  38. * define SPI error status
  39. *
  40. *//*! @addtogroup spi_error_list
  41. * @{
  42. *******************************************************************************/
  43. #define SPI_ERR_SUCCESS 0 /*!< success */
  44. #define SPI_ERR_CODE_BASE ((uint32)SPI0 - 0x40000000L) /*!< error code base for SPI */
  45. #define SPI_ERR_TXBUF_NOT_EMPTY (SPI_ERR_CODE_BASE+1) /*!< failure due to SPTEF (empty) not set */
  46. #define SPI_ERR_RXBUF_NOT_FULL (SPI_ERR_CODE_BASE+2) /*!< failure due to SPRF (full) not set */
  47. /*! @} End of spi_error_list */
  48. /******************************************************************************
  49. * Types
  50. ******************************************************************************/
  51. typedef uint8_t SPI_WidthType; /* SPI width type */
  52. typedef uint32_t ResultType; /* SPI routine Result code */
  53. /******************************************************************************
  54. * define SPI call back funtion
  55. *
  56. *//*! @addtogroup spi_callback
  57. * @{
  58. *******************************************************************************/
  59. typedef void (*SPI_CallbackType)(void); /*!< SPI call back function */
  60. /*! @} End of spi_callback */
  61. /******************************************************************************
  62. *
  63. *//*! @addtogroup spi_setting_type
  64. * @{
  65. *******************************************************************************/
  66. /*!
  67. * @brief SPI setting type.
  68. *
  69. */
  70. typedef struct
  71. {
  72. uint32_t bIntEn : 1; /*!< 1: Interrupt Enable, 0: Interrupt disable */
  73. uint32_t bModuleEn : 1; /*!< 1: SPI module Enable, 0: SPI module disable */
  74. uint32_t bTxIntEn : 1; /*!< 1: Tx Interrupt Enable, 0: Tx Interrupt disable */
  75. uint32_t bMasterMode : 1; /*!< 1: Master mode, 0: Slave mode */
  76. uint32_t bClkPolarityLow : 1; /*!< 1: Active-low SPI clock, 0: Active-HIgh SPI clock */
  77. uint32_t bClkPhase1 : 1; /*!< Set clock phase */
  78. uint32_t bMasterAutoDriveSS : 1; /*!< Slave select output enable */
  79. uint32_t bShiftLSBFirst : 1; /*!< 1: LSB first, 0: MSB first */
  80. uint32_t bMatchIntEn : 1; /*!< 1: Match interrupt Enable, 0: Match interrupt disable */
  81. uint32_t bModeFaultEn : 1; /*!< Master mode-fault function enable */
  82. uint32_t bBidirectionModeEn : 1; /*!< Bidirectional mode output enable */
  83. uint32_t bPinAsOuput : 1; /*!< enables bidirectional pin configurations */
  84. uint32_t bStopInWaitMode : 1; /*!< SPI stop in wait mode */
  85. uint32_t bRsvd : 19;
  86. } SPI_SettingType;
  87. /*! @} End of spi_setting_type */
  88. /******************************************************************************
  89. *
  90. *//*! @addtogroup spi_config_type
  91. * @{
  92. *******************************************************************************/
  93. /*!
  94. * @brief SPI configuration type.
  95. *
  96. */
  97. typedef struct
  98. {
  99. SPI_SettingType sSettings; /*!< SPI settings */
  100. uint32_t u32BitRate; /*!< set baud rate */
  101. uint32_t u32BusClkHz; /*!< input bus clock */
  102. } SPI_ConfigType; /*!< SPI configuration structure */
  103. /*! @} End of spi_config_type */
  104. /******************************************************************************
  105. * Global variables
  106. ******************************************************************************/
  107. /******************************************************************************
  108. * inline function
  109. ******************************************************************************/
  110. /******************************************************************************
  111. *
  112. *//*! @addtogroup spi_api_list
  113. * @{
  114. *******************************************************************************/
  115. /*****************************************************************************//*!
  116. *
  117. * @brief LSB first (shifter direction).
  118. *
  119. * @param[in] pSPI point to SPI module type.
  120. *
  121. * @return none.
  122. *
  123. * @ Pass/ Fail criteria: none.
  124. *****************************************************************************/
  125. __STATIC_INLINE void SPI_SetLSBFirst(SPI_Type *pSPI)
  126. {
  127. pSPI->C1 |= SPI_C1_LSBFE_MASK;
  128. }
  129. /*****************************************************************************//*!
  130. *
  131. * @brief MSB first (shifter direction).
  132. *
  133. * @param[in] pSPI point to SPI module type.
  134. *
  135. * @return none.
  136. *
  137. * @ Pass/ Fail criteria: none.
  138. *****************************************************************************/
  139. __STATIC_INLINE void SPI_SetMSBFirst(SPI_Type *pSPI)
  140. {
  141. pSPI->C1 &= ~SPI_C1_LSBFE_MASK;
  142. }
  143. /*****************************************************************************//*!
  144. *
  145. * @brief set SPI clock polarity.
  146. *
  147. * @param[in] pSPI point to SPI module type.
  148. * @param[in] u8PolLow set clock polarity, 1 - Active-low SPI clock (idles high).
  149. * @return none
  150. *
  151. * @ Pass/ Fail criteria: none
  152. *****************************************************************************/
  153. __STATIC_INLINE void SPI_SetClockPol(SPI_Type *pSPI,uint8_t u8PolLow)
  154. {
  155. if( u8PolLow )
  156. {
  157. pSPI->C1 |= SPI_C1_CPOL_MASK;
  158. }
  159. else
  160. {
  161. pSPI->C1 &= ~SPI_C1_CPOL_MASK;
  162. }
  163. }
  164. /*****************************************************************************//*!
  165. *
  166. * @brief set SPI clock phase.
  167. *
  168. * @param[in] pSPI point to SPI module type.
  169. * @param[in] u8Phase set clock phase, 1 - First edge on SPSCK occurs at the start of the first cycle of a data transfer.
  170. *
  171. * @return none
  172. *
  173. * @ Pass/ Fail criteria: none
  174. *****************************************************************************/
  175. __STATIC_INLINE void SPI_SetClockPhase(SPI_Type *pSPI,uint8_t u8Phase)
  176. {
  177. if( u8Phase )
  178. {
  179. pSPI->C1 |= SPI_C1_CPHA_MASK;
  180. }
  181. else
  182. {
  183. pSPI->C1 &= ~SPI_C1_CPHA_MASK;
  184. }
  185. }
  186. /*****************************************************************************//*!
  187. *
  188. * @brief enable SPI module.
  189. *
  190. * @param[in] pSPI point to SPI module type.
  191. *
  192. * @return none
  193. *
  194. * @ Pass/ Fail criteria: none
  195. *****************************************************************************/
  196. __STATIC_INLINE void SPI_Enable(SPI_Type *pSPI)
  197. {
  198. pSPI->C1 |= SPI_C1_SPE_MASK;
  199. }
  200. /*****************************************************************************//*!
  201. *
  202. * @brief disable SPI module.
  203. *
  204. * @param[in] pSPI point to SPI module type.
  205. *
  206. * @return none
  207. *
  208. * @ Pass/ Fail criteria: none
  209. *****************************************************************************/
  210. __STATIC_INLINE void SPI_Disable(SPI_Type *pSPI)
  211. {
  212. pSPI->C1 &= ~SPI_C1_SPE_MASK;
  213. }
  214. /*****************************************************************************//*!
  215. *
  216. * @brief enable SPI interrupt.
  217. *
  218. * @param[in] pSPI point to SPI module type.
  219. *
  220. * @return none
  221. *
  222. * @ Pass/ Fail criteria: none
  223. *****************************************************************************/
  224. __STATIC_INLINE void SPI_IntEnable(SPI_Type *pSPI)
  225. {
  226. pSPI->C1 |= SPI_C1_SPIE_MASK;
  227. }
  228. /*****************************************************************************//*!
  229. *
  230. * @brief disable SPI interrupt.
  231. *
  232. * @param[in] pSPI point to SPI module type.
  233. *
  234. * @return none
  235. *
  236. * @ Pass/ Fail criteria: none
  237. *****************************************************************************/
  238. __STATIC_INLINE void SPI_IntDisable(SPI_Type *pSPI)
  239. {
  240. pSPI->C1 &= ~SPI_C1_SPIE_MASK;
  241. }
  242. /*****************************************************************************//*!
  243. *
  244. * @brief set SPI to master mode.
  245. *
  246. * @param[in] pSPI point to SPI module type.
  247. *
  248. * @return none
  249. *
  250. * @ Pass/ Fail criteria: none
  251. *****************************************************************************/
  252. __STATIC_INLINE void SPI_SetMasterMode(SPI_Type *pSPI)
  253. {
  254. pSPI->C1 |= SPI_C1_MSTR_MASK;
  255. }
  256. /*****************************************************************************//*!
  257. *
  258. * @brief set SPI to slave mode.
  259. *
  260. * @param[in] pSPI point to SPI module type.
  261. *
  262. * @return none
  263. *
  264. * @ Pass/ Fail criteria: none
  265. *****************************************************************************/
  266. __STATIC_INLINE void SPI_SetSlaveMode(SPI_Type *pSPI)
  267. {
  268. pSPI->C1 &= ~SPI_C1_MSTR_MASK;
  269. }
  270. /*****************************************************************************//*!
  271. *
  272. * @brief SPI transmit interrupt enable.
  273. *
  274. * @param[in] pSPI point to SPI module type.
  275. *
  276. * @return none.
  277. *
  278. * @ Pass/ Fail criteria: none.
  279. *****************************************************************************/
  280. __STATIC_INLINE void SPI_TxIntEnable(SPI_Type *pSPI)
  281. {
  282. pSPI->C1 |= SPI_C1_SPTIE_MASK;
  283. }
  284. /*****************************************************************************//*!
  285. *
  286. * @brief SPI transmit interrupt disable.
  287. *
  288. * @param[in] pSPI point to SPI module type.
  289. *
  290. * @return none
  291. *
  292. * @ Pass/ Fail criteria: none
  293. *****************************************************************************/
  294. __STATIC_INLINE void SPI_TxIntDisable(SPI_Type *pSPI)
  295. {
  296. pSPI->C1 &= ~SPI_C1_SPTIE_MASK;
  297. }
  298. /*****************************************************************************//*!
  299. *
  300. * @brief Slave select output enable.
  301. *
  302. * @param[in] pSPI point to SPI module type.
  303. *
  304. * @return none
  305. *
  306. * @ Pass/ Fail criteria: none
  307. *****************************************************************************/
  308. __STATIC_INLINE void SPI_SSOutputEnable(SPI_Type *pSPI )
  309. {
  310. pSPI->C1 |= SPI_C1_SSOE_MASK;
  311. }
  312. /*****************************************************************************//*!
  313. *
  314. * @brief Slave select output disable.
  315. *
  316. * @param[in] pSPI point to SPI module type.
  317. *
  318. * @return none
  319. *
  320. * @ Pass/ Fail criteria: none
  321. *****************************************************************************/
  322. __STATIC_INLINE void SPI_SSOutputDisable(SPI_Type *pSPI )
  323. {
  324. pSPI->C1 &= ~SPI_C1_SSOE_MASK;
  325. }
  326. /*****************************************************************************//*!
  327. *
  328. * @brief SPI match interrupt enable.
  329. *
  330. * @param[in] pSPI point to SPI module type.
  331. *
  332. * @return none
  333. *
  334. * @ Pass/ Fail criteria: none
  335. *****************************************************************************/
  336. __STATIC_INLINE void SPI_MatchIntEnable(SPI_Type *pSPI )
  337. {
  338. pSPI->C2 |= SPI_C2_SPMIE_MASK;
  339. }
  340. /*****************************************************************************//*!
  341. *
  342. * @brief SPI match interrupt disable.
  343. *
  344. * @param[in] pSPI point to SPI module type.
  345. *
  346. * @return none.
  347. *
  348. * @ Pass/ Fail criteria: none.
  349. *****************************************************************************/
  350. __STATIC_INLINE void SPI_MatchIntDisable(SPI_Type *pSPI )
  351. {
  352. pSPI->C2 &= ~SPI_C2_SPMIE_MASK;
  353. }
  354. /*****************************************************************************//*!
  355. *
  356. * @brief Master mode-fault function disable.
  357. *
  358. * @param[in] pSPI point to SPI module type.
  359. *
  360. * @return none.
  361. *
  362. * @ Pass/ Fail criteria: none.
  363. *****************************************************************************/
  364. __STATIC_INLINE void SPI_ModfDisable(SPI_Type *pSPI )
  365. {
  366. pSPI->C2 &= ~SPI_C2_MODFEN_MASK;
  367. }
  368. /*****************************************************************************//*!
  369. *
  370. * @brief Master mode-fault function enable.
  371. *
  372. * @param[in] pSPI point to SPI module type.
  373. *
  374. * @return none.
  375. *
  376. * @ Pass/ Fail criteria: none.
  377. *****************************************************************************/
  378. __STATIC_INLINE void SPI_ModfEnable(SPI_Type *pSPI )
  379. {
  380. pSPI->C2 |= SPI_C2_MODFEN_MASK;
  381. }
  382. /*****************************************************************************//*!
  383. *
  384. * @brief Bidirectional mode output enable.
  385. *
  386. * @param[in] pSPI point to SPI module type.
  387. *
  388. * @return none.
  389. *
  390. * @ Pass/ Fail criteria: none.
  391. *****************************************************************************/
  392. __STATIC_INLINE void SPI_BidirOutEnable(SPI_Type *pSPI )
  393. {
  394. pSPI->C2 |= SPI_C2_BIDIROE_MASK;
  395. }
  396. /*****************************************************************************//*!
  397. *
  398. * @brief Bidirectional mode output disable.
  399. *
  400. * @param[in] pSPI point to SPI module type.
  401. *
  402. * @return none.
  403. *
  404. * @ Pass/ Fail criteria: none.
  405. *****************************************************************************/
  406. __STATIC_INLINE void SPI_BidirOutDisable(SPI_Type *pSPI )
  407. {
  408. pSPI->C2 &= ~SPI_C2_BIDIROE_MASK;
  409. }
  410. /*****************************************************************************//*!
  411. *
  412. * @brief SPI stop in wait mode
  413. *
  414. * @param[in] pSPI point to SPI module type.
  415. *
  416. * @return none.
  417. *
  418. * @ Pass/ Fail criteria: none.
  419. *****************************************************************************/
  420. __STATIC_INLINE void SPI_ClockStopDisable(SPI_Type *pSPI )
  421. {
  422. pSPI->C2 &= ~SPI_C2_SPISWAI_MASK;
  423. }
  424. /*****************************************************************************//*!
  425. *
  426. * @brief SPI stop in wait mode.
  427. *
  428. * @param[in] pSPI point to SPI module type.
  429. *
  430. * @return none
  431. *
  432. * @ Pass/ Fail criteria: none
  433. *****************************************************************************/
  434. __STATIC_INLINE void SPI_ClockStopEnable(SPI_Type *pSPI )
  435. {
  436. pSPI->C2 |= SPI_C2_SPISWAI_MASK;
  437. }
  438. /*****************************************************************************//*!
  439. *
  440. * @brief enables bidirectional pin configurations.
  441. *
  442. * @param[in] pSPI point to SPI module type.
  443. *
  444. * @return none
  445. *
  446. * @ Pass/ Fail criteria: none
  447. *****************************************************************************/
  448. __STATIC_INLINE void SPI_BidirPinEnable(SPI_Type *pSPI)
  449. {
  450. pSPI->C2 |= SPI_C2_SPC0_MASK;
  451. }
  452. /*****************************************************************************//*!
  453. *
  454. * @brief enables bidirectional pin configurations.
  455. *
  456. * @param[in] pSPI point to SPI module type.
  457. *
  458. * @return none
  459. *
  460. * @ Pass/ Fail criteria: none
  461. *****************************************************************************/
  462. __STATIC_INLINE void SPI_BidirPinDisable(SPI_Type *pSPI)
  463. {
  464. pSPI->C2 &= ~SPI_C2_SPC0_MASK;
  465. }
  466. /*****************************************************************************//*!
  467. *
  468. * @brief check SPI read buffer full flag.
  469. *
  470. * @param[in] pSPI point to SPI module type.
  471. *
  472. * @return TRUE or FALSE.
  473. *
  474. * @ Pass/ Fail criteria: none.
  475. *****************************************************************************/
  476. __STATIC_INLINE uint8_t SPI_IsSPRF(SPI_Type *pSPI )
  477. {
  478. return(pSPI->S & SPI_S_SPRF_MASK);
  479. }
  480. /*****************************************************************************//*!
  481. *
  482. * @brief check SPI match flag.
  483. *
  484. * @param[in] pSPI point to SPI module type.
  485. *
  486. * @return TRUE or FALSE.
  487. *
  488. * @ Pass/ Fail criteria: none.
  489. *****************************************************************************/
  490. __STATIC_INLINE uint8_t SPI_IsSPMF(SPI_Type *pSPI )
  491. {
  492. return(pSPI->S & SPI_S_SPMF_MASK);
  493. }
  494. /*****************************************************************************//*!
  495. *
  496. * @brief check SPI transmit buffer empty flag.
  497. *
  498. * @param[in] pSPI point to SPI module type.
  499. *
  500. * @return TRUE or FALSE.
  501. *
  502. * @ Pass/ Fail criteria: none
  503. *****************************************************************************/
  504. __STATIC_INLINE uint8_t SPI_IsSPTEF(SPI_Type *pSPI )
  505. {
  506. return(pSPI->S & SPI_S_SPTEF_MASK);
  507. }
  508. /*****************************************************************************//*!
  509. *
  510. * @brief check master mode fault flag.
  511. *
  512. * @param[in] pSPI point to SPI module type.
  513. *
  514. * @return TRUE or FALSE.
  515. *
  516. * @ Pass/ Fail criteria: none
  517. *****************************************************************************/
  518. __STATIC_INLINE uint8_t SPI_IsMODF(SPI_Type *pSPI )
  519. {
  520. return(pSPI->S & SPI_S_MODF_MASK);
  521. }
  522. /*****************************************************************************//*!
  523. *
  524. * @brief read SPI data register.
  525. *
  526. * @param[in] pSPI point to SPI module type.
  527. *
  528. * @return data register value
  529. *
  530. * @ Pass/ Fail criteria: none
  531. *****************************************************************************/
  532. __STATIC_INLINE uint8_t SPI_ReadDataReg(SPI_Type *pSPI )
  533. {
  534. return pSPI->D;
  535. }
  536. /*****************************************************************************//*!
  537. *
  538. * @brief write SPI data register.
  539. *
  540. * @param[in] pSPI point to SPI module type.
  541. * @param[in] u8WrBuff data buffer write to spi data register.
  542. *
  543. * @return none
  544. *
  545. * @ Pass/ Fail criteria: none
  546. *****************************************************************************/
  547. __STATIC_INLINE void SPI_WriteDataReg(SPI_Type *pSPI, uint8_t u8WrBuff )
  548. {
  549. pSPI->D = u8WrBuff;
  550. }
  551. /*****************************************************************************//*!
  552. *
  553. * @brief write SPI match register.
  554. *
  555. * @param[in] pSPI point to SPI module type.
  556. * @param[in] u8WrBuff the data buffer write to match register.
  557. *
  558. * @return none
  559. *
  560. * @ Pass/ Fail criteria: none
  561. *****************************************************************************/
  562. __STATIC_INLINE void SPI_WriteMatchValue(SPI_Type *pSPI, uint8_t u8WrBuff )
  563. {
  564. pSPI->M = u8WrBuff;
  565. }
  566. /******************************************************************************
  567. * Global functions
  568. ******************************************************************************/
  569. void SPI_Enable(SPI_Type *pSPI);
  570. void SPI_Disable(SPI_Type *pSPI);
  571. void SPI_SetLSBFirst(SPI_Type *pSPI);
  572. void SPI_SetMSBFirst(SPI_Type *pSPI);
  573. void SPI_IntEnable(SPI_Type *pSPI);
  574. void SPI_IntDisable(SPI_Type *pSPI);
  575. void SPI_SetMasterMode(SPI_Type *pSPI);
  576. void SPI_SetSlaveMode(SPI_Type *pSPI);
  577. void SPI_TxIntEnable(SPI_Type *pSPI);
  578. void SPI_TxIntDisable(SPI_Type *pSPI);
  579. void SPI_SSOutputEnable(SPI_Type *pSPI );
  580. void SPI_SSOutputDisable(SPI_Type *pSPI );
  581. void SPI_MatchIntEnable(SPI_Type *pSPI );
  582. void SPI_MatchIntDisable(SPI_Type *pSPI );
  583. void SPI_ModfDisable(SPI_Type *pSPI );
  584. void SPI_ModfEnable(SPI_Type *pSPI );
  585. void SPI_BidirOutEnable(SPI_Type *pSPI );
  586. void SPI_BidirOutDisable(SPI_Type *pSPI );
  587. void SPI_ClockStopDisable(SPI_Type *pSPI );
  588. void SPI_ClockStopEnable(SPI_Type *pSPI );
  589. void SPI_BidirPinEnable(SPI_Type *pSPI );
  590. void SPI_BidirPinDisable(SPI_Type *pSPI );
  591. void SPI_SetClockPol(SPI_Type *pSPI,uint8_t u8PolLow);
  592. void SPI_SetClockPhase(SPI_Type *pSPI,uint8_t u8Phase);
  593. void SPI_SetBaudRate(SPI_Type *pSPI,uint32_t u32BusClock,uint32_t u32Bps );
  594. uint8_t SPI_IsSPRF(SPI_Type *pSPI );
  595. uint8_t SPI_IsSPMF(SPI_Type *pSPI );
  596. uint8_t SPI_IsSPTEF(SPI_Type *pSPI );
  597. uint8_t SPI_IsMODF(SPI_Type *pSPI );
  598. uint8_t SPI_ReadDataReg(SPI_Type *pSPI );
  599. void SPI_WriteDataReg(SPI_Type *pSPI, uint8_t u8WrBuff );
  600. void SPI_WriteMatchValue(SPI_Type *pSPI, uint8_t u8WrBuff );
  601. void SPI_Init(SPI_Type *pSPI, SPI_ConfigType *pConfig);
  602. void SPI_DeInit(SPI_Type *pSPI);
  603. ResultType SPI_TransferWait(SPI_Type *pSPI, SPI_WidthType* pRdBuff, SPI_WidthType *pWrBuff,uint32 uiLength);
  604. void SPI_SetCallback(SPI_Type *pSPI,SPI_CallbackType pfnCallback);
  605. /*! @} End of spi_api_list */
  606. #ifdef __cplusplus
  607. }
  608. #endif
  609. #endif /* SPI_H_ */