yb_arm/driver/stc-dev/stc_def.h
2023-07-12 14:14:31 +08:00

70 lines
2.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef _STC_DEF_H_
#define _STC_DEF_H_
#include <linux/module.h>
#include <linux/kernel.h> /*声明printk()这个内核态的函数*/
#include <linux/fs.h> /*文件系统有关的结构体file_operations也在fs头文件定义*/
#include <linux/init.h> /*init和exit相关宏*/
#include <linux/delay.h>
#include <linux/poll.h>
#include <linux/irq.h> /*linux中断定义*/
#include <asm/irq.h>
#include <linux/interrupt.h> /*包含与中断相关的大部分宏及结构体的定义request_irq()等*/
#include <asm/uaccess.h> /*linux中的用户态内存交互函数copy_from_user(),copy_to_user()等*/
#include <linux/platform_device.h>
#include <linux/cdev.h>
#include <linux/miscdevice.h> /*misc混合设备注册与注销*/
#include <asm/io.h>
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/spinlock.h>
#include <linux/errno.h>
#include <linux/fcntl.h>
#include <linux/init.h>
#include <linux/proc_fs.h>
#include <linux/workqueue.h>
typedef char sint8;
typedef unsigned char uint8;
typedef int sint32;
typedef unsigned int uint32;
typedef long sint64;
typedef unsigned long uint64;
#define SUCCESS (0)
#define FAILURE (-1)
#define IRQ_EXCEPTION (0xFFFFFF)
#define STC_MODULE_MAGIC 'g'
#define STC_INT_CFG _IOWR(STC_MODULE_MAGIC, 0x01, uint32)
#define STC_REG_BASE_ADDR (0x08568000ull) //STC鍩哄湴鍧€
#define STC_REG_LEN (0x08000)
typedef enum
{
STC_INT_RESERVED = 0, /* Reserved*/ /* Reserved*/
STC_TOD_1PPS, /* stc 1pps*/
STC_EX_1PPS_IN, /* external 1pps */
STC_HSCC_DUMP = 4 /* HSCC_DUMP */
} stc_int_type_e;
struct stc_driver{
sint32 irq_1pps_tod;
sint32 irq_1pps_in;
sint32 irq_hscc_dump;
uint32 irq_1pps_tod_cnt;
uint32 irq_1pps_in_cnt;
uint32 irq_hscc_dump_cnt;
stc_int_type_e cond_1pps_tod;
stc_int_type_e cond_1pps_in;
stc_int_type_e cond_hscc_dump;
wait_queue_head_t pp1s_tod_queue;
wait_queue_head_t pp1s_in_queue;
wait_queue_head_t hscc_dump_queue;
void __iomem *io_base_addr;
};
#endif