This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Multicast: | |
https://gist.github.com/hostilefork/f7cae3dc33e7416f2dd25a402857b6c6 | |
https://web.cs.wpi.edu/~claypool/courses/4514-B99/samples/multicast.c | |
https://www.cs.unc.edu/~jeffay/dirt/FAQ/comp249-001-F99/mcast-socket.html -> drop multicast membership | |
Reflection in C: | |
https://stackoverflow.com/questions/7674255/get-list-of-c-structure-members |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Simple listener.c program for UDP multicast | |
// | |
// Adapted from: | |
// http://ntrg.cs.tcd.ie/undergrad/4ba2/multicast/antony/example.html | |
// | |
// Changes: | |
// * Compiles for Windows as well as Linux | |
// * Takes the port and group on the command line | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tasks for C course. | |
Common requirements: | |
- don't use external libraries (if something else not specified) | |
- build system make/cmake (must be in every task) | |
- compilation with options '-O0 -g3 -Wall -Wextra -Wpedantic -std=c11' | |
- error handling | |
- all task must be checked with valgrind for memory leaks: 'valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose /path/to/your/executable' (or with log file: 'valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind-out.txt /path/to/your/executable') | |
!!!!! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef MATRIXN_H_ | |
#define MATRIXN_H_ | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
typedef unsigned long int dimen_t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void get_console_message(char* const buffer, unsigned int len_max) { | |
uint32_t count_symbols = 0; | |
printf("Please enter a message (max size 1024 symbols):\r\n"); | |
while (1) { | |
uint8_t c; | |
HAL_StatusTypeDef status = HAL_UART_Receive(&huart3, &c, 1, HAL_MAX_DELAY); | |
if (c == '\r') { | |
HAL_UART_Transmit(&huart3, &c, 1, HAL_MAX_DELAY); | |
c = '\n'; | |
HAL_UART_Transmit(&huart3, &c, 1, HAL_MAX_DELAY); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RM_OLD_IMAGE = "1" | |
INHERIT += "rm_work" | |
IMAGE_INSTALL:append = " git python3" | |
# Also you can specify an amount of threads to use for build (default value: BB_NUMBER_THREADS = "${@oe.utils.cpu_count()}"): | |
#BB_NUMBER_THREADS = "4" | |
#PARALLEL_MAKE - number of processes for -j option (for gcc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void q1_SPI_ping_pong() { | |
printf("\r\n\r\n\r\nQ1 Ping pong on SPI\r\n"); | |
char message[] = "That's a SPI message"; | |
char buffer1[128] = { '\0' }; | |
char buffer2[128] = { '\0' }; | |
while(1) { | |
HAL_StatusTypeDef status = HAL_SPI_Receive_IT(SPI_S, (uint8_t*) buffer1, LEN_STR(message)); | |
if (status != HAL_OK) { | |
printf("Failed to receiveIT on SPI_S: %d, error 0x%"PRIX32"\r\n", status, HAL_SPI_GetError(SPI_S)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <inttypes.h> | |
#include "i2c.h" | |
#include "usart.h" | |
#include "rtg_main.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <fcntl.h> | |
#include <unistd.h> | |
#include <sys/ioctl.h> | |
#include <linux/spi/spidev.h> | |
/* | |
To read data from an SPI (Serial Peripheral Interface) device in Linux, you can use the spidev driver. Here are the basic steps: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Guide: | |
https://stackoverflow.com/questions/70277481/how-to-access-xilinx-axi-dma-from-linux | |
https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/1027702787/Linux+DMA+From+User+Space+2.0 | |
Non xilinx driver: | |
https://github.com/bperez77/xilinx_axidma | |
Driver: https://github.com/Xilinx/linux-xlnx/blob/master/drivers/dma/xilinx/xilinx_dma.c | |
DMA test: | |
https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842337/Linux+Soft+DMA+Driver |
NewerOlder