1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 * 19 * \file pynq_driver.h 20 * \brief VTA driver for Zynq SoC boards with Pynq support (see pynq.io). 21 */ 22 23 #ifndef VTA_PYNQ_PYNQ_DRIVER_H_ 24 #define VTA_PYNQ_PYNQ_DRIVER_H_ 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 #include <assert.h> 30 #include <fcntl.h> 31 #include <stddef.h> 32 #include <stdint.h> 33 #include <stdio.h> 34 #include <stdlib.h> 35 #include <sys/mman.h> 36 #include <sys/stat.h> 37 #include <sys/types.h> 38 #include <time.h> 39 #include <unistd.h> 40 41 #if defined(__arm__) || defined(__aarch64__) 42 #include <libxlnk_cma.h> 43 #else 44 void* cma_alloc(size_t size, int cached); 45 void cma_free(void* buf); 46 uint32_t cma_get_phy_addr(void* buf); 47 void cma_flush_cache(void* buf, unsigned int phys_addr, int size); 48 void cma_invalidate_cache(void* buf, unsigned int phys_addr, int size); 49 #endif 50 51 void *VTAMapRegister(uint32_t addr); 52 void VTAUnmapRegister(void *vta); 53 void VTAWriteMappedReg(void* base_addr, uint32_t offset, uint32_t val); 54 uint32_t VTAReadMappedReg(void* base_addr, uint32_t offset); 55 56 /*! \brief VTA configuration register start value */ 57 #define VTA_START 0x1 58 /*! \brief VTA configuration register auto-restart value */ 59 #define VTA_AUTORESTART 0x81 60 /*! \brief VTA configuration register done value */ 61 #define VTA_DONE 0x1 62 63 #ifdef __cplusplus 64 } 65 #endif 66 #endif // VTA_PYNQ_PYNQ_DRIVER_H_ 67