ch395_adapter.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /** @file
  2. ethernet_phy_adapter.h
  3. @brief
  4. This file is used to define bt api for different Quectel Project.
  5. */
  6. /*================================================================
  7. Copyright (c) 2020 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
  8. Quectel Wireless Solution Proprietary and Confidential.
  9. =================================================================*/
  10. /*=================================================================
  11. EDIT HISTORY FOR MODULE
  12. This section contains comments describing changes made to the module.
  13. Notice that changes are listed in reverse chronological order.
  14. WHEN WHO WHAT, WHERE, WHY
  15. ------------ ------- -------------------------------------------------------------------------------
  16. =================================================================*/
  17. #ifndef _CH395_ADAPTER_H_
  18. #define _CH395_ADAPTER_H_
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. #include "ql_api_common.h"
  23. #include <stdint.h>
  24. #include "ql_api_spi.h"
  25. #include "ql_api_osi.h"
  26. #include "ql_api_ethernet.h"
  27. #include "ethernet_demo.h"
  28. #define mDelaymS(x); ({ql_rtos_task_sleep_ms(x);})
  29. #define mDelayuS(x); ({ql_delay_us(x);})
  30. #define xCH395CmdStart() ({uint8_t __i = 0;ql_ethernet_phy_append((void*)ethernet_phy_set_cs,&__i);})
  31. #define xEndCH395Cmd() ({uint8_t __i = 1;ql_ethernet_phy_append((void*)ethernet_phy_set_cs,&__i);})
  32. #define xWriteCH395Cmd(cmd) ({uint8_t __i = (cmd);xEndCH395Cmd();xCH395CmdStart();ql_ethernet_phy_write(&__i,sizeof(__i));mDelayuS(2);})
  33. #define xWriteCH395Data(data) ({uint8_t __i = (data);ql_ethernet_phy_write(&__i,sizeof(__i));})
  34. #define xReadCH395Data() ({uint8_t __i = (0);ql_ethernet_phy_read(&__i,sizeof(__i));(uint8_t)__i;})
  35. //Write data block for increaing the rate.
  36. #define xWriteCH395DataBlock(data,len) ({ql_ethernet_phy_write(data,len);})
  37. #define xReadCH395DataBlock(data,len) ({ql_ethernet_phy_read(data,len);})
  38. #ifdef __cplusplus
  39. }
  40. #endif
  41. #endif