162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * Copyright 2019 Red Hat Inc. 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 562306a36Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 662306a36Sopenharmony_ci * to deal in the Software without restriction, including without limitation 762306a36Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 862306a36Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 962306a36Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 1062306a36Sopenharmony_ci * 1162306a36Sopenharmony_ci * The above copyright notice and this permission notice shall be included in 1262306a36Sopenharmony_ci * all copies or substantial portions of the Software. 1362306a36Sopenharmony_ci * 1462306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1562306a36Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1662306a36Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1762306a36Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 1862306a36Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 1962306a36Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 2062306a36Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE. 2162306a36Sopenharmony_ci */ 2262306a36Sopenharmony_ci#ifndef __NVHW_DRF_H__ 2362306a36Sopenharmony_ci#define __NVHW_DRF_H__ 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci/* Helpers common to all DRF accessors. */ 2662306a36Sopenharmony_ci#define DRF_LO(drf) (0 ? drf) 2762306a36Sopenharmony_ci#define DRF_HI(drf) (1 ? drf) 2862306a36Sopenharmony_ci#define DRF_BITS(drf) (DRF_HI(drf) - DRF_LO(drf) + 1) 2962306a36Sopenharmony_ci#define DRF_MASK(drf) (~0ULL >> (64 - DRF_BITS(drf))) 3062306a36Sopenharmony_ci#define DRF_SMASK(drf) (DRF_MASK(drf) << DRF_LO(drf)) 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci/* Helpers for DRF-MW accessors. */ 3362306a36Sopenharmony_ci#define DRF_MX_MW(drf) drf 3462306a36Sopenharmony_ci#define DRF_MX(drf) DRF_MX_##drf 3562306a36Sopenharmony_ci#define DRF_MW(drf) DRF_MX(drf) 3662306a36Sopenharmony_ci#define DRF_MW_SPANS(o,drf) (DRF_LW_IDX((o),drf) != DRF_HW_IDX((o),drf)) 3762306a36Sopenharmony_ci#define DRF_MW_SIZE(o) (sizeof((o)[0]) * 8) 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci#define DRF_LW_IDX(o,drf) (DRF_LO(DRF_MW(drf)) / DRF_MW_SIZE(o)) 4062306a36Sopenharmony_ci#define DRF_LW_LO(o,drf) (DRF_LO(DRF_MW(drf)) % DRF_MW_SIZE(o)) 4162306a36Sopenharmony_ci#define DRF_LW_HI(o,drf) (DRF_MW_SPANS((o),drf) ? (DRF_MW_SIZE(o) - 1) : DRF_HW_HI((o),drf)) 4262306a36Sopenharmony_ci#define DRF_LW_BITS(o,drf) (DRF_LW_HI((o),drf) - DRF_LW_LO((o),drf) + 1) 4362306a36Sopenharmony_ci#define DRF_LW_MASK(o,drf) (~0ULL >> (64 - DRF_LW_BITS((o),drf))) 4462306a36Sopenharmony_ci#define DRF_LW_SMASK(o,drf) (DRF_LW_MASK((o),drf) << DRF_LW_LO((o),drf)) 4562306a36Sopenharmony_ci#define DRF_LW_GET(o,drf) (((o)[DRF_LW_IDX((o),drf)] >> DRF_LW_LO((o),drf)) & DRF_LW_MASK((o),drf)) 4662306a36Sopenharmony_ci#define DRF_LW_VAL(o,drf,v) (((v) & DRF_LW_MASK((o),drf)) << DRF_LW_LO((o),drf)) 4762306a36Sopenharmony_ci#define DRF_LW_CLR(o,drf) ((o)[DRF_LW_IDX((o),drf)] & ~DRF_LW_SMASK((o),drf)) 4862306a36Sopenharmony_ci#define DRF_LW_SET(o,drf,v) (DRF_LW_CLR((o),drf) | DRF_LW_VAL((o),drf,(v))) 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci#define DRF_HW_IDX(o,drf) (DRF_HI(DRF_MW(drf)) / DRF_MW_SIZE(o)) 5162306a36Sopenharmony_ci#define DRF_HW_LO(o,drf) 0 5262306a36Sopenharmony_ci#define DRF_HW_HI(o,drf) (DRF_HI(DRF_MW(drf)) % DRF_MW_SIZE(o)) 5362306a36Sopenharmony_ci#define DRF_HW_BITS(o,drf) (DRF_HW_HI((o),drf) - DRF_HW_LO((o),drf) + 1) 5462306a36Sopenharmony_ci#define DRF_HW_MASK(o,drf) (~0ULL >> (64 - DRF_HW_BITS((o),drf))) 5562306a36Sopenharmony_ci#define DRF_HW_SMASK(o,drf) (DRF_HW_MASK((o),drf) << DRF_HW_LO((o),drf)) 5662306a36Sopenharmony_ci#define DRF_HW_GET(o,drf) ((o)[DRF_HW_IDX(o,drf)] & DRF_HW_SMASK((o),drf)) 5762306a36Sopenharmony_ci#define DRF_HW_VAL(o,drf,v) (((long long)(v) >> DRF_LW_BITS((o),drf)) & DRF_HW_SMASK((o),drf)) 5862306a36Sopenharmony_ci#define DRF_HW_CLR(o,drf) ((o)[DRF_HW_IDX((o),drf)] & ~DRF_HW_SMASK((o),drf)) 5962306a36Sopenharmony_ci#define DRF_HW_SET(o,drf,v) (DRF_HW_CLR((o),drf) | DRF_HW_VAL((o),drf,(v))) 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci/* DRF accessors. */ 6262306a36Sopenharmony_ci#define NVVAL_X(drf,v) (((v) & DRF_MASK(drf)) << DRF_LO(drf)) 6362306a36Sopenharmony_ci#define NVVAL_N(X,d,r,f, v) NVVAL_X(d##_##r##_##f, (v)) 6462306a36Sopenharmony_ci#define NVVAL_I(X,d,r,f,i,v) NVVAL_X(d##_##r##_##f(i), (v)) 6562306a36Sopenharmony_ci#define NVVAL_(X,_1,_2,_3,_4,_5,IMPL,...) IMPL 6662306a36Sopenharmony_ci#define NVVAL(A...) NVVAL_(X, ##A, NVVAL_I, NVVAL_N)(X, ##A) 6762306a36Sopenharmony_ci 6862306a36Sopenharmony_ci#define NVDEF_N(X,d,r,f, v) NVVAL_X(d##_##r##_##f, d##_##r##_##f##_##v) 6962306a36Sopenharmony_ci#define NVDEF_I(X,d,r,f,i,v) NVVAL_X(d##_##r##_##f(i), d##_##r##_##f##_##v) 7062306a36Sopenharmony_ci#define NVDEF_(X,_1,_2,_3,_4,_5,IMPL,...) IMPL 7162306a36Sopenharmony_ci#define NVDEF(A...) NVDEF_(X, ##A, NVDEF_I, NVDEF_N)(X, ##A) 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci#define NVVAL_GET_X(o,drf) (((o) >> DRF_LO(drf)) & DRF_MASK(drf)) 7462306a36Sopenharmony_ci#define NVVAL_GET_N(X,o,d,r,f ) NVVAL_GET_X(o, d##_##r##_##f) 7562306a36Sopenharmony_ci#define NVVAL_GET_I(X,o,d,r,f,i) NVVAL_GET_X(o, d##_##r##_##f(i)) 7662306a36Sopenharmony_ci#define NVVAL_GET_(X,_1,_2,_3,_4,_5,IMPL,...) IMPL 7762306a36Sopenharmony_ci#define NVVAL_GET(A...) NVVAL_GET_(X, ##A, NVVAL_GET_I, NVVAL_GET_N)(X, ##A) 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ci#define NVVAL_TEST_X(o,drf,cmp,drfv) (NVVAL_GET_X((o), drf) cmp drfv) 8062306a36Sopenharmony_ci#define NVVAL_TEST_N(X,o,d,r,f, cmp,v) NVVAL_TEST_X(o, d##_##r##_##f , cmp, (v)) 8162306a36Sopenharmony_ci#define NVVAL_TEST_I(X,o,d,r,f,i,cmp,v) NVVAL_TEST_X(o, d##_##r##_##f(i), cmp, (v)) 8262306a36Sopenharmony_ci#define NVVAL_TEST_(X,_1,_2,_3,_4,_5,_6,_7,IMPL,...) IMPL 8362306a36Sopenharmony_ci#define NVVAL_TEST(A...) NVVAL_TEST_(X, ##A, NVVAL_TEST_I, NVVAL_TEST_N)(X, ##A) 8462306a36Sopenharmony_ci 8562306a36Sopenharmony_ci#define NVDEF_TEST_N(X,o,d,r,f, cmp,v) NVVAL_TEST_X(o, d##_##r##_##f , cmp, d##_##r##_##f##_##v) 8662306a36Sopenharmony_ci#define NVDEF_TEST_I(X,o,d,r,f,i,cmp,v) NVVAL_TEST_X(o, d##_##r##_##f(i), cmp, d##_##r##_##f##_##v) 8762306a36Sopenharmony_ci#define NVDEF_TEST_(X,_1,_2,_3,_4,_5,_6,_7,IMPL,...) IMPL 8862306a36Sopenharmony_ci#define NVDEF_TEST(A...) NVDEF_TEST_(X, ##A, NVDEF_TEST_I, NVDEF_TEST_N)(X, ##A) 8962306a36Sopenharmony_ci 9062306a36Sopenharmony_ci#define NVVAL_SET_X(o,drf,v) (((o) & ~DRF_SMASK(drf)) | NVVAL_X(drf, (v))) 9162306a36Sopenharmony_ci#define NVVAL_SET_N(X,o,d,r,f, v) NVVAL_SET_X(o, d##_##r##_##f, (v)) 9262306a36Sopenharmony_ci#define NVVAL_SET_I(X,o,d,r,f,i,v) NVVAL_SET_X(o, d##_##r##_##f(i), (v)) 9362306a36Sopenharmony_ci#define NVVAL_SET_(X,_1,_2,_3,_4,_5,_6,IMPL,...) IMPL 9462306a36Sopenharmony_ci#define NVVAL_SET(A...) NVVAL_SET_(X, ##A, NVVAL_SET_I, NVVAL_SET_N)(X, ##A) 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_ci#define NVDEF_SET_N(X,o,d,r,f, v) NVVAL_SET_X(o, d##_##r##_##f, d##_##r##_##f##_##v) 9762306a36Sopenharmony_ci#define NVDEF_SET_I(X,o,d,r,f,i,v) NVVAL_SET_X(o, d##_##r##_##f(i), d##_##r##_##f##_##v) 9862306a36Sopenharmony_ci#define NVDEF_SET_(X,_1,_2,_3,_4,_5,_6,IMPL,...) IMPL 9962306a36Sopenharmony_ci#define NVDEF_SET(A...) NVDEF_SET_(X, ##A, NVDEF_SET_I, NVDEF_SET_N)(X, ##A) 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_ci/* DRF-MW accessors. */ 10262306a36Sopenharmony_ci#define NVVAL_MW_GET_X(o,drf) \ 10362306a36Sopenharmony_ci ((DRF_MW_SPANS((o),drf) ? \ 10462306a36Sopenharmony_ci (DRF_HW_GET((o),drf) << DRF_LW_BITS((o),drf)) : 0) | DRF_LW_GET((o),drf)) 10562306a36Sopenharmony_ci#define NVVAL_MW_GET_N(X,o,d,r,f ) NVVAL_MW_GET_X((o), d##_##r##_##f) 10662306a36Sopenharmony_ci#define NVVAL_MW_GET_I(X,o,d,r,f,i) NVVAL_MW_GET_X((o), d##_##r##_##f(i)) 10762306a36Sopenharmony_ci#define NVVAL_MW_GET_(X,_1,_2,_3,_4,_5,IMPL,...) IMPL 10862306a36Sopenharmony_ci#define NVVAL_MW_GET(A...) NVVAL_MW_GET_(X, ##A, NVVAL_MW_GET_I, NVVAL_MW_GET_N)(X, ##A) 10962306a36Sopenharmony_ci 11062306a36Sopenharmony_ci#define NVVAL_MW_SET_X(o,drf,v) do { \ 11162306a36Sopenharmony_ci (o)[DRF_LW_IDX((o),drf)] = DRF_LW_SET((o),drf,(v)); \ 11262306a36Sopenharmony_ci if (DRF_MW_SPANS((o),drf)) \ 11362306a36Sopenharmony_ci (o)[DRF_HW_IDX((o),drf)] = DRF_HW_SET((o),drf,(v)); \ 11462306a36Sopenharmony_ci} while(0) 11562306a36Sopenharmony_ci#define NVVAL_MW_SET_N(X,o,d,r,f, v) NVVAL_MW_SET_X((o), d##_##r##_##f, (v)) 11662306a36Sopenharmony_ci#define NVVAL_MW_SET_I(X,o,d,r,f,i,v) NVVAL_MW_SET_X((o), d##_##r##_##f(i), (v)) 11762306a36Sopenharmony_ci#define NVVAL_MW_SET_(X,_1,_2,_3,_4,_5,_6,IMPL,...) IMPL 11862306a36Sopenharmony_ci#define NVVAL_MW_SET(A...) NVVAL_MW_SET_(X, ##A, NVVAL_MW_SET_I, NVVAL_MW_SET_N)(X, ##A) 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ci#define NVDEF_MW_SET_N(X,o,d,r,f, v) NVVAL_MW_SET_X(o, d##_##r##_##f, d##_##r##_##f##_##v) 12162306a36Sopenharmony_ci#define NVDEF_MW_SET_I(X,o,d,r,f,i,v) NVVAL_MW_SET_X(o, d##_##r##_##f(i), d##_##r##_##f##_##v) 12262306a36Sopenharmony_ci#define NVDEF_MW_SET_(X,_1,_2,_3,_4,_5,_6,IMPL,...) IMPL 12362306a36Sopenharmony_ci#define NVDEF_MW_SET(A...) NVDEF_MW_SET_(X, ##A, NVDEF_MW_SET_I, NVDEF_MW_SET_N)(X, ##A) 12462306a36Sopenharmony_ci 12562306a36Sopenharmony_ci/* Helper for reading an arbitrary object. */ 12662306a36Sopenharmony_ci#define DRF_RD_X(e,p,o,dr) e((p), (o), dr) 12762306a36Sopenharmony_ci#define DRF_RD_N(X,e,p,o,d,r ) DRF_RD_X(e, (p), (o), d##_##r) 12862306a36Sopenharmony_ci#define DRF_RD_I(X,e,p,o,d,r,i) DRF_RD_X(e, (p), (o), d##_##r(i)) 12962306a36Sopenharmony_ci#define DRF_RD_(X,_1,_2,_3,_4,_5,_6,IMPL,...) IMPL 13062306a36Sopenharmony_ci#define DRF_RD(A...) DRF_RD_(X, ##A, DRF_RD_I, DRF_RD_N)(X, ##A) 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ci/* Helper for writing an arbitrary object. */ 13362306a36Sopenharmony_ci#define DRF_WR_X(e,p,o,dr,v) e((p), (o), dr, (v)) 13462306a36Sopenharmony_ci#define DRF_WR_N(X,e,p,o,d,r, v) DRF_WR_X(e, (p), (o), d##_##r , (v)) 13562306a36Sopenharmony_ci#define DRF_WR_I(X,e,p,o,d,r,i,v) DRF_WR_X(e, (p), (o), d##_##r(i), (v)) 13662306a36Sopenharmony_ci#define DRF_WR_(X,_1,_2,_3,_4,_5,_6,_7,IMPL,...) IMPL 13762306a36Sopenharmony_ci#define DRF_WR(A...) DRF_WR_(X, ##A, DRF_WR_I, DRF_WR_N)(X, ##A) 13862306a36Sopenharmony_ci 13962306a36Sopenharmony_ci/* Helper for modifying an arbitrary object. */ 14062306a36Sopenharmony_ci#define DRF_MR_X(er,ew,ty,p,o,dr,m,v) ({ \ 14162306a36Sopenharmony_ci ty _t = DRF_RD_X(er, (p), (o), dr); \ 14262306a36Sopenharmony_ci DRF_WR_X(ew, (p), (o), dr, (_t & ~(m)) | (v)); \ 14362306a36Sopenharmony_ci _t; \ 14462306a36Sopenharmony_ci}) 14562306a36Sopenharmony_ci#define DRF_MR_N(X,er,ew,ty,p,o,d,r ,m,v) DRF_MR_X(er, ew, ty, (p), (o), d##_##r , (m), (v)) 14662306a36Sopenharmony_ci#define DRF_MR_I(X,er,ew,ty,p,o,d,r,i,m,v) DRF_MR_X(er, ew, ty, (p), (o), d##_##r(i), (m), (v)) 14762306a36Sopenharmony_ci#define DRF_MR_(X,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,IMPL,...) IMPL 14862306a36Sopenharmony_ci#define DRF_MR(A...) DRF_MR_(X, ##A, DRF_MR_I, DRF_MR_N)(X, ##A) 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ci/* Helper for extracting a field value from arbitrary object. */ 15162306a36Sopenharmony_ci#define DRF_RV_X(e,p,o,dr,drf) NVVAL_GET_X(DRF_RD_X(e, (p), (o), dr), drf) 15262306a36Sopenharmony_ci#define DRF_RV_N(X,e,p,o,d,r, f) DRF_RV_X(e, (p), (o), d##_##r , d##_##r##_##f) 15362306a36Sopenharmony_ci#define DRF_RV_I(X,e,p,o,d,r,i,f) DRF_RV_X(e, (p), (o), d##_##r(i), d##_##r##_##f) 15462306a36Sopenharmony_ci#define DRF_RV_(X,_1,_2,_3,_4,_5,_6,_7,IMPL,...) IMPL 15562306a36Sopenharmony_ci#define DRF_RV(A...) DRF_RV_(X, ##A, DRF_RV_I, DRF_RV_N)(X, ##A) 15662306a36Sopenharmony_ci 15762306a36Sopenharmony_ci/* Helper for writing field value to arbitrary object (all other bits cleared). */ 15862306a36Sopenharmony_ci#define DRF_WV_N(X,e,p,o,d,r, f,v) \ 15962306a36Sopenharmony_ci DRF_WR_X(e, (p), (o), d##_##r , NVVAL_X(d##_##r##_##f, (v))) 16062306a36Sopenharmony_ci#define DRF_WV_I(X,e,p,o,d,r,i,f,v) \ 16162306a36Sopenharmony_ci DRF_WR_X(e, (p), (o), d##_##r(i), NVVAL_X(d##_##r##_##f, (v))) 16262306a36Sopenharmony_ci#define DRF_WV_(X,_1,_2,_3,_4,_5,_6,_7,_8,IMPL,...) IMPL 16362306a36Sopenharmony_ci#define DRF_WV(A...) DRF_WV_(X, ##A, DRF_WV_I, DRF_WV_N)(X, ##A) 16462306a36Sopenharmony_ci 16562306a36Sopenharmony_ci/* Helper for writing field definition to arbitrary object (all other bits cleared). */ 16662306a36Sopenharmony_ci#define DRF_WD_N(X,e,p,o,d,r, f,v) \ 16762306a36Sopenharmony_ci DRF_WR_X(e, (p), (o), d##_##r , NVVAL_X(d##_##r##_##f, d##_##r##_##f##_##v)) 16862306a36Sopenharmony_ci#define DRF_WD_I(X,e,p,o,d,r,i,f,v) \ 16962306a36Sopenharmony_ci DRF_WR_X(e, (p), (o), d##_##r(i), NVVAL_X(d##_##r##_##f, d##_##r##_##f##_##v)) 17062306a36Sopenharmony_ci#define DRF_WD_(X,_1,_2,_3,_4,_5,_6,_7,_8,IMPL,...) IMPL 17162306a36Sopenharmony_ci#define DRF_WD(A...) DRF_WD_(X, ##A, DRF_WD_I, DRF_WD_N)(X, ##A) 17262306a36Sopenharmony_ci 17362306a36Sopenharmony_ci/* Helper for modifying field value in arbitrary object. */ 17462306a36Sopenharmony_ci#define DRF_MV_N(X,er,ew,ty,p,o,d,r, f,v) \ 17562306a36Sopenharmony_ci NVVAL_GET_X(DRF_MR_X(er, ew, ty, (p), (o), d##_##r , DRF_SMASK(d##_##r##_##f), \ 17662306a36Sopenharmony_ci NVVAL_X(d##_##r##_##f, (v))), d##_##r##_##f) 17762306a36Sopenharmony_ci#define DRF_MV_I(X,er,ew,ty,p,o,d,r,i,f,v) \ 17862306a36Sopenharmony_ci NVVAL_GET_X(DRF_MR_X(er, ew, ty, (p), (o), d##_##r(i), DRF_SMASK(d##_##r##_##f), \ 17962306a36Sopenharmony_ci NVVAL_X(d##_##r##_##f, (v))), d##_##r##_##f) 18062306a36Sopenharmony_ci#define DRF_MV_(X,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,IMPL,...) IMPL 18162306a36Sopenharmony_ci#define DRF_MV(A...) DRF_MV_(X, ##A, DRF_MV_I, DRF_MV_N)(X, ##A) 18262306a36Sopenharmony_ci 18362306a36Sopenharmony_ci/* Helper for modifying field definition in arbitrary object. */ 18462306a36Sopenharmony_ci#define DRF_MD_N(X,er,ew,ty,p,o,d,r, f,v) \ 18562306a36Sopenharmony_ci NVVAL_GET_X(DRF_MR_X(er, ew, ty, (p), (o), d##_##r , DRF_SMASK(d##_##r##_##f), \ 18662306a36Sopenharmony_ci NVVAL_X(d##_##r##_##f, d##_##r##_##f##_##v)), d##_##r##_##f) 18762306a36Sopenharmony_ci#define DRF_MD_I(X,er,ew,ty,p,o,d,r,i,f,v) \ 18862306a36Sopenharmony_ci NVVAL_GET_X(DRF_MR_X(er, ew, ty, (p), (o), d##_##r(i), DRF_SMASK(d##_##r##_##f), \ 18962306a36Sopenharmony_ci NVVAL_X(d##_##r##_##f, d##_##r##_##f##_##v)), d##_##r##_##f) 19062306a36Sopenharmony_ci#define DRF_MD_(X,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,IMPL,...) IMPL 19162306a36Sopenharmony_ci#define DRF_MD(A...) DRF_MD_(X, ##A, DRF_MD_I, DRF_MD_N)(X, ##A) 19262306a36Sopenharmony_ci 19362306a36Sopenharmony_ci/* Helper for testing against field value in arbitrary object */ 19462306a36Sopenharmony_ci#define DRF_TV_N(X,e,p,o,d,r, f,cmp,v) \ 19562306a36Sopenharmony_ci NVVAL_TEST_X(DRF_RD_X(e, (p), (o), d##_##r ), d##_##r##_##f, cmp, (v)) 19662306a36Sopenharmony_ci#define DRF_TV_I(X,e,p,o,d,r,i,f,cmp,v) \ 19762306a36Sopenharmony_ci NVVAL_TEST_X(DRF_RD_X(e, (p), (o), d##_##r(i)), d##_##r##_##f, cmp, (v)) 19862306a36Sopenharmony_ci#define DRF_TV_(X,_1,_2,_3,_4,_5,_6,_7,_8,_9,IMPL,...) IMPL 19962306a36Sopenharmony_ci#define DRF_TV(A...) DRF_TV_(X, ##A, DRF_TV_I, DRF_TV_N)(X, ##A) 20062306a36Sopenharmony_ci 20162306a36Sopenharmony_ci/* Helper for testing against field definition in arbitrary object */ 20262306a36Sopenharmony_ci#define DRF_TD_N(X,e,p,o,d,r, f,cmp,v) \ 20362306a36Sopenharmony_ci NVVAL_TEST_X(DRF_RD_X(e, (p), (o), d##_##r ), d##_##r##_##f, cmp, d##_##r##_##f##_##v) 20462306a36Sopenharmony_ci#define DRF_TD_I(X,e,p,o,d,r,i,f,cmp,v) \ 20562306a36Sopenharmony_ci NVVAL_TEST_X(DRF_RD_X(e, (p), (o), d##_##r(i)), d##_##r##_##f, cmp, d##_##r##_##f##_##v) 20662306a36Sopenharmony_ci#define DRF_TD_(X,_1,_2,_3,_4,_5,_6,_7,_8,_9,IMPL,...) IMPL 20762306a36Sopenharmony_ci#define DRF_TD(A...) DRF_TD_(X, ##A, DRF_TD_I, DRF_TD_N)(X, ##A) 20862306a36Sopenharmony_ci#endif 209