libpynq (release 5EWC0-2023 version 0.1.0 of 2023-08-14 14:01)
Loading...
Searching...
No Matches
version.c
Go to the documentation of this file.
1/*
2Copyright (c) 2023 Eindhoven University of Technology
3
4Permission is hereby granted, free of charge, to any person obtaining a copy
5of this software and associated documentation files (the "Software"), to deal
6in the Software without restriction, including without limitation the rights
7to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8copies of the Software, and to permit persons to whom the Software is
9furnished to do so, subject to the following conditions:
10
11The above copyright notice and this permission notice shall be included in all
12copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20SOFTWARE.
21*/
22#include <libpynq.h>
23
24/**********************
25 * WARNING
26 * only change the numbers in these 4 #defs; do not change anything else
27 * the libpynq version in doxygen ryb.doxy is updated automatically based
28 * on the next 4 lines
29 **********************/
30#define LIBPYNQ_RELEASE "5EWC0-2023"
31#define LIBPYNQ_VERSION_MAJOR 0
32#define LIBPYNQ_VERSION_MINOR 1
33#define LIBPYNQ_VERSION_PATCH 0
39};
40
41#undef LOG_DOMAIN
42#define LOG_DOMAIN "version"
43
44void print_version(void) {
45 arm_shared t;
46 version_t volatile *hardwareVersion =
47 (version_t volatile *)arm_shared_init(&t, axi_version_0, 4096);
48 printf("Bitstream version: %d.%d.%d\r\n", hardwareVersion->major,
49 hardwareVersion->minor, hardwareVersion->patch);
50 printf("Libpynq release %s version %d.%d.%d\r\n", libpynq_version.release,
52 if (libpynq_version.major != hardwareVersion->major) {
55 "ERROR: the bitstream (hardware) and the libpynq library versions "
56 "are incompatible. Please update your SD-card image and libpynq "
57 "library.\n");
58 } else if (libpynq_version.minor > hardwareVersion->minor) {
60 printf("INFO: the libpynq library is newer than the bitstream (hardware). "
61 "Please check if there is a newer version of the SD-card image.\n");
62 } else if (libpynq_version.minor < hardwareVersion->minor) {
64 printf(
65 "INFO: the bitstream (hardware) is newer than the libpynq library. "
66 "Please check if there is a newer version of the libpynq library.\n");
67 }
69}
70
71void check_version(void) {
72 arm_shared t;
73 version_t volatile *hardwareVersion =
74 (version_t volatile *)arm_shared_init(&t, axi_version_0, 4096);
75 if (libpynq_version.major != hardwareVersion->major) {
78 "ERROR: the bitstream (hardware) and the libpynq library versions "
79 "are incompatible. Please update your SD-card image and libpynq "
80 "library.\n");
81 }
83}
void arm_shared_close(arm_shared *handle)
void * arm_shared_init(arm_shared *handle, const uint32_t address, const uint32_t length)
#define pynq_error(...)
Definition log.h:118
void check_version(void)
Definition version.c:71
void print_version(void)
Definition version.c:44
const version_t libpynq_version
Definition version.c:34
uint8_t release[64]
Definition version.h:62
uint32_t patch
Definition version.h:65
uint32_t major
Definition version.h:63
uint32_t minor
Definition version.h:64
#define LIBPYNQ_RELEASE
Definition version.c:30
#define LIBPYNQ_VERSION_MAJOR
Definition version.c:31
#define LIBPYNQ_VERSION_MINOR
Definition version.c:32
#define LIBPYNQ_VERSION_PATCH
Definition version.c:33