Commit 81c59133 authored by Ille, Ondrej, Ing.'s avatar Ille, Ondrej, Ing.
Browse files

Merge remote-tracking branch 'origin/master' into 202-txt-buffer-hazard-test

# Conflicts:
#	test/tests_debug.yml
parents a8fc51b4 6f0a5462
......@@ -7,3 +7,9 @@
*~
.fuse_hidden*
.mypy_cache
debian/ctucanfd-drv
debian/*.log
debian/*.substvars
debian/debhelper-build-stamp
debian/*.debhelper
debian/files
ctucanfd-drv (1.0.0) unstable; urgency=medium
* Initial dkms build.
-- Pavel Pisa <ppisa@pikron.com> Fri, 18 Jan 2019 19:09:04 +0100
Source: ctucanfd-drv
Maintainer: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Section: admin
Priority: optional
Build-Depends: debhelper (>=9),
dkms
Standards-Version: 1.0.0
Vcs-Browser: https://gitlab.fel.cvut.cz/canbus/ctucanfd_ip_core
Vcs-Git: https://gitlab.fel.cvut.cz/canbus/ctucanfd_ip_core.git
Homepage: https://gitlab.fel.cvut.cz/canbus/ctucanfd_ip_core
Package: ctucanfd-drv
Architecture: all
Depends: ${misc:Depends}
Description: CTU CAN FD IP Core driver
CAN with Flexible Data-rate IP Core developed
at Department of Measurement of FEE CTU.
.
This package provides driver for the core.
It supports PCI express cards as well as it provides
platform driver for SoC integration when appropriate
device tree is provided.
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: ctucanfd_ip_core
Source: https://gitlab.fel.cvut.cz/canbus/ctucanfd_ip_core
Files: /driver/*
Copyright: 2018-2019 Ondrej Ille <ondrej.ille@gmail.com>
2018-2019 Martin Jerabek <martin.jerabek01@gmail.com>
2018-2019 Pavel Pisa <pisa@cmp.felk.cvut.cz>
License: GPL-2.0+
Files: /src/*
Copyright: 2018-2019 Ondrej Ille <ondrej.ille@gmail.com>
2018-2019 Martin Jerabek <martin.jerabek01@gmail.com>
License: CTUCANFD-Core License
License: CTUCANFD-Core License
CTU CAN FD IP Core
Copyright (C) 2015-2018
.
Authors:
Ondrej Ille <ondrej.ille@gmail.com>
Martin Jerabek <martin.jerabek01@gmail.com>
.
Project advisors:
Jiri Novak <jnovak@fel.cvut.cz>
Pavel Pisa <pisa@cmp.felk.cvut.cz>
.
Department of Measurement (http://meas.fel.cvut.cz/)
Faculty of Electrical Engineering (http://www.fel.cvut.cz)
Czech Technical University (http://www.cvut.cz/)
.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this VHDL component and associated documentation files (the "Component"),
to deal in the Component without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Component, and to permit persons to whom the
Component is furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Component.
.
THE COMPONENT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHTHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE COMPONENT OR THE USE OR OTHER DEALINGS
IN THE COMPONENT.
.
The CAN protocol is developed by Robert Bosch GmbH and protected by patents.
Anybody who wants to implement this IP core on silicon has to obtain a CAN
protocol license from Bosch.
License: GPL-2.0+
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.
.
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.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General Public License
Version 2 can be found in `/usr/share/common-licenses/GPL-2'.
#!/bin/sh
for fname in ctu_can_fd.c ctu_can_fd_frame.h ctu_can_fd_hw.c ctu_can_fd_hw.h \
ctu_can_fd_regs.h ; do
echo driver/${fname} /usr/src/${PACKAGE_NAME}-${PACKAGE_VERSION}
done
for fname in Kbuild Makefile ; do
echo driver/linux/${fname} /usr/src/${PACKAGE_NAME}-${PACKAGE_VERSION}
done
driver/dkms.conf
README.md
#!/usr/bin/make -f
export DH_VERBOSE = 1
export OMIT_KERNEL_PASSES = y
PACKAGE_NAME=$(shell grep PACKAGE_NAME= driver/dkms.conf | cut -d= -f2 | cut -d\" -f2)
PACKAGE_VERSION=$(shell grep PACKAGE_VERSION= driver/dkms.conf | cut -d= -f2 | cut -d\" -f2)
export PACKAGE_NAME PACKAGE_VERSION
%:
dh $@ --with dkms
# Nothing to configure, build or auto-install (this all happens after
# installation using dkms)
override_dh_auto_configure:
override_dh_auto_build:
override_dh_auto_install:
......@@ -4930,8 +4930,8 @@ ILBP Internal loop-back option (recommended only for testing). If internal loop
\end_layout
\begin_layout Description
ENA Enable bit for the whole CAN FD Controller. When disabled, IP Core acts as if not connected to the CAN Bus.\begin_inset Newline newline\end_inset
0b0 - DISABLED - The CAN Core is disabled.\begin_inset Newline newline\end_inset
0b1 - ENABLED - The CAN Core is enabled.
0b0 - CTU_CAN_DISABLED - The CAN Core is disabled.\begin_inset Newline newline\end_inset
0b1 - CTU_CAN_ENABLED - The CAN Core is enabled.
\end_layout
\begin_layout Description
NISOFD Selection between two possible CAN FD specifications. This bit should be modified only when SETTINGS[ENA]=0.\begin_inset Newline newline\end_inset
......
......@@ -142,7 +142,7 @@ void ctu_can_fd_enable(struct ctucanfd_priv *priv, bool enable)
union ctu_can_fd_mode_command_status_settings reg;
reg.u32 = priv->read_reg(priv, CTU_CAN_FD_MODE);
reg.s.ena = enable ? ENABLED : DISABLED;
reg.s.ena = enable ? CTU_CAN_ENABLED : CTU_CAN_DISABLED;
priv->write_reg(priv, CTU_CAN_FD_MODE, reg.u32);
}
......@@ -774,4 +774,21 @@ bool ctu_can_fd_insert_frame(struct ctucanfd_priv *priv,
return true;
}
u64 ctu_can_fd_read_timestamp(struct ctucanfd_priv *priv)
{
union ctu_can_fd_timestamp_low ts_low;
union ctu_can_fd_timestamp_high ts_high;
union ctu_can_fd_timestamp_high ts_high_2;
ts_high.u32 = priv->read_reg(priv, CTU_CAN_FD_TIMESTAMP_HIGH);
ts_low.u32 = priv->read_reg(priv, CTU_CAN_FD_TIMESTAMP_LOW);
ts_high_2.u32 = priv->read_reg(priv, CTU_CAN_FD_TIMESTAMP_HIGH);
if (ts_high.u32 != ts_high_2.u32){
ts_low.u32 = priv->read_reg(priv, CTU_CAN_FD_TIMESTAMP_LOW);
}
return (( (u64) ts_high_2.u32) << 32) | ( (u64) ts_low.u32);
}
// TODO: AL_CAPTURE and ERROR_CAPTURE
......@@ -316,7 +316,7 @@ static inline bool ctu_can_fd_is_enabled(struct ctucanfd_priv *priv)
union ctu_can_fd_mode_command_status_settings reg;
reg.u32 = priv->read_reg(priv, CTU_CAN_FD_MODE);
return reg.s.ena == ENABLED;
return reg.s.ena == CTU_CAN_ENABLED;
}
......@@ -955,6 +955,20 @@ static inline union ctu_can_fd_debug_register
return reg;
}
/*
* Read timestamp value which is used internally by CTU CAN FD Core.
* Reads timestamp twice and checks consistency betwen upper and
* lower timestamp word.
*
* Arguments:
* priv Private info
* Returns:
* Value of timestamp in CTU CAN FD Core
*/
u64 ctu_can_fd_read_timestamp(struct ctucanfd_priv *priv);
extern const struct can_bittiming_const ctu_can_fd_bit_timing_max;
extern const struct can_bittiming_const ctu_can_fd_bit_timing_data_max;
......
......@@ -250,8 +250,8 @@ enum ctu_can_fd_settings_ilbp {
};
enum ctu_can_fd_settings_ena {
DISABLED = 0x0,
ENABLED = 0x1,
CTU_CAN_DISABLED = 0x0,
CTU_CAN_ENABLED = 0x1,
};
enum ctu_can_fd_settings_nisofd {
......
......@@ -251,7 +251,9 @@ int main(int argc, char *argv[])
case 'p':
addrs[0] = pci_find_bar(0x1172, 0xcafd, 0, 1);
if (!addrs[0])
err(1, "-p PCI device not found");
addrs[0] = pci_find_bar(0x1760, 0xff00, 0, 1);
if (!addrs[0])
err(1, "-p PCI device not found");
addrs[1] = addrs[0] + 0x4000;
break;
case 'h':
......
PACKAGE_VERSION="1.0.0"
PACKAGE_NAME="ctucanfd-drv"
CLEAN="make clean"
BUILT_MODULE_NAME[0]="ctucanfd"
BUILT_MODULE_LOCATION[0]=""
DEST_MODULE_LOCATION[0]="/extra"
MAKE[0]="make KERNEL_VERSION=$kernelver -C ${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build"
AUTOINSTALL="yes"
CROSS_COMPILE= arm-linux-gnueabihf-
ifeq ($(KERNEL_VERSION),)
CROSS_COMPILE?= arm-linux-gnueabihf-
KDIR ?= /home/mjerabek/projects/kernel/linux-4.15-build/zynq
ARCH=arm
ifeq ($(shell hostname),hathi)
INSTALL_DIR=/srv/nfs4/debian-armhf-devel
endif
#KDIR ?= /lib/modules/$(shell uname -r)/build
#ARCH ?= x86_64
else
KDIR = /lib/modules/$(KERNEL_VERSION)/build
endif
MAKEARGS := -C $(KDIR)
MAKEARGS += $(if $(ARCH),ARCH=$(ARCH))
MAKEARGS += $(if $(CROSS_COMPILE),CROSS_COMPILE=$(CROSS_COMPILE))
$(warning "$(MAKEARGS)")
default:
$(MAKE) -C $(KDIR) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) M=$$PWD
ifeq ($(shell hostname),hathi)
-rm -f /srv/nfs4/debian-armhf-devel/ctucanfd.ko
cp ctucanfd.ko /srv/nfs4/debian-armhf-devel/
$(MAKE) $(MAKEARGS) M=$$PWD
ifneq ($(INSTALL_DIR),)
-rm -f $(INSTALL_DIR)/ctucanfd.ko
cp ctucanfd.ko $(INSTALL_DIR)/
endif
clean:
$(MAKE) -C $(KDIR) M=$$PWD ARCH=arm clean
$(MAKE) $(MAKEARGS) M=$$PWD clean
This diff is collapsed.
#!/usr/bin/python3
"""
Generate vivado component file in /src/component.xml.
Serves to update the list of source files -- run when you add/delete/rename
a src vhdl file.
"""
from jinja2 import Environment, FileSystemLoader, select_autoescape
from pathlib import Path
d = Path(__file__).parent
jinja_env = Environment(
loader=FileSystemLoader(str(d)),
autoescape=select_autoescape(['html', 'xml']))
template = jinja_env.get_template('component.xml.j2')
src_dir = d / '..' / 'src'
files = [str(f.relative_to(src_dir)) for f in src_dir.glob('**/*.vhd')]
files = sorted(files)
contents = template.render(files=files)
with (src_dir / 'component.xml').open('wt', encoding='utf-8') as f:
f.write(contents)
......@@ -532,14 +532,14 @@
<ipxact:bitWidth>1</ipxact:bitWidth>
<ipxact:enumeratedValues>
<ipxact:enumeratedValue>
<ipxact:name>ENABLED</ipxact:name>
<ipxact:displayName>ENABLED</ipxact:displayName>
<ipxact:name>CTU_CAN_ENABLED</ipxact:name>
<ipxact:displayName>CTU_CAN_ENABLED</ipxact:displayName>
<ipxact:description>The CAN Core is enabled.</ipxact:description>
<ipxact:value>1</ipxact:value>
</ipxact:enumeratedValue>
<ipxact:enumeratedValue>
<ipxact:name>DISABLED</ipxact:name>
<ipxact:displayName>DISABLED</ipxact:displayName>
<ipxact:name>CTU_CAN_DISABLED</ipxact:name>
<ipxact:displayName>CTU_CAN_DISABLED</ipxact:displayName>
<ipxact:description>The CAN Core is disabled.</ipxact:description>
<ipxact:value>0</ipxact:value>
</ipxact:enumeratedValue>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment