userspace_utils.h 1.68 KB
Newer Older
1
// SPDX-License-Identifier: GPL-2.0+
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
2
/*******************************************************************************
3
 *
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
4
 * CTU CAN FD IP Core
5
 * Copyright (C) 2015-2018
6
 *
7 8
 * Authors:
 *     Ondrej Ille <ondrej.ille@gmail.com>
9
 *     Martin Jerabek <martin.jerabek01@gmail.com>
10
 *     Jaroslav Beran <jara.beran@gmail.com>
11 12
 *
 * Project advisors:
13 14
 *     Jiri Novak <jnovak@fel.cvut.cz>
 *     Pavel Pisa <pisa@cmp.felk.cvut.cz>
15
 *
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
16 17 18
 * Department of Measurement         (http://meas.fel.cvut.cz/)
 * Faculty of Electrical Engineering (http://www.fel.cvut.cz)
 * Czech Technical University        (http://www.cvut.cz/)
19
 *
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
20 21 22 23
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
24
 *
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
25 26 27 28
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
29
 ******************************************************************************/
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
30

31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
#pragma once

extern "C" {
#include "ctu_can_fd_linux_defs.h"
#include "ctu_can_fd_hw.h"
}

#undef abs
#include <sys/mman.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <inttypes.h>
#include <err.h>

48
struct ctucan_hw_priv *ctucanfd_init(uint32_t addr);
49

50
unsigned int ctu_can_fd_read8(struct ctucan_hw_priv *priv,
51 52
				enum ctu_can_fd_can_registers reg);

53
unsigned int ctu_can_fd_read16(struct ctucan_hw_priv *priv,
54
				enum ctu_can_fd_can_registers reg);