### Install with CMake Source: https://github.com/spaceinventor/libcsp/blob/master/doc/INSTALL.md Install the compiled libcsp.so and header files to the specified install directory using CMake. ```shell cmake --install builddir ``` -------------------------------- ### Install ZeroMQ Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-send-zmq/README.md Install the libzmq3 development library, which is required for ZeroMQ functionality. ```bash sudo apt-get install libzmq3-dev ``` -------------------------------- ### Build and Install with Waf Source: https://github.com/spaceinventor/libcsp/blob/master/doc/INSTALL.md Build the project and install the library to the location specified by the --prefix option using Waf. ```shell ./waf build install ``` -------------------------------- ### Run CSP Server/Client Example with Loopback Interface Source: https://github.com/spaceinventor/libcsp/blob/master/doc/example.md Execute the CSP server and client example using the default loopback interface for communication. This is useful for testing without external hardware. ```bash ./build/examples/csp_server_client ``` -------------------------------- ### Install Runtime Library with CMake Source: https://github.com/spaceinventor/libcsp/blob/master/doc/INSTALL.md Install only the libcsp.so runtime library using CMake. ```shell cmake --install builddir --component runtime ``` -------------------------------- ### Install iproute2 Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-send-canbus/README.md Install the necessary 'ip' command utility if it's not already present. ```bash sudo apt-get install iproute2 ``` -------------------------------- ### Build Documentation Source: https://github.com/spaceinventor/libcsp/blob/master/doc/build-doc.md Steps to set up a virtual environment, install dependencies, and build the documentation using CMake. ```shell python3 -m venv venv . venv/bin/activate pip install -r doc/requirements.txt mkdir builddir cmake -S doc -B builddir cmake --build builddir ``` -------------------------------- ### Install socat Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-send-usart/README.md Installs the socat utility, which is required for setting up PTY devices. ```bash sudo apt-get install socat ``` -------------------------------- ### Git Rebase Command Example Source: https://github.com/spaceinventor/libcsp/blob/master/doc/git-commit.md Provides an example of how to rebase a topic branch onto the develop branch to maintain a linear commit history. ```sh git fetch origin git rebase develop topic ``` -------------------------------- ### Run zmqproxy Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-send-zmq/README.md Start the zmqproxy, which handles ZeroMQ communication for publishing and subscribing. ```bash ./builddir/examples/zmqproxy ``` -------------------------------- ### Build the Simple Send USART Example Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-send-usart/README.md Builds the simple-send-usart CSP server using CMake and Ninja. ```bash cmake -B builddir ninja -C builddir simple-send-usart csp_server ``` -------------------------------- ### Run CSP Server Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-send-zmq/README.md Start the CSP server with ZeroMQ support. This server listens on localhost and uses address 1. ```bash ./builddir/examples/csp_server -z localhost -a 1 ``` -------------------------------- ### Setup vcan0 interface Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-send-canbus/README.md Create and bring up a virtual CANbus interface for testing without hardware. ```bash sudo ip link add dev vcan0 type vcan sudo ip link set up vcan0 ``` -------------------------------- ### Run CSP Server Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-send-canbus/README.md Start the CSP server on the vcan0 interface, listening on address 1. ```bash ./builddir/examples/csp_server -c vcan0 -a 1 ``` -------------------------------- ### Run CSP Server with PTY Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-send-usart/README.md Starts a CSP server instance, binding it to a PTY device for communication. ```bash ./builddir/examples/csp_server -k /tmp/pty1 -a 1 ``` -------------------------------- ### csp_listen Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_h.rst Starts listening for incoming connections on a CSP socket. ```APIDOC ## csp_listen ### Description Starts listening for incoming connections on a CSP socket. ### Function Signature `csp_listen()` ``` -------------------------------- ### Run CSP Server Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-send-udp/README.md Command to start the CSP server with UDP enabled, listening on a specific address and port. ```bash ./builddir/examples/csp_server csp_server -u "127.0.0.1" -a 1 ``` -------------------------------- ### Run CSP Client with ZMQHUB Interface Source: https://github.com/spaceinventor/libcsp/blob/master/doc/example.md Start the CSP client with the ZMQHUB interface, connecting to localhost as address 3 and targeting server address 2. This initiates communication with the server. ```bash ./build/examples/csp_client -z localhost -a 3 -C 2 ``` -------------------------------- ### Setup PTY Devices for Testing Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-send-usart/README.md Sets up a pair of pseudo-terminal (PTY) devices on Linux for simulating UART/USART communication. ```bash socat -dd pty,raw,echo=0,link=/tmp/pty1 pty,raw,echo=0,link=/tmp/pty2 ``` -------------------------------- ### csp_rdp_get_opt Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_h.rst Gets an option for the RDP protocol. ```APIDOC ## csp_rdp_get_opt ### Description Gets an option for the RDP protocol. ### Function Signature `csp_rdp_get_opt()` ``` -------------------------------- ### csp_uptime Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_h.rst Gets the uptime of the CSP system. ```APIDOC ## csp_uptime ### Description Gets the uptime of the CSP system. ### Function Signature `csp_uptime()` ``` -------------------------------- ### Configure Waf for FreeRTOS Source: https://github.com/spaceinventor/libcsp/blob/master/doc/INSTALL.md Configure the Waf build system for AVR32 toolchain and FreeRTOS, specifying the installation prefix. ```shell ./waf configure --toolchain=avr32- --with-os=freertos --prefix=install ``` -------------------------------- ### Run CSP Server with ZMQHUB Interface Source: https://github.com/spaceinventor/libcsp/blob/master/doc/example.md Start the CSP server with the ZMQHUB interface enabled, listening on localhost and assigned address 2. This allows the server to receive requests over the network. ```bash ./build/examples/csp_server -z localhost -a 2 ``` -------------------------------- ### csp_get_buf_free Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_h.rst Gets the amount of free buffer space. ```APIDOC ## csp_get_buf_free ### Description Gets the amount of free buffer space. ### Function Signature `csp_get_buf_free()` ``` -------------------------------- ### Example Commit Message: Drivers Source: https://github.com/spaceinventor/libcsp/blob/master/doc/git-commit.md Demonstrates a commit message for driver changes, including an area tag, imperative subject, and detailed body explaining the 'why' and implementation details. ```text drivers: usart_linux: Fail early and release unused resources This commit introduces early failing to csp_usart_open() in case neither rx_callback nor return_fd are provided. We also move the allocation of `ctx` into the if block ensuring that a rx_callback is provided. Thus, we do not allocate and free memory needlessly. After usage of the pthread attributes, we destroy them to further reduce memory leaks. In case of an error, at the moment we only log it and do not abort, as it would not influence functionality. If return_fd is not provided (l. 205), we do not need to explicitly close the descriptor as rx_callback is provided and using the fd in that case. Signed-off-by: pr0me Reviewed-by: Yasushi SHOJI ``` -------------------------------- ### csp_get_memfree Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_h.rst Gets the amount of free memory. ```APIDOC ## csp_get_memfree ### Description Gets the amount of free memory. ### Function Signature `csp_get_memfree()` ``` -------------------------------- ### Run ZMQ Proxy for ZMQHUB Interface Source: https://github.com/spaceinventor/libcsp/blob/master/doc/example.md Start the ZMQ proxy, which is required for the CSP server and client to communicate over the ZMQHUB interface. This process handles network communication. ```bash ./build/examples/zmqproxy ``` -------------------------------- ### Example Commit Message: CMake Source: https://github.com/spaceinventor/libcsp/blob/master/doc/git-commit.md Illustrates a commit message for CMake build system changes, focusing on fixing an option name and updating Python binding support. ```text cmake: Fix python binding option, change to py3 The previous option name for the python bindings, 'enable-python3-bindings' is not a valid variable name in CMAKE. Also only Python3 is supported forwards so the CMake package Python3 is now used. Due to the 'WITH_SOABI' option being specified, the MODULE option was also explicitly specified as 'WITH_SOABI' can only be used with 'MODULE'. ``` -------------------------------- ### Example Commit Message: Network MTU Source: https://github.com/spaceinventor/libcsp/blob/master/doc/git-commit.md Shows a commit message for changes related to network Maximum Transmission Unit (MTU) handling, explaining the removal of a field and its implications. ```text nomtu: Remove the usage of the interface MTU field After leading to much confusion over the years, the mtu field has now been removed. This is made possible with the recent change to the packet structure having a compile time defined size. This means we dont need a runtime configuration field to check against, we can simply check against sizeof(packet->data) now. All RX functions need to check for overflow of the packet data field. All TX functions that is askd to transmit a csp packet larger than their underlying layer cannot handle, should drop the packet. In-the field MTU analysis is done by sending larger and larger ping packets over the network to determine what the end-to-end MTU is. Interfaces that support "infinite mtu" are: CAN CFP 2.0 (begin and end flag) KISS (begin and end flag) I2C (begin and end flag) Interfaces that are limited: CAN CFP 1.0 (uses 256 frame remain field, so 2^255 * 8 = 2048 B) ZMQ (supports 2^29 bytes at least) UDP (limited to 2^16) ``` -------------------------------- ### Time Hooks for CSP Source: https://github.com/spaceinventor/libcsp/blob/master/doc/hooks.md These functions are used to get and set the system time. They rely on architecture-specific implementations and have default behaviors on FreeRTOS (returning 0) and POSIX/Zephyr (using `clock_gettime`). ```c void csp_clock_get_time(csp_timestamp_t * time); int csp_clock_set_time(const csp_timestamp_t * time); ``` -------------------------------- ### Build the Sample Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-sfp-send-recv/README.md Builds the simple-sfp-send-recv sample using CMake and Ninja. ```bash cmake -B builddir ninja -C builddir simple-sfp-send-recv ``` -------------------------------- ### Compile with Meson Source: https://github.com/spaceinventor/libcsp/blob/master/doc/INSTALL.md Use these commands to set up, navigate to, and build the project using the Meson build system. ```shell meson setup builddir cd builddir ninja ``` -------------------------------- ### Test the Sample Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-sfp-send-recv/README.md Runs the compiled sample to test SFP file transfer. Requires an existing file and specifies a file to be created. ```bash ./builddir/samples/posix/simple-sfp-send-recv/simple-sfp-send-recv existing_file_on_system.txt file_to_create_on_system.txt ``` -------------------------------- ### Build simple-send-canbus and csp_server Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-send-canbus/README.md Build the sample application and the CSP server using CMake and Ninja. ```bash cmake -B builddir ninja -C builddir simple-send-canbus csp_server ``` -------------------------------- ### csp_conn_flags Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_h.rst Gets the flags of a CSP connection. ```APIDOC ## csp_conn_flags ### Description Gets the flags of a CSP connection. ### Function Signature `csp_conn_flags()` ``` -------------------------------- ### csp_conn_src Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_h.rst Gets the source address of a CSP connection. ```APIDOC ## csp_conn_src ### Description Gets the source address of a CSP connection. ### Function Signature `csp_conn_src()` ``` -------------------------------- ### Compile with CMake and Ninja Source: https://github.com/spaceinventor/libcsp/blob/master/doc/INSTALL.md Set up the build directory using CMake with the Ninja generator and then build the project. ```shell cmake -G Ninja -B builddir cmake --build builddir ``` -------------------------------- ### csp_conn_dst Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_h.rst Gets the destination address of a CSP connection. ```APIDOC ## csp_conn_dst ### Description Gets the destination address of a CSP connection. ### Function Signature `csp_conn_dst()` ``` -------------------------------- ### csp_conn_sport Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_h.rst Gets the source port of a CSP connection. ```APIDOC ## csp_conn_sport ### Description Gets the source port of a CSP connection. ### Function Signature `csp_conn_sport()` ``` -------------------------------- ### csp_conn_dport Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_h.rst Gets the destination port of a CSP connection. ```APIDOC ## csp_conn_dport ### Description Gets the destination port of a CSP connection. ### Function Signature `csp_conn_dport()` ``` -------------------------------- ### Build Samples with CMake Source: https://github.com/spaceinventor/libcsp/blob/master/doc/INSTALL.md Configure CMake to build tools and samples by defining CSP_BUILD_SAMPLES=ON. ```shell cmake -B builddir -DCSP_BUILD_SAMPLES=ON ``` -------------------------------- ### Enable Reproducible Builds with Meson Source: https://github.com/spaceinventor/libcsp/blob/master/doc/INSTALL.md Set up the build directory with Meson to enable reproducible builds. ```shell meson setup builddir . -Denable_reproducible_builds=true ``` -------------------------------- ### csp_eth_arp_get_addr Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/interfaces/csp_if_eth_h.rst Gets the ARP address for the Ethernet interface. ```APIDOC ## csp_eth_arp_get_addr ### Description Gets the ARP address for the Ethernet interface. ### Function Signature `void csp_eth_arp_get_addr(uint8_t *mac_addr)` ### Parameters * **mac_addr** (uint8_t *) - Pointer to a buffer where the MAC address will be stored. ``` -------------------------------- ### Build Project Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-send-zmq/README.md Build the project using CMake and Ninja. This command compiles the main application, the CSP server, and the zmqproxy. ```bash cmake -B builddir ninja -C builddir simple-send-zmq csp_server zmqproxy ``` -------------------------------- ### csp_clock_get_time Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_hooks_h.rst Function to get the current system time. ```APIDOC ## csp_clock_get_time ### Description Function to get the current system time. This function retrieves the time from the system's clock. ### Function Signature `void csp_clock_get_time(csp_time_t *time)` ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **time** (csp_time_t *) - Required - Pointer to a csp_time_t structure to store the current time. ``` -------------------------------- ### Run Simple Send UDP Client Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-send-udp/README.md Command to execute the simple-send-udp client application. ```bash ./builddir/samples/posix/simple-send-udp/simple-send-udp ``` -------------------------------- ### csp_zmqhub_init Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/interfaces/csp_if_zmqhub_h.rst Initializes the CSP ZeroMQ hub interface with default settings. ```APIDOC ## csp_zmqhub_init ### Description Initializes the CSP ZeroMQ hub interface with default settings. This function sets up the necessary ZeroMQ context and binds to the default ports. ### Function Signature `int csp_zmqhub_init(void)` ### Returns `CSP_OK` on success, or an error code on failure. ``` -------------------------------- ### csp_crc32_final Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_crc32_h.rst Finalizes the CRC32 calculation. This function should be called after all data has been processed to get the final CRC32 checksum. ```APIDOC ## csp_crc32_final ### Description Finalizes the CRC32 calculation. This function should be called after all data has been processed to get the final CRC32 checksum. ### Function Signature `csp_crc32_final(uint32_t crc)` ### Parameters * **crc** (uint32_t) - The CRC32 checksum after processing all data. ### Returns * uint32_t - The final CRC32 checksum. ``` -------------------------------- ### Build Simple Send UDP Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-send-udp/README.md Commands to build the simple-send-udp application and the csp_server using CMake and Ninja. ```bash cmake -B builddir ninja -C builddir simple-send-udp csp_server ``` -------------------------------- ### Enable Reproducible Builds with Waf Source: https://github.com/spaceinventor/libcsp/blob/master/doc/INSTALL.md Configure Waf to enable reproducible builds. ```shell ./waf configure --enable-reproducible-builds ``` -------------------------------- ### Build simple-sfp-send-recv Executable Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-sfp-send-recv/CMakeLists.txt Configures the CMake build system to create the simple-sfp-send-recv executable. It specifies the source file, include directories, and necessary libraries. ```cmake add_executable(simple-sfp-send-recv ${CSP_SAMPLES_EXCLUDE} src/main.c) target_include_directories(simple-sfp-send-recv PRIVATE ${csp_inc}) target_link_libraries(simple-sfp-send-recv PRIVATE csp Threads::Threads) ``` -------------------------------- ### csp_eth_init Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/drivers/eth_linux_h.rst Initializes the Posix ETH driver. This function sets up the necessary resources and configurations for the Ethernet interface to be used with CSP. ```APIDOC ## csp_eth_init ### Description Initializes the Posix ETH driver. This function sets up the necessary resources and configurations for the Ethernet interface to be used with CSP. ### Function Signature ```c int csp_eth_init(csp_iface_t * iface, const char *dev_name) ``` ### Parameters #### Arguments - **iface** (*csp_iface_t* *) - Pointer to the CSP interface structure to be initialized. - **dev_name** (*const char* *) - The name of the network device to use (e.g., "eth0"). ### Returns Returns 0 on success, or a negative error code on failure. ``` -------------------------------- ### csp_init Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_h.rst Initializes the CSP system. This function must be called before any other CSP functions. ```APIDOC ## csp_init ### Description Initializes the CSP system. This function must be called before any other CSP functions. ### Function Signature `csp_init()` ``` -------------------------------- ### csp_zmqhub_init_w_endpoints Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/interfaces/csp_if_zmqhub_h.rst Initializes the CSP ZeroMQ hub interface with specified endpoints. ```APIDOC ## csp_zmqhub_init_w_endpoints ### Description Initializes the CSP ZeroMQ hub interface with a list of custom ZeroMQ endpoints. ### Function Signature `int csp_zmqhub_init_w_endpoints(const char *endpoints[])` ### Parameters * **endpoints** (const char *[]) - An array of strings, where each string is a ZeroMQ endpoint (e.g., "tcp://*:1234"). The array must be NULL-terminated. ### Returns `CSP_OK` on success, or an error code on failure. ``` -------------------------------- ### Run Simple Send ZMQ Client Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-send-zmq/README.md Execute the simple-send-zmq client application to send a message via the zmqhub interface. ```bash ./builddir/samples/posix/simple-send-zmq/simple-send-zmq ``` -------------------------------- ### Enable Reproducible Builds with CMake Source: https://github.com/spaceinventor/libcsp/blob/master/doc/INSTALL.md Configure CMake with Ninja to enable reproducible builds. ```shell cmake -G Ninja -B builddir -DCSP_REPRODUCIBLE_BUILDS=ON ``` -------------------------------- ### csp_zmqhub_init_w_name_endpoints_rxfilter Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/interfaces/csp_if_zmqhub_h.rst Initializes the CSP ZeroMQ hub interface with a name, custom endpoints, and an RX filter. ```APIDOC ## csp_zmqhub_init_w_name_endpoints_rxfilter ### Description Initializes the CSP ZeroMQ hub interface with a specific name, a list of custom ZeroMQ endpoints, and an RX filter. ### Function Signature `int csp_zmqhub_init_w_name_endpoints_rxfilter(const char *name, const char *endpoints[], csp_rxfilter_t rxfilter)` ### Parameters * **name** (const char *) - The name for this ZeroMQ hub interface. * **endpoints** (const char *[]) - An array of strings, where each string is a ZeroMQ endpoint. The array must be NULL-terminated. * **rxfilter** (csp_rxfilter_t) - A function pointer for the receive filter. ### Returns `CSP_OK` on success, or an error code on failure. ``` -------------------------------- ### CMakeLists.txt Configuration for simple-send-zmq Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-send-zmq/CMakeLists.txt This snippet defines the build settings for the simple-send-zmq executable. It specifies the source file, include directories, and libraries to link against. ```cmake add_executable(simple-send-zmq EXCLUDE_FROM_ALL src/main.c) target_include_directories(simple-send-zmq PRIVATE ${csp_inc}) target_link_libraries(simple-send-zmq PRIVATE csp) ``` -------------------------------- ### csp_zmqhub_init_filter2 Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/interfaces/csp_if_zmqhub_h.rst Initializes the CSP ZeroMQ hub interface with a custom RX filter. ```APIDOC ## csp_zmqhub_init_filter2 ### Description Initializes the CSP ZeroMQ hub interface with a custom receive filter. ### Function Signature `int csp_zmqhub_init_filter2(csp_rxfilter_t rxfilter)` ### Parameters * **rxfilter** (csp_rxfilter_t) - A function pointer for the receive filter. ### Returns `CSP_OK` on success, or an error code on failure. ``` -------------------------------- ### CMakeLists.txt Configuration for simple-send-udp Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-send-udp/CMakeLists.txt This snippet shows how to configure the CMake build system for the simple-send-udp executable. It specifies the source file, include directories, and links against the CSP library. ```cmake add_executable(simple-send-udp ${CSP_SAMPLES_EXCLUDE} src/main.c) target_include_directories(simple-send-udp PRIVATE ${csp_inc}) target_link_libraries(simple-send-udp PRIVATE csp) ``` -------------------------------- ### csp_sha1_init Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/crypto/csp_sha1_h.rst Initializes the SHA1 hashing state. ```APIDOC ## csp_sha1_init ### Description Initializes the SHA1 hashing state structure. ### Function Signature `void csp_sha1_init(csp_sha1_state_t *state);` ### Parameters * **state** (*csp_sha1_state_t* *) - Pointer to the SHA1 state structure to be initialized. ``` -------------------------------- ### Run Python Bindings Source: https://github.com/spaceinventor/libcsp/blob/master/doc/INSTALL.md Execute Python code to import and use the libcsp_py3 library, specifying the build directory for PYTHONPATH. ```shell PYTHONPATH=builddir python3 -c 'import libcsp_py3 as csp' ``` -------------------------------- ### CMakeLists.txt Configuration Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-send-usart/CMakeLists.txt Defines the build process for the simple-send-usart executable. It specifies the source files, private include directories, and links against the CSP library. ```cmake add_executable(simple-send-usart ${CSP_SAMPLES_EXCLUDE} src/main.c) target_include_directories(simple-send-usart PRIVATE ${csp_inc}) target_link_libraries(simple-send-usart PRIVATE csp) ``` -------------------------------- ### csp_connect Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_h.rst Establishes a connection to a remote CSP service. ```APIDOC ## csp_connect ### Description Establishes a connection to a remote CSP service. ### Function Signature `csp_connect()` ``` -------------------------------- ### Run Simple Send USART Client Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-send-usart/README.md Executes the simple-send-usart client application to send data over the configured USART interface. ```bash ./builddir/samples/posix/simple-send-usart/simple-send-usart ``` -------------------------------- ### csp_buffer_init Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_buffer_h.rst Initializes the CSP buffer management system. This function must be called before any other CSP buffer functions. ```APIDOC ## csp_buffer_init ### Description Initializes the CSP buffer management system. This function must be called before any other CSP buffer functions. ### Function Signature `int csp_buffer_init(void); ` ### Return Value - Returns 0 on success, or a negative error code on failure. ``` -------------------------------- ### csp_usart_open_and_add_kiss_interface Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/drivers/usart_h.rst Opens a USART interface and adds a KISSS interface to it. ```APIDOC ## csp_usart_open_and_add_kiss_interface ### Description Opens a USART interface and adds a KISSS interface to it. ### Function Signature `csp_usart_open_and_add_kiss_interface(csp_usart_conf_t * conf, const char * name)` ### Parameters * **conf** (`csp_usart_conf_t *`) - Required - Pointer to the USART configuration structure. * **name** (`const char *`) - Required - The name of the KISSS interface. ### Returns Returns `CSP_ERR_NONE` on success, or an error code if the operation fails. ``` -------------------------------- ### Configure CAN Device for Optimal Performance Source: https://github.com/spaceinventor/libcsp/blob/master/doc/example.md These commands configure a CAN device for optimal performance and stability on Linux. Ensure the device is brought down before applying settings and restarted afterward. ```bash sudo ip link set dev can0 down sudo ip link set dev can0 up type can bitrate 1000000 restart-ms 100 sudo ip link set dev can0 txqueuelen 100 ``` -------------------------------- ### Run simple-send-canbus Client Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-send-canbus/README.md Execute the simple-send-canbus client to send a message over the vcan0 interface. ```bash ./builddir/samples/posix/simple-send-canbus/simple-send-canbus ``` -------------------------------- ### System Reboot and Shutdown Callbacks Source: https://github.com/spaceinventor/libcsp/blob/master/doc/hooks.md These callbacks allow custom functions to be registered for system reboot and shutdown events. They are configured at runtime by passing function pointers to setter functions. ```c typedef int (*csp_sys_reboot_t)(void); void csp_sys_set_reboot(csp_sys_reboot_t reboot); typedef int (*csp_sys_shutdown_t)(void); void csp_sys_set_shutdown(csp_sys_shutdown_t shutdown); ``` -------------------------------- ### csp_can_open_and_add_interface Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/drivers/can_zephyr_h.rst Opens a CAN interface and adds it to the CSP system. This function initializes the specified CAN interface and registers it with the CSP network stack, allowing it to send and receive CAN frames. ```APIDOC ## csp_can_open_and_add_interface ### Description Opens a CAN interface and adds it to the CSP system. This function initializes the specified CAN interface and registers it with the CSP network stack, allowing it to send and receive CAN frames. ### Function Signature `csp_can_open_and_add_interface(ifname, drv_data)` ### Parameters #### Path Parameters - **ifname** (string) - Required - The name of the CAN interface to open (e.g., "CAN_0"). - **drv_data** (void *) - Required - Pointer to driver-specific data. This is typically NULL for Zephyr CAN driver. ### Return Value - **int** - Returns 0 on success, or a negative error code on failure. ``` -------------------------------- ### Simple Send ZMQ Client Code Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-send-zmq/README.md This C code demonstrates sending a message 'abc' over ZeroMQ using libcsp. It includes a small delay to ensure ZeroMQ sockets are ready. ```c #include #include #include #include int main(void) { // Initialize CSP csp_init(); // Initialize ZMQHUB interface csp_zmqhub_init(1, "tcp://0.0.0.0:7000", "tcp://0.0.0.0:6000", 100); // Set default route to ZMQHUB interface csp_rtable_set(CSP_DEFAULT_ROUTE, CSP_MAX_ID, &csp_if_zmqhub, CSP_NODE_ANY); // Wait for sockets to establish usleep(1000); // Create a new message csp_packet_t *packet = csp_buffer_get(32); if (packet == NULL) { printf("Failed to get CSP buffer\n"); return -1; } // Fill message with "abc" memcpy(packet->data, "abc", 3); packet->length = 3; // Send message to address 1, port 0 if (csp_send(packet, 1, 0) < CSP_OK) { printf("Failed to send packet\n"); csp_buffer_free(packet); return -1; } printf("Message sent\n"); // Free the packet csp_buffer_free(packet); return 0; } ``` -------------------------------- ### csp_id_setup_rx Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_id_h.rst Sets up the CSP identifier for receiving packets. This function configures the necessary structures for processing incoming CSP packets. ```APIDOC ## csp_id_setup_rx ### Description Sets up the CSP identifier for receiving packets. This function configures the necessary structures for processing incoming CSP packets. ### Function Signature `void csp_id_setup_rx(void)` ### Parameters None ### Returns None ``` -------------------------------- ### Building the ZMQ Interface Library Source: https://github.com/spaceinventor/libcsp/blob/master/src/interfaces/CMakeLists.txt Conditionally builds the 'if_zmq' object library if ZMQ is found. It sets include directories and links necessary libraries. ```cmake if(LIBZMQ_FOUND) add_library(if_zmq OBJECT csp_if_zmqhub.c) target_include_directories(if_zmq PRIVATE ${csp_inc} ${LIBZMQ_INCLUDE_DIRS}) target_link_libraries(if_zmq PRIVATE csp_common ${LIBZMQ_LIBRARIES}) target_link_libraries(csp PRIVATE if_zmq) if(BUILD_SHARED_LIBS) set_property(TARGET if_zmq PROPERTY POSITION_INDEPENDENT_CODE ON) endif() endif() ``` -------------------------------- ### Build Python Bindings with CMake Source: https://github.com/spaceinventor/libcsp/blob/master/doc/INSTALL.md Configure CMake to build Python 3 bindings and enable the routing table. ```shell cmake -B builddir -DCSP_ENABLE_PYTHON3_BINDINGS=ON -DCSP_USE_RTABLE=ON ``` -------------------------------- ### Define Executable and Link Libraries Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/simple-send-canbus/CMakeLists.txt Configures the CMake build system to create an executable named 'simple-send-canbus' from the main source file and links it against the 'csp' library. It also specifies the include directories for the project. ```cmake add_executable(simple-send-canbus ${CSP_SAMPLES_EXCLUDE} src/main.c) target_include_directories(simple-send-canbus PRIVATE ${csp_inc}) target_link_libraries(simple-send-canbus PRIVATE csp) ``` -------------------------------- ### csp_get_uptime Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_h.rst Retrieves the system uptime. ```APIDOC ## csp_get_uptime ### Description Retrieves the system uptime. ### Function Signature `csp_get_uptime()` ``` -------------------------------- ### csp_can_socketcan_init Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/drivers/can_socketcan_h.rst Initializes the Socket CAN driver. This function should be called before using any other Socket CAN driver functions. ```APIDOC ## csp_can_socketcan_init ### Description Initializes the Socket CAN driver. This function should be called before using any other Socket CAN driver functions. ### Function Signature `int csp_can_socketcan_init(void)` ### Return Value Returns `CSP_ERR_NONE` on success, or an error code on failure. ``` -------------------------------- ### csp_usart_open Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/drivers/usart_h.rst Opens a USART interface and returns a configuration structure. ```APIDOC ## csp_usart_open ### Description Opens a USART interface and returns a configuration structure. ### Function Signature `csp_usart_open()` ### Parameters None ### Returns A pointer to a `csp_usart_conf_t` structure representing the USART configuration. ``` -------------------------------- ### csp_can_socketcan_open_and_add_interface Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/drivers/can_socketcan_h.rst Opens a Socket CAN interface and adds it to the CSP system. This function initializes the CAN interface and makes it available for CSP communication. ```APIDOC ## csp_can_socketcan_open_and_add_interface ### Description Opens a Socket CAN interface and adds it to the CSP system. This function initializes the CAN interface and makes it available for CSP communication. ### Function Signature `csp_can_socketcan_open_and_add_interface(const char *ifname, csp_iface_t **iface_out)` ### Parameters #### Path Parameters - **ifname** (const char *) - Required - The name of the Socket CAN interface to open (e.g., "can0"). - **iface_out** (csp_iface_t **) - Required - A pointer to a `csp_iface_t` structure that will be populated with the new interface information. ### Return Value Returns `CSP_ERR_NONE` on success, or an error code on failure. ``` -------------------------------- ### csp_reboot_hook Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_hooks_h.rst Callback function to be executed before a system reboot. ```APIDOC ## csp_reboot_hook ### Description Callback function to be executed before a system reboot. This hook allows for pre-reboot cleanup or logging. ### Function Signature `void csp_reboot_hook(void)` ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - None ``` -------------------------------- ### csp_get_conf Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_h.rst Retrieves the current CSP configuration. ```APIDOC ## csp_get_conf ### Description Retrieves the current CSP configuration. ### Function Signature `csp_get_conf()` ``` -------------------------------- ### Default Route to Interface Source: https://github.com/spaceinventor/libcsp/blob/master/doc/basic.md Configures a default route that directs any packet, for which no other matching route is found, to the 'CAN' interface. ```text 0/0 CAN ``` -------------------------------- ### csp_crc32_init Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_crc32_h.rst Initializes the CRC32 calculation context. This function is used to set up the initial state for CRC32 calculations. ```APIDOC ## csp_crc32_init ### Description Initializes the CRC32 calculation context. This function is used to set up the initial state for CRC32 calculations. ### Function Signature `csp_crc32_init(void)` ### Returns * uint32_t - The initial CRC32 checksum value. ``` -------------------------------- ### csp_accept Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_h.rst Accepts a new connection on a CSP socket. ```APIDOC ## csp_accept ### Description Accepts a new connection on a CSP socket. ### Function Signature `csp_accept()` ``` -------------------------------- ### Build HMAC Executable Source: https://github.com/spaceinventor/libcsp/blob/master/samples/posix/hmac/CMakeLists.txt Configures the CMake build system to create an executable for the HMAC sample. It specifies the source file and links against the CSP library. ```cmake add_executable(sample-hmac ${CSP_SAMPLES_EXCLUDE} src/main.c) target_include_directories(sample-hmac PRIVATE ${csp_inc}) target_link_libraries(sample-hmac PRIVATE csp) ``` -------------------------------- ### csp_zmqhub_make_endpoint Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/interfaces/csp_if_zmqhub_h.rst Creates a ZeroMQ endpoint string for the CSP ZeroMQ hub interface. ```APIDOC ## csp_zmqhub_make_endpoint ### Description Creates a ZeroMQ endpoint string for the CSP ZeroMQ hub interface. ### Function Signature `char *csp_zmqhub_make_endpoint(const char *address, uint16_t port)` ### Parameters * **address** (const char *) - The IP address or hostname for the endpoint. * **port** (uint16_t) - The port number for the endpoint. ### Returns A string representing the ZeroMQ endpoint (e.g., "tcp://
:"). The caller is responsible for freeing this string. ``` -------------------------------- ### CMake Reproducible Builds with RPATH Source: https://github.com/spaceinventor/libcsp/blob/master/doc/INSTALL.md Configure CMake for reproducible builds, ensuring RPATH is handled correctly for deterministic builds. ```shell cmake -G Ninja -B builddir -DCSP_REPRODUCIBLE_BUILDS=ON -DCMAKE_BUILD_RPATH_USE_ORIGIN=ON ``` -------------------------------- ### csp_bind Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_h.rst Binds a CSP socket to a local port. ```APIDOC ## csp_bind ### Description Binds a CSP socket to a local port. ### Function Signature `csp_bind()` ``` -------------------------------- ### Zephyr CSP CMake Configuration Source: https://github.com/spaceinventor/libcsp/blob/master/zephyr/CMakeLists.txt Configures libcsp for Zephyr RTOS. Sets system name, build type, and various CSP parameters via cache variables. Includes conditional compilation for features like routing tables and CAN support. Links the CSP library and its interface. ```cmake if(CONFIG_LIBCSP) set(CSP_SYSTEM_NAME "Zephyr") set(CMAKE_BUILD_TYPE None) set(CSP_PRINT_STDIO OFF) # check_include_file() doesn't work in Zephyr module # https://github.com/zephyrproject-rtos/zephyr/issues/31193 # predefine it set(HAVE_SYS_SOCKET_H OFF) # Cache entries. see the top level CMakeLists.txt set(CSP_QFIFO_LEN CONFIG_CSP_QFIFO_LEN CACHE STRING "") set(CSP_PORT_MAX_BIND CONFIG_CSP_PORT_MAX_BIND CACHE STRING "") set(CSP_CONN_RXQUEUE_LEN CONFIG_CSP_CONN_RXQUEUE_LEN CACHE STRING "") set(CSP_CONN_MAX CONFIG_CSP_CONN_MAX CACHE STRING "") set(CSP_BUFFER_SIZE CONFIG_CSP_BUFFER_SIZE CACHE STRING "") set(CSP_BUFFER_COUNT CONFIG_CSP_BUFFER_COUNT CACHE STRING "") set(CSP_RDP_MAX_WINDOW CONFIG_CSP_RDP_MAX_WINDOW CACHE STRING "") set(CSP_RTABLE_SIZE CONFIG_CSP_RTABLE_SIZE CACHE STRING "") if(CONFIG_CSP_USE_RTABLE) set(CSP_USE_RTABLE ON) endif() if(CONFIG_CSP_HAVE_CAN) set(HAVE_ZEPHYR_CAN ON) endif() add_subdirectory(${ZEPHYR_CURRENT_MODULE_DIR} build) zephyr_interface_library_named(libcsp) target_include_directories(libcsp INTERFACE ${ZEPHYR_CURRENT_MODULE_DIR}/include) target_include_directories(libcsp INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/build/include) zephyr_append_cmake_library(csp) target_link_libraries(csp PUBLIC zephyr_interface) endif() ``` -------------------------------- ### Adding CSP Interface Source Files Source: https://github.com/spaceinventor/libcsp/blob/master/src/interfaces/CMakeLists.txt This snippet adds multiple C source files to the 'csp' target, defining various network interfaces for the CSP library. ```cmake target_sources(csp PRIVATE csp_if_lo.c csp_if_kiss.c csp_if_i2c.c csp_if_tun.c csp_if_can.c csp_if_can_pbuf.c csp_if_eth.c csp_if_eth_pbuf.c ) ``` -------------------------------- ### Add CSP Tests Executable Source: https://github.com/spaceinventor/libcsp/blob/master/unittests/CMakeLists.txt Configures the build to add an executable for CSP tests. It links the necessary CSP libraries and specifies the source files required for the tests. ```cmake if(CHECK_FOUND) add_executable(csp_tests) target_link_libraries(csp_tests PRIVATE csp ${CHECK_LIBRARIES}) target_sources(csp_tests PRIVATE main.c queue.c buffer.c hmac.c ) endif() ``` -------------------------------- ### csp_bind_callback Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_h.rst Binds a CSP socket to a local port and registers a callback function. ```APIDOC ## csp_bind_callback ### Description Binds a CSP socket to a local port and registers a callback function. ### Function Signature `csp_bind_callback()` ``` -------------------------------- ### CSP Debug Defines Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_debug_h.rst Defines for general, CAN-specific, and Ethernet-specific error codes, as well as print macros for debugging output. ```APIDOC ## CSP Debug Defines ### Description This section lists the error codes and print macros available within the CSP Debug module. ### General Error Codes - **CSP_DBG_ERR_CORRUPT_BUFFER**: Indicates a corrupt buffer. - **CSP_DBG_ERR_MTU_EXCEEDED**: Indicates that the Maximum Transmission Unit (MTU) has been exceeded. - **CSP_DBG_ERR_ALREADY_FREE**: Indicates that the resource is already free. - **CSP_DBG_ERR_REFCOUNT**: Indicates an error related to reference counting. - **CSP_DBG_ERR_INVALID_RTABLE_ENTRY**: Indicates an invalid routing table entry. - **CSP_DBG_ERR_UNSUPPORTED**: Indicates an unsupported operation or feature. - **CSP_DBG_ERR_INVALID_BIND_PORT**: Indicates an invalid port for binding. - **CSP_DBG_ERR_PORT_ALREADY_IN_USE**: Indicates that the port is already in use. - **CSP_DBG_ERR_ALREADY_CLOSED**: Indicates that the connection is already closed. - **CSP_DBG_ERR_INVALID_POINTER**: Indicates an invalid pointer was provided. - **CSP_DBG_ERR_CLOCK_SET_FAIL**: Indicates a failure to set the clock. ### CAN-Specific Error Codes - **CSP_DBG_CAN_ERR_FRAME_LOST**: Indicates a CAN frame was lost. - **CSP_DBG_CAN_ERR_RX_OVF**: Indicates a CAN receive buffer overflow. - **CSP_DBG_CAN_ERR_RX_OUT**: Indicates CAN data received out of order. - **CSP_DBG_CAN_ERR_SHORT_BEGIN**: Indicates a short CAN frame at the beginning. - **CSP_DBG_CAN_ERR_INCOMPLETE**: Indicates an incomplete CAN frame. - **CSP_DBG_CAN_ERR_UNKNOWN**: Indicates an unknown CAN error. ### ETH-Specific Error Codes - **CSP_DBG_ETH_ERR_FRAME_LOST**: Indicates an Ethernet frame was lost. - **CSP_DBG_ETH_ERR_RX_OVF**: Indicates an Ethernet receive buffer overflow. - **CSP_DBG_ETH_ERR_RX_OUT**: Indicates Ethernet data received out of order. - **CSP_DBG_ETH_ERR_SHORT_BEGIN**: Indicates a short Ethernet frame at the beginning. - **CSP_DBG_ETH_ERR_INCOMPLETE**: Indicates an incomplete Ethernet frame. - **CSP_DBG_ETH_ERR_UNKNOWN**: Indicates an unknown Ethernet error. ### Print Macros - **csp_print**: General purpose print macro. - **csp_rdp_error**: Macro for printing RDP errors. - **csp_rdp_protocol**: Macro for printing RDP protocol information. - **csp_print_packet**: Macro for printing packet details. ``` -------------------------------- ### csp_output_hook Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_hooks_h.rst Callback function for outputting data via CSP. ```APIDOC ## csp_output_hook ### Description Callback function for outputting data via CSP. This hook is invoked when data needs to be sent out through the CSP stack. ### Function Signature `void csp_output_hook(csp_packet_t *packet)` ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **packet** (csp_packet_t *) - Required - Pointer to the CSP packet to be outputted. ``` -------------------------------- ### csp_rtable_load Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_rtable_h.rst Loads the routing table from a file. This function restores the routing table from a previously saved state. ```APIDOC ## csp_rtable_load ### Description Loads the routing table from a specified file path, replacing the current table contents. ### Function Signature `int csp_rtable_load(const char *path)` ### Parameters #### Path Parameters - **path** (const char *) - Required - The file path from which to load the routing table. ``` -------------------------------- ### csp_sfp_recv_fp Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_sfp_h.rst Receives data using the Small Fragmentation Protocol (SFP) with a file pointer. ```APIDOC ## csp_sfp_recv_fp ### Description Receives data using the Small Fragmentation Protocol (SFP) with a file pointer. ### Function Signature `csp_sfp_recv_fp(conn, file, size)` ### Parameters - **conn** (`csp_conn_t *`): Pointer to the CSP connection structure. - **file** (`FILE *`): Pointer to the file stream to write received data to. - **size** (`size_t`): The maximum number of bytes to receive. ### Returns - `int`: The number of bytes received, or a negative error code on failure. ``` -------------------------------- ### csp_ps Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_h.rst Retrieves process status information. ```APIDOC ## csp_ps ### Description Retrieves process status information. ### Function Signature `csp_ps()` ``` -------------------------------- ### csp_buf_free Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_h.rst Frees a buffer. ```APIDOC ## csp_buf_free ### Description Frees a buffer. ### Function Signature `csp_buf_free()` ``` -------------------------------- ### csp_promisc_enable Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_promisc_h.rst Enables promiscuous mode for packet reception. ```APIDOC ## csp_promisc_enable ### Description Enables promiscuous mode, allowing the system to capture all incoming packets on the CSP interface. ### Function Signature `csp_promisc_enable()` ### Parameters None ### Returns - `CSP_ERR_NONE` on success. - An error code if enabling promiscuous mode fails. ``` -------------------------------- ### Configure SocketCAN Driver Source: https://github.com/spaceinventor/libcsp/blob/master/src/drivers/CMakeLists.txt Conditionally builds the `driver_can` library using SocketCAN if `LIBSOCKETCAN_FOUND` is true. It includes necessary headers and links against `csp_common` and SocketCAN libraries. ```cmake if(LIBSOCKETCAN_FOUND) add_library(driver_can OBJECT can/can_socketcan.c) target_include_directories(driver_can PRIVATE ${csp_inc} ${LIBSOCKETCAN_INCLUDE_DIRS}) target_link_libraries(driver_can PRIVATE csp_common ${LIBSOCKETCAN_LIBRARIES}) target_link_libraries(csp PRIVATE driver_can) if(BUILD_SHARED_LIBS) set_property(TARGET driver_can PROPERTY POSITION_INDEPENDENT_CODE ON) endif() endif() ``` -------------------------------- ### csp_shutdown_hook Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_hooks_h.rst Callback function to be executed before system shutdown. ```APIDOC ## csp_shutdown_hook ### Description Callback function to be executed before system shutdown. This hook allows for pre-shutdown cleanup or logging. ### Function Signature `void csp_shutdown_hook(void)` ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - None ``` -------------------------------- ### Adding UDP Interface Source File Source: https://github.com/spaceinventor/libcsp/blob/master/src/interfaces/CMakeLists.txt Conditionally adds the 'csp_if_udp.c' source file to the 'csp' target if the necessary system headers for socket programming are available. ```cmake if(HAVE_SYS_SOCKET_H AND HAVE_ARPA_INET_H) target_sources(csp PRIVATE csp_if_udp.c) endif() ``` -------------------------------- ### csp_eth_pack_header Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/interfaces/csp_if_eth_h.rst Packs the CSP header into an Ethernet frame. ```APIDOC ## csp_eth_pack_header ### Description Packs the CSP header into an Ethernet frame. ### Function Signature `csp_eth_pack_header(uint8_t *buf, uint16_t buf_size, csp_packet_t *packet)` ### Parameters * **buf** (uint8_t *) - Pointer to the buffer where the Ethernet frame will be packed. * **buf_size** (uint16_t) - The size of the buffer. * **packet** (csp_packet_t *) - Pointer to the CSP packet to be packed. ``` -------------------------------- ### csp_transaction_w_opts Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_h.rst Performs a CSP transaction with options. ```APIDOC ## csp_transaction_w_opts ### Description Performs a CSP transaction with options. ### Function Signature `csp_transaction_w_opts()` ``` -------------------------------- ### Add Zephyr CAN Driver Source Source: https://github.com/spaceinventor/libcsp/blob/master/src/drivers/CMakeLists.txt Conditionally adds the `can_zephyr.c` driver source if `HAVE_ZEPHYR_CAN` is defined, enabling CAN support on Zephyr. ```cmake if(HAVE_ZEPHYR_CAN) target_sources(csp PRIVATE can/can_zephyr.c) endif() ``` -------------------------------- ### csp_reboot Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_h.rst Reboots the CSP system. ```APIDOC ## csp_reboot ### Description Reboots the CSP system. ### Function Signature `csp_reboot()` ``` -------------------------------- ### csp_memfree_hook Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_hooks_h.rst Callback function for memory free operations. ```APIDOC ## csp_memfree_hook ### Description Callback function for memory free operations. This hook can be used to track or manage memory deallocations. ### Function Signature `void csp_memfree_hook(void *ptr)` ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **ptr** (void *) - Required - Pointer to the memory block being freed. ``` -------------------------------- ### csp_kiss_add_interface Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/interfaces/csp_if_kiss_h.rst Adds a KISS interface to the CSP system. This function initializes and registers a new interface that uses the KISS protocol for communication. ```APIDOC ## csp_kiss_add_interface ### Description Adds a KISS interface to the CSP system. This function initializes and registers a new interface that uses the KISS protocol for communication. ### Function Signature `csp_kiss_add_interface(const char *name, csp_iface_t *iface)` ### Parameters #### Path Parameters - **name** (const char *) - The name of the interface to be added. - **iface** (csp_iface_t *) - A pointer to the CSP interface structure to be added. ``` -------------------------------- ### csp_ps_hook Source: https://github.com/spaceinventor/libcsp/blob/master/doc/api/csp_hooks_h.rst Callback function for process status information. ```APIDOC ## csp_ps_hook ### Description Callback function for retrieving process status information. This hook can be used to implement a process listing feature. ### Function Signature `void csp_ps_hook(void)` ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - None ```