diff options
-rw-r--r-- | src/nv_dac.c | 78 | ||||
-rw-r--r-- | src/nv_type.h | 14 | ||||
-rw-r--r-- | src/riva_dac.c | 78 | ||||
-rw-r--r-- | src/riva_type.h | 14 |
4 files changed, 92 insertions, 92 deletions
diff --git a/src/nv_dac.c b/src/nv_dac.c index a256d0a..b6df107 100644 --- a/src/nv_dac.c +++ b/src/nv_dac.c @@ -118,58 +118,58 @@ NVDACInit(ScrnInfoPtr pScrn, DisplayModePtr mode) horizTotal += 2; } - pVga->CRTC[0x0] = Set8Bits(horizTotal); - pVga->CRTC[0x1] = Set8Bits(horizDisplay); - pVga->CRTC[0x2] = Set8Bits(horizBlankStart); - pVga->CRTC[0x3] = SetBitField(horizBlankEnd,4:0,4:0) - | SetBit(7); - pVga->CRTC[0x4] = Set8Bits(horizStart); - pVga->CRTC[0x5] = SetBitField(horizBlankEnd,5:5,7:7) - | SetBitField(horizEnd,4:0,4:0); - pVga->CRTC[0x6] = SetBitField(vertTotal,7:0,7:0); - pVga->CRTC[0x7] = SetBitField(vertTotal,8:8,0:0) - | SetBitField(vertDisplay,8:8,1:1) - | SetBitField(vertStart,8:8,2:2) - | SetBitField(vertBlankStart,8:8,3:3) - | SetBit(4) - | SetBitField(vertTotal,9:9,5:5) - | SetBitField(vertDisplay,9:9,6:6) - | SetBitField(vertStart,9:9,7:7); - pVga->CRTC[0x9] = SetBitField(vertBlankStart,9:9,5:5) - | SetBit(6) + pVga->CRTC[0x0] = NV_Set8Bits(horizTotal); + pVga->CRTC[0x1] = NV_Set8Bits(horizDisplay); + pVga->CRTC[0x2] = NV_Set8Bits(horizBlankStart); + pVga->CRTC[0x3] = NV_SetBitField(horizBlankEnd,4:0,4:0) + | NV_SetBit(7); + pVga->CRTC[0x4] = NV_Set8Bits(horizStart); + pVga->CRTC[0x5] = NV_SetBitField(horizBlankEnd,5:5,7:7) + | NV_SetBitField(horizEnd,4:0,4:0); + pVga->CRTC[0x6] = NV_SetBitField(vertTotal,7:0,7:0); + pVga->CRTC[0x7] = NV_SetBitField(vertTotal,8:8,0:0) + | NV_SetBitField(vertDisplay,8:8,1:1) + | NV_SetBitField(vertStart,8:8,2:2) + | NV_SetBitField(vertBlankStart,8:8,3:3) + | NV_SetBit(4) + | NV_SetBitField(vertTotal,9:9,5:5) + | NV_SetBitField(vertDisplay,9:9,6:6) + | NV_SetBitField(vertStart,9:9,7:7); + pVga->CRTC[0x9] = NV_SetBitField(vertBlankStart,9:9,5:5) + | NV_SetBit(6) | ((mode->Flags & V_DBLSCAN) ? 0x80 : 0x00); - pVga->CRTC[0x10] = Set8Bits(vertStart); - pVga->CRTC[0x11] = SetBitField(vertEnd,3:0,3:0) | SetBit(5); - pVga->CRTC[0x12] = Set8Bits(vertDisplay); + pVga->CRTC[0x10] = NV_Set8Bits(vertStart); + pVga->CRTC[0x11] = NV_SetBitField(vertEnd,3:0,3:0) | NV_SetBit(5); + pVga->CRTC[0x12] = NV_Set8Bits(vertDisplay); pVga->CRTC[0x13] = ((pLayout->displayWidth/8)*(pLayout->bitsPerPixel/8)); - pVga->CRTC[0x15] = Set8Bits(vertBlankStart); - pVga->CRTC[0x16] = Set8Bits(vertBlankEnd); + pVga->CRTC[0x15] = NV_Set8Bits(vertBlankStart); + pVga->CRTC[0x16] = NV_Set8Bits(vertBlankEnd); pVga->Attribute[0x10] = 0x01; if(pNv->Television) pVga->Attribute[0x11] = 0x00; - nvReg->screen = SetBitField(horizBlankEnd,6:6,4:4) - | SetBitField(vertBlankStart,10:10,3:3) - | SetBitField(vertStart,10:10,2:2) - | SetBitField(vertDisplay,10:10,1:1) - | SetBitField(vertTotal,10:10,0:0); + nvReg->screen = NV_SetBitField(horizBlankEnd,6:6,4:4) + | NV_SetBitField(vertBlankStart,10:10,3:3) + | NV_SetBitField(vertStart,10:10,2:2) + | NV_SetBitField(vertDisplay,10:10,1:1) + | NV_SetBitField(vertTotal,10:10,0:0); - nvReg->horiz = SetBitField(horizTotal,8:8,0:0) - | SetBitField(horizDisplay,8:8,1:1) - | SetBitField(horizBlankStart,8:8,2:2) - | SetBitField(horizStart,8:8,3:3); + nvReg->horiz = NV_SetBitField(horizTotal,8:8,0:0) + | NV_SetBitField(horizDisplay,8:8,1:1) + | NV_SetBitField(horizBlankStart,8:8,2:2) + | NV_SetBitField(horizStart,8:8,3:3); - nvReg->extra = SetBitField(vertTotal,11:11,0:0) - | SetBitField(vertDisplay,11:11,2:2) - | SetBitField(vertStart,11:11,4:4) - | SetBitField(vertBlankStart,11:11,6:6); + nvReg->extra = NV_SetBitField(vertTotal,11:11,0:0) + | NV_SetBitField(vertDisplay,11:11,2:2) + | NV_SetBitField(vertStart,11:11,4:4) + | NV_SetBitField(vertBlankStart,11:11,6:6); if(mode->Flags & V_INTERLACE) { horizTotal = (horizTotal >> 1) & ~1; - nvReg->interlace = Set8Bits(horizTotal); - nvReg->horiz |= SetBitField(horizTotal,8:8,4:4); + nvReg->interlace = NV_Set8Bits(horizTotal); + nvReg->horiz |= NV_SetBitField(horizTotal,8:8,4:4); } else { nvReg->interlace = 0xff; /* interlace off */ } diff --git a/src/nv_type.h b/src/nv_type.h index 2710c5a..8ebb9a8 100644 --- a/src/nv_type.h +++ b/src/nv_type.h @@ -14,13 +14,13 @@ #define NV_ARCH_40 0x40 -#define BITMASK(t,b) (((unsigned)(1U << (((t)-(b)+1)))-1) << (b)) -#define MASKEXPAND(mask) BITMASK(1?mask,0?mask) -#define SetBF(mask,value) ((value) << (0?mask)) -#define GetBF(var,mask) (((unsigned)((var) & MASKEXPAND(mask))) >> (0?mask) ) -#define SetBitField(value,from,to) SetBF(to, GetBF(value,from)) -#define SetBit(n) (1<<(n)) -#define Set8Bits(value) ((value)&0xff) +#define NV_BITMASK(t,b) (((unsigned)(1U << (((t)-(b)+1)))-1) << (b)) +#define NV_MASKEXPAND(mask) NV_BITMASK(1?mask,0?mask) +#define NV_SetBF(mask,value) ((value) << (0?mask)) +#define NV_GetBF(var,mask) (((unsigned)((var) & NV_MASKEXPAND(mask))) >> (0?mask) ) +#define NV_SetBitField(value,from,to) NV_SetBF(to, NV_GetBF(value,from)) +#define NV_SetBit(n) (1<<(n)) +#define NV_Set8Bits(value) ((value)&0xff) typedef struct { int bitsPerPixel; diff --git a/src/riva_dac.c b/src/riva_dac.c index 6e9f346..9b7b518 100644 --- a/src/riva_dac.c +++ b/src/riva_dac.c @@ -67,55 +67,55 @@ RivaDACInit(ScrnInfoPtr pScrn, DisplayModePtr mode) if(mode->Flags & V_INTERLACE) vertTotal |= 1; - pVga->CRTC[0x0] = Set8Bits(horizTotal); - pVga->CRTC[0x1] = Set8Bits(horizDisplay); - pVga->CRTC[0x2] = Set8Bits(horizBlankStart); - pVga->CRTC[0x3] = SetBitField(horizBlankEnd,4:0,4:0) - | SetBit(7); - pVga->CRTC[0x4] = Set8Bits(horizStart); - pVga->CRTC[0x5] = SetBitField(horizBlankEnd,5:5,7:7) - | SetBitField(horizEnd,4:0,4:0); - pVga->CRTC[0x6] = SetBitField(vertTotal,7:0,7:0); - pVga->CRTC[0x7] = SetBitField(vertTotal,8:8,0:0) - | SetBitField(vertDisplay,8:8,1:1) - | SetBitField(vertStart,8:8,2:2) - | SetBitField(vertBlankStart,8:8,3:3) - | SetBit(4) - | SetBitField(vertTotal,9:9,5:5) - | SetBitField(vertDisplay,9:9,6:6) - | SetBitField(vertStart,9:9,7:7); - pVga->CRTC[0x9] = SetBitField(vertBlankStart,9:9,5:5) - | SetBit(6) + pVga->CRTC[0x0] = RIVA_Set8Bits(horizTotal); + pVga->CRTC[0x1] = RIVA_Set8Bits(horizDisplay); + pVga->CRTC[0x2] = RIVA_Set8Bits(horizBlankStart); + pVga->CRTC[0x3] = RIVA_SetBitField(horizBlankEnd,4:0,4:0) + | RIVA_SetBit(7); + pVga->CRTC[0x4] = RIVA_Set8Bits(horizStart); + pVga->CRTC[0x5] = RIVA_SetBitField(horizBlankEnd,5:5,7:7) + | RIVA_SetBitField(horizEnd,4:0,4:0); + pVga->CRTC[0x6] = RIVA_SetBitField(vertTotal,7:0,7:0); + pVga->CRTC[0x7] = RIVA_SetBitField(vertTotal,8:8,0:0) + | RIVA_SetBitField(vertDisplay,8:8,1:1) + | RIVA_SetBitField(vertStart,8:8,2:2) + | RIVA_SetBitField(vertBlankStart,8:8,3:3) + | RIVA_SetBit(4) + | RIVA_SetBitField(vertTotal,9:9,5:5) + | RIVA_SetBitField(vertDisplay,9:9,6:6) + | RIVA_SetBitField(vertStart,9:9,7:7); + pVga->CRTC[0x9] = RIVA_SetBitField(vertBlankStart,9:9,5:5) + | RIVA_SetBit(6) | ((mode->Flags & V_DBLSCAN) ? 0x80 : 0x00); - pVga->CRTC[0x10] = Set8Bits(vertStart); - pVga->CRTC[0x11] = SetBitField(vertEnd,3:0,3:0) | SetBit(5); - pVga->CRTC[0x12] = Set8Bits(vertDisplay); + pVga->CRTC[0x10] = RIVA_Set8Bits(vertStart); + pVga->CRTC[0x11] = RIVA_SetBitField(vertEnd,3:0,3:0) | RIVA_SetBit(5); + pVga->CRTC[0x12] = RIVA_Set8Bits(vertDisplay); pVga->CRTC[0x13] = ((pLayout->displayWidth/8)*(pLayout->bitsPerPixel/8)); - pVga->CRTC[0x15] = Set8Bits(vertBlankStart); - pVga->CRTC[0x16] = Set8Bits(vertBlankEnd); + pVga->CRTC[0x15] = RIVA_Set8Bits(vertBlankStart); + pVga->CRTC[0x16] = RIVA_Set8Bits(vertBlankEnd); pVga->Attribute[0x10] = 0x01; - rivaReg->screen = SetBitField(horizBlankEnd,6:6,4:4) - | SetBitField(vertBlankStart,10:10,3:3) - | SetBitField(vertStart,10:10,2:2) - | SetBitField(vertDisplay,10:10,1:1) - | SetBitField(vertTotal,10:10,0:0); + rivaReg->screen = RIVA_SetBitField(horizBlankEnd,6:6,4:4) + | RIVA_SetBitField(vertBlankStart,10:10,3:3) + | RIVA_SetBitField(vertStart,10:10,2:2) + | RIVA_SetBitField(vertDisplay,10:10,1:1) + | RIVA_SetBitField(vertTotal,10:10,0:0); - rivaReg->horiz = SetBitField(horizTotal,8:8,0:0) - | SetBitField(horizDisplay,8:8,1:1) - | SetBitField(horizBlankStart,8:8,2:2) - | SetBitField(horizStart,8:8,3:3); + rivaReg->horiz = RIVA_SetBitField(horizTotal,8:8,0:0) + | RIVA_SetBitField(horizDisplay,8:8,1:1) + | RIVA_SetBitField(horizBlankStart,8:8,2:2) + | RIVA_SetBitField(horizStart,8:8,3:3); - rivaReg->extra = SetBitField(vertTotal,11:11,0:0) - | SetBitField(vertDisplay,11:11,2:2) - | SetBitField(vertStart,11:11,4:4) - | SetBitField(vertBlankStart,11:11,6:6); + rivaReg->extra = RIVA_SetBitField(vertTotal,11:11,0:0) + | RIVA_SetBitField(vertDisplay,11:11,2:2) + | RIVA_SetBitField(vertStart,11:11,4:4) + | RIVA_SetBitField(vertBlankStart,11:11,6:6); if(mode->Flags & V_INTERLACE) { horizTotal = (horizTotal >> 1) & ~1; - rivaReg->interlace = Set8Bits(horizTotal); - rivaReg->horiz |= SetBitField(horizTotal,8:8,4:4); + rivaReg->interlace = RIVA_Set8Bits(horizTotal); + rivaReg->horiz |= RIVA_SetBitField(horizTotal,8:8,4:4); } else { rivaReg->interlace = 0xff; /* interlace off */ } diff --git a/src/riva_type.h b/src/riva_type.h index e9448e6..5a1317f 100644 --- a/src/riva_type.h +++ b/src/riva_type.h @@ -9,13 +9,13 @@ #include "xf86int10.h" -#define BITMASK(t,b) (((unsigned)(1U << (((t)-(b)+1)))-1) << (b)) -#define MASKEXPAND(mask) BITMASK(1?mask,0?mask) -#define SetBF(mask,value) ((value) << (0?mask)) -#define GetBF(var,mask) (((unsigned)((var) & MASKEXPAND(mask))) >> (0?mask) ) -#define SetBitField(value,from,to) SetBF(to, GetBF(value,from)) -#define SetBit(n) (1<<(n)) -#define Set8Bits(value) ((value)&0xff) +#define RIVA_BITMASK(t,b) (((unsigned)(1U << (((t)-(b)+1)))-1) << (b)) +#define RIVA_MASKEXPAND(mask) RIVA_BITMASK(1?mask,0?mask) +#define RIVA_SetBF(mask,value) ((value) << (0?mask)) +#define RIVA_GetBF(var,mask) (((unsigned)((var) & RIVA_MASKEXPAND(mask))) >> (0?mask) ) +#define RIVA_SetBitField(value,from,to) RIVA_SetBF(to, RIVA_GetBF(value,from)) +#define RIVA_SetBit(n) (1<<(n)) +#define RIVA_Set8Bits(value) ((value)&0xff) typedef RIVA_HW_STATE* RivaRegPtr; |