1 ///////////////////////////////////////////////////////////////////////////
2 // Workfile: tvout.c (Implementation)
3 // Author: Daniel Giritzer
5 // Description: Simple Program to move the picture of the composite video
9 // Copyright (C) 2017, Daniel Giritzer (giri@nwrk.biz)
10 ///////////////////////////////////////////////////////////////////////////
18 void PrintUsageMessage(FILE* output)
20 fprintf(output, "++++++++++++++++++++++++++++++\n");
21 fprintf(output, "Usage: tvout [-m [-x val] [-y val]] \n\n");
22 fprintf(output, "-m \t move \n");
23 fprintf(output, "-x \t vertical offset in px \n");
24 fprintf(output, "-x \t horizontal offset in px \n");
25 fprintf(output, "\nThis program was created for the Armbian Project.\n");
26 fprintf(output, "(c) 2017, Daniel G.\n");
27 fprintf(output, "++++++++++++++++++++++++++++++\n");
30 int main(int argc, char **argv)
41 PrintUsageMessage(stdout);
44 // Use getopt to parse the cmd parameters
45 while ((c = getopt (argc, argv, "mx:y:?")) != -1)
61 PrintUsageMessage(stdout);
68 //check if m flag was set
71 unsigned long to_write = 0;
73 // read current position
74 readmem(TV_ENCODER_RESYNC, 'w', &to_write);
78 to_write += strtoul(xVal, 0, 0) << X_REG_OFFSET;
84 to_write += strtoul(yVal, 0, 0) << Y_REG_OFFSET;
86 //write new position to register
87 writemem(TV_ENCODER_RESYNC, to_write, 'w');
90 for (unsigned int index = optind; index < argc; index++)
92 printf ("Non-option argument %s\n", argv[index]);