source: hacks/xtide/atarwbuf.c@ 73

Last change on this file since 73 was 73, checked in by bird, 10 years ago

xtide util hacking.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.7 KB
Line 
1/* $Id: atarwbuf.c 73 2015-12-20 21:17:34Z bird $ */
2/** @file
3 * Tests writing the ATA buffer.
4 */
5
6/*
7 * Copyright (c) 2015 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with This program. If not, see <http://www.gnu.org/licenses/>
21 *
22 */
23
24
25#include <stdio.h>
26#include <stdlib.h>
27#include <string.h>
28#include <stdint.h>
29#include <io.h>
30#include <conio.h>
31
32#include "atalib.h"
33
34
35
36int main(int argc, char **argv)
37{
38 static uint8_t s_abBuf1[512];
39 static uint8_t s_abBuf2[512];
40 int rc;
41 unsigned i;
42
43 rc = AtaInitFromArgv(1, argc, argv);
44 if (rc != 0)
45 return 2;
46
47 /*
48 * Write and read back.
49 */
50 for (i = 0; i < 512; i++)
51 s_abBuf1[i] = (uint8_t)i;
52 rc = AtaWriteBuffer(s_abBuf1, 1 /*fExtraChecks*/);
53 if (rc != 0)
54 return 1;
55 rc = AtaReadBuffer(s_abBuf2, 1 /*fExtraChecks*/);
56 if (rc != 0)
57 return 1;
58 if (memcmp(s_abBuf1, s_abBuf2, sizeof(s_abBuf1)) == 0)
59 printf("Initial buffer write and read-back worked\n");
60 else
61 {
62 fprintf(stderr, "error: Initial buffer write and read-back failed!\n");
63 return 1;
64 }
65
66 return 0;
67}
68
69
Note: See TracBrowser for help on using the repository browser.