Skip to content

Commit

Permalink
latest td host code and bitstream
Browse files Browse the repository at this point in the history
  • Loading branch information
hst10 committed Oct 23, 2018
1 parent 1f64b7f commit 2f3412a
Show file tree
Hide file tree
Showing 16 changed files with 6,128 additions and 0 deletions.
5 changes: 5 additions & 0 deletions truss_decomposition/td_v3/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
all:
g++ -O3 td.cpp -std=c++11 -o td -lsds_lib

clean:
rm -rf td
Binary file added truss_decomposition/td_v3/libsds_lib.so
Binary file not shown.
56 changes: 56 additions & 0 deletions truss_decomposition/td_v3/libxlnk_cma.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>

// kernel buffer pool
#define XLNK_BUFPOOL_SIZE 100

#define XLNK_DRIVER_PATH "/dev/xlnk"

// counter of buffer currently instantiated
static uint32_t xlnkBufCnt = 0;
// virtual address of buffer
static void *xlnkBufPool[2 * XLNK_BUFPOOL_SIZE];
// length in bytes of buffer
static size_t xlnkBufLens[2 * XLNK_BUFPOOL_SIZE];
// physical address of buffer
static uint32_t xlnkBufPhyPool[2 * XLNK_BUFPOOL_SIZE];

/*
* Get the virtual address referencing the physical address resulting from
* mmaping /dev/mem.
* Required to use bare-metal drivers on linux. Return -1 in case of error.
*/
unsigned long cma_mmap(unsigned long phyAddr, uint32_t len);
/*
* Unmap a previously mapped memory space.
*/
uint32_t cma_munmap(void *buf, uint32_t len);
/*
* Allocate a physically contiguos chunk of CMA memory and map it into
* virtual memory space. Return this Virtual pointer. Returns -1 on failure.
*/
void *cma_alloc(uint32_t len, uint32_t cacheable);
/*
* Return a physical memory address corresponding to a given Virtual address
* pointer. Returns NULL on failure.
*/
unsigned long cma_get_phy_addr(void *buf);
/*
* Free a previously allocated CMA memory chunk.
*/
void cma_free(void *buf);
/*
* Returns the number of available CMA memiry pages which can be allocated.
*/
uint32_t cma_pages_available();
/*
* Extra functions in case user needs to flush or invalidate Cache.
*/
void cma_flush_cache(void *buf, unsigned int phys_addr, int size);
void cma_invalidate_cache(void *buf, unsigned int phys_addr, int size);
Binary file added truss_decomposition/td_v3/td
Binary file not shown.
Loading

0 comments on commit 2f3412a

Please sign in to comment.