📄 pm3fb.h
字号:
/*********************************************** GLINT Permedia3 2D setup Unit ************************************************/#define PM3Config2D 0xb618 #define PM3Config2D_OpaqueSpan 1<<0 #define PM3Config2D_MultiRXBlit 1<<1 #define PM3Config2D_UserScissorEnable 1<<2 #define PM3Config2D_FBDestReadEnable 1<<3 #define PM3Config2D_AlphaBlendEnable 1<<4 #define PM3Config2D_DitherEnable 1<<5 #define PM3Config2D_ForegroundROPEnable 1<<6 #define PM3Config2D_ForegroundROP(rop) (((rop)&0xf)<<7) #define PM3Config2D_BackgroundROPEnable 1<<11 #define PM3Config2D_BackgroundROP(rop) (((rop)&0xf)<<12) #define PM3Config2D_UseConstantSource 1<<16 #define PM3Config2D_FBWriteEnable 1<<17 #define PM3Config2D_Blocking 1<<18 #define PM3Config2D_ExternalSourceData 1<<19 #define PM3Config2D_LUTModeEnable 1<<20#define PM3DownloadGlyphwidth 0xb658 #define PM3DownloadGlyphwidth_GlyphWidth(gw) ((gw)&0xffff)#define PM3DownloadTarget 0xb650 #define PM3DownloadTarget_TagName(tag) ((tag)&0x1fff)#define PM3GlyphData 0xb660#define PM3GlyphPosition 0xb608 #define PM3GlyphPosition_XOffset(x) ((x)&0xffff) #define PM3GlyphPosition_YOffset(y) (((y)&0xffff)<<16)#define PM3Packed4Pixels 0xb668#define PM3Packed8Pixels 0xb630#define PM3Packed16Pixels 0xb638#define PM3RectanglePosition 0xb600 #define PM3RectanglePosition_XOffset(x) ((x)&0xffff) #define PM3RectanglePosition_YOffset(y) (((y)&0xffff)<<16)#define PM3Render2D 0xb640 #define PM3Render2D_Width(w) ((w)&0x0fff) #define PM3Render2D_Operation_Normal 0<<12 #define PM3Render2D_Operation_SyncOnHostData 1<<12 #define PM3Render2D_Operation_SyncOnBitMask 2<<12 #define PM3Render2D_Operation_PatchOrderRendering 3<<12 #define PM3Render2D_FBSourceReadEnable 1<<14 #define PM3Render2D_SpanOperation 1<<15 #define PM3Render2D_Height(h) (((h)&0x0fff)<<16) #define PM3Render2D_XPositive 1<<28 #define PM3Render2D_YPositive 1<<29 #define PM3Render2D_AreaStippleEnable 1<<30 #define PM3Render2D_TextureEnable 1<<31#define PM3Render2DGlyph 0xb648 #define PM3Render2DGlyph_Width(w) ((w)&0x7f) #define PM3Render2DGlyph_Height(h) (((h)&0x7f)<<7) #define PM3Render2DGlyph_XOffset(x) (((x)&0x1ff)<<14) #define PM3Render2DGlyph_YOffset(y) (((y)&0x1ff)<<23)#define PM3RenderPatchOffset 0xb610 #define PM3RenderPatchOffset_XOffset(x) ((x)&0xffff) #define PM3RenderPatchOffset_YOffset(y) (((y)&0xffff)<<16)#define PM3RLCount 0xb678 #define PM3RLCount_Count(c) ((c)&0x0fff)#define PM3RLData 0xb670/*********************************************** GLINT Permedia3 Alias Register ************************************************/#define PM3FillBackgroundColor 0x8330#define PM3FillConfig2D0 0x8338#define PM3FillConfig2D1 0x8360 #define PM3FillConfig2D_OpaqueSpan 1<<0 #define PM3FillConfig2D_MultiRXBlit 1<<1 #define PM3FillConfig2D_UserScissorEnable 1<<2 #define PM3FillConfig2D_FBDestReadEnable 1<<3 #define PM3FillConfig2D_AlphaBlendEnable 1<<4 #define PM3FillConfig2D_DitherEnable 1<<5 #define PM3FillConfig2D_ForegroundROPEnable 1<<6 #define PM3FillConfig2D_ForegroundROP(rop) (((rop)&0xf)<<7) #define PM3FillConfig2D_BackgroundROPEnable 1<<11 #define PM3FillConfig2D_BackgroundROP(rop) (((rop)&0xf)<<12) #define PM3FillConfig2D_UseConstantSource 1<<16 #define PM3FillConfig2D_FBWriteEnable 1<<17 #define PM3FillConfig2D_Blocking 1<<18 #define PM3FillConfig2D_ExternalSourceData 1<<19 #define PM3FillConfig2D_LUTModeEnable 1<<20#define PM3FillFBDestReadBufferAddr 0x8310#define PM3FillFBSourceReadBufferAddr 0x8308#define PM3FillFBSourceReadBufferOffset 0x8340 #define PM3FillFBSourceReadBufferOffset_XOffset(x) ((x)&0xffff) #define PM3FillFBSourceReadBufferOffset_YOffset(y) (((y)&0xffff)<<16)#define PM3FillFBWriteBufferAddr 0x8300#define PM3FillForegroundColor0 0x8328#define PM3FillForegroundColor1 0x8358#define PM3FillGlyphPosition 0x8368 #define PM3FillGlyphPosition_XOffset(x) ((x)&0xffff) #define PM3FillGlyphPosition_YOffset(y) (((y)&0xffff)<<16)#define PM3FillRectanglePosition 0x8348 #define PM3FillRectanglePosition_XOffset(x) ((x)&0xffff) #define PM3FillRectanglePosition_YOffset(y) (((y)&0xffff)<<16)#define PM3_REGS_SIZE 0x10000#define PM3_MAX_PIXCLOCK 300000/* a few more useful registers & regs value... */#define PM3Sync 0x8c40 #define PM3Sync_Tag 0x188#define PM3FilterMode 0x8c00 #define PM3FilterModeSync 0x400#define PM3OutputFifo 0x2000#define PM3StatisticMode 0x8c08#define PM3AreaStippleMode 0x81a0 #define AreaStipplePattern0 (0x8200) #define AreaStipplePattern1 (0x8208) #define AreaStipplePattern2 (0x8210) #define AreaStipplePattern3 (0x8218) #define AreaStipplePattern4 (0x8220) #define AreaStipplePattern5 (0x8228) #define AreaStipplePattern6 (0x8230) #define AreaStipplePattern7 (0x8238) #define AreaStipplePattern8 (0x8240) #define AreaStipplePattern9 (0x8248) #define AreaStipplePattern10 (0x8250) #define AreaStipplePattern11 (0x8258) #define AreaStipplePattern12 (0x8260) #define AreaStipplePattern13 (0x8268) #define AreaStipplePattern14 (0x8270) #define AreaStipplePattern15 (0x8278) #define AreaStipplePattern16 (0x8280) #define AreaStipplePattern17 (0x8288) #define AreaStipplePattern18 (0x8290) #define AreaStipplePattern19 (0x8298) #define AreaStipplePattern20 (0x82a0) #define AreaStipplePattern21 (0x82a8) #define AreaStipplePattern22 (0x82b0) #define AreaStipplePattern23 (0x82b8) #define AreaStipplePattern24 (0x82c0) #define AreaStipplePattern25 (0x82c8) #define AreaStipplePattern26 (0x82d0) #define AreaStipplePattern27 (0x82d8) #define AreaStipplePattern28 (0x82eo) #define AreaStipplePattern29 (0x82e8) #define AreaStipplePattern30 (0x82f0) #define AreaStipplePattern31 (0x82f8) #define AreaStipplePattern_indexed(i) (0x8200 + ((i) * 0x8))#define PM3DepthMode 0x89a0#define PM3StencilMode 0x8988#define PM3StencilData 0x8990#define PM3TextureReadMode 0x8670#define PM3FogMode 0x8690#define PM3ChromaTestMode 0x8f18#define PM3YUVMode 0x8f00#define PM3BitMaskPattern 0x8068/* ***************************** *//* ***** pm3fb IOCTL const ***** *//* ***************************** *//* debug-only IOCTL */#define PM3FBIO_CLEARMEMORY 0x504D3300 /* 'PM3\000' */#define PM3FBIO_CLEARCMAP 0x504D3301 /* 'PM3\001' *//* common use IOCTL */#define PM3FBIO_RESETCHIP 0x504D33FF /* 'PM3\377' *//* ***************************************** *//* ***** pm3fb useful define and macro ***** *//* ***************************************** *//* kernel -specific definitions *//* what kernel is this ? */#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)))#define KERNEL_2_4#endif#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0))) #define KERNEL_2_2/* pci_resource_start, available in 2.2.18 */#include <linux/kcomp.h>#ifdef CONFIG_FB_OF#define SUPPORT_FB_OF#endif#endif#if (!defined(KERNEL_2_2)) && (!defined(KERNEL_2_4))#error "Only kernel 2.2.x and kernel 2.4.y might work"#endif/* not sure if/why it's needed. doesn't work without on my PowerMac... */#ifdef __BIG_ENDIAN#define MUST_BYTESWAP#endif/* permedia3 -specific definitions */#define PM3_SCALE_TO_CLOCK(pr, fe, po) ((2 * PM3_REF_CLOCK * fe) / (pr * (1 << (po))))#define PICOS2KHZ(a) (1000000000UL/(a))#define KHZ2PICOS(a) (1000000000UL/(a))/* in case it's not in linux/pci.h */#ifndef PCI_DEVICE_ID_3DLABS_PERMEDIA3#define PCI_DEVICE_ID_3DLABS_PERMEDIA3 0x000a#endif/* max number of simultaneous board *//* warning : make sure module array def's are coherent with PM3_MAX_BOARD */#define PM3_MAX_BOARD 4#define PM3_MAX_BOARD_MODULE_ARRAY_SHORT "1-4h"#define PM3_MAX_BOARD_MODULE_ARRAY_STRING "1-4s"/* max size of options */#define PM3_OPTIONS_SIZE 256/* max size of font name */#define PM3_FONTNAME_SIZE 40/* do we want accelerated console */#define PM3FB_USE_ACCEL 1/* useful ? */#define CHAR_IS_NUM(a) ((((a) >= '0') && ((a) <= '9')) ? 1 : 0)/* for driver debugging ONLY *//* 0 = assert only, 1 = error, 2 = info, 3+ = verbose *//* define PM3FB_MASTER_DEBUG 1 */#if defined(PM3FB_MASTER_DEBUG) && (PM3FB_MASTER_DEBUG >= 3)#define PM3FB_TRACE#endif /* defined(PM3FB_MASTER_DEBUG) && (PM3FB_MASTER_DEBUG >= 3) */#ifdef PM3FB_MASTER_DEBUG#define DPRINTK(l,a,b...) do { if ((l) <= PM3FB_MASTER_DEBUG) printk("pm3fb: %s: " a, __FUNCTION__ , ## b); } while (0)#define DASSERT(t,a,b...) do { if (!(t)) printk("pm3fb: _assert failed: %s: " a, __FUNCTION__ , ## b); } while (0)#ifdef PM3FB_TRACE#define DTRACE printk("pm3fb: _enter %s\n", __FUNCTION__)#else /* PM3FB_TRACE */#define DTRACE#endif /* PM3FB_TRACE */#else /* PM3FB_MASTER_DEBUG */#define DPRINTK(l,a,b...)#define DASSERT(t,a,b...)#define DTRACE#endif /* PM3FB_MASTER_DEBUG */#if defined(PM3FB_MASTER_DEBUG) && (PM3FB_MASTER_DEBUG >= 2)#define PM3_SHOW_CUR_MODE pm3fb_show_cur_mode(l_fb_info)#else#define PM3_SHOW_CUR_MODE /* pm3fb_show_cur_mode() */#endif/* ******************************************** *//* ***** A bunch of register-access macro ***** *//* ******************************************** */#ifdef KERNEL_2_2#ifdef MUST_BYTESWAP /* we are writing big_endian to big_endian through a little_endian macro */#define PM3_READ_REG(r) __swab32(readl((l_fb_info->vIOBase + r)))#define PM3_WRITE_REG(r, v) writel(__swab32(v), (l_fb_info->vIOBase + r))#else /* MUST_BYTESWAP */#define PM3_WRITE_REG(r, v) writel(v, (l_fb_info->vIOBase + r))#define PM3_READ_REG(r) readl((l_fb_info->vIOBase + r))#endif /* MUST_BYTESWAP */#endif /* KERNEL_2_2 */#ifdef KERNEL_2_4 /* native-endian access */#define PM3_WRITE_REG(r, v) fb_writel(v, (l_fb_info->vIOBase + r))#define PM3_READ_REG(r) fb_readl((l_fb_info->vIOBase + r))#endif /* KERNEL_2_4 */#define depth2bpp(d) ((d + 7L) & ~7L)#define depth2ByPP(d) (depth2bpp(d) / 8)#define depth_supported(d) ((d == 8) || (d == 12) || (d == 15) || (d == 16) || (d==32))#define PM3_WAIT(n) \do{ \ while(PM3_READ_REG(PM3InFIFOSpace)<(n)); \} while(0)#define PM3_DELAY(x) do { \ int delay = x; \ unsigned char tmp; \ while(delay--){tmp = PM3_READ_REG(PM3InFIFOSpace);}; \} while(0)#define PM3_SLOW_WRITE_REG(r,v) \do{ \ DASSERT((l_fb_info->vIOBase != (unsigned char*)(-1)), "l_fb_info->vIOBase mapped in slow write\n"); \ mb(); \ PM3_WAIT(1); \ mb(); \ PM3_WRITE_REG(r,v); \} while(0)#define PM3_SET_INDEX(index) \do{ \ PM3_SLOW_WRITE_REG(PM3RD_IndexHigh,(((index)>>8)&0xff)); \ PM3_SLOW_WRITE_REG(PM3RD_IndexLow,((index)&0xff)); \} while(0)#define PM3_WRITE_DAC_REG(r, v) \do { \ DASSERT((l_fb_info->vIOBase != (unsigned char*)(-1)), "l_fb_info->vIOBase mapped in write dac reg\n"); \ PM3_SET_INDEX(r); \ mb(); \ PM3_WRITE_REG(PM3RD_IndexedData, v); \} while (0)/* next one is really a function, added as a macro to be consistent */#define PM3_READ_DAC_REG(r) pm3fb_read_dac_reg(l_fb_info, r)#define PM3_COLOR(c) \do { \ if (l_fb_info->current_par->depth == 8) \ { \ c = (c & 0xFF); \ c = c | (c << 8); \ } \ if ((l_fb_info->current_par->depth == 8) || (depth2bpp(l_fb_info->current_par->depth) == 16)) \ { \ c = (c & 0xFFFF); \ c = c | (c << 16); \ } \} while (0)#endif PM3FB_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -