📄 pmacisa.h
字号:
#ifndef PMACISA_H#define PMACISA_H#include <linux/ioctl.h>//////////////////////Device Structure to hold buffer and other stuff/////////////////#define MAX_COMM_BUFFER 256#define MAX_DPR_BUFFER 160#define PMAC_NO 8 // total pmac devices allowed, if you have more then 8 do increase hereenum Pmac_Device_Type{ PT_UNKNOWN=0, PT_PMAC1, PT_PMAC2, PT_PMACUL, PT_PMAC, PT_PMAC1T, PT_PMAC2T, PT_PMACUT, PT_UMAC, PT_QMAC};struct _Device_Ext{ char buffer[MAX_COMM_BUFFER]; /**Communication buffer*/ unsigned int err_code; unsigned long dpr_offset; unsigned int dpr_count; int status;};struct _Pmac_Device{ enum Pmac_Device_Type type; int has_region; int has_memory; unsigned int host; unsigned int range; unsigned long dpr; unsigned int size; unsigned char *dpr_vadd; /** virtual mapped address for Dual Port Ram */ unsigned long reg_write_status; unsigned long reg_read_status; unsigned long reg_ctrl_char; unsigned long reg_num_char; unsigned long reg_write; unsigned long reg_read; struct _Device_Ext ext;};////////////////////////////// Communication Return Codes///////////////////////////#define COMM_OK 0x00000001#define COMM_EOT 0x80000000#define COMM_TIMEOUT 0xC0000000#define COMM_ERROR 0xE0000000#define COMM_UNSOLICITED 0x10000000//////////////////////////////#defines for Ctrl characters//////////////////////////#define NULL_CHR (0x0000)#define CARRIAGE_RETURN (0x000D)#define ACK_CHR (0x0006)#define CTRL_A (0x01)#define CTRL_B (0x02)#define CTRL_C (0x03)#define CTRL_D (0x04)#define CTRL_E (0x05)#define CTRL_F (0x06)#define CTRL_G (0x07)#define CTRL_H (0x08)#define CTRL_I (0x09)#define CTRL_J (0x0A)#define CTRL_K (0x0B)#define CTRL_L (0x0C)#define CTRL_M (0x0D)#define CTRL_N (0x0E)#define CTRL_O (0x0F)#define CTRL_P (0x10)#define CTRL_Q (0x11)#define CTRL_R (0x12)#define CTRL_S (0x13)#define CTRL_T (0x14)#define CTRL_U (0x15)#define CTRL_V (0x16)#define CTRL_W (0x17)#define CTRL_X (0x18)#define CTRL_Y (0x19)#define CTRL_Z (0x1A)//////////////////////////////#defines for ioctls//////////////////////////////////#define IOCTL_MOTION_BASE 0xA1 //Must be unique and not allocated to any other device see: Documentation/ioctl-number.txt in source tree//ioctls for the Bus Communication#define IOCTL_MOTION_INIT _IO(IOCTL_MOTION_BASE, 0)#define IOCTL_MOTION_FLUSH_PORT _IO(IOCTL_MOTION_BASE, 1)#define IOCTL_MOTION_PORT_READREADY _IO(IOCTL_MOTION_BASE, 2) //returns 0 if ready and a -ve value if not#define IOCTL_MOTION_READLN_PORT _IOR(IOCTL_MOTION_BASE, 3, struct _Device_Ext)#define IOCTL_MOTION_WRITELN_PORT _IOW(IOCTL_MOTION_BASE, 4, struct _Device_Ext)#define IOCTL_MOTION_WRITECHAR_PORT _IOW(IOCTL_MOTION_BASE, 5, struct _Device_Ext) //character to be written to port is at buffer[0]//**********#define IOCTL_MOTION_PORT_ERROR _IO(IOCTL_MOTION_BASE, 6,#define IOCTL_WRITECHAR_PORT _IOW(IOCTL_MOTION_BASE, 7, struct _Device_Ext) //offset is at buffer[0] and character at buffer[1]#define IOCTL_READCHAR_PORT _IOWR(IOCTL_MOTION_BASE, 8, struct _Device_Ext) //data read from offset buffer[0] is stored in buffer[1]#define IOCTL_MOTION_CTRLRESP_PORT _IOWR(IOCTL_MOTION_BASE, 9, struct _Device_Ext) //ctrl character is at buffer[0]//ioctls for dpram communication#define IOCTL_MOTION_FLUSH_MEM _IO(IOCTL_MOTION_BASE, 10)#define IOCTL_MOTION_MEM_READREADY _IO(IOCTL_MOTION_BASE, 11)#define IOCTL_MOTION_READLN_MEM _IOR(IOCTL_MOTION_BASE, 12, struct _Device_Ext)#define IOCTL_MOTION_WRITELN_MEM _IOW(IOCTL_MOTION_BASE, 13, struct _Device_Ext)//#define IOCTL_MOTION_MEM_ERROR _IO(IOCTL_MOTION_BASE, 14#define IOCTL_MOTION_GET_MEM _IOW(IOCTL_MOTION_BASE, 15, struct _Device_Ext)#define IOCTL_MOTION_SET_MEM _IOR(IOCTL_MOTION_BASE, 16, struct _Device_Ext)//efine IOCTL_MOTION_GET_MEM_BIT _IO(IOCTL_MOTION_BASE, 17)//#define IOCTL_MOTION_SET_MEM_BIT _IO(IOCTL_MOTION_BASE, 18)//#define IOCTL_MOTION_GET_MEM_BITS _IO(IOCTL_MOTION_BASE, 19)//#define IOCTL_MOTION_SET_MEM_BITS _IO(IOCTL_MOTION_BASE, 20)#define IOCTL_MOTION_WRITECHAR_MEM _IOW(IOCTL_MOTION_BASE, 21, struct _Device_Ext)#define IOCTL_MOTION_WRITECTRL_MEM _IOW(IOCTL_MOTION_BASE, 22, struct _Device_Ext)#define IOCTL_MOTION_CTRLRESP_MEM _IOWR(IOCTL_MOTION_BASE, 23, struct _Device_Ext)#define IOCTL_MOTION_DPRAM _IO(IOCTL_MOTION_BASE, 24)#define IOCTL_MAXNR 25#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -