I try to compile kvaser linuxcan in TX1. But there are some error.
--------------------------------------------------------------------
building kvcommon
Kernel src: /lib/modules/3.10.96-tegra/build
make -C /lib/modules/`uname -r`/build SUBDIRS=/home/ubuntu/linuxcan/common modules
make[2]: Entering directory `/usr/src/linux-headers-3.10.96-tegra'
CC [M] /home/ubuntu/linuxcan/common/VCanOsIf.o
/home/ubuntu/linuxcan/common/VCanOsIf.c: In function ‘vCanDispatchEvent’:
/home/ubuntu/linuxcan/common/VCanOsIf.c:382:9: error: implicit declaration of function ‘atomic_set_mask’ [-Werror=implicit-function-declaration]
atomic_set_mask(objbuf_mask, &fileNodePtr->objbufActive);
^
/home/ubuntu/linuxcan/common/VCanOsIf.c: At top level:
cc1: error: unrecognized command line option "-Wno-date-time" [-Werror]
cc1: all warnings being treated as errors
make[3]: *** [/home/ubuntu/linuxcan/common/VCanOsIf.o] Error 1
make[2]: *** [_module_/home/ubuntu/linuxcan/common] Error 2
make[2]: Leaving directory `/usr/src/linux-headers-3.10.96-tegra'
make[1]: *** [kv_module] Error 2
make[1]: Leaving directory `/home/ubuntu/linuxcan/common'
make: *** [common] Error 2
The code in driver file is like
#ifdef __arm__
unsigned int rd;
unsigned int new_rd;
do {
rd = atomic_read(&fileNodePtr->objbufActive);
new_rd = rd | objbuf_mask;
} while (atomic_cmpxchg(&fileNodePtr->objbufActive, rd, new_rd) != rd);
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
atomic_set_mask(objbuf_mask, &fileNodePtr->objbufActive);
#else
atomic_or(objbuf_mask, &fileNodePtr->objbufActive);
#endif
queue_work(fileNodePtr->objbufTaskQ,
&fileNodePtr->objbufWork);
}
}
Then I check the <asm/atomic.h> in TX1 system. But there is not atomic_set_mask. It only have atomic_or.
So I change the code like
#ifdef __arm__
unsigned int rd;
unsigned int new_rd;
do {
rd = atomic_read(&fileNodePtr->objbufActive);
new_rd = rd | objbuf_mask;
} while (atomic_cmpxchg(&fileNodePtr->objbufActive, rd, new_rd) != rd);
#else
atomic_or(objbuf_mask, &fileNodePtr->objbufActive);
#endif
queue_work(fileNodePtr->objbufTaskQ,
&fileNodePtr->objbufWork);
}
}
or
unsigned int rd;
unsigned int new_rd;
do {
rd = atomic_read(&fileNodePtr->objbufActive);
new_rd = rd | objbuf_mask;
} while (atomic_cmpxchg(&fileNodePtr->objbufActive, rd, new_rd) != rd);
But there is a new error like
--------------------------------------------------------------------
building kvcommon
Kernel src: /lib/modules/3.10.96-tegra/build
make -C /lib/modules/`uname -r`/build SUBDIRS=/home/ubuntu/linuxcan/common modul es
make[2]: Entering directory `/usr/src/linux-headers-3.10.96-tegra'
CC [M] /home/ubuntu/linuxcan/common/VCanOsIf.o
scripts/basic/fixdep: 1: scripts/basic/fixdep: Syntax error: "(" unexpected
make[3]: *** [/home/ubuntu/linuxcan/common/VCanOsIf.o] Error 2
make[2]: *** [_module_/home/ubuntu/linuxcan/common] Error 2
make[2]: Leaving directory `/usr/src/linux-headers-3.10.96-tegra'
make[1]: *** [kv_module] Error 2
make[1]: Leaving directory `/home/ubuntu/linuxcan/common'
make: *** [common] Error 2
Any help is really appreciated!