1 /* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */ 2 3 /* 4 * Copyright © 2014 Rob Clark <[email protected]> 5 * SPDX-License-Identifier: MIT 6 * 7 * Authors: 8 * Rob Clark <[email protected]> 9 */ 10 11 #ifndef RNNUTIL_H_ 12 #define RNNUTIL_H_ 13 14 #include <assert.h> 15 #include <stdint.h> 16 #include <string.h> 17 18 #include "rnn.h" 19 #include "rnndec.h" 20 21 struct rnn { 22 struct rnndb *db; 23 struct rnndeccontext *vc, *vc_nocolor; 24 struct rnndomain *dom[2]; 25 const char *variant; 26 }; 27 28 union rnndecval { 29 uint64_t u; 30 int64_t i; 31 }; 32 33 void _rnn_init(struct rnn *rnn, int nocolor); 34 struct rnn *rnn_new(int nocolor); 35 void rnn_load_file(struct rnn *rnn, char *file, char *domain); 36 void rnn_load(struct rnn *rnn, const char *gpuname); 37 uint32_t rnn_regbase(struct rnn *rnn, const char *name); 38 const char *rnn_regname(struct rnn *rnn, uint32_t regbase, int color); 39 struct rnndecaddrinfo *rnn_reginfo(struct rnn *rnn, uint32_t regbase); 40 void rnn_reginfo_free(struct rnndecaddrinfo *info); 41 const char *rnn_enumname(struct rnn *rnn, const char *name, uint32_t val); 42 43 struct rnndelem *rnn_regelem(struct rnn *rnn, const char *name); 44 struct rnndelem *rnn_regoff(struct rnn *rnn, uint32_t offset); 45 enum rnnttype rnn_decodelem(struct rnn *rnn, struct rnntypeinfo *info, 46 uint64_t regval, union rnndecval *val); 47 48 #endif /* RNNUTIL_H_ */ 49