blob: 0742d55f1c59f57f9a53a95504511c78cfb1400b [file] [log] [blame]
Ben Tyner92e39fd2020-02-05 18:11:02 -06001/**
Ben Tynerb859d792020-05-06 21:29:47 -05002 * @file These are the implementations of the user interfaces declared
3 * in hei_user_interface.hpp
Ben Tyner92e39fd2020-02-05 18:11:02 -06004 */
5
Ben Tynerb859d792020-05-06 21:29:47 -05006#include <assert.h>
Zane Shelleyb78dd0c2020-05-08 14:35:15 -05007#include <stdarg.h>
8#include <stdio.h>
9
Ben Tyner92e39fd2020-02-05 18:11:02 -060010#include <hei_user_interface.hpp>
11
12namespace libhei
13{
14
15//------------------------------------------------------------------------------
16
Zane Shelleyb78dd0c2020-05-08 14:35:15 -050017bool registerRead(const Chip& i_chip, void* o_buffer, size_t& io_bufSize,
18 uint64_t i_regType, uint64_t i_address)
Ben Tyner92e39fd2020-02-05 18:11:02 -060019{
Zane Shelleyb78dd0c2020-05-08 14:35:15 -050020 bool accessFailure = false;
Ben Tyner92e39fd2020-02-05 18:11:02 -060021
Ben Tynerb859d792020-05-06 21:29:47 -050022 assert(nullptr != o_buffer);
23 assert(0 != io_bufSize);
24
25 // TODO need real register read code
26 printf("registerRead not implemented\n");
Ben Tyner92e39fd2020-02-05 18:11:02 -060027
Zane Shelleyb78dd0c2020-05-08 14:35:15 -050028 return accessFailure;
Ben Tyner92e39fd2020-02-05 18:11:02 -060029}
30
31//------------------------------------------------------------------------------
32
33#ifndef __HEI_READ_ONLY
34
Zane Shelleyb78dd0c2020-05-08 14:35:15 -050035bool registerWrite(const Chip& i_chip, void* i_buffer, size_t& io_bufSize,
36 uint64_t i_regType, uint64_t i_address)
Ben Tyner92e39fd2020-02-05 18:11:02 -060037{
Zane Shelleyb78dd0c2020-05-08 14:35:15 -050038 bool accessFailure = false;
Ben Tyner92e39fd2020-02-05 18:11:02 -060039
Ben Tynerb859d792020-05-06 21:29:47 -050040 assert(nullptr != i_buffer);
41 assert(0 != io_bufSize);
42
43 // TODO need real register write code
44 printf("registerWrite not implemented\n");
Ben Tyner92e39fd2020-02-05 18:11:02 -060045
Zane Shelleyb78dd0c2020-05-08 14:35:15 -050046 return accessFailure;
Ben Tyner92e39fd2020-02-05 18:11:02 -060047}
48
49#endif
50
51//------------------------------------------------------------------------------
52
Zane Shelleyb78dd0c2020-05-08 14:35:15 -050053// prints a single line to stdout
54void hei_inf(char* format, ...)
55{
56 va_list args;
57 fprintf(stdout, "I> ");
58 va_start(args, format);
59 vfprintf(stdout, format, args);
60 va_end(args);
61 fprintf(stdout, "\n");
62}
63
64//------------------------------------------------------------------------------
65
66// prints a single line to stderr
67void hei_err(char* format, ...)
68{
69 va_list args;
70 fprintf(stderr, "E> ");
71 va_start(args, format);
72 vfprintf(stderr, format, args);
73 va_end(args);
74 fprintf(stderr, "\n");
75}
76
Ben Tyner92e39fd2020-02-05 18:11:02 -060077} // namespace libhei