| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- /******************************************************************************
- 版权所有:
- 文件名称: gps.h
- 文件版本: 01.01
- 创建作者: sunxi
- 创建日期: 2012-07-23
- 功能说明: GPS驱动程序。
- 其它说明:
- 修改记录:
- */
- #ifndef _GPS_H
- #define _GPS_H
- /*------------------------------ 头文件 --------------------------------------
- */
- #include "bspconfig.h"
- #include "my_rtc.h"
- /*------------------------------- 宏定义 --------------------------------------
- */
- #define USEC_PER_10MS 10000
- #define NSEC_PER_10MS 10000000
- #define USEC_PER_MS 1000
- #define NSEC_PER_MS 1000000
- #define NSEC8_PER_MS (125*1000)
- /*------------------------------ 全局变量声明 ---------------------------------
- */
- /*------------------------------ 函数声明 -------------------------------------
- */
- int gps_init(void);
- int gps_exit(void);
- int gps_reset(void);
- int gps_get_time(struct timespec *p_ts);
- int gps_set_time(struct timespec *p_ts);
- void gps_disable(void);
- void gps_enable(void);
- int gps_test(void);
- void init_timer_1ms_thread(void);
- #if 1 //国网集中式输出GPIO翻转到子板 zhl
- // GPIO基地址
- #define GPIO_BASE_ADDR 0x03604000
- // PD组寄存器偏移
- #define PD_CFG2_OFFSET 0x0208 // PD18功能选择寄存器
- #define PD_DAT_OFFSET 0x0210 // PD数据寄存器
- #define PD_DAT_SET 0x0214 // PD置位寄存器
- #define PD_DAT_CLR 0x0218 // PD清零寄存器
- #define PD_DRV2_OFFSET 0x0228 // PD驱动能力寄存器
- #define PD_PUL1_OFFSET 0x0234 // PD上下拉寄存器
- // PD18位定义
- #define PD18_BIT 18 // PD18在数据寄存器中的位
- // PD18功能选择值(根据手册)
- #define PD18_SELECT_INPUT 0x0 // 输入
- #define PD18_SELECT_OUTPUT 0x1 // 输出
- #define PD18_SELECT_LCD_CLK 0x2 // LCD时钟
- #define PD18_SELECT_DISABLE 0xF // 禁用
- // PD18驱动能力
- #define PD18_DRV_LEVEL0 0x0 // 驱动能力等级0
- #define PD18_DRV_LEVEL1 0x1 // 驱动能力等级1(默认)
- #define PD18_DRV_LEVEL2 0x2 // 驱动能力等级2
- #define PD18_DRV_LEVEL3 0x3 // 驱动能力等级3
- // PD18上下拉
- #define PD18_PULL_DISABLE 0x0 // 禁用上下拉
- #define PD18_PULL_UP 0x1 // 上拉
- #define PD18_PULL_DOWN 0x2 // 下拉
- // 函数声明
- void init_flip_gpio(void);
- void* map_gpio_registers(void);
- void unmap_gpio_registers(void* addr);
- void set_pd18_output(void);
- void set_pd18_high(void);
- void set_pd18_low(void);
- void toggle_pd18(void);
- uint8_t read_pd18(void);
- #endif
- #endif
|