gps.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /******************************************************************************
  2. 版权所有:
  3. 文件名称: gps.h
  4. 文件版本: 01.01
  5. 创建作者: sunxi
  6. 创建日期: 2012-07-23
  7. 功能说明: GPS驱动程序。
  8. 其它说明:
  9. 修改记录:
  10. */
  11. #ifndef _GPS_H
  12. #define _GPS_H
  13. /*------------------------------ 头文件 --------------------------------------
  14. */
  15. #include "bspconfig.h"
  16. #include "my_rtc.h"
  17. /*------------------------------- 宏定义 --------------------------------------
  18. */
  19. #define USEC_PER_10MS 10000
  20. #define NSEC_PER_10MS 10000000
  21. #define USEC_PER_MS 1000
  22. #define NSEC_PER_MS 1000000
  23. #define NSEC8_PER_MS (125*1000)
  24. /*------------------------------ 全局变量声明 ---------------------------------
  25. */
  26. /*------------------------------ 函数声明 -------------------------------------
  27. */
  28. int gps_init(void);
  29. int gps_exit(void);
  30. int gps_reset(void);
  31. int gps_get_time(struct timespec *p_ts);
  32. int gps_set_time(struct timespec *p_ts);
  33. void gps_disable(void);
  34. void gps_enable(void);
  35. int gps_test(void);
  36. void init_timer_1ms_thread(void);
  37. #if 1 //国网集中式输出GPIO翻转到子板 zhl
  38. // GPIO基地址
  39. #define GPIO_BASE_ADDR 0x03604000
  40. // PD组寄存器偏移
  41. #define PD_CFG2_OFFSET 0x0208 // PD18功能选择寄存器
  42. #define PD_DAT_OFFSET 0x0210 // PD数据寄存器
  43. #define PD_DAT_SET 0x0214 // PD置位寄存器
  44. #define PD_DAT_CLR 0x0218 // PD清零寄存器
  45. #define PD_DRV2_OFFSET 0x0228 // PD驱动能力寄存器
  46. #define PD_PUL1_OFFSET 0x0234 // PD上下拉寄存器
  47. // PD18位定义
  48. #define PD18_BIT 18 // PD18在数据寄存器中的位
  49. // PD18功能选择值(根据手册)
  50. #define PD18_SELECT_INPUT 0x0 // 输入
  51. #define PD18_SELECT_OUTPUT 0x1 // 输出
  52. #define PD18_SELECT_LCD_CLK 0x2 // LCD时钟
  53. #define PD18_SELECT_DISABLE 0xF // 禁用
  54. // PD18驱动能力
  55. #define PD18_DRV_LEVEL0 0x0 // 驱动能力等级0
  56. #define PD18_DRV_LEVEL1 0x1 // 驱动能力等级1(默认)
  57. #define PD18_DRV_LEVEL2 0x2 // 驱动能力等级2
  58. #define PD18_DRV_LEVEL3 0x3 // 驱动能力等级3
  59. // PD18上下拉
  60. #define PD18_PULL_DISABLE 0x0 // 禁用上下拉
  61. #define PD18_PULL_UP 0x1 // 上拉
  62. #define PD18_PULL_DOWN 0x2 // 下拉
  63. // 函数声明
  64. void init_flip_gpio(void);
  65. void* map_gpio_registers(void);
  66. void unmap_gpio_registers(void* addr);
  67. void set_pd18_output(void);
  68. void set_pd18_high(void);
  69. void set_pd18_low(void);
  70. void toggle_pd18(void);
  71. uint8_t read_pd18(void);
  72. #endif
  73. #endif