Compare commits
42 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
c4828c486d | |
|
|
8ca5fa7fe9 | |
|
|
5123a30746 | |
|
|
1bdb4bbb50 | |
|
|
8b5d92d61d | |
|
|
8618f2e75e | |
|
|
7158af4b73 | |
|
|
d66977868f | |
|
|
9dd9a74b9e | |
|
|
760b9d8e34 | |
|
|
c888a206d9 | |
|
|
b69aaf12ab | |
|
|
4841b2863c | |
|
|
8f5889e129 | |
|
|
f92a946a08 | |
|
|
9caa973a5a | |
|
|
67c196ddfe | |
|
|
2ee6101ec2 | |
|
|
f67b4b3620 | |
|
|
cd073b2019 | |
|
|
198cc74e21 | |
|
|
e455a8847c | |
|
|
5d25e80c35 | |
|
|
6e9319c3f4 | |
|
|
7c2338125f | |
|
|
7924117c2a | |
|
|
c515de3a25 | |
|
|
a46b3c62ed | |
|
|
8a21b53cd1 | |
|
|
9da27da69e | |
|
|
6bbcf1b527 | |
|
|
668e50d08c | |
|
|
6025ea1349 | |
|
|
d75acfa8a5 | |
|
|
96836cb186 | |
|
|
03235819fc | |
|
|
5031840429 | |
|
|
17569a82a9 | |
|
|
3a043ecedd | |
|
|
b5dfcee1e1 | |
|
|
6c061d771e | |
|
|
408459cbe2 |
|
|
@ -98,3 +98,7 @@ extra_certificates
|
|||
signing_key.priv
|
||||
signing_key.x509
|
||||
x509.genkey
|
||||
|
||||
.vscode
|
||||
compile_commands.json
|
||||
intrepid.mod
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
v3.1.2
|
||||
Update kernel logging for dropped messages to pr_debug
|
||||
Added instructions for debug message in README
|
||||
v3.1.1
|
||||
Update copyright
|
||||
Fix Ethernet interfaces
|
||||
|
||||
v3.0.4
|
||||
Update copyright
|
||||
Add Fedora package requirements to README
|
||||
Fix for newer 6.4.x Kernel, class_create() sig changed (Doug Potts <dpotts@genrad.com>)
|
||||
|
||||
v3.0.3
|
||||
Update daemon version requirement to 3.1.*
|
||||
|
||||
v3.0.2
|
||||
Bump maximum device count to 64
|
||||
|
||||
v3.0.1
|
||||
Update copyright
|
||||
|
||||
v3.0.0
|
||||
Added Functionality for Ethernet
|
||||
|
||||
v2.1.1
|
||||
Fix support for kernels <5.12
|
||||
Tested on 5.4.0
|
||||
|
||||
v2.1.0
|
||||
Implement proper functionality for echoing transmits
|
||||
Transmit errors are now reported properly
|
||||
Transmit byte count is now reported properly
|
||||
Use with icsscand >= v2.1.0 for full echo support
|
||||
|
||||
v2.0.5
|
||||
Add support for kernels 5.9+
|
||||
Tested on 5.11.0-rc5
|
||||
CAN frames with length > 8 from userspace are rejected rather than truncated
|
||||
|
||||
v2.0.4
|
||||
Ensure carrier is up on new kernels which require it
|
||||
|
||||
v2.0.3
|
||||
Add support for kernels 5.1+
|
||||
Tested on 5.3.0 (Ubuntu 19.10)
|
||||
|
||||
v2.0.2
|
||||
Add support for older kernels
|
||||
Tested working properly back to 4.4
|
||||
Disabled aliasing for kernels <4.15
|
||||
Required, as these kernels do not have netdevice aliasing
|
||||
Use the correct format specifier for (s)size_t
|
||||
Resolves a compile-time warning on 32-bit
|
||||
Check the return type of copy_from_user
|
||||
Resolves a compile-time warning on ARM
|
||||
Standardize kernel version checking
|
||||
Requires icsscand >= v2.0.1
|
||||
icsscand v2.0.0 will not work with older kernels, and would display an obscure error
|
||||
|
||||
v2.0.1
|
||||
Resolve runtime warning message on changing MTU
|
||||
Reviewed our locking behavior, made tweaks where necessary
|
||||
|
||||
v2.0.0
|
||||
Full rewrite
|
||||
Initial release with CAN-FD support
|
||||
Requires icsscand >= v2.0.0
|
||||
55
README.md
55
README.md
|
|
@ -1,10 +1,10 @@
|
|||
Version 2.0.1
|
||||
Version 3.1.2
|
||||
|
||||
This is the kernel object portion of the Intrepid Control Systems SocketCAN support. For SocketCAN to work with Intrepid devices you will need to have this kernel object loaded on your system. Once the module is built and loaded run [icsscand](https://github.com/intrepidcs/icsscand) to turn on SocketCAN support.
|
||||
|
||||
First, install the necessary dependencies for building kernel modules.
|
||||
|
||||
On Ubuntu, this is acomplished by running `sudo apt install linux-headers-generic build-essential gcc git`
|
||||
First, install the necessary dependencies for building kernel modules:
|
||||
- Ubuntu: `sudo apt install linux-headers-generic build-essential gcc git`
|
||||
- Fedora: `sudo dnf install git kernel-devel-matched`
|
||||
|
||||
Clone this repository by running `git clone https://github.com/intrepidcs/intrepid-socketcan-kernel-module.git`
|
||||
|
||||
|
|
@ -45,3 +45,50 @@ can_raw
|
|||
can_dev
|
||||
intrepid
|
||||
```
|
||||
|
||||
## Dynamic Debug Support
|
||||
|
||||
The module includes debug messages that can be enabled at runtime using the kernel's dynamic debug framework. This requires your kernel to be built with `CONFIG_DYNAMIC_DEBUG=y` (most modern distributions include this).
|
||||
|
||||
### Enabling Debug Messages
|
||||
|
||||
After building and loading the module with the standard `make` and `make install`, you can enable debug output:
|
||||
|
||||
**Enable all debug messages for the intrepid module:**
|
||||
```bash
|
||||
$ echo "module intrepid +p" | sudo tee /sys/kernel/debug/dynamic_debug/control
|
||||
```
|
||||
|
||||
**Disable debug messages:**
|
||||
```bash
|
||||
$ echo "module intrepid -p" | sudo tee /sys/kernel/debug/dynamic_debug/control
|
||||
```
|
||||
|
||||
**Enable debug messages for specific functions:**
|
||||
```bash
|
||||
$ echo "file intrepid.c func function_name +p" | sudo tee /sys/kernel/debug/dynamic_debug/control
|
||||
```
|
||||
|
||||
**View current debug settings:**
|
||||
```bash
|
||||
$ sudo cat /sys/kernel/debug/dynamic_debug/control | grep intrepid
|
||||
```
|
||||
|
||||
**View debug output:**
|
||||
```bash
|
||||
$ sudo dmesg | grep intrepid
|
||||
$ sudo dmesg -w # Follow live output
|
||||
```
|
||||
|
||||
### Available Debug Messages
|
||||
|
||||
The debug messages provide information about:
|
||||
- CAN bittiming configuration
|
||||
- Frame validation and processing
|
||||
- Message dropping conditions
|
||||
- Error handling
|
||||
|
||||
Debug messages are primarily triggered during:
|
||||
- CAN interface configuration
|
||||
- Frame transmission/reception
|
||||
- Error conditions and message drops
|
||||
|
|
|
|||
729
intrepid.c
729
intrepid.c
File diff suppressed because it is too large
Load Diff
73
neomessage.h
73
neomessage.h
|
|
@ -16,12 +16,12 @@ typedef union {
|
|||
uint32_t extendedFrame : 1;
|
||||
uint32_t remoteFrame : 1;
|
||||
uint32_t crcError : 1;
|
||||
uint32_t canErrorPassive : 1;
|
||||
uint32_t canErrorPassive : 1; // Occupies the same space as headerCRCError
|
||||
uint32_t incompleteFrame : 1;
|
||||
uint32_t lostArbitration : 1;
|
||||
uint32_t undefinedError : 1;
|
||||
uint32_t canBusOff : 1;
|
||||
uint32_t canErrorWarning : 1;
|
||||
uint32_t canBusRecovered : 1;
|
||||
uint32_t canBusShortedPlus : 1;
|
||||
uint32_t canBusShortedGround : 1;
|
||||
uint32_t checksumError : 1;
|
||||
|
|
@ -98,6 +98,10 @@ typedef union {
|
|||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
typedef uint16_t neonetid_t;
|
||||
typedef uint8_t neonettype_t;
|
||||
typedef uint16_t neomessagetype_t;
|
||||
|
||||
#define ICSNEO_NETWORK_TYPE_INVALID ((uint8_t)0)
|
||||
#define ICSNEO_NETWORK_TYPE_INTERNAL ((uint8_t)1) // Used for statuses that don't actually need to be transferred to the client application
|
||||
#define ICSNEO_NETWORK_TYPE_CAN ((uint8_t)2)
|
||||
|
|
@ -109,42 +113,73 @@ typedef union {
|
|||
#define ICSNEO_NETWORK_TYPE_OTHER ((uint8_t)0xFF)
|
||||
|
||||
typedef struct {
|
||||
neomessage_statusbitfield_t status;
|
||||
uint8_t _reserved1[16];
|
||||
uint64_t timestamp;
|
||||
uint64_t timestampReserved;
|
||||
const uint8_t* data;
|
||||
size_t length;
|
||||
uint8_t header[4];
|
||||
uint16_t netid;
|
||||
uint8_t type;
|
||||
uint8_t reserved[17];
|
||||
uint64_t _reservedTimestamp;
|
||||
uint8_t _reserved2[sizeof(size_t) * 2 + 7 + sizeof(neonetid_t) + sizeof(neonettype_t)];
|
||||
neomessagetype_t messageType;
|
||||
uint8_t _reserved3[12];
|
||||
} neomessage_t; // 72 bytes total
|
||||
// Any time you add another neomessage_*_t type, make sure to add it to the static_asserts below!
|
||||
|
||||
typedef struct {
|
||||
neomessage_statusbitfield_t status;
|
||||
uint64_t timestamp;
|
||||
uint64_t timestampReserved;
|
||||
uint64_t _reservedTimestamp;
|
||||
const uint8_t* data;
|
||||
size_t length;
|
||||
uint8_t header[4];
|
||||
neonetid_t netid;
|
||||
neonettype_t type;
|
||||
uint8_t _reserved0;
|
||||
uint16_t description;
|
||||
neomessagetype_t messageType;
|
||||
uint8_t _reserved1[12];
|
||||
} neomessage_frame_t;
|
||||
|
||||
typedef struct {
|
||||
neomessage_statusbitfield_t status;
|
||||
uint64_t timestamp;
|
||||
uint64_t _reservedTimestamp;
|
||||
const uint8_t* data;
|
||||
size_t length;
|
||||
uint32_t arbid;
|
||||
uint16_t netid;
|
||||
uint8_t type;
|
||||
neonetid_t netid;
|
||||
neonettype_t type;
|
||||
uint8_t dlcOnWire;
|
||||
uint8_t reserved[16];
|
||||
uint16_t description;
|
||||
neomessagetype_t messageType;
|
||||
uint8_t _reserved1[12];
|
||||
} neomessage_can_t;
|
||||
|
||||
typedef struct {
|
||||
neomessage_statusbitfield_t status;
|
||||
uint64_t timestamp;
|
||||
uint64_t timestampReserved;
|
||||
uint64_t _reservedTimestamp;
|
||||
size_t _reserved2[2];
|
||||
uint8_t transmitErrorCount;
|
||||
uint8_t receiveErrorCount;
|
||||
uint8_t _reserved3[5];
|
||||
neonetid_t netid;
|
||||
neonettype_t type;
|
||||
neomessagetype_t messageType;
|
||||
uint8_t _reserved4[12];
|
||||
} neomessage_can_error_t;
|
||||
|
||||
typedef struct {
|
||||
neomessage_statusbitfield_t status;
|
||||
uint64_t timestamp;
|
||||
uint64_t _reservedTimestamp;
|
||||
const uint8_t* data;
|
||||
size_t length;
|
||||
uint8_t preemptionFlags;
|
||||
uint8_t reservedHeader[3];
|
||||
uint16_t netid;
|
||||
uint8_t type;
|
||||
uint8_t reserved[17];
|
||||
uint8_t _reservedHeader[3];
|
||||
neonetid_t netid;
|
||||
neonettype_t type;
|
||||
uint8_t _reserved0;
|
||||
uint16_t description;
|
||||
neomessagetype_t messageType;
|
||||
uint8_t _reserved1[12];
|
||||
} neomessage_eth_t;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
|
|
|||
Loading…
Reference in New Issue