#include "memory.h" char* map_shared_mem() { int fd; char *memaddr; fd = open("/dev/mem", O_RDWR); if (fd == -1) { printf("can not access /dev/mem\n" ); return NULL; } memaddr = (char *)mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, SHMADDR); if (memaddr == MAP_FAILED) { printf("mmap failed\n" ); return NULL; } return memaddr; } int write_shared_mem(char* memaddr, packet_t packet) { *memaddr = 0xFF; memcpy(*(memaddr + 1), packet.data, packet.len); return 0; } int shared_mem_loop(queue_t* queue) { }