1/* |
2 * Copyright (c) 2014-2016 ARM Limited |
3 * All rights reserved 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * --- 43 unchanged lines hidden (view full) --- 54 nomali_error_t regRead(uint32_t *value, nomali_addr_t addr); 55 nomali_error_t regWrite(nomali_addr_t addr, uint32_t value); 56 nomali_error_t regReadRaw(uint32_t *value, nomali_addr_t addr); 57 nomali_error_t regWriteRaw(nomali_addr_t addr, uint32_t value); 58 nomali_error_t intState(int *state, nomali_int_t intno) const; 59 60 public: 61 void callbackInt(nomali_int_t intno, int set); |
62 void callbackReset(); |
63 64 private: 65 nomali_callback_t callbacks[NOMALI_CALLBACK_NUM_CALLBACKS]; 66 67 NoMali::GPU *_gpu; 68}; 69 70template<class BaseGpu> 71class NoMaliApiGpu 72 : public BaseGpu 73{ 74 public: 75 template<typename... Args> 76 NoMaliApiGpu(NoMaliApi &_api, Args &&... args) 77 : BaseGpu(std::forward<Args>(args)...), 78 api(_api) 79 { |
80 reset(); 81 } 82 83 void reset() override { |
84 BaseGpu::reset(); |
85 api.callbackReset(); |
86 } 87 88 public: 89 void intJob(int set) override { api.callbackInt(NOMALI_INT_JOB, set); } 90 void intMMU(int set) override { api.callbackInt(NOMALI_INT_MMU, set); } 91 void intGPU(int set) override { api.callbackInt(NOMALI_INT_GPU, set); } 92 93 private: --- 112 unchanged lines hidden (view full) --- 206NoMaliApi::callbackInt(nomali_int_t intno, int set) 207{ 208 const nomali_callback_t &c(callbacks[NOMALI_CALLBACK_INT]); 209 210 if (c.func.interrupt) 211 c.func.interrupt(static_cast<nomali_handle_t>(this), c.usr, intno, set); 212} 213 |
214void 215NoMaliApi::callbackReset() 216{ 217 const nomali_callback_t &c(callbacks[NOMALI_CALLBACK_RESET]); |
218 |
219 if (c.func.reset) 220 c.func.reset(static_cast<nomali_handle_t>(this), c.usr); 221} |
222 |
223 224 |
225static NoMaliApi * 226get_gpu(nomali_handle_t h) 227{ 228 return h ? static_cast<NoMaliApi *>(h) : nullptr; 229} 230 231 232extern "C" EXPORT nomali_api_version_t --- 138 unchanged lines hidden --- |