summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2019-09-22 22:01:46 -0400
committerDave Airlie <airlied@redhat.com>2019-09-22 22:01:46 -0400
commit3123bb05da5dc20b50f42deee90d98e26ec43f0e (patch)
tree0f0f907ad23ca6cd4703b03281bec5401b72a9f2
parent72de2346e5c346ed257e2ea2ef73c8dca4a4bf08 (diff)
add cursorasttool
-rw-r--r--asttool.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/asttool.c b/asttool.c
index 28b74e6..2c90778 100644
--- a/asttool.c
+++ b/asttool.c
@@ -222,9 +222,9 @@ unsigned ast_get_crt_start_addr(struct ast_private *ast)
tmp = ast_get_index_reg(ast, AST_IO_CRTC_PORT, 0x0d);
offset = tmp;
tmp = ast_get_index_reg(ast, AST_IO_CRTC_PORT, 0x0c);
- offset |= ((uint16_t)tmp << 8);
+ offset |= ((uint32_t)tmp << 8);
tmp = ast_get_index_reg(ast, AST_IO_CRTC_PORT, 0xaf);
- offset |= ((uint16_t)tmp << 16);
+ offset |= ((uint32_t)tmp << 16);
offset <<= 2;
return offset;
}
@@ -242,6 +242,21 @@ unsigned ast_get_pitch_reg(struct ast_private *ast)
return offset;
}
+unsigned ast_get_cursor_offset(struct ast_private *ast)
+{
+ uint32_t offset;
+ uint8_t tmp;
+
+ tmp = ast_get_index_reg(ast, AST_IO_CRTC_PORT, 0xc8);
+ offset = tmp;
+ tmp = ast_get_index_reg(ast, AST_IO_CRTC_PORT, 0xc9);
+ offset |= ((uint32_t)tmp << 8);
+ tmp = ast_get_index_reg(ast, AST_IO_CRTC_PORT, 0xca);
+ offset |= ((uint32_t)tmp << 16);
+ offset >>= 3;
+ return offset;
+}
+
int main(int argc,char *argv[])
{
struct ast_private ast;
@@ -256,5 +271,5 @@ int main(int argc,char *argv[])
init(&ast);
- printf("crtc offset is %08x pitch is %08x\n", ast_get_crt_start_addr(&ast), ast_get_pitch_reg(&ast));
+ printf("crtc offset is %08x pitch is %08x, cursor %08x\n", ast_get_crt_start_addr(&ast), ast_get_pitch_reg(&ast), ast_get_cursor_offset(&ast));
}