From faecf53a921a5084784a33ff9efef61280d086ab Mon Sep 17 00:00:00 2001 From: Daniel Giritzer Date: Fri, 2 Jun 2017 22:25:18 +0200 Subject: [PATCH] Program to move picture ready --- src/devmem2.c | 3 +-- src/main.c | 31 ++++++++++++++++++++++--------- src/tvout.h | 8 +++++--- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/devmem2.c b/src/devmem2.c index ea96828..720aab5 100644 --- a/src/devmem2.c +++ b/src/devmem2.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -113,7 +112,7 @@ int writemem(unsigned long address, unsigned long writeval, int access_type) /// \brief This function allows reading the memory /// on the specified address. /// -/// \param char* Address to read from +/// \param unsigned long Address to read from /// \param int Access type, should be 'w' (word), /// 'h' (halfword), 'b'(byte) /// \param unsigned long* pointer result variable diff --git a/src/main.c b/src/main.c index e48c397..9278d78 100644 --- a/src/main.c +++ b/src/main.c @@ -12,17 +12,30 @@ #include "devmem2.h" #include "tvout.h" -int main() + +int main(int argc, char **argv) { - unsigned long readfrommemory = 0; + unsigned long to_write = 0; + + + //Print usage message + if(argc != 3) + { + fprintf(stdout, "Usage: tvout \n"); + fprintf(stdout, "The parameter values should be in px.\n"); + fprintf(stdout, "This program was created for the Armbian Project."); + fprintf(stdout, "(c) 2017, Daniel G."); + return EXIT_SUCCESS; + } + + //Set X value + to_write = strtoul(argv[1], 0, 0) << X_REG_OFFSET; - //Testing writemem - writemem(0x01E00130, 0x10140025, 'w'); + //Set Y value + to_write = strtoul(argv[2], 0, 0) << Y_REG_OFFSET; - //Testing readmem - readmem(0x01E00130, 'w', &readfrommemory); + //write to register + writemem(TV_ENCODER_RESYNC, to_write, 'w'); - //Print read value to stdout - printf("Value: 0x%X \n", (unsigned int)readfrommemory); - return 0; + return EXIT_SUCCESS; } diff --git a/src/tvout.h b/src/tvout.h index 4fdfe9a..69e7b6e 100644 --- a/src/tvout.h +++ b/src/tvout.h @@ -2,7 +2,7 @@ // Workfile: tvout.h (Header) // Author: Daniel Giritzer // Date: 2017-06-02 -// Description: +// Description: Provides Adresses to the TV Encoder Registers // Remarks: - // Revision: 1 // Copyright (C) 2017, Daniel Giritzer (giri@nwrk.biz) @@ -10,7 +10,9 @@ #ifndef TVOUT_H_INCLUDED #define TVOUT_H_INCLUDED -#define TV_BASE 0x01E00000 - +#define TV_ENCODER_BASE 0x01E00000 +#define TV_ENCODER_RESYNC TV_ENCODER_BASE + 0x130 +#define X_REG_OFFSET 16 +#define Y_REG_OFFSET 0 #endif // TVOUT_H_INCLUDED -- 2.11.0