diff options
Diffstat (limited to 'src/ast_2dtool.h')
-rw-r--r-- | src/ast_2dtool.h | 102 |
1 files changed, 81 insertions, 21 deletions
diff --git a/src/ast_2dtool.h b/src/ast_2dtool.h index 2539705..193d3cd 100644 --- a/src/ast_2dtool.h +++ b/src/ast_2dtool.h @@ -206,55 +206,93 @@ typedef struct { /* MMIO 2D Macro */ #define ASTSetupSRCBase_MMIO(base) \ { \ - *(ULONG *)(MMIOREG_SRC_BASE) = (ULONG) (base); \ + do { \ + *(ULONG *)(MMIOREG_SRC_BASE) = (ULONG) (base); \ + } while (*(ULONG *)(MMIOREG_SRC_BASE) != (ULONG) (base)); \ } #define ASTSetupSRCPitch_MMIO(pitch) \ { \ - *(ULONG *)(MMIOREG_SRC_PITCH) = (ULONG)(pitch << 16); \ + do { \ + *(ULONG *)(MMIOREG_SRC_PITCH) = (ULONG)(pitch << 16); \ + } while (*(ULONG *)(MMIOREG_SRC_PITCH) != (ULONG)(pitch << 16)); \ } #define ASTSetupDSTBase_MMIO(base) \ { \ - *(ULONG *)(MMIOREG_DST_BASE) = (ULONG)(base); \ + do { \ + *(ULONG *)(MMIOREG_DST_BASE) = (ULONG)(base); \ + } while (*(ULONG *)(MMIOREG_DST_BASE) != (ULONG)(base)); \ } #define ASTSetupDSTPitchHeight_MMIO(pitch, height) \ { \ - *(ULONG *)(MMIOREG_DST_PITCH) = (ULONG)((pitch << 16) + ((height) & MAX_DST_HEIGHT)); \ + ULONG dstpitch; \ + dstpitch = (ULONG)((pitch << 16) + ((height) & MAX_DST_HEIGHT)); \ + do { \ + *(ULONG *)(MMIOREG_DST_PITCH) = dstpitch; \ + } while (*(ULONG *)(MMIOREG_DST_PITCH) != dstpitch); \ } #define ASTSetupDSTXY_MMIO(x, y) \ { \ - *(ULONG *)(MMIOREG_DST_XY) = (ULONG)(((x & MAX_DST_X) << 16) + (y & MAX_DST_Y)); \ + ULONG dstxy; \ + dstxy = (ULONG)(((x & MAX_DST_X) << 16) + (y & MAX_DST_Y)); \ + do { \ + *(ULONG *)(MMIOREG_DST_XY) = dstxy; \ + } while (*(ULONG *)(MMIOREG_DST_XY) != dstxy); \ } #define ASTSetupSRCXY_MMIO(x, y) \ { \ - *(ULONG *)(MMIOREG_SRC_XY) = (ULONG)(((x & MAX_SRC_X) << 16) + (y & MAX_SRC_Y)); \ + ULONG srcxy; \ + srcxy = (ULONG)(((x & MAX_SRC_X) << 16) + (y & MAX_SRC_Y)); \ + do { \ + *(ULONG *)(MMIOREG_SRC_XY) = srcxy; \ + } while (*(ULONG *)(MMIOREG_SRC_XY) != srcxy); \ } #define ASTSetupRECTXY_MMIO(x, y) \ { \ - *(ULONG *)(MMIOREG_RECT_XY) = (ULONG)(((x & MAX_RECT_WIDTH) << 16) + (y & MAX_RECT_WIDTH)); \ + ULONG rectxy; \ + rectxy = (ULONG)(((x & MAX_RECT_WIDTH) << 16) + (y & MAX_RECT_WIDTH)); \ + do { \ + *(ULONG *)(MMIOREG_RECT_XY) = rectxy; \ + } while (*(ULONG *)(MMIOREG_RECT_XY) != rectxy); \ } #define ASTSetupFG_MMIO(color) \ { \ - *(ULONG *)(MMIOREG_FG) = (ULONG)(color); \ + do { \ + *(ULONG *)(MMIOREG_FG) = (ULONG)(color); \ + } while (*(ULONG *)(MMIOREG_FG) != (ULONG)(color)); \ } #define ASTSetupBG_MMIO(color) \ { \ - *(ULONG *)(MMIOREG_BG) = (ULONG)(color); \ + do { \ + *(ULONG *)(MMIOREG_BG) = (ULONG)(color); \ + } while (*(ULONG *)(MMIOREG_BG) != (ULONG)(color)); \ } #define ASTSetupMONO1_MMIO(pat) \ { \ - *(ULONG *)(MMIOREG_MONO1) = (ULONG)(pat); \ + do { \ + *(ULONG *)(MMIOREG_MONO1) = (ULONG)(pat); \ + } while (*(ULONG *)(MMIOREG_MONO1) != (ULONG)(pat)); \ } #define ASTSetupMONO2_MMIO(pat) \ { \ - *(ULONG *)(MMIOREG_MONO2) = (ULONG)(pat); \ + do { \ + *(ULONG *)(MMIOREG_MONO2) = (ULONG)(pat); \ + } while (*(ULONG *)(MMIOREG_MONO2) != (ULONG)(pat)); \ } #define ASTSetupCLIP1_MMIO(left, top) \ { \ - *(ULONG *)(MMIOREG_CLIP1) = (ULONG)(((left & MAX_CLIP) << 16) + (top & MAX_CLIP)); \ + ULONG clip1; \ + clip1 = (ULONG)(((left & MAX_CLIP) << 16) + (top & MAX_CLIP)); \ + do { \ + *(ULONG *)(MMIOREG_CLIP1) = clip1; \ + } while (*(ULONG *)(MMIOREG_CLIP1) != clip1); \ } #define ASTSetupCLIP2_MMIO(right, bottom) \ { \ - *(ULONG *)(MMIOREG_CLIP2) = (ULONG)(((right & MAX_CLIP) << 16) + (bottom & MAX_CLIP)); \ + ULONG clip2; \ + clip2 = (ULONG)(((right & MAX_CLIP) << 16) + (bottom & MAX_CLIP)); \ + do { \ + *(ULONG *)(MMIOREG_CLIP2) = clip2; \ + } while (*(ULONG *)(MMIOREG_CLIP2) != clip2); \ } #define ASTSetupCMDReg_MMIO(reg) \ { \ @@ -262,37 +300,59 @@ typedef struct { } #define ASTSetupPatReg_MMIO(patreg, pat) \ { \ - *(ULONG *)(MMIOREG_PAT + patreg*4) = (ULONG)(pat); \ + do { \ + *(ULONG *)(MMIOREG_PAT + patreg*4) = (ULONG)(pat); \ + } while (*(ULONG *)(MMIOREG_PAT + patreg*4) != (ULONG)(pat)); \ } /* Line CMD */ #define ASTSetupLineXY_MMIO(x, y) \ { \ - *(ULONG *)(MMIOREG_LINE_XY) = (ULONG)(((x & MAX_LINE_X) << 16) + (y & MAX_LINE_Y)); \ + ULONG linexy; \ + linexy = (ULONG)(((x & MAX_LINE_X) << 16) + (y & MAX_LINE_Y)); \ + do { \ + *(ULONG *)(MMIOREG_LINE_XY) = linexy; \ + } while (*(ULONG *)(MMIOREG_LINE_XY) != linexy); \ } #define ASTSetupLineXMErrTerm_MMIO(xm, err) \ { \ - *(ULONG *)(MMIOREG_LINE_Err) = (ULONG)((xm << 24) + (err & MAX_LINE_ERR)); \ + ULONG lineerr; \ + lineerr = (ULONG)((xm << 24) + (err & MAX_LINE_ERR)); \ + do { \ + *(ULONG *)(MMIOREG_LINE_Err) = lineerr; \ + } while (*(ULONG *)(MMIOREG_LINE_Err) != lineerr); \ } #define ASTSetupLineWidth_MMIO(width) \ { \ - *(ULONG *)(MMIOREG_LINE_WIDTH) = (ULONG)((width & MAX_LINE_WIDTH) << 16); \ + ULONG linewidth; \ + linewidth = (ULONG)((width & MAX_LINE_WIDTH) << 16); \ + do { \ + *(ULONG *)(MMIOREG_LINE_WIDTH) = linewidth; \ + } while (*(ULONG *)(MMIOREG_LINE_WIDTH) != linewidth); \ } #define ASTSetupLineK1Term_MMIO(err) \ { \ - *(ULONG *)(MMIOREG_LINE_K1) = (ULONG)(err & MAX_LINE_K1); \ + do { \ + *(ULONG *)(MMIOREG_LINE_K1) = (ULONG)(err & MAX_LINE_K1); \ + } while (*(ULONG *)(MMIOREG_LINE_K1) != (ULONG)(err & MAX_LINE_K1)); \ } #define ASTSetupLineK2Term_MMIO(err) \ { \ - *(ULONG *)(MMIOREG_LINE_K2) = (ULONG)(err & MAX_LINE_K2); \ + do { \ + *(ULONG *)(MMIOREG_LINE_K2) = (ULONG)(err & MAX_LINE_K2); \ + } while (*(ULONG *)(MMIOREG_LINE_K2) != (ULONG)(err & MAX_LINE_K2)); \ } #define ASTSetupLineStyle1_MMIO(pat) \ { \ - *(ULONG *)(MMIOREG_LINE_STYLE1) = (ULONG)(pat); \ + do { \ + *(ULONG *)(MMIOREG_LINE_STYLE1) = (ULONG)(pat); \ + } while (*(ULONG *)(MMIOREG_LINE_STYLE1) != (ULONG)(pat)); \ } #define ASTSetupLineStyle2_MMIO(pat) \ { \ - *(ULONG *)(MMIOREG_LINE_STYLE2) = (ULONG)(pat); \ + do { \ + *(ULONG *)(MMIOREG_LINE_STYLE2) = (ULONG)(pat); \ + } while (*(ULONG *)(MMIOREG_LINE_STYLE2) != (ULONG)(pat)); \ } /* CMDQ Mode Macro */ |