blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
721
content_id
stringlengths
40
40
detected_licenses
listlengths
0
57
license_type
stringclasses
2 values
repo_name
stringlengths
5
91
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
321 values
visit_date
timestamp[ns]date
2016-08-12 09:31:09
2023-09-06 10:45:07
revision_date
timestamp[ns]date
2010-09-28 14:01:40
2023-09-06 06:22:19
committer_date
timestamp[ns]date
2010-09-28 14:01:40
2023-09-06 06:22:19
github_id
int64
426
681M
star_events_count
int64
101
243k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
23 values
gha_event_created_at
timestamp[ns]date
2012-06-28 18:51:49
2023-09-14 21:59:16
gha_created_at
timestamp[ns]date
2008-02-11 22:55:26
2023-08-10 11:14:58
gha_language
stringclasses
147 values
src_encoding
stringclasses
26 values
language
stringclasses
2 values
is_vendor
bool
2 classes
is_generated
bool
2 classes
length_bytes
int64
6
10.2M
extension
stringclasses
115 values
filename
stringlengths
3
113
content
stringlengths
6
10.2M
4bc96773a3b8c3b10effdeab143b2622dfed962f
7744859512f027ef0da8b1bde0f8518e631b98eb
/soh/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c
d45bd8c9bd7cab29f76863915f7a647ef3f42818
[]
no_license
HarbourMasters/Shipwright
7f70b9470e4f9a117f3fe2d6e4deb776b8742182
0e7c6585239c0d7ea2c039b8b8cb7eaedf8928a9
refs/heads/develop
2023-08-31T20:50:56.253521
2023-08-30T17:34:06
2023-08-30T17:34:06
472,575,717
2,104
459
null
2023-09-14T20:29:01
2022-03-22T01:42:52
C
UTF-8
C
false
false
20,365
c
z_en_dodojr.c
/* * File: z_en_dodojr.c * Overlay: ovl_En_Dodojr * Description: Baby Dodongo */ #include "z_en_dodojr.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "objects/object_dodojr/object_dodojr.h" #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_HOSTILE) void EnDodojr_Init(Actor* thisx, PlayState* play); void EnDodojr_Destroy(Actor* thisx, PlayState* play); void EnDodojr_Update(Actor* thisx, PlayState* play); void EnDodojr_Draw(Actor* thisx, PlayState* play); void func_809F73AC(EnDodojr* this, PlayState* play); void func_809F7BE4(EnDodojr* this, PlayState* play); void func_809F74C4(EnDodojr* this, PlayState* play); void func_809F758C(EnDodojr* this, PlayState* play); void func_809F786C(EnDodojr* this, PlayState* play); void func_809F799C(EnDodojr* this, PlayState* play); void func_809F78EC(EnDodojr* this, PlayState* play); void func_809F773C(EnDodojr* this, PlayState* play); void func_809F77AC(EnDodojr* this, PlayState* play); void func_809F784C(EnDodojr* this, PlayState* play); void func_809F7AB8(EnDodojr* this, PlayState* play); void func_809F7A00(EnDodojr* this, PlayState* play); void func_809F7B3C(EnDodojr* this, PlayState* play); void func_809F7C48(EnDodojr* this, PlayState* play); void func_809F768C(EnDodojr* this, PlayState* play); const ActorInit En_Dodojr_InitVars = { ACTOR_EN_DODOJR, ACTORCAT_ENEMY, FLAGS, OBJECT_DODOJR, sizeof(EnDodojr), (ActorFunc)EnDodojr_Init, (ActorFunc)EnDodojr_Destroy, (ActorFunc)EnDodojr_Update, (ActorFunc)EnDodojr_Draw, NULL, }; static ColliderCylinderInit sCylinderInit = { { COLTYPE_HIT6, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFC5FFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, { 18, 20, 0, { 0, 0, 0 } }, }; static CollisionCheckInfoInit2 sColChkInit = { 1, 2, 25, 25, 0xFF }; void EnDodojr_Init(Actor* thisx, PlayState* play) { EnDodojr* this = (EnDodojr*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 18.0f); SkelAnime_Init(play, &this->skelAnime, &object_dodojr_Skel_0020E0, &object_dodojr_Anim_0009D4, this->jointTable, this->morphTable, 15); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(4), &sColChkInit); this->actor.naviEnemyId = 0xE; this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; Actor_SetScale(&this->actor, 0.02f); this->actionFunc = func_809F73AC; } void EnDodojr_Destroy(Actor* thisx, PlayState* play) { EnDodojr* this = (EnDodojr*)thisx; Collider_DestroyCylinder(play, &this->collider); ResourceMgr_UnregisterSkeleton(&this->skelAnime); } void func_809F64D0(EnDodojr* this) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_BOMB_EXPLOSION); Actor_SetColorFilter(&this->actor, 0x4000, 200, 0, 8); } void func_809F6510(EnDodojr* this, PlayState* play, s32 count) { Color_RGBA8 prim = { 170, 130, 90, 255 }; Color_RGBA8 env = { 100, 60, 20, 0 }; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 0.3f, 0.0f }; Vec3f pos; s16 angle = ((Rand_ZeroOne() - 0.5f) * 65536.0f); s32 i; pos.y = this->dustPos.y; for (i = count; i >= 0; i--, angle += (s16)(0x10000 / count)) { accel.x = (Rand_ZeroOne() - 0.5f) * 4.0f; accel.z = (Rand_ZeroOne() - 0.5f) * 4.0f; pos.x = (Math_SinS(angle) * 22.0f) + this->dustPos.x; pos.z = (Math_CosS(angle) * 22.0f) + this->dustPos.z; func_8002836C(play, &pos, &velocity, &accel, &prim, &env, 120, 40, 10); } } void func_809F6730(EnDodojr* this, PlayState* play, Vec3f* arg2) { Color_RGBA8 prim = { 170, 130, 90, 255 }; Color_RGBA8 env = { 100, 60, 20, 0 }; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 0.3f, 0.0f }; Vec3f pos; s16 angle = ((Rand_ZeroOne() - 0.5f) * 65536.0f); pos.y = this->actor.floorHeight; accel.x = (Rand_ZeroOne() - 0.5f) * 2; accel.z = (Rand_ZeroOne() - 0.5f) * 2; pos.x = (Math_SinS(angle) * 11.0f) + arg2->x; pos.z = (Math_CosS(angle) * 11.0f) + arg2->z; func_8002836C(play, &pos, &velocity, &accel, &prim, &env, 100, 60, 8); } s32 func_809F68B0(EnDodojr* this, PlayState* play) { if (this->actor.velocity.y >= 0.0f) { return 0; } if (this->unk_1FC == 0) { return 0; } if (this->actor.bgCheckFlags & 1) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); this->dustPos = this->actor.world.pos; func_809F6510(this, play, 10); this->actor.velocity.y = 10.0f / (4 - this->unk_1FC); this->unk_1FC--; if (this->unk_1FC == 0) { this->actor.velocity.y = 0.0f; return 1; } } return 0; } void func_809F6994(EnDodojr* this) { f32 lastFrame = Animation_GetLastFrame(&object_dodojr_Anim_000860); Animation_Change(&this->skelAnime, &object_dodojr_Anim_000860, 1.8f, 0.0f, lastFrame, ANIMMODE_LOOP_INTERP, -10.0f); this->actor.velocity.y = 0.0f; this->actor.speedXZ = 2.6f; this->actor.gravity = -0.8f; } void func_809F6A20(EnDodojr* this) { f32 lastFrame = Animation_GetLastFrame(&object_dodojr_Anim_0004A0); Animation_Change(&this->skelAnime, &object_dodojr_Anim_0004A0, 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, -10.0f); this->actor.speedXZ = 0.0f; this->actor.velocity.x = 0.0f; this->actor.velocity.z = 0.0f; this->actor.gravity = -0.8f; if (this->unk_1FC == 0) { this->unk_1FC = 3; this->actor.velocity.y = 10.0f; } gSaveContext.sohStats.count[COUNT_ENEMIES_DEFEATED_DODONGO_BABY]++; } void func_809F6AC4(EnDodojr* this) { f32 lastFrame = Animation_GetLastFrame(&object_dodojr_Anim_0005F0); Animation_Change(&this->skelAnime, &object_dodojr_Anim_0005F0, 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP, 0.0f); this->actor.velocity.y = 0.0f; this->actor.gravity = -0.8f; } void func_809F6B38(EnDodojr* this) { f32 lastFrame = Animation_GetLastFrame(&object_dodojr_Anim_000724); Animation_Change(&this->skelAnime, &object_dodojr_Anim_000724, 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP, -10.0f); this->actor.gravity = -0.8f; this->unk_1FC = 3; this->actor.velocity.y = 10.0f; } void func_809F6BBC(EnDodojr* this) { this->actor.shape.shadowDraw = NULL; this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.home.pos = this->actor.world.pos; this->actor.speedXZ = 0.0f; this->actor.gravity = -0.8f; this->timer3 = 30; this->dustPos = this->actor.world.pos; } void func_809F6C24(EnDodojr* this) { Animation_Change(&this->skelAnime, &object_dodojr_Anim_000724, 1.0f, 8.0f, 12.0f, ANIMMODE_ONCE, 0.0f); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_EAT); this->actor.speedXZ = 0.0f; this->actor.velocity.x = 0.0f; this->actor.velocity.z = 0.0f; this->actor.gravity = -0.8f; } s32 func_809F6CA4(EnDodojr* this, PlayState* play) { Actor* bomb; Vec3f unkVec = { 99999.0f, 99999.0f, 99999.0f }; s32 retVar = 0; f32 xDist; f32 yDist; f32 zDist; bomb = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; this->bomb = NULL; while (bomb != NULL) { if ((bomb->params != 0) || (bomb->parent != NULL) || (bomb->update == NULL)) { bomb = bomb->next; continue; } if (bomb->id != ACTOR_EN_BOM) { bomb = bomb->next; continue; } xDist = bomb->world.pos.x - this->actor.world.pos.x; yDist = bomb->world.pos.y - this->actor.world.pos.y; zDist = bomb->world.pos.z - this->actor.world.pos.z; if ((fabsf(xDist) >= fabsf(unkVec.x)) || (fabsf(yDist) >= fabsf(unkVec.y)) || (fabsf(zDist) >= fabsf(unkVec.z))) { bomb = bomb->next; continue; } this->bomb = bomb; unkVec = bomb->world.pos; retVar = 1; bomb = bomb->next; } return retVar; } s32 func_809F6DD0(EnDodojr* this) { if (this->bomb == NULL) { return 0; } else if (this->bomb->parent != NULL) { return 0; } else if (Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->bomb->world.pos) > 30.0f) { return 0; } else { this->bomb->parent = &this->actor; return 1; } } void func_809F6E54(EnDodojr* this, PlayState* play) { f32 angles[] = { 0.0f, 210.0f, 60.0f, 270.0f, 120.0f, 330.0f, 180.0f, 30.0f, 240.0f, 90.0f, 300.0f, 150.0f }; s32 pad; Player* player = GET_PLAYER(play); Vec3f pos; s16 angleIndex; if ((this->bomb == NULL) || (this->bomb->update == NULL) || ((this->bomb != NULL) && (this->bomb->parent != NULL))) { func_809F6CA4(this, play); } if (this->bomb != NULL) { pos = this->bomb->world.pos; } else { pos = player->actor.world.pos; } if (Math_Vec3f_DistXYZ(&this->actor.world.pos, &pos) > 80.0f) { angleIndex = (s16)(this->actor.home.pos.x + this->actor.home.pos.y + this->actor.home.pos.z + play->state.frames / 30) % 12; angleIndex = ABS(angleIndex); pos.x += 80.0f * sinf(angles[angleIndex]); pos.z += 80.0f * cosf(angles[angleIndex]); } Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &pos), 10, 1000, 1); this->actor.shape.rot.y = this->actor.world.rot.y; } s32 func_809F706C(EnDodojr* this) { if (this->actor.xzDistToPlayer > 40.0f) { return 0; } else { return 1; } } void func_809F709C(EnDodojr* this) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_DEAD); this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; func_809F6A20(this); this->actionFunc = func_809F7AB8; } s32 func_809F70E8(EnDodojr* this, PlayState* play) { if ((this->actionFunc == func_809F773C) || (this->actionFunc == func_809F77AC) || (this->actionFunc == func_809F784C) || (this->actionFunc == func_809F7A00) || (this->actionFunc == func_809F7AB8) || (this->actionFunc == func_809F7B3C) || (this->actionFunc == func_809F7BE4)) { return 0; } if (play->actorCtx.unk_02 != 0) { if (this->actionFunc != func_809F73AC) { if (this->actionFunc == func_809F74C4) { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; } func_809F709C(this); } return 0; } if (!(this->collider.base.acFlags & 2)) { return 0; } else { this->collider.base.acFlags &= ~2; if ((this->actionFunc == func_809F73AC) || (this->actionFunc == func_809F74C4)) { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; } if ((this->actor.colChkInfo.damageEffect == 0) && (this->actor.colChkInfo.damage != 0)) { Enemy_StartFinishingBlow(play, &this->actor); this->timer2 = 2; this->actionFunc = func_809F7C48; return 1; } if ((this->actor.colChkInfo.damageEffect == 1) && (this->actionFunc != func_809F78EC) && (this->actionFunc != func_809F786C)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); this->timer1 = 120; Actor_SetColorFilter(&this->actor, 0, 200, 0, 120); func_809F6A20(this); this->actionFunc = func_809F786C; } return 0; } } void func_809F72A4(EnDodojr* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); if ((this->actionFunc != func_809F73AC) && (this->actionFunc != func_809F7BE4)) { if ((this->actionFunc == func_809F74C4) || (this->actionFunc == func_809F758C) || (this->actionFunc == func_809F799C)) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if ((this->actionFunc == func_809F74C4) || (this->actionFunc == func_809F758C) || (this->actionFunc == func_809F786C) || (this->actionFunc == func_809F78EC) || (this->actionFunc == func_809F799C)) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } void func_809F73AC(EnDodojr* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&object_dodojr_Anim_000860); Player* player = GET_PLAYER(play); f32 dist; if (!(this->actor.xzDistToPlayer >= 320.0f)) { dist = this->actor.world.pos.y - player->actor.world.pos.y; if (!(dist >= 40.0f)) { Animation_Change(&this->skelAnime, &object_dodojr_Anim_000860, 1.8f, 0.0f, lastFrame, ANIMMODE_LOOP_INTERP, -10.0f); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_UP); this->actor.world.pos.y -= 60.0f; this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actor.world.rot.x -= 0x4000; this->actor.shape.rot.x = this->actor.world.rot.x; this->dustPos = this->actor.world.pos; this->dustPos.y = this->actor.floorHeight; this->actionFunc = func_809F74C4; } } } void func_809F74C4(EnDodojr* this, PlayState* play) { f32 sp2C; Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 4, 0x3E8, 0x64); sp2C = this->actor.shape.rot.x; sp2C /= 16384.0f; this->actor.world.pos.y = this->actor.home.pos.y + (60.0f * sp2C); func_809F6510(this, play, 3); if (sp2C == 0.0f) { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; this->actor.world.rot.x = this->actor.shape.rot.x; this->actor.speedXZ = 2.6f; this->actionFunc = func_809F758C; } } void func_809F758C(EnDodojr* this, PlayState* play) { func_8002D868(&this->actor); func_809F6730(this, play, &this->actor.world.pos); if (DECR(this->timer4) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_MOVE); this->timer4 = 5; } if (func_809F6DD0(this) != 0) { func_809F6C24(this); this->actionFunc = func_809F768C; return; } func_809F6E54(this, play); if (func_809F706C(this) != 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_CRY); func_809F6B38(this); this->actionFunc = func_809F799C; } if (this->actor.bgCheckFlags & 8) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_DOWN); func_809F6BBC(this); this->actionFunc = func_809F7A00; } } void func_809F768C(EnDodojr* this, PlayState* play) { EnBom* bomb; if (((s16)this->skelAnime.curFrame - 8) < 4) { bomb = (EnBom*)this->bomb; bomb->timer++; this->bomb->world.pos = this->headPos; } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_K_DRINK); Actor_Kill(this->bomb); this->timer3 = 24; this->unk_1FC = 0; this->actionFunc = func_809F773C; } } void func_809F773C(EnDodojr* this, PlayState* play) { if (DECR(this->timer3) == 0) { func_809F64D0(this); this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; func_809F6A20(this); this->actionFunc = func_809F77AC; } } void func_809F77AC(EnDodojr* this, PlayState* play) { this->rootScale = 1.2f; this->rootScale *= ((f32)this->actor.colorFilterTimer / 8); func_8002D868(&this->actor); if (func_809F68B0(this, play) != 0) { this->timer3 = 60; func_809F6AC4(this); this->unk_1FC = 7; this->actionFunc = func_809F784C; } } void func_809F784C(EnDodojr* this, PlayState* play) { func_809F7B3C(this, play); } void func_809F786C(EnDodojr* this, PlayState* play) { func_8002D868(&this->actor); if (func_809F68B0(this, play) != 0) { func_809F6AC4(this); this->actionFunc = func_809F78EC; } Math_SmoothStepToS(&this->actor.shape.rot.y, 0, 4, 1000, 10); this->actor.world.rot.x = this->actor.shape.rot.x; this->actor.colorFilterTimer = this->timer1; } void func_809F78EC(EnDodojr* this, PlayState* play) { if (DECR(this->timer1) != 0) { if (this->timer1 < 30) { if ((this->timer1 & 1) != 0) { this->actor.world.pos.x += 1.5f; this->actor.world.pos.z += 1.5f; } else { this->actor.world.pos.x -= 1.5f; this->actor.world.pos.z -= 1.5f; } return; } } else { func_809F6994(this); this->actionFunc = func_809F758C; } } void func_809F799C(EnDodojr* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_PLAY_HIT_SFX; func_8002D868(&this->actor); if (func_809F68B0(this, play) != 0) { func_809F6994(this); this->actionFunc = func_809F758C; } } void func_809F7A00(EnDodojr* this, PlayState* play) { f32 tmp; Math_SmoothStepToS(&this->actor.shape.rot.x, 0x4000, 4, 1000, 100); if (DECR(this->timer3) != 0) { tmp = (30 - this->timer3) / 30.0f; this->actor.world.pos.y = this->actor.home.pos.y - (60.0f * tmp); } else { Actor_Kill(&this->actor); } func_809F6510(this, play, 3); } void func_809F7AB8(EnDodojr* this, PlayState* play) { func_8002D868(&this->actor); Math_SmoothStepToS(&this->actor.shape.rot.y, 0, 4, 1000, 10); this->actor.world.rot.x = this->actor.shape.rot.x; if (func_809F68B0(this, play) != 0) { this->timer3 = 60; func_809F6AC4(this); this->unk_1FC = 7; this->actionFunc = func_809F7B3C; } } void func_809F7B3C(EnDodojr* this, PlayState* play) { EnBom* bomb; if (this->unk_1FC != 0) { if (this->actor.colorFilterTimer == 0) { Actor_SetColorFilter(&this->actor, 0x4000, 200, 0, this->unk_1FC); this->unk_1FC--; } } else { bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, BOMB_BODY, true); if (bomb != NULL) { bomb->timer = 0; } this->timer3 = 8; this->actionFunc = func_809F7BE4; } } void func_809F7BE4(EnDodojr* this, PlayState* play) { if (DECR(this->timer3) == 0) { Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0x40); Actor_Kill(&this->actor); } } void func_809F7C48(EnDodojr* this, PlayState* play) { if (DECR(this->timer2) == 0) { func_809F709C(this); } } void EnDodojr_Update(Actor* thisx, PlayState* play) { EnDodojr* this = (EnDodojr*)thisx; SkelAnime_Update(&this->skelAnime); Actor_MoveForward(&this->actor); func_809F70E8(this, play); if (this->actionFunc != func_809F73AC) { Actor_UpdateBgCheckInfo(play, &this->actor, this->collider.dim.radius, this->collider.dim.height, 0.0f, 5); } this->actionFunc(this, play); Actor_SetFocus(&this->actor, 10.0f); func_809F72A4(this, play); } s32 func_809F7D50(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnDodojr* this = (EnDodojr*)thisx; Vec3f D_809F7F64 = { 480.0f, 620.0f, 0.0f }; if (limbIndex == 1) { Matrix_Scale((this->rootScale * 0.5f) + 1.0f, this->rootScale + 1.0f, (this->rootScale * 0.5f) + 1.0f, MTXMODE_APPLY); } if (limbIndex == 4) { Matrix_MultVec3f(&D_809F7F64, &this->headPos); } return false; } void func_809F7DFC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { } void EnDodojr_Draw(Actor* thisx, PlayState* play) { EnDodojr* this = (EnDodojr*)thisx; if ((this->actionFunc != func_809F73AC) && (this->actionFunc != func_809F7BE4)) { Gfx_SetupDL_25Opa(play->state.gfxCtx); SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, func_809F7D50, func_809F7DFC, &this->actor); } }
99b99320eeb5a53ce1ab0b088758939485516478
bbed308c9ee9b2123b691592419db011a35b9e5e
/src/merger/tt2ps.h
9d0a1132050db031aa8b68cd755e2891f3443dcb
[ "MIT" ]
permissive
nowar-fonts/Warcraft-Font-Merger
f42cec645c29ec8736a4f66ca04c0aa416c6ca6b
7462fbab32afeb7bb94506aa88d899240d6066e9
refs/heads/master
2023-07-07T05:23:17.852003
2023-07-02T04:48:29
2023-07-02T04:48:29
161,875,032
455
38
MIT
2023-07-02T04:48:30
2018-12-15T05:58:34
C
UTF-8
C
false
false
123
h
tt2ps.h
#pragma once #include <nlohmann/json.hpp> nlohmann::json Tt2Ps(const nlohmann::json &glyf, bool roundToInt = true);
71f4d3c02acfda036ac98d665eac4232b550787c
8447eb38a4fc71b32b6b82a99f7828a2c50621aa
/ppu/sprx/libhttputil/exports.h
eb1a3331679f7c965cc6ff64d4da81314bbf20aa
[ "MIT" ]
permissive
ps3dev/PSL1GHT
9ecc1f0a2996b39d35cc98303c58c79966b9388b
5bc0961c66a3615c74f15e0c29bbeaa33f867ab3
refs/heads/master
2023-08-04T06:50:55.256801
2023-07-30T13:34:19
2023-07-30T13:34:19
1,541,223
159
357
MIT
2023-07-23T07:26:09
2011-03-29T12:34:15
C
UTF-8
C
false
false
885
h
exports.h
#ifndef __EXPORTS_H__ #define __EXPORTS_H__ EXPORT(httpUtilBuildHeader, 0x04accebf); EXPORT(httpUtilBuildRequestLine, 0x1c6e4dbb); EXPORT(httpUtilUnescapeUri, 0x2763fd66); EXPORT(httpUtilParseStatusLine, 0x2bcbced4); EXPORT(httpUtilParseUri, 0x32faaf58); EXPORT(httpUtilAppendHeaderValue, 0x37bb53a2); EXPORT(httpUtilFormUrlEncode, 0x44d756d6); EXPORT(httpUtilCopyStatusLine, 0x50ea75bc); EXPORT(httpUtilBuildUri, 0x6f0f7667); EXPORT(httpUtilBase64Encoder, 0x83faa354); EXPORT(httpUtilParseUriPath, 0x8bb608e4); EXPORT(httpUtilBase64Decoder, 0x8e52ee08); EXPORT(httpUtilFormUrlDecode, 0x8e6c5bb9); EXPORT(httpUtilMergeUriPath, 0x8ea23deb); EXPORT(httpUtilEscapeUri, 0x9003b1f2); EXPORT(httpUtilCopyHeader, 0x97f9fbe5); EXPORT(httpUtilParseProxy, 0xa3457869); EXPORT(httpUtilSweepPath, 0xaabeb869); EXPORT(httpUtilParseHeader, 0xe1fb0ebd); EXPORT(httpUtilCopyUri, 0xf05df789); #endif
a7c2022d4f297b58f72a3341326eb80bba0a25de
436ea72de0c0e5f41f52b2776968d8dd18ed2d59
/lib/crc32.c
c3a4da48b2cfd15a94c4cc8e52376c3386dc9ee9
[ "MIT" ]
permissive
ebiggers/libdeflate
61c1b596ea178e84856c01ab215110ee4a665282
5753355b29a5f7e4b32f79b44e8ee528632c8655
refs/heads/master
2023-08-16T17:18:36.002150
2023-08-13T18:21:26
2023-08-13T22:03:22
28,554,304
847
156
MIT
2023-09-13T06:19:52
2014-12-28T05:10:42
C
UTF-8
C
false
false
9,226
c
crc32.c
/* * crc32.c - CRC-32 checksum algorithm for the gzip format * * Copyright 2016 Eric Biggers * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /* * High-level description of CRC * ============================= * * Consider a bit sequence 'bits[1...len]'. Interpret 'bits' as the "message" * polynomial M(x) with coefficients in GF(2) (the field of integers modulo 2), * where the coefficient of 'x^i' is 'bits[len - i]'. Then, compute: * * R(x) = M(x)*x^n mod G(x) * * where G(x) is a selected "generator" polynomial of degree 'n'. The remainder * R(x) is a polynomial of max degree 'n - 1'. The CRC of 'bits' is R(x) * interpreted as a bitstring of length 'n'. * * CRC used in gzip * ================ * * In the gzip format (RFC 1952): * * - The bitstring to checksum is formed from the bytes of the uncompressed * data by concatenating the bits from the bytes in order, proceeding * from the low-order bit to the high-order bit within each byte. * * - The generator polynomial G(x) is: x^32 + x^26 + x^23 + x^22 + x^16 + * x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1. * Consequently, the CRC length is 32 bits ("CRC-32"). * * - The highest order 32 coefficients of M(x)*x^n are inverted. * * - All 32 coefficients of R(x) are inverted. * * The two inversions cause added leading and trailing zero bits to affect the * resulting CRC, whereas with a regular CRC such bits would have no effect on * the CRC. * * Computation and optimizations * ============================= * * We can compute R(x) through "long division", maintaining only 32 bits of * state at any given time. Multiplication by 'x' can be implemented as * right-shifting by 1 (assuming the polynomial<=>bitstring mapping where the * highest order bit represents the coefficient of x^0), and both addition and * subtraction can be implemented as bitwise exclusive OR (since we are working * in GF(2)). Here is an unoptimized implementation: * * static u32 crc32_gzip(const u8 *p, size_t len) * { * u32 crc = 0; * const u32 divisor = 0xEDB88320; * * for (size_t i = 0; i < len * 8 + 32; i++) { * int bit; * u32 multiple; * * if (i < len * 8) * bit = (p[i / 8] >> (i % 8)) & 1; * else * bit = 0; // one of the 32 appended 0 bits * * if (i < 32) // the first 32 bits are inverted * bit ^= 1; * * if (crc & 1) * multiple = divisor; * else * multiple = 0; * * crc >>= 1; * crc |= (u32)bit << 31; * crc ^= multiple; * } * * return ~crc; * } * * In this implementation, the 32-bit integer 'crc' maintains the remainder of * the currently processed portion of the message (with 32 zero bits appended) * when divided by the generator polynomial. 'crc' is the representation of * R(x), and 'divisor' is the representation of G(x) excluding the x^32 * coefficient. For each bit to process, we multiply R(x) by 'x^1', then add * 'x^0' if the new bit is a 1. If this causes R(x) to gain a nonzero x^32 * term, then we subtract G(x) from R(x). * * We can speed this up by taking advantage of the fact that XOR is commutative * and associative, so the order in which we combine the inputs into 'crc' is * unimportant. And since each message bit we add doesn't affect the choice of * 'multiple' until 32 bits later, we need not actually add each message bit * until that point: * * static u32 crc32_gzip(const u8 *p, size_t len) * { * u32 crc = ~0; * const u32 divisor = 0xEDB88320; * * for (size_t i = 0; i < len * 8; i++) { * int bit; * u32 multiple; * * bit = (p[i / 8] >> (i % 8)) & 1; * crc ^= bit; * if (crc & 1) * multiple = divisor; * else * multiple = 0; * crc >>= 1; * crc ^= multiple; * } * * return ~crc; * } * * With the above implementation we get the effect of 32 appended 0 bits for * free; they never affect the choice of a divisor, nor would they change the * value of 'crc' if they were to be actually XOR'ed in. And by starting with a * remainder of all 1 bits, we get the effect of complementing the first 32 * message bits. * * The next optimization is to process the input in multi-bit units. Suppose * that we insert the next 'n' message bits into the remainder. Then we get an * intermediate remainder of length '32 + n' bits, and the CRC of the extra 'n' * bits is the amount by which the low 32 bits of the remainder will change as a * result of cancelling out those 'n' bits. Taking n=8 (one byte) and * precomputing a table containing the CRC of each possible byte, we get * crc32_slice1() defined below. * * As a further optimization, we could increase the multi-bit unit size to 16. * However, that is inefficient because the table size explodes from 256 entries * (1024 bytes) to 65536 entries (262144 bytes), which wastes memory and won't * fit in L1 cache on typical processors. * * However, we can actually process 4 bytes at a time using 4 different tables * with 256 entries each. Logically, we form a 64-bit intermediate remainder * and cancel out the high 32 bits in 8-bit chunks. Bits 32-39 are cancelled * out by the CRC of those bits, whereas bits 40-47 are be cancelled out by the * CRC of those bits with 8 zero bits appended, and so on. * * In crc32_slice8(), this method is extended to 8 bytes at a time. The * intermediate remainder (which we never actually store explicitly) is 96 bits. * * On CPUs that support fast carryless multiplication, CRCs can be computed even * more quickly via "folding". See e.g. the x86 PCLMUL implementation. */ #include "lib_common.h" #include "crc32_multipliers.h" #include "crc32_tables.h" /* This is the default implementation. It uses the slice-by-8 method. */ static u32 MAYBE_UNUSED crc32_slice8(u32 crc, const u8 *p, size_t len) { const u8 * const end = p + len; const u8 *end64; for (; ((uintptr_t)p & 7) && p != end; p++) crc = (crc >> 8) ^ crc32_slice8_table[(u8)crc ^ *p]; end64 = p + ((end - p) & ~7); for (; p != end64; p += 8) { u32 v1 = le32_bswap(*(const u32 *)(p + 0)); u32 v2 = le32_bswap(*(const u32 *)(p + 4)); crc = crc32_slice8_table[0x700 + (u8)((crc ^ v1) >> 0)] ^ crc32_slice8_table[0x600 + (u8)((crc ^ v1) >> 8)] ^ crc32_slice8_table[0x500 + (u8)((crc ^ v1) >> 16)] ^ crc32_slice8_table[0x400 + (u8)((crc ^ v1) >> 24)] ^ crc32_slice8_table[0x300 + (u8)(v2 >> 0)] ^ crc32_slice8_table[0x200 + (u8)(v2 >> 8)] ^ crc32_slice8_table[0x100 + (u8)(v2 >> 16)] ^ crc32_slice8_table[0x000 + (u8)(v2 >> 24)]; } for (; p != end; p++) crc = (crc >> 8) ^ crc32_slice8_table[(u8)crc ^ *p]; return crc; } /* * This is a more lightweight generic implementation, which can be used as a * subroutine by architecture-specific implementations to process small amounts * of unaligned data at the beginning and/or end of the buffer. */ static forceinline u32 MAYBE_UNUSED crc32_slice1(u32 crc, const u8 *p, size_t len) { size_t i; for (i = 0; i < len; i++) crc = (crc >> 8) ^ crc32_slice1_table[(u8)crc ^ p[i]]; return crc; } /* Include architecture-specific implementation(s) if available. */ #undef DEFAULT_IMPL #undef arch_select_crc32_func typedef u32 (*crc32_func_t)(u32 crc, const u8 *p, size_t len); #if defined(ARCH_ARM32) || defined(ARCH_ARM64) # include "arm/crc32_impl.h" #elif defined(ARCH_X86_32) || defined(ARCH_X86_64) # include "x86/crc32_impl.h" #endif #ifndef DEFAULT_IMPL # define DEFAULT_IMPL crc32_slice8 #endif #ifdef arch_select_crc32_func static u32 dispatch_crc32(u32 crc, const u8 *p, size_t len); static volatile crc32_func_t crc32_impl = dispatch_crc32; /* Choose the best implementation at runtime. */ static u32 dispatch_crc32(u32 crc, const u8 *p, size_t len) { crc32_func_t f = arch_select_crc32_func(); if (f == NULL) f = DEFAULT_IMPL; crc32_impl = f; return f(crc, p, len); } #else /* The best implementation is statically known, so call it directly. */ #define crc32_impl DEFAULT_IMPL #endif LIBDEFLATEAPI u32 libdeflate_crc32(u32 crc, const void *p, size_t len) { if (p == NULL) /* Return initial value. */ return 0; return ~crc32_impl(~crc, p, len); }
8f1dfb3a3917c5ebf8d66547caf417a4c50587f7
a11e4bdd6157b22067288d860507fa20abea033d
/src/modules/wizard/page_020.c
69a33ab1542d48c1ba5495babd56be48348d11d9
[ "BSD-2-Clause" ]
permissive
JeffHoogland/moksha
85a0f39dc97daa61d35e64a511013d21552db288
c56013644d8cd8e32101bb38a8d1e4ebd9d47f37
refs/heads/master
2023-08-24T05:39:13.415948
2023-08-22T19:49:32
2023-08-22T19:49:32
34,704,822
179
51
NOASSERTION
2023-09-06T14:41:31
2015-04-28T02:59:19
C
UTF-8
C
false
false
955
c
page_020.c
/* Profile chooser */ #include "e_wizard.h" static const char *profile = NULL; /* EAPI int wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons __UNUSED__) { return 1; } EAPI int wizard_page_shutdown(E_Wizard_Page *pg __UNUSED__) { return 1; } */ EAPI int wizard_page_show(E_Wizard_Page *pg __UNUSED__) { // actually apply profile if (ecore_file_exists("/etc/bodhi/iso") && ecore_file_exists("/usr/share/enlightenment/data/config/ISO/")) { profile = "ISO"; } profile = profile ? profile : "bodhi"; e_config_profile_set(profile); e_config_profile_del(e_config_profile_get()); e_config_load(); e_config_save(); return 0; /* 1 == show ui, and wait for user, 0 == just continue */ } /* EAPI int wizard_page_hide(E_Wizard_Page *pg __UNUSED__) { return 1; } EAPI int wizard_page_apply(E_Wizard_Page *pg __UNUSED__) { return 1; } */
3b08b67b3e3129ef854ac1203eeb46e10739273c
05a4d2bf45b32798d2f6820c4ec001dd8ef13e4a
/tests/multithreaded/mr/rpma_mr_get_ptr.c
58a0ddf6508b1c065a161ab7ebdee3d6c3ef4f1f
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
pmem/rpma
207ee08f465a22341f92c80b15132a9617e57596
93d31224fd69786d4b1ace0084108aa270e4c263
refs/heads/main
2023-09-01T05:29:34.609582
2023-06-13T12:12:10
2023-06-13T12:12:10
240,216,867
115
63
NOASSERTION
2023-09-05T14:31:33
2020-02-13T08:59:31
C
UTF-8
C
false
false
2,749
c
rpma_mr_get_ptr.c
// SPDX-License-Identifier: BSD-3-Clause /* Copyright 2021-2022, Intel Corporation */ /* * rpma_mr_get_ptr.c -- rpma_mr_get_ptr multithreaded test */ #include <stdlib.h> #include <librpma.h> #include "mtt.h" struct prestate { char *addr; struct rpma_peer *peer; void *mr_ptr; struct rpma_mr_local *mr; }; /* * prestate_init -- obtain an ibv_context for a local IP address, create a new peer object, * allocate memory region, register the memory and get the memory region pointer */ static void prestate_init(void *prestate, struct mtt_result *tr) { struct prestate *pr = (struct prestate *)prestate; struct ibv_context *ibv_ctx; void *mr_ptr_exp; int ret; ret = rpma_utils_get_ibv_context(pr->addr, RPMA_UTIL_IBV_CONTEXT_LOCAL, &ibv_ctx); if (ret) { MTT_RPMA_ERR(tr, "rpma_utils_get_ibv_context", ret); return; } ret = rpma_peer_new(ibv_ctx, &pr->peer); if (ret) { MTT_RPMA_ERR(tr, "rpma_peer_new", ret); return; } pr->mr_ptr = mtt_malloc_aligned(KILOBYTE, tr); if (pr->mr_ptr == NULL) goto err_peer_delete; ret = rpma_mr_reg(pr->peer, pr->mr_ptr, KILOBYTE, RPMA_MR_USAGE_READ_SRC, &pr->mr); if (ret) { MTT_RPMA_ERR(tr, "rpma_mr_reg", ret); goto err_free; } ret = rpma_mr_get_ptr(pr->mr, &mr_ptr_exp); if (ret) { MTT_RPMA_ERR(tr, "rpma_mr_get_ptr", ret); goto err_mr_dereg; } if (mr_ptr_exp != pr->mr_ptr) { MTT_ERR_MSG(tr, "mr_ptr_exp != pr->mr_ptr", -1); goto err_mr_dereg; } return; err_mr_dereg: (void) rpma_mr_dereg(&pr->mr); err_free: free(pr->mr_ptr); err_peer_delete: (void) rpma_peer_delete(&pr->peer); } /* * thread -- get the memory region pointer */ static void thread(unsigned id, void *prestate, void *state, struct mtt_result *result) { struct prestate *pr = (struct prestate *)prestate; void *mr_ptr; int ret = rpma_mr_get_ptr(pr->mr, &mr_ptr); if (ret) { MTT_RPMA_ERR(result, "rpma_mr_get_ptr", ret); return; } if (mr_ptr != pr->mr_ptr) MTT_ERR(result, "mr_ptr != pr->mr_ptr", EINVAL); } /* * prestate_fini -- deregister the memory region, free it and delete the peer object */ static void prestate_fini(void *prestate, struct mtt_result *tr) { struct prestate *pr = (struct prestate *)prestate; int ret; ret = rpma_mr_dereg(&pr->mr); if (ret) MTT_RPMA_ERR(tr, "rpma_mr_dereg", ret); free(pr->mr_ptr); ret = rpma_peer_delete(&pr->peer); if (ret) MTT_RPMA_ERR(tr, "rpma_peer_delete", ret); } int main(int argc, char *argv[]) { struct mtt_args args = {0}; if (mtt_parse_args(argc, argv, &args)) return -1; struct prestate prestate = {args.addr, NULL}; struct mtt_test test = { &prestate, prestate_init, NULL, NULL, thread, NULL, NULL, prestate_fini }; return mtt_run(&test, args.threads_num); }
fb1ca5433fb4bbfbec335c2631487c7bb1f57caa
f3eed0234b4d0ad2bbb2abd700cf1e2c7a0e8a1d
/AKWF-c/AKWF_0018/AKWF_1783.h
2d8db374984235e26d6f75c45bb23d4b1c14f3b5
[ "CC0-1.0" ]
permissive
KristofferKarlAxelEkstrand/AKWF-FREE
b2defa1a2d389d309be6dd2e9f968923daf80d1b
cf8171df36e9fec25416b5f568b72a6e2cb69194
refs/heads/master
2023-07-23T18:22:36.939705
2023-07-10T17:14:40
2023-07-10T17:14:40
145,817,187
359
59
CC0-1.0
2023-07-10T17:14:41
2018-08-23T07:26:56
null
UTF-8
C
false
false
4,672
h
AKWF_1783.h
/* Adventure Kid Waveforms (AKWF) converted for use with Teensy Audio Library * * Adventure Kid Waveforms(AKWF) Open waveforms library * https://www.adventurekid.se/akrt/waveforms/adventure-kid-waveforms/ * * This code is in the public domain, CC0 1.0 Universal (CC0 1.0) * https://creativecommons.org/publicdomain/zero/1.0/ * * Converted by Brad Roy, https://github.com/prosper00 */ /* AKWF_1783 256 samples +-----------------------------------------------------------------------------------------------------------------+ | ****** ** * | | *** ****** **** * * ****** | | ** **** * *** *** * ** ** ***** | |** *** * ***** * ** ** * ** | |* ** * ** * * * ** | | * ** * * ** * * | | ** ** * ** ** ** * *| | ***** * * * * ** *| | * ** * * ** **| | * ** ** * ** * | | ** ** * * ** * | | * * * * ***** | | ** ** ** ** * | | * ** ** * | | ** ** *** | +-----------------------------------------------------------------------------------------------------------------+ */ const uint16_t AKWF_1783 [] = { 33299, 35858, 38377, 40466, 42258, 44087, 45713, 47009, 48225, 49236, 50080, 50484, 50740, 50943, 51199, 51378, 51380, 51359, 51298, 51097, 50772, 50415, 50257, 50107, 49933, 49817, 49557, 49284, 49009, 48612, 48333, 48009, 47612, 47267, 46843, 46399, 45831, 45326, 44955, 44443, 43672, 42835, 42135, 41410, 40750, 39280, 36688, 34521, 32412, 30371, 29043, 27978, 27522, 27211, 26742, 26579, 26766, 27388, 28509, 30274, 32354, 34396, 36390, 38160, 39933, 41568, 43038, 44689, 46285, 47570, 48358, 48711, 48699, 48273, 47711, 47120, 46624, 46192, 45430, 44693, 43890, 43047, 42255, 41687, 41577, 41601, 41752, 42050, 42327, 42780, 43118, 43515, 44284, 44873, 45155, 44887, 43871, 40573, 38062, 37705, 35926, 32733, 29499, 26747, 23841, 20747, 17636, 14782, 12212, 9910, 7796, 5838, 4052, 2564, 1490, 608, 87, 13, 288, 813, 1581, 2604, 3865, 5237, 6800, 8537, 10531, 12484, 14557, 16585, 18532, 20467, 22261, 24363, 26577, 30245, 33423, 34726, 36702, 39344, 41824, 43845, 45836, 47798, 49519, 51097, 52437, 53498, 54212, 54705, 55139, 55421, 55446, 55429, 55036, 54492, 53698, 52746, 50804, 47698, 46105, 45043, 42882, 40291, 37781, 35486, 33274, 31012, 28616, 26321, 24275, 22406, 20806, 18552, 15229, 12418, 9809, 7442, 5962, 4808, 4318, 4048, 3738, 3787, 4292, 5218, 6793, 9132, 12062, 15021, 19000, 23798, 26693, 28963, 32282, 36208, 39693, 42553, 44943, 46811, 48157, 48855, 49312, 49593, 49888, 50073, 49811, 49356, 48745, 47950, 47162, 46446, 46145, 45860, 45643, 45408, 45099, 44842, 44453, 43938, 43664, 42600, 40408, 39565, 39211, 37740, 35668, 33681, 31941, 30161, 28337, 26421, 24486, 22539, 20629, 18798, 17232, 15919, 14825, 13886, 13051, 12430, 12148, 12059, 12252, 12887, 13772, 14920, 16162, 17617, 19120, 20836, 22941, 26416, 29366, 31107, };
ff90a1e5522ec256a3560c082c0d84bce09ac127
3f017c2c3a55a2ac783045a23977765862ef4b20
/modules/minilzo/module.c
3b763fa5a7babb68a26b34bf460e30ec3941df6b
[]
no_license
DC-SWAT/DreamShell
8e4310087eb7f8e9bed285b8c66992e4df9c9143
f2551e18c06345fed0f5144245d6380203c20fa6
refs/heads/master
2023-07-09T16:50:05.291266
2023-06-23T05:32:37
2023-06-23T05:32:37
13,268,848
308
94
null
2023-06-23T05:04:53
2013-10-02T10:58:30
C
UTF-8
C
false
false
185
c
module.c
/* DreamShell ##version## module.c - minilzo module Copyright (C)2011-2015 SWAT */ #include "ds.h" #include "minilzo.h" DEFAULT_MODULE_EXPORTS(minilzo);
909f5b8c153e9d08556c3e005a8b49bfd556c39c
3f017c2c3a55a2ac783045a23977765862ef4b20
/modules/ffmpeg/module.c
bcde549987375526b0efe695482aad0367c7e63d
[]
no_license
DC-SWAT/DreamShell
8e4310087eb7f8e9bed285b8c66992e4df9c9143
f2551e18c06345fed0f5144245d6380203c20fa6
refs/heads/master
2023-07-09T16:50:05.291266
2023-06-23T05:32:37
2023-06-23T05:32:37
13,268,848
308
94
null
2023-06-23T05:04:53
2013-10-02T10:58:30
C
UTF-8
C
false
false
3,526
c
module.c
/* DreamShell ##version## module.c - ffmpeg module Copyright (C)2011-2014 SWAT */ #include "ds.h" #include "libavcodec/avcodec.h" #include "libavformat/avformat.h" #include "libavformat/avio.h" DEFAULT_MODULE_HEADER(ffmpeg); static int file_open(URLContext *h, const char *filename, int flags) { file_t fd; int _flags = 0; char fn[NAME_MAX]; char proto[32]; sscanf(filename, "%[a-zA-Z0-9_]:%s", proto, fn); switch(flags) { case URL_RDONLY: _flags = O_RDONLY; break; case URL_WRONLY: _flags = O_WRONLY; break; case URL_RDWR: _flags = O_RDWR; break; default: ds_printf("DS_ERROR_FFMPEG: Uknown file open flag: %08x\n", flags); return -1; } if ((fd = fs_open(fn, _flags)) < 0) { return -1; } h->priv_data = (void*)fd; return 0; } static int file_read(URLContext *h, unsigned char *buf, int size) { return fs_read((file_t)h->priv_data, buf, size); } static int file_write(URLContext *h, unsigned char *buf, int size) { return fs_write((file_t)h->priv_data, buf, size); } static int64_t file_seek(URLContext *h, int64_t pos, int whence) { if(whence == AVSEEK_SIZE) { return fs_total((file_t)h->priv_data); } return fs_seek((file_t)h->priv_data, pos, whence); } static int file_close(URLContext *h) { fs_close((file_t)h->priv_data); return 0; } /* static int file_read_pause(URLContext *h, int pause) { return 0; } static int64_t file_read_seek(URLContext *h, int stream_index, int64_t timestamp, int flags) { return 0; } */ static int file_get_file_handle(URLContext *h) { return (file_t)h->priv_data; } static URLProtocol fs_protocol = { "ds", file_open, file_read, file_write, file_seek, file_close, NULL, NULL, NULL, file_get_file_handle }; int ffplay(const char *filename, const char *force_format); //int sdl_ffplay(const char *filename); int builtin_ffplay_cmd(int argc, char *argv[]) { if(argc == 1) { ds_printf("Usage: %s option args...\n\n" "Options: \n" " -v, --version -Show ffmpeg version\n" //" -s, --sdl -Use SDL_ffmpeg (slow)\n" " -p, --play -Start playing\n\n" "Arguments: \n" " -i --format -Force format detection\n" " -f, --file -File for playing\n\n" "Examples: %s -p -f /cd/file.avi\n", argv[0], argv[0]); return CMD_NO_ARG; } int play = 0, /*use_sdl = 0, */ver = 0; char *file = NULL, *format = NULL; struct cfg_option options[] = { {"play", 'p', NULL, CFG_BOOL, (void *) &play, 0}, //{"sdl", 's', NULL, CFG_BOOL, (void *) &use_sdl, 0}, {"version", 'v', NULL, CFG_BOOL, (void *) &ver, 0}, {"file", 'f', NULL, CFG_STR, (void *) &file, 0}, {"format", 'i', NULL, CFG_STR, (void *) &format, 0}, CFG_END_OF_LIST }; CMD_DEFAULT_ARGS_PARSER(options); if(ver) { ds_printf("DS: ffmpeg v%d.%d.%d build %02x\n", VER_MAJOR, VER_MINOR, VER_MICRO, VER_BUILD); } if(play) { //if(use_sdl) { // sdl_ffplay(file); //} else { ffplay(file, format); //} } return CMD_OK; } int lib_open(klibrary_t *lib) { av_register_all(); av_register_protocol(&fs_protocol); AddCmd("ffplay", "Video/Audio player via ffmpeg", (CmdHandler *) builtin_ffplay_cmd); return nmmgr_handler_add(&ds_ffmpeg_hnd.nmmgr); } int lib_close(klibrary_t *lib) { RemoveCmd(GetCmdByName("ffplay")); return nmmgr_handler_remove(&ds_ffmpeg_hnd.nmmgr); }
11caf3083da7b5b65f5126a089d72a8f56e2b663
9ceacf33fd96913cac7ef15492c126d96cae6911
/sys/net/ppp-comp.h
4991a6b1ec54a29b4865fd306f047f2735253561
[ "BSD-3-Clause" ]
permissive
openbsd/src
ab97ef834fd2d5a7f6729814665e9782b586c130
9e79f3a0ebd11a25b4bff61e900cb6de9e7795e9
refs/heads/master
2023-09-02T18:54:56.624627
2023-09-02T15:16:12
2023-09-02T15:16:12
66,966,208
3,394
1,235
null
2023-08-08T02:42:25
2016-08-30T18:18:25
C
UTF-8
C
false
false
5,902
h
ppp-comp.h
/* $OpenBSD: ppp-comp.h,v 1.8 2002/09/13 00:12:07 deraadt Exp $ */ /* * ppp-comp.h - Definitions for doing PPP packet compression. * * Copyright (c) 1989-2002 Paul Mackerras. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The name(s) of the authors of this software must not be used to * endorse or promote products derived from this software without * prior written permission. * * 4. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by Paul Mackerras * <paulus@samba.org>". * * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef _NET_PPP_COMP_H_ #define _NET_PPP_COMP_H_ /* * The following symbols control whether we include code for * various compression methods. */ #ifndef DO_BSD_COMPRESS #define DO_BSD_COMPRESS 1 /* by default, include BSD-Compress */ #endif #ifndef DO_DEFLATE #define DO_DEFLATE 1 /* by default, include Deflate */ #endif #define DO_PREDICTOR_1 0 #define DO_PREDICTOR_2 0 /* * Structure giving methods for compression/decompression. */ #ifdef PACKETPTR struct compressor { int compress_proto; /* CCP compression protocol number */ /* Allocate space for a compressor (transmit side) */ void *(*comp_alloc)(u_char *options, int opt_len); /* Free space used by a compressor */ void (*comp_free)(void *state); /* Initialize a compressor */ int (*comp_init)(void *state, u_char *options, int opt_len, int unit, int hdrlen, int debug); /* Reset a compressor */ void (*comp_reset)(void *state); /* Compress a packet */ int (*compress)(void *state, PACKETPTR *mret, PACKETPTR mp, int orig_len, int max_len); /* Return compression statistics */ void (*comp_stat)(void *state, struct compstat *stats); /* Allocate space for a decompressor (receive side) */ void *(*decomp_alloc)(u_char *options, int opt_len); /* Free space used by a decompressor */ void (*decomp_free)(void *state); /* Initialize a decompressor */ int (*decomp_init)(void *state, u_char *options, int opt_len, int unit, int hdrlen, int mru, int debug); /* Reset a decompressor */ void (*decomp_reset)(void *state); /* Decompress a packet. */ int (*decompress)(void *state, PACKETPTR mp, PACKETPTR *dmpp); /* Update state for an incompressible packet received */ void (*incomp)(void *state, PACKETPTR mp); /* Return decompression statistics */ void (*decomp_stat)(void *state, struct compstat *stats); }; #endif /* PACKETPTR */ /* * Return values for decompress routine. * We need to make these distinctions so that we can disable certain * useful functionality, namely sending a CCP reset-request as a result * of an error detected after decompression. This is to avoid infringing * a patent held by Motorola. * Don't you just lurve software patents. */ #define DECOMP_OK 0 /* everything went OK */ #define DECOMP_ERROR 1 /* error detected before decomp. */ #define DECOMP_FATALERROR 2 /* error detected after decomp. */ /* * CCP codes. */ #define CCP_CONFREQ 1 #define CCP_CONFACK 2 #define CCP_TERMREQ 5 #define CCP_TERMACK 6 #define CCP_RESETREQ 14 #define CCP_RESETACK 15 /* * Max # bytes for a CCP option */ #define CCP_MAX_OPTION_LENGTH 32 /* * Parts of a CCP packet. */ #define CCP_CODE(dp) ((dp)[0]) #define CCP_ID(dp) ((dp)[1]) #define CCP_LENGTH(dp) (((dp)[2] << 8) + (dp)[3]) #define CCP_HDRLEN 4 #define CCP_OPT_CODE(dp) ((dp)[0]) #define CCP_OPT_LENGTH(dp) ((dp)[1]) #define CCP_OPT_MINLEN 2 /* * Definitions for BSD-Compress. */ #define CI_BSD_COMPRESS 21 /* config. option for BSD-Compress */ #define CILEN_BSD_COMPRESS 3 /* length of config. option */ /* Macros for handling the 3rd byte of the BSD-Compress config option. */ #define BSD_NBITS(x) ((x) & 0x1F) /* number of bits requested */ #define BSD_VERSION(x) ((x) >> 5) /* version of option format */ #define BSD_CURRENT_VERSION 1 /* current version number */ #define BSD_MAKE_OPT(v, n) (((v) << 5) | (n)) #define BSD_MIN_BITS 9 /* smallest code size supported */ #define BSD_MAX_BITS 15 /* largest code size supported */ /* * Definitions for Deflate. */ #define CI_DEFLATE 26 /* config option for Deflate */ #define CI_DEFLATE_DRAFT 24 /* value used in original draft RFC */ #define CILEN_DEFLATE 4 /* length of its config option */ #define DEFLATE_MIN_SIZE 8 #define DEFLATE_MAX_SIZE 15 #define DEFLATE_METHOD_VAL 8 #define DEFLATE_SIZE(x) (((x) >> 4) + DEFLATE_MIN_SIZE) #define DEFLATE_METHOD(x) ((x) & 0x0F) #define DEFLATE_MAKE_OPT(w) ((((w) - DEFLATE_MIN_SIZE) << 4) \ + DEFLATE_METHOD_VAL) #define DEFLATE_CHK_SEQUENCE 0 /* * Definitions for other, as yet unsupported, compression methods. */ #define CI_PREDICTOR_1 1 /* config option for Predictor-1 */ #define CILEN_PREDICTOR_1 2 /* length of its config option */ #define CI_PREDICTOR_2 2 /* config option for Predictor-2 */ #define CILEN_PREDICTOR_2 2 /* length of its config option */ #endif /* _NET_PPP_COMP_H_ */
9deed23f4c597eff5228d58584420870767fc222
28d0f8c01599f8f6c711bdde0b59f9c2cd221203
/sys/arch/hpcmips/hpcmips/mainbus.c
a8b7c4bb41385424ec479e185faa5b78417ba32b
[]
no_license
NetBSD/src
1a9cbc22ed778be638b37869ed4fb5c8dd616166
23ee83f7c0aea0777bd89d8ebd7f0cde9880d13c
refs/heads/trunk
2023-08-31T13:24:58.105962
2023-08-27T15:50:47
2023-08-27T15:50:47
88,439,547
656
348
null
2023-07-20T20:07:24
2017-04-16T20:03:43
null
UTF-8
C
false
false
4,213
c
mainbus.c
/* $NetBSD: mainbus.c,v 1.33 2021/08/07 16:18:54 thorpej Exp $ */ /*- * Copyright (c) 1999 * Shin Takemura and PocketBSD Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the PocketBSD project * and its contributors. * 4. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #include <sys/cdefs.h> __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.33 2021/08/07 16:18:54 thorpej Exp $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/device.h> #include <sys/bus.h> #include <machine/autoconf.h> #include <machine/platid.h> #include <machine/bus_space_hpcmips.h> #include "locators.h" #ifdef DEBUG #define STATIC #else #define STATIC static #endif STATIC int mainbus_match(device_t, cfdata_t, void *); STATIC void mainbus_attach(device_t, device_t, void *); STATIC int mainbus_search(device_t, cfdata_t, const int *, void *); STATIC int mainbus_print(void *, const char *); CFATTACH_DECL_NEW(mainbus, 0, mainbus_match, mainbus_attach, NULL, NULL); STATIC int __mainbus_attached; int mainbus_match(device_t parent, cfdata_t cf, void *aux) { return (__mainbus_attached ? 0 : 1); /* don't attach twice */ } void mainbus_attach(device_t parent, device_t self, void *aux) { static const char * const devnames[] = { /* ATTACH ORDER */ "cpu", /* 1. CPU */ "vrip", "vr4102ip", "vr4122ip", "vr4181ip", /* 2. System BUS */ "txsim", "bivideo", "btnmgr", /* 3. misc */ }; struct mainbus_attach_args ma; int i; __mainbus_attached = 1; printf("\n"); /* system bus_space */ ma.ma_iot = hpcmips_system_bus_space(); hpcmips_init_bus_space((struct bus_space_tag_hpcmips *)ma.ma_iot, NULL, "main bus", 0, 0xffffffff); /* search and attach devices in order */ for (i = 0; i < sizeof(devnames) / sizeof(devnames[0]); i++) { ma.ma_name = devnames[i]; config_search(self, &ma, CFARGS(.search = mainbus_search, .iattr = "mainbus")); } /* APM */ config_found(self, NULL, mainbus_print, CFARGS(.iattr = "hpcapmif")); } int mainbus_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { struct mainbus_attach_args *ma = (void *)aux; int locator = cf->cf_loc[MAINBUSCF_PLATFORM]; /* check device name */ if (strcmp(ma->ma_name, cf->cf_name) != 0) return (0); /* check platform ID in config file */ if (locator != MAINBUSCF_PLATFORM_DEFAULT && !platid_match(&platid, PLATID_DEREFP(locator))) return (0); /* attach device */ if (config_probe(parent, cf, ma)) config_attach(parent, cf, ma, mainbus_print, CFARGS_NONE); return (0); } int mainbus_print(void *aux, const char *pnp) { return (pnp ? QUIET : UNCONF); }
0c1050dc06f035f57ab6f7e352c9dbc1eb414bda
cec37bb3d8dc9e1a4707557ebec00b299cea2ed2
/test/test_ast_node.c
ce0fa8c596e11cb6b60c20b6f71a33dd1d262b6b
[ "Zlib", "LicenseRef-scancode-unknown-license-reference" ]
permissive
Ratstail91/Toy
b5b7ae568360acccd30fbee2a593067410e7e1fa
9dc9316853bc428eb51668fb38e158b51088dfd0
refs/heads/main
2023-08-31T10:38:14.144226
2023-08-29T03:07:22
2023-08-29T03:07:22
158,295,420
201
20
NOASSERTION
2023-08-30T01:43:04
2018-11-19T21:58:43
C
UTF-8
C
false
false
2,944
c
test_ast_node.c
#include "toy_ast_node.h" #include "toy_memory.h" #include "toy_console_colors.h" #include <stdio.h> #include <stdlib.h> //lazy #define ASSERT(test_for_true) if (!(test_for_true)) {\ fprintf(stderr, TOY_CC_ERROR "assert failed: %s\n" TOY_CC_RESET, #test_for_true); \ exit(-1); \ } int main() { //test literals { //test literals char* str = "foobar"; Toy_Literal literal = TOY_TO_STRING_LITERAL(Toy_createRefString(str)); //generate the node Toy_ASTNode* node = NULL; Toy_emitASTNodeLiteral(&node, literal); //check node type ASSERT(node->type == TOY_AST_NODE_LITERAL); //cleanup Toy_freeLiteral(literal); Toy_freeASTNode(node); } //test unary { //generate the child node char* str = "foobar"; Toy_Literal literal = TOY_TO_STRING_LITERAL(Toy_createRefString(str)); Toy_ASTNode* childNode = NULL; Toy_emitASTNodeLiteral(&childNode, literal); //generate the unary node Toy_ASTNode* unary = NULL; Toy_emitASTNodeUnary(&unary, TOY_OP_PRINT, childNode); //check node type ASSERT(unary->type == TOY_AST_NODE_UNARY); //cleanup Toy_freeLiteral(literal); Toy_freeASTNode(unary); } //test binary { //generate the child node char* str = "foobar"; Toy_Literal literal = TOY_TO_STRING_LITERAL(Toy_createRefString(str)); Toy_ASTNode* nodeHandle = NULL; Toy_emitASTNodeLiteral(&nodeHandle, literal); Toy_ASTNode* rhsChildNode = NULL; Toy_emitASTNodeLiteral(&rhsChildNode, literal); //generate the unary node Toy_emitASTNodeBinary(&nodeHandle, rhsChildNode, TOY_OP_PRINT); //check node type ASSERT(nodeHandle->type == TOY_AST_NODE_BINARY); ASSERT(nodeHandle->binary.opcode == TOY_OP_PRINT); //cleanup Toy_freeLiteral(literal); Toy_freeASTNode(nodeHandle); } //TODO: more tests for other AST node types //test compounds { //test compound (dictionary) char* idn = "foobar"; char* str = "hello world"; Toy_ASTNode* dictionary; Toy_ASTNode* left; Toy_ASTNode* right; Toy_Literal identifier = TOY_TO_IDENTIFIER_LITERAL(Toy_createRefString(idn)); Toy_Literal string = TOY_TO_STRING_LITERAL(Toy_createRefString(str)); Toy_emitASTNodeCompound(&dictionary, TOY_LITERAL_DICTIONARY); Toy_emitASTNodeLiteral(&left, identifier); Toy_emitASTNodeLiteral(&right, string); //grow the node if needed if (dictionary->compound.capacity < dictionary->compound.count + 1) { int oldCapacity = dictionary->compound.capacity; dictionary->compound.capacity = TOY_GROW_CAPACITY(oldCapacity); dictionary->compound.nodes = TOY_GROW_ARRAY(Toy_ASTNode, dictionary->compound.nodes, oldCapacity, dictionary->compound.capacity); } //store the left and right in the node Toy_setASTNodePair(&dictionary->compound.nodes[dictionary->compound.count++], left, right); //the real test Toy_freeASTNode(dictionary); Toy_freeLiteral(identifier); Toy_freeLiteral(string); } printf(TOY_CC_NOTICE "All good\n" TOY_CC_RESET); return 0; }
ea058cfc564c90ab37ae9b75812bfe552423d4f6
476ec976648ebb17c7e7df0e944910e3a36e4ea1
/2D/message_board.h
39737c629813fb20028c5ddcffbcc80f6387c9e8
[]
no_license
tom-2015/rpi-ws2812-server
dca65ea96a76301cd11a379ab7cdb4766e8aa89e
e76291fda909487fa199fd4129510dc3440ae4c6
refs/heads/master
2023-01-11T08:48:17.016626
2022-12-31T15:29:00
2022-12-31T15:29:00
30,657,642
161
44
null
2022-12-29T18:17:33
2015-02-11T16:34:19
C
UTF-8
C
false
false
147
h
message_board.h
#ifndef _2D_MESSAGE_BOARD_H #define _2D_MESSAGE_BOARD_H #include "../ws2812svr.h" void message_board(thread_context* context, char* args); #endif
32212a13e1fc65d635b38e6d11e3123a676e5ced
195095d6bea45648ea2d79b134c7c2a2821b1dba
/experiments/timing_agnostic_fpu.c
0b0fc4c7c52704622fda11b4a677695e1da159a3
[ "MIT" ]
permissive
dillonhuff/ahaHLS
bc1c87029db1687228ca1ec96175e0310425fcfe
1d4953bca0db52fed81a2c5f6d4c2df6497865bf
refs/heads/master
2023-02-07T05:50:42.703485
2019-07-23T21:59:53
2019-07-23T21:59:53
152,540,700
106
17
MIT
2023-01-23T14:07:07
2018-10-11T06:18:31
C++
UTF-8
C
false
false
1,118
c
timing_agnostic_fpu.c
struct builtin_fifo_32; struct adder; typedef struct builtin_fifo_32 builtin_fifo_32; typedef struct adder adder; #include <stdint.h> typedef uint8_t bit; int builtin_read_fifo_32(builtin_fifo_32* a); void builtin_write_fifo_32(int f, builtin_fifo_32* a); void builtin_write_port_rst(adder* a, bit val); void builtin_write_port_input_a_stb(adder* a, bit val); void builtin_write_port_input_b_stb(adder* a, bit val); void builtin_write_port_input_a(adder* a, int val); void builtin_write_port_input_b(adder* a, int val); int builtin_read_port_output_z(adder* a); void builtin_fadd(adder* const fpu, builtin_fifo_32* a, builtin_fifo_32* b, builtin_fifo_32* c) { int af = builtin_read_fifo_32(a); int bf = builtin_read_fifo_32(b); builtin_write_port_rst(fpu, 1); builtin_write_port_rst(fpu, 0); builtin_write_port_input_a(fpu, af); builtin_write_port_input_a_stb(fpu, 1); builtin_write_port_input_b(fpu, bf); builtin_write_port_input_b_stb(fpu, 1); int result = builtin_read_port_output_z(fpu); builtin_write_fifo_32(result, c); }
b1b750756eaa8d57ad3baa5c8e5ef32a5d081abc
52c8ed39b32ccc7c0673278c1adea3638797c9ff
/src/external/cairo-1.17.4/cairo-freelist.c
7f2f3b30b811c452b8fa9bedda1d98764602f35d
[ "MIT" ]
permissive
xboot/xboot
0cab7b440b612aa0a4c366025598a53a7ec3adf1
6d6b93947b7fcb8c3924fedb0715c23877eedd5e
refs/heads/master
2023-08-20T05:56:25.149388
2023-07-12T07:38:29
2023-07-12T07:38:29
471,539
765
296
MIT
2023-05-25T09:39:01
2010-01-14T08:25:12
C
UTF-8
C
false
false
5,194
c
cairo-freelist.c
/* * Copyright © 2006 Joonas Pihlaja * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "cairoint.h" #include "cairo-error-private.h" #include "cairo-freelist-private.h" void _cairo_freelist_init (cairo_freelist_t *freelist, unsigned nodesize) { memset (freelist, 0, sizeof (cairo_freelist_t)); freelist->nodesize = nodesize; } void _cairo_freelist_fini (cairo_freelist_t *freelist) { cairo_freelist_node_t *node = freelist->first_free_node; while (node) { cairo_freelist_node_t *next; VG (VALGRIND_MAKE_MEM_DEFINED (node, sizeof (node->next))); next = node->next; free (node); node = next; } } void * _cairo_freelist_alloc (cairo_freelist_t *freelist) { if (freelist->first_free_node) { cairo_freelist_node_t *node; node = freelist->first_free_node; VG (VALGRIND_MAKE_MEM_DEFINED (node, sizeof (node->next))); freelist->first_free_node = node->next; VG (VALGRIND_MAKE_MEM_UNDEFINED (node, freelist->nodesize)); return node; } return _cairo_malloc (freelist->nodesize); } void * _cairo_freelist_calloc (cairo_freelist_t *freelist) { void *node = _cairo_freelist_alloc (freelist); if (node) memset (node, 0, freelist->nodesize); return node; } void _cairo_freelist_free (cairo_freelist_t *freelist, void *voidnode) { cairo_freelist_node_t *node = voidnode; if (node) { node->next = freelist->first_free_node; freelist->first_free_node = node; VG (VALGRIND_MAKE_MEM_UNDEFINED (node, freelist->nodesize)); } } void _cairo_freepool_init (cairo_freepool_t *freepool, unsigned nodesize) { freepool->first_free_node = NULL; freepool->pools = &freepool->embedded_pool; freepool->freepools = NULL; freepool->nodesize = nodesize; freepool->embedded_pool.next = NULL; freepool->embedded_pool.size = sizeof (freepool->embedded_data); freepool->embedded_pool.rem = sizeof (freepool->embedded_data); freepool->embedded_pool.data = freepool->embedded_data; VG (VALGRIND_MAKE_MEM_UNDEFINED (freepool->embedded_data, sizeof (freepool->embedded_data))); } void _cairo_freepool_fini (cairo_freepool_t *freepool) { cairo_freelist_pool_t *pool; pool = freepool->pools; while (pool != &freepool->embedded_pool) { cairo_freelist_pool_t *next = pool->next; free (pool); pool = next; } pool = freepool->freepools; while (pool != NULL) { cairo_freelist_pool_t *next = pool->next; free (pool); pool = next; } VG (VALGRIND_MAKE_MEM_UNDEFINED (freepool, sizeof (freepool))); } void * _cairo_freepool_alloc_from_new_pool (cairo_freepool_t *freepool) { cairo_freelist_pool_t *pool; int poolsize; if (freepool->freepools != NULL) { pool = freepool->freepools; freepool->freepools = pool->next; poolsize = pool->size; } else { if (freepool->pools != &freepool->embedded_pool) poolsize = 2 * freepool->pools->size; else poolsize = (128 * freepool->nodesize + 8191) & -8192; pool = _cairo_malloc (sizeof (cairo_freelist_pool_t) + poolsize); if (unlikely (pool == NULL)) return pool; pool->size = poolsize; } pool->next = freepool->pools; freepool->pools = pool; pool->rem = poolsize - freepool->nodesize; pool->data = (uint8_t *) (pool + 1) + freepool->nodesize; VG (VALGRIND_MAKE_MEM_UNDEFINED (pool->data, pool->rem)); return pool + 1; } cairo_status_t _cairo_freepool_alloc_array (cairo_freepool_t *freepool, int count, void **array) { int i; for (i = 0; i < count; i++) { cairo_freelist_node_t *node; node = freepool->first_free_node; if (likely (node != NULL)) { VG (VALGRIND_MAKE_MEM_DEFINED (node, sizeof (node->next))); freepool->first_free_node = node->next; VG (VALGRIND_MAKE_MEM_UNDEFINED (node, freepool->nodesize)); } else { node = _cairo_freepool_alloc_from_pool (freepool); if (unlikely (node == NULL)) goto CLEANUP; } array[i] = node; } return CAIRO_STATUS_SUCCESS; CLEANUP: while (i--) _cairo_freepool_free (freepool, array[i]); return _cairo_error (CAIRO_STATUS_NO_MEMORY); }
cb8196286f268289c09769d181d6c90931c86ec3
fb0f9abad373cd635c2635bbdf491ea0f32da5ff
/src/native/public/mono/metadata/details/threads-types.h
d79d0abe045d477e1b6f693dfc9ed6dc9cb5d914
[ "MIT" ]
permissive
dotnet/runtime
f6fd23936752e202f8e4d6d94f3a4f3b0e77f58f
47bb554d298e1e34c4e3895d7731e18ad1c47d02
refs/heads/main
2023-09-03T15:35:46.493337
2023-09-03T08:13:23
2023-09-03T08:13:23
210,716,005
13,765
5,179
MIT
2023-09-14T21:58:52
2019-09-24T23:36:39
C#
UTF-8
C
false
false
636
h
threads-types.h
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // #ifndef _MONO_METADATA_DETAILS_THREADS_TYPES_H #define _MONO_METADATA_DETAILS_THREADS_TYPES_H #include <mono/utils/details/mono-publib-types.h> #include <mono/metadata/details/object-types.h> #include <mono/metadata/details/appdomain-types.h> MONO_BEGIN_DECLS /* This callback should return TRUE if the runtime must wait for the thread, FALSE otherwise */ typedef mono_bool (*MonoThreadManageCallback) (MonoThread* thread); MONO_END_DECLS #endif /* _MONO_METADATA_DETAILS_THREADS_TYPES_H */
3537a065c8ecdceaba092cad5d2107f8f7a6a09f
7c857119fe1505b1d80d6e62969661c06dc1a2f4
/rEFIt_UEFI/Platform/nvidia.h
d903cc2a04cf1ad51a8bcefa1291739b20d71400
[ "BSD-2-Clause" ]
permissive
CloverHackyColor/CloverBootloader
7042ca7dd6b513d22be591a295e49071ae1482ee
2711170df4f60b2ae5aa20add3e00f35cf57b7e5
refs/heads/master
2023-08-30T22:14:34.590134
2023-08-27T19:14:02
2023-08-27T19:14:02
205,810,121
4,734
770
BSD-2-Clause
2023-09-03T12:41:33
2019-09-02T08:22:14
C
UTF-8
C
false
false
6,648
h
nvidia.h
/* * NVidia injector * * Copyright (C) 2009 Jasmin Fazlic, iNDi * * NVidia injector modified by Fabio (ErmaC) on May 2012, * for allow the cosmetics injection also based on SubVendorID and SubDeviceID. * * NVidia injector is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * NVidia driver and injector is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NVidia injector. If not, see <http://www.gnu.org/licenses/>. * * Alternatively you can choose to comply with APSL * * DCB-Table parsing is based on software (nouveau driver) originally distributed under following license: * * * Copyright 2005-2006 Erik Waling * Copyright 2006 Stephane Marchesin * Copyright 2007-2009 Stuart Bennett * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef __LIBSAIO_NVIDIA_H #define __LIBSAIO_NVIDIA_H //#include "device_inject.h" //#include "card_vlist.h" #include "../include/Pci.h" extern CHAR8* gDeviceProperties; //XBool setup_nvidia_devprop(pci_dt_t *nvda_dev); typedef struct nvidia_pci_info_t { UINT32 device; // VendorID + DeviceID CONST CHAR8 *name_model; } nvidia_pci_info_t; typedef struct nvidia_card_info_t { UINT32 device; // VendorID + DeviceID UINT32 subdev; // SubdeviceID + SubvendorID CONST CHAR8 *name_model; UINT8 *custom_NVCAP; } nvidia_card_info_t; #define DCB_MAX_NUM_ENTRIES 16 #define DCB_MAX_NUM_I2C_ENTRIES 16 #define DCB_LOC_ON_CHIP 0 struct bios { UINT16 signature; /* 0x55AA */ UINT8 size; /* Size in multiples of 512 */ }; #define NVIDIA_ROM_SIZE 0x20000 #define PATCH_ROM_SUCCESS 1 #define PATCH_ROM_SUCCESS_HAS_LVDS 2 #define PATCH_ROM_FAILED 0 #define MAX_NUM_DCB_ENTRIES 16 #define TYPE_GROUPED 0xff #define NVCAP_LEN ( sizeof(default_NVCAP) / sizeof(UINT8) ) #define NVPM_LEN ( sizeof(default_NVPM) / sizeof(UINT8) ) #define DCFG0_LEN ( sizeof(default_dcfg_0) / sizeof(UINT8) ) #define DCFG1_LEN ( sizeof(default_dcfg_1) / sizeof(UINT8) ) #define NV_SUB_IDS 0x00000000 #define NV_PMC_OFFSET 0x000000 #define NV_PMC_SIZE 0x2ffff #define NV_PDISPLAY_OFFSET 0x610000 #define NV_PDISPLAY_SIZE 0x10000 #define NV_PROM_OFFSET 0x300000 #define NV_PROM_SIZE 0x0001ffff #define NV_PRAMIN_OFFSET 0x00700000 #define NV_PRAMIN_SIZE 0x00100000 #define NV04_PFB_FIFO_DATA 0x0010020c #define NV10_PFB_FIFO_DATA_RAM_AMOUNT_MB_MASK 0xfff00000 #define NV10_PFB_FIFO_DATA_RAM_AMOUNT_MB_SHIFT 20 #define NVC0_MEM_CTRLR_COUNT 0x00121c74 #define NVC0_MEM_CTRLR_RAM_AMOUNT 0x0010f20c #define NV_PBUS_PCI_NV_20 0x00001850 #define NV_PBUS_PCI_NV_20_ROM_SHADOW_DISABLED (0 << 0) #define NV_PBUS_PCI_NV_20_ROM_SHADOW_ENABLED (1 << 0) #define NV_ARCH_03 0x03 #define NV_ARCH_04 0x04 #define NV_ARCH_10 0x10 #define NV_ARCH_20 0x20 #define NV_ARCH_30 0x30 #define NV_ARCH_40 0x40 #define NV_ARCH_TESLA 0x50 #define NV_ARCH_FERMI1 0xC0 // Fermi #define NV_ARCH_FERMI2 0xD0 // Fermi #define NV_ARCH_KEPLER1 0xE0 // Kepler - GT 6XX/GTX 6XX/GTX 6XX Ti #define NV_ARCH_KEPLER2 0xF0 // Kepler - Tesla K20X/GTX 780/GTX TITAN/TITAN LE #define NV_ARCH_KEPLER3 0x100 // Kepler - GT 630.Rev2/635/640.Rev2/710/720/730/740 #define NV_ARCH_MAXWELL1 0x110 // Maxwell - GTX 745/750/750 Ti #define NV_ARCH_MAXWELL2 0x120 // Maxwell - GTX 9XX/9XX Ti/TITAN X #define NV_ARCH_PASCAL 0x130 // Pascal - GTX 10XX/10XX Ti/TITAN X/Xp #define NV_ARCH_VOLTA 0x140 // Volta - Titan V/Quadro GV100 #define NV_ARCH_TURING 0x160 // Turing - GTX 16xx/RTX 20xx #define CHIPSET_NV03 0x0010 #define CHIPSET_NV04 0x0020 #define CHIPSET_NV10 0x0100 #define CHIPSET_NV11 0x0110 #define CHIPSET_NV15 0x0150 #define CHIPSET_NV17 0x0170 #define CHIPSET_NV18 0x0180 #define CHIPSET_NFORCE 0x01A0 #define CHIPSET_NFORCE2 0x01F0 #define CHIPSET_NV20 0x0200 #define CHIPSET_NV25 0x0250 #define CHIPSET_NV28 0x0280 #define CHIPSET_NV30 0x0300 #define CHIPSET_NV31 0x0310 #define CHIPSET_NV34 0x0320 #define CHIPSET_NV35 0x0330 #define CHIPSET_NV36 0x0340 #define CHIPSET_NV40 0x0040 #define CHIPSET_NV41 0x00C0 #define CHIPSET_NV43 0x0140 #define CHIPSET_NV44 0x0160 #define CHIPSET_NV44A 0x0220 #define CHIPSET_NV45 0x0210 #define CHIPSET_NV50 0x0190 #define CHIPSET_NV84 0x0400 #define CHIPSET_MISC_BRIDGED 0x00F0 #define CHIPSET_G70 0x0090 #define CHIPSET_G71 0x0290 #define CHIPSET_G72 0x01D0 #define CHIPSET_G73 0x0390 // integrated GeForces (6100, 6150) #define CHIPSET_C51 0x0240 // variant of C51, seems based on a G70 design #define CHIPSET_C512 0x03D0 #define CHIPSET_G73_BRIDGED 0x02E0 #ifndef DONT_DEFINE_GLOBALS extern UINT8 default_NVCAP[]; #endif extern const UINT8 default_NVPM[]; extern const UINT8 default_dcfg_0[]; extern const UINT8 default_dcfg_1[]; XBool setup_nvidia_devprop ( pci_dt_t *nvda_dev ); CONST CHAR8* get_nvidia_model(UINT32 device_id, UINT32 subsys_id); #endif /* !__LIBSAIO_NVIDIA_H */
c18669b40ac8bb61ca42523b499809ad884a4a65
9ceacf33fd96913cac7ef15492c126d96cae6911
/sys/dev/ic/adv.c
e32f1da5b26c5287d501296e76b080bc1a3217d5
[]
no_license
openbsd/src
ab97ef834fd2d5a7f6729814665e9782b586c130
9e79f3a0ebd11a25b4bff61e900cb6de9e7795e9
refs/heads/master
2023-09-02T18:54:56.624627
2023-09-02T15:16:12
2023-09-02T15:16:12
66,966,208
3,394
1,235
null
2023-08-08T02:42:25
2016-08-30T18:18:25
C
UTF-8
C
false
false
20,698
c
adv.c
/* $OpenBSD: adv.c,v 1.53 2022/04/16 19:19:58 naddy Exp $ */ /* $NetBSD: adv.c,v 1.6 1998/10/28 20:39:45 dante Exp $ */ /* * Generic driver for the Advanced Systems Inc. Narrow SCSI controllers * * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * * Author: Baldassare Dante Profeta <dante@mclink.it> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> #include <sys/errno.h> #include <sys/ioctl.h> #include <sys/device.h> #include <sys/malloc.h> #include <sys/buf.h> #include <machine/bus.h> #include <machine/intr.h> #include <scsi/scsi_all.h> #include <scsi/scsiconf.h> #include <dev/ic/adv.h> #include <dev/ic/advlib.h> /* #define ASC_DEBUG */ /******************************************************************************/ static int adv_alloc_ccbs(ASC_SOFTC *); static int adv_create_ccbs(ASC_SOFTC *, ADV_CCB *, int); void adv_ccb_free(void *, void *); static void adv_reset_ccb(ADV_CCB *); static int adv_init_ccb(ASC_SOFTC *, ADV_CCB *); void *adv_ccb_alloc(void *); static void adv_queue_ccb(ASC_SOFTC *, ADV_CCB *); static void adv_start_ccbs(ASC_SOFTC *); static u_int8_t *adv_alloc_overrunbuf(char *dvname, bus_dma_tag_t); static void adv_scsi_cmd(struct scsi_xfer *); static void adv_narrow_isr_callback(ASC_SOFTC *, ASC_QDONE_INFO *); static int adv_poll(ASC_SOFTC *, struct scsi_xfer *, int); static void adv_timeout(void *); static void adv_watchdog(void *); /******************************************************************************/ struct cfdriver adv_cd = { NULL, "adv", DV_DULL }; const struct scsi_adapter adv_switch = { adv_scsi_cmd, NULL, NULL, NULL, NULL }; #define ADV_ABORT_TIMEOUT 2000 /* time to wait for abort (mSec) */ #define ADV_WATCH_TIMEOUT 1000 /* time to wait for watchdog (mSec) */ /******************************************************************************/ /* Control Blocks routines */ /******************************************************************************/ static int adv_alloc_ccbs(ASC_SOFTC *sc) { bus_dma_segment_t seg; int error, rseg; /* * Allocate the control blocks. */ if ((error = bus_dmamem_alloc(sc->sc_dmat, sizeof(struct adv_control), NBPG, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT | BUS_DMA_ZERO)) != 0) { printf("%s: unable to allocate control structures," " error = %d\n", sc->sc_dev.dv_xname, error); return (error); } if ((error = bus_dmamem_map(sc->sc_dmat, &seg, rseg, sizeof(struct adv_control), (caddr_t *) & sc->sc_control, BUS_DMA_NOWAIT | BUS_DMA_COHERENT)) != 0) { printf("%s: unable to map control structures, error = %d\n", sc->sc_dev.dv_xname, error); return (error); } /* * Create and load the DMA map used for the control blocks. */ if ((error = bus_dmamap_create(sc->sc_dmat, sizeof(struct adv_control), 1, sizeof(struct adv_control), 0, BUS_DMA_NOWAIT, &sc->sc_dmamap_control)) != 0) { printf("%s: unable to create control DMA map, error = %d\n", sc->sc_dev.dv_xname, error); return (error); } if ((error = bus_dmamap_load(sc->sc_dmat, sc->sc_dmamap_control, sc->sc_control, sizeof(struct adv_control), NULL, BUS_DMA_NOWAIT)) != 0) { printf("%s: unable to load control DMA map, error = %d\n", sc->sc_dev.dv_xname, error); return (error); } return (0); } /* * Create a set of ccbs and add them to the free list. Called once * by adv_init(). We return the number of CCBs successfully created. * CCB data is already zeroed on allocation. */ static int adv_create_ccbs(ASC_SOFTC *sc, ADV_CCB *ccbstore, int count) { ADV_CCB *ccb; int i, error; for (i = 0; i < count; i++) { ccb = &ccbstore[i]; if ((error = adv_init_ccb(sc, ccb)) != 0) { printf("%s: unable to initialize ccb, error = %d\n", sc->sc_dev.dv_xname, error); return (i); } TAILQ_INSERT_TAIL(&sc->sc_free_ccb, ccb, chain); } return (i); } /* * A ccb is put onto the free list. */ void adv_ccb_free(void *xsc, void *xccb) { ASC_SOFTC *sc = xsc; ADV_CCB *ccb = xccb; adv_reset_ccb(ccb); mtx_enter(&sc->sc_ccb_mtx); TAILQ_INSERT_HEAD(&sc->sc_free_ccb, ccb, chain); mtx_leave(&sc->sc_ccb_mtx); } static void adv_reset_ccb(ADV_CCB *ccb) { ccb->flags = 0; } static int adv_init_ccb(ASC_SOFTC *sc, ADV_CCB *ccb) { int error; /* * Create the DMA map for this CCB. */ error = bus_dmamap_create(sc->sc_dmat, (ASC_MAX_SG_LIST - 1) * PAGE_SIZE, ASC_MAX_SG_LIST, (ASC_MAX_SG_LIST - 1) * PAGE_SIZE, 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &ccb->dmamap_xfer); if (error) { printf("%s: unable to create DMA map, error = %d\n", sc->sc_dev.dv_xname, error); return (error); } adv_reset_ccb(ccb); return (0); } /* * Get a free ccb */ void * adv_ccb_alloc(void *xsc) { ASC_SOFTC *sc = xsc; ADV_CCB *ccb; mtx_enter(&sc->sc_ccb_mtx); ccb = TAILQ_FIRST(&sc->sc_free_ccb); if (ccb) { TAILQ_REMOVE(&sc->sc_free_ccb, ccb, chain); ccb->flags |= CCB_ALLOC; } mtx_leave(&sc->sc_ccb_mtx); return (ccb); } /* * Queue a CCB to be sent to the controller, and send it if possible. */ static void adv_queue_ccb(ASC_SOFTC *sc, ADV_CCB *ccb) { timeout_set(&ccb->xs->stimeout, adv_timeout, ccb); TAILQ_INSERT_TAIL(&sc->sc_waiting_ccb, ccb, chain); adv_start_ccbs(sc); } static void adv_start_ccbs(ASC_SOFTC *sc) { ADV_CCB *ccb; struct scsi_xfer *xs; while ((ccb = TAILQ_FIRST(&sc->sc_waiting_ccb)) != NULL) { xs = ccb->xs; if (ccb->flags & CCB_WATCHDOG) timeout_del(&xs->stimeout); if (AscExeScsiQueue(sc, &ccb->scsiq) == ASC_BUSY) { ccb->flags |= CCB_WATCHDOG; timeout_set(&xs->stimeout, adv_watchdog, ccb); timeout_add_msec(&xs->stimeout, ADV_WATCH_TIMEOUT); break; } TAILQ_REMOVE(&sc->sc_waiting_ccb, ccb, chain); if ((ccb->xs->flags & SCSI_POLL) == 0) { timeout_set(&xs->stimeout, adv_timeout, ccb); timeout_add_msec(&xs->stimeout, ccb->timeout); } } } /******************************************************************************/ /* DMA able memory allocation routines */ /******************************************************************************/ /* * Allocate a DMA able memory for overrun_buffer. * This memory can be safely shared among all the AdvanSys boards. */ u_int8_t * adv_alloc_overrunbuf(char *dvname, bus_dma_tag_t dmat) { static u_int8_t *overrunbuf = NULL; bus_dmamap_t ovrbuf_dmamap; bus_dma_segment_t seg; int rseg, error; /* * if an overrun buffer has been already allocated don't allocate it * again. Instead return the address of the allocated buffer. */ if (overrunbuf) return (overrunbuf); if ((error = bus_dmamem_alloc(dmat, ASC_OVERRUN_BSIZE, NBPG, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) != 0) { printf("%s: unable to allocate overrun buffer, error = %d\n", dvname, error); return (0); } if ((error = bus_dmamem_map(dmat, &seg, rseg, ASC_OVERRUN_BSIZE, (caddr_t *) & overrunbuf, BUS_DMA_NOWAIT | BUS_DMA_COHERENT)) != 0) { printf("%s: unable to map overrun buffer, error = %d\n", dvname, error); bus_dmamem_free(dmat, &seg, 1); return (0); } if ((error = bus_dmamap_create(dmat, ASC_OVERRUN_BSIZE, 1, ASC_OVERRUN_BSIZE, 0, BUS_DMA_NOWAIT, &ovrbuf_dmamap)) != 0) { printf("%s: unable to create overrun buffer DMA map," " error = %d\n", dvname, error); bus_dmamem_unmap(dmat, overrunbuf, ASC_OVERRUN_BSIZE); bus_dmamem_free(dmat, &seg, 1); return (0); } if ((error = bus_dmamap_load(dmat, ovrbuf_dmamap, overrunbuf, ASC_OVERRUN_BSIZE, NULL, BUS_DMA_NOWAIT)) != 0) { printf("%s: unable to load overrun buffer DMA map," " error = %d\n", dvname, error); bus_dmamap_destroy(dmat, ovrbuf_dmamap); bus_dmamem_unmap(dmat, overrunbuf, ASC_OVERRUN_BSIZE); bus_dmamem_free(dmat, &seg, 1); return (0); } return (overrunbuf); } /******************************************************************************/ /* SCSI layer interfacing routines */ /******************************************************************************/ int adv_init(ASC_SOFTC *sc) { int warn; if (!AscFindSignature(sc->sc_iot, sc->sc_ioh)) panic("adv_init: adv_find_signature failed"); /* * Read the board configuration */ AscInitASC_SOFTC(sc); warn = AscInitFromEEP(sc); if (warn) { printf("%s -get: ", sc->sc_dev.dv_xname); switch (warn) { case -1: printf("Chip is not halted\n"); break; case -2: printf("Couldn't get MicroCode Start" " address\n"); break; case ASC_WARN_IO_PORT_ROTATE: printf("I/O port address modified\n"); break; case ASC_WARN_AUTO_CONFIG: printf("I/O port increment switch enabled\n"); break; case ASC_WARN_EEPROM_CHKSUM: printf("EEPROM checksum error\n"); break; case ASC_WARN_IRQ_MODIFIED: printf("IRQ modified\n"); break; case ASC_WARN_CMD_QNG_CONFLICT: printf("tag queuing enabled w/o disconnects\n"); break; default: printf("unknown warning %d\n", warn); } } if (sc->scsi_reset_wait > ASC_MAX_SCSI_RESET_WAIT) sc->scsi_reset_wait = ASC_MAX_SCSI_RESET_WAIT; /* * Modify the board configuration */ warn = AscInitFromASC_SOFTC(sc); if (warn) { printf("%s -set: ", sc->sc_dev.dv_xname); switch (warn) { case ASC_WARN_CMD_QNG_CONFLICT: printf("tag queuing enabled w/o disconnects\n"); break; case ASC_WARN_AUTO_CONFIG: printf("I/O port increment switch enabled\n"); break; default: printf("unknown warning %d\n", warn); } } sc->isr_callback = (ulong) adv_narrow_isr_callback; if (!(sc->overrun_buf = adv_alloc_overrunbuf(sc->sc_dev.dv_xname, sc->sc_dmat))) { return (1); } return (0); } void adv_attach(ASC_SOFTC *sc) { struct scsibus_attach_args saa; int i, error; /* * Initialize board RISC chip and enable interrupts. */ switch (AscInitDriver(sc)) { case 0: /* AllOK */ break; case 1: panic("%s: bad signature", sc->sc_dev.dv_xname); break; case 2: panic("%s: unable to load MicroCode", sc->sc_dev.dv_xname); break; case 3: panic("%s: unable to initialize MicroCode", sc->sc_dev.dv_xname); break; default: panic("%s: unable to initialize board RISC chip", sc->sc_dev.dv_xname); } TAILQ_INIT(&sc->sc_free_ccb); TAILQ_INIT(&sc->sc_waiting_ccb); mtx_init(&sc->sc_ccb_mtx, IPL_BIO); scsi_iopool_init(&sc->sc_iopool, sc, adv_ccb_alloc, adv_ccb_free); /* * Allocate the Control Blocks. */ error = adv_alloc_ccbs(sc); if (error) return; /* (error) */ ; /* * Create and initialize the Control Blocks. */ i = adv_create_ccbs(sc, sc->sc_control->ccbs, ADV_MAX_CCB); if (i == 0) { printf("%s: unable to create control blocks\n", sc->sc_dev.dv_xname); return; /* (ENOMEM) */ ; } else if (i != ADV_MAX_CCB) { printf("%s: WARNING: only %d of %d control blocks created\n", sc->sc_dev.dv_xname, i, ADV_MAX_CCB); } saa.saa_adapter_softc = sc; saa.saa_adapter_target = sc->chip_scsi_id; saa.saa_adapter = &adv_switch; saa.saa_adapter_buswidth = 7; saa.saa_luns = 8; saa.saa_openings = 4; saa.saa_pool = &sc->sc_iopool; saa.saa_wwpn = saa.saa_wwnn = 0; saa.saa_quirks = saa.saa_flags = 0; config_found(&sc->sc_dev, &saa, scsiprint); } /* * start a scsi operation given the command and the data address. Also needs * the unit, target and lu. */ static void adv_scsi_cmd(struct scsi_xfer *xs) { struct scsi_link *sc_link = xs->sc_link; ASC_SOFTC *sc = sc_link->bus->sb_adapter_softc; bus_dma_tag_t dmat = sc->sc_dmat; ADV_CCB *ccb; int flags, error, nsegs; /* * get a ccb to use. If the transfer * is from a buf (possibly from interrupt time) * then we can't allow it to sleep */ flags = xs->flags; ccb = xs->io; ccb->xs = xs; ccb->timeout = xs->timeout; /* * Build up the request */ memset(&ccb->scsiq, 0, sizeof(ASC_SCSI_Q)); ccb->scsiq.q2.ccb_ptr = (ulong) ccb; ccb->scsiq.cdbptr = (u_int8_t *)&xs->cmd; ccb->scsiq.q2.cdb_len = xs->cmdlen; ccb->scsiq.q1.target_id = ASC_TID_TO_TARGET_ID(sc_link->target); ccb->scsiq.q1.target_lun = sc_link->lun; ccb->scsiq.q2.target_ix = ASC_TIDLUN_TO_IX(sc_link->target, sc_link->lun); ccb->scsiq.q1.sense_addr = sc->sc_dmamap_control->dm_segs[0].ds_addr + ADV_CCB_OFF(ccb) + offsetof(struct adv_ccb, scsi_sense); ccb->scsiq.q1.sense_len = sizeof(struct scsi_sense_data); /* * If there are any outstanding requests for the current target, * then every 255th request send an ORDERED request. This heuristic * tries to retain the benefit of request sorting while preventing * request starvation. 255 is the max number of tags or pending commands * a device may have outstanding. */ sc->reqcnt[sc_link->target]++; if ((sc->reqcnt[sc_link->target] > 0) && (sc->reqcnt[sc_link->target] % 255) == 0) { ccb->scsiq.q2.tag_code = M2_QTAG_MSG_ORDERED; } else { ccb->scsiq.q2.tag_code = M2_QTAG_MSG_SIMPLE; } if (xs->datalen) { /* * Map the DMA transfer. */ error = bus_dmamap_load(dmat, ccb->dmamap_xfer, xs->data, xs->datalen, NULL, (flags & SCSI_NOSLEEP) ? BUS_DMA_NOWAIT : BUS_DMA_WAITOK); if (error) { if (error == EFBIG) { printf("%s: adv_scsi_cmd, more than %d dma" " segments\n", sc->sc_dev.dv_xname, ASC_MAX_SG_LIST); } else { printf("%s: adv_scsi_cmd, error %d loading" " dma map\n", sc->sc_dev.dv_xname, error); } xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); return; } bus_dmamap_sync(dmat, ccb->dmamap_xfer, 0, ccb->dmamap_xfer->dm_mapsize, ((flags & SCSI_DATA_IN) ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE)); memset(&ccb->sghead, 0, sizeof(ASC_SG_HEAD)); for (nsegs = 0; nsegs < ccb->dmamap_xfer->dm_nsegs; nsegs++) { ccb->sghead.sg_list[nsegs].addr = ccb->dmamap_xfer->dm_segs[nsegs].ds_addr; ccb->sghead.sg_list[nsegs].bytes = ccb->dmamap_xfer->dm_segs[nsegs].ds_len; } ccb->sghead.entry_cnt = ccb->scsiq.q1.sg_queue_cnt = ccb->dmamap_xfer->dm_nsegs; ccb->scsiq.q1.cntl |= ASC_QC_SG_HEAD; ccb->scsiq.sg_head = &ccb->sghead; ccb->scsiq.q1.data_addr = 0; ccb->scsiq.q1.data_cnt = 0; } else { /* * No data xfer, use non S/G values. */ ccb->scsiq.q1.data_addr = 0; ccb->scsiq.q1.data_cnt = 0; } #ifdef ASC_DEBUG printf("id = %d, lun = %d, cmd = %d, ccb = 0x%lX \n", sc_link->target, sc_link->lun, xs->cmd.opcode, (unsigned long)ccb); #endif /* * Usually return SUCCESSFULLY QUEUED */ if ((flags & SCSI_POLL) == 0) return; /* * If we can't use interrupts, poll on completion */ if (adv_poll(sc, xs, ccb->timeout)) { adv_timeout(ccb); if (adv_poll(sc, xs, ccb->timeout)) adv_timeout(ccb); } } int adv_intr(void *arg) { ASC_SOFTC *sc = arg; #ifdef ASC_DEBUG int int_pend = FALSE; if(ASC_IS_INT_PENDING(sc->sc_iot, sc->sc_ioh)) { int_pend = TRUE; printf("ISR - "); } #endif AscISR(sc); #ifdef ASC_DEBUG if(int_pend) printf("\n"); #endif return (1); } /* * Poll a particular unit, looking for a particular xs */ static int adv_poll(ASC_SOFTC *sc, struct scsi_xfer *xs, int count) { int s; /* timeouts are in msec, so we loop in 1000 usec cycles */ while (count) { s = splbio(); adv_intr(sc); splx(s); if (xs->flags & ITSDONE) return (0); delay(1000); /* only happens in boot so ok */ count--; } return (1); } static void adv_timeout(void *arg) { ADV_CCB *ccb = arg; struct scsi_xfer *xs = ccb->xs; struct scsi_link *sc_link = xs->sc_link; ASC_SOFTC *sc = sc_link->bus->sb_adapter_softc; int s; sc_print_addr(sc_link); printf("timed out"); s = splbio(); /* * If it has been through before, then a previous abort has failed, * don't try abort again, reset the bus instead. */ if (ccb->flags & CCB_ABORT) { /* abort timed out */ printf(" AGAIN. Resetting Bus\n"); /* Lets try resetting the bus! */ if (AscResetBus(sc) == ASC_ERROR) { ccb->timeout = sc->scsi_reset_wait; adv_queue_ccb(sc, ccb); } } else { /* abort the operation that has timed out */ printf("\n"); AscAbortCCB(sc, (u_int32_t) ccb); ccb->xs->error = XS_TIMEOUT; ccb->timeout = ADV_ABORT_TIMEOUT; ccb->flags |= CCB_ABORT; adv_queue_ccb(sc, ccb); } splx(s); } static void adv_watchdog(void *arg) { ADV_CCB *ccb = arg; struct scsi_xfer *xs = ccb->xs; struct scsi_link *sc_link = xs->sc_link; ASC_SOFTC *sc = sc_link->bus->sb_adapter_softc; int s; s = splbio(); ccb->flags &= ~CCB_WATCHDOG; adv_start_ccbs(sc); splx(s); } /******************************************************************************/ /* NARROW and WIDE boards Interrupt callbacks */ /******************************************************************************/ /* * adv_narrow_isr_callback() - Second Level Interrupt Handler called by AscISR() * * Interrupt callback function for the Narrow SCSI Asc Library. */ static void adv_narrow_isr_callback(ASC_SOFTC *sc, ASC_QDONE_INFO *qdonep) { bus_dma_tag_t dmat = sc->sc_dmat; ADV_CCB *ccb = (ADV_CCB *) qdonep->d2.ccb_ptr; struct scsi_xfer *xs = ccb->xs; struct scsi_sense_data *s1, *s2; #ifdef ASC_DEBUG printf(" - ccb=0x%lx, id=%d, lun=%d, cmd=%d, ", (unsigned long)ccb, xs->sc_link->target, xs->sc_link->lun, xs->cmd.opcode); #endif timeout_del(&xs->stimeout); /* * If we were a data transfer, unload the map that described * the data buffer. */ if (xs->datalen) { bus_dmamap_sync(dmat, ccb->dmamap_xfer, 0, ccb->dmamap_xfer->dm_mapsize, ((xs->flags & SCSI_DATA_IN) ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE)); bus_dmamap_unload(dmat, ccb->dmamap_xfer); } if ((ccb->flags & CCB_ALLOC) == 0) { panic("%s: exiting ccb not allocated!", sc->sc_dev.dv_xname); return; } /* * 'qdonep' contains the command's ending status. */ #ifdef ASC_DEBUG printf("d_s=%d, h_s=%d", qdonep->d3.done_stat, qdonep->d3.host_stat); #endif switch (qdonep->d3.done_stat) { case ASC_QD_NO_ERROR: switch (qdonep->d3.host_stat) { case ASC_QHSTA_NO_ERROR: xs->error = XS_NOERROR; xs->resid = 0; break; default: /* QHSTA error occurred */ xs->error = XS_DRIVER_STUFFUP; break; } /* * If an INQUIRY command completed successfully, then call * the AscInquiryHandling() function to patch bugged boards. */ if ((xs->cmd.opcode == SCSICMD_Inquiry) && (xs->sc_link->lun == 0) && (xs->datalen - qdonep->remain_bytes) >= 8) { AscInquiryHandling(sc, xs->sc_link->target & 0x7, (ASC_SCSI_INQUIRY *) xs->data); } break; case ASC_QD_WITH_ERROR: switch (qdonep->d3.host_stat) { case ASC_QHSTA_NO_ERROR: if (qdonep->d3.scsi_stat == SS_CHK_CONDITION) { s1 = &ccb->scsi_sense; s2 = &xs->sense; *s2 = *s1; xs->error = XS_SENSE; } else { xs->error = XS_DRIVER_STUFFUP; } break; default: /* QHSTA error occurred */ xs->error = XS_DRIVER_STUFFUP; break; } break; case ASC_QD_ABORTED_BY_HOST: default: xs->error = XS_DRIVER_STUFFUP; break; } scsi_done(xs); }
572b09d76fda5ef48f3cb22dc1c3cf23404e8a61
8380b5eb12e24692e97480bfa8939a199d067bce
/Carberp Botnet/source - absource/pro/all source/BJWJ/include/qcms/qcmstypes.h
24e66572d73db68ab5de6d3f5bfeef9f9259a2d2
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
RamadhanAmizudin/malware
788ee745b5bb23b980005c2af08f6cb8763981c2
62d0035db6bc9aa279b7c60250d439825ae65e41
refs/heads/master
2023-02-05T13:37:18.909646
2023-01-26T08:43:18
2023-01-26T08:43:18
53,407,812
873
291
null
2023-01-26T08:43:19
2016-03-08T11:44:21
C++
UTF-8
C
false
false
1,954
h
qcmstypes.h
#ifndef QCMS_TYPES_H #define QCMS_TYPES_H #ifdef MOZ_QCMS #include "prtypes.h" /* prtypes.h defines IS_LITTLE_ENDIAN and IS_BIG ENDIAN */ #if defined (__SVR4) && defined (__sun) /* int_types.h gets included somehow, so avoid redefining the types differently */ #include <sys/int_types.h> #else typedef PRInt8 int8_t; typedef PRUint8 uint8_t; typedef PRInt16 int16_t; typedef PRUint16 uint16_t; typedef PRInt32 int32_t; typedef PRUint32 uint32_t; typedef PRInt64 int64_t; typedef PRUint64 uint64_t; #ifdef __OS2__ /* OS/2's stdlib typdefs uintptr_t. So we'll just include that so we don't collide */ #include <stdlib.h> #elif defined(__FreeBSD__) /* FreeBSD typedefs uintptr_t in /usr/include/sys/types.h */ #else typedef PRUptrdiff uintptr_t; #endif #endif #else // MOZ_QCMS #if BYTE_ORDER == LITTLE_ENDIAN #define IS_LITTLE_ENDIAN #elif BYTE_ORDER == BIG_ENDIAN #define IS_BIG_ENDIAN #endif /* all of the platforms that we use _MSC_VER on are little endian * so this is sufficient for now */ #ifdef _MSC_VER #define IS_LITTLE_ENDIAN #endif #ifdef __OS2__ #define IS_LITTLE_ENDIAN #endif #if !defined(IS_LITTLE_ENDIAN) && !defined(IS_BIG_ENDIAN) #error Unknown endianess #endif #if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || defined (_sgi) || defined (__sun) || defined (sun) || defined (__digital__) # include <inttypes.h> #elif defined (_MSC_VER) typedef __int8 int8_t; typedef unsigned __int8 uint8_t; typedef __int16 int16_t; typedef unsigned __int16 uint16_t; typedef __int32 int32_t; typedef unsigned __int32 uint32_t; typedef __int64 int64_t; typedef unsigned __int64 uint64_t; #ifdef _WIN64 typedef unsigned __int64 uintptr_t; #else typedef unsigned long uintptr_t; #endif #elif defined (_AIX) # include <sys/inttypes.h> #else # include <stdint.h> #endif #endif typedef qcms_bool bool; #define true 1 #define false 0 #endif
0da0ce88c6cf0bfea3bce90009592fdf98f2f258
fbe68d84e97262d6d26dd65c704a7b50af2b3943
/third_party/virtualbox/src/libs/xpcom18a4/nsprpub/pr/src/md/unix/solaris.c
2ec3bd1ebd290cf0e05b1782c49717b704f4a1e1
[ "GPL-1.0-or-later", "MPL-1.1", "GPL-2.0-only", "LicenseRef-scancode-unknown-license-reference", "CDDL-1.0", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-or-later", "GPL-2.0-or-later", "MPL-1.0", "LicenseRef-scancode-generic-exception", "Apache-2.0", "OpenSSL", "MIT" ]
permissive
thalium/icebox
c4e6573f2b4f0973b6c7bb0bf068fe9e795fdcfb
6f78952d58da52ea4f0e55b2ab297f28e80c1160
refs/heads/master
2022-08-14T00:19:36.984579
2022-02-22T13:10:31
2022-02-22T13:10:31
190,019,914
585
109
MIT
2022-01-13T20:58:15
2019-06-03T14:18:12
C++
UTF-8
C
false
false
23,977
c
solaris.c
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is the Netscape Portable Runtime (NSPR). * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "primpl.h" extern PRBool suspendAllOn; extern PRThread *suspendAllThread; extern void _MD_SET_PRIORITY(_MDThread *md, PRThreadPriority newPri); PRIntervalTime _MD_Solaris_TicksPerSecond(void) { /* * Ticks have a 10-microsecond resolution. So there are * 100000 ticks per second. */ return 100000UL; } /* Interval timers, implemented using gethrtime() */ PRIntervalTime _MD_Solaris_GetInterval(void) { union { hrtime_t hrt; /* hrtime_t is a 64-bit (long long) integer */ PRInt64 pr64; } time; PRInt64 resolution; PRIntervalTime ticks; time.hrt = gethrtime(); /* in nanoseconds */ /* * Convert from nanoseconds to ticks. A tick's resolution is * 10 microseconds, or 10000 nanoseconds. */ LL_I2L(resolution, 10000); LL_DIV(time.pr64, time.pr64, resolution); LL_L2UI(ticks, time.pr64); return ticks; } #ifdef _PR_PTHREADS void _MD_EarlyInit(void) { } PRWord *_MD_HomeGCRegisters(PRThread *t, PRIntn isCurrent, PRIntn *np) { *np = 0; return NULL; } #endif /* _PR_PTHREADS */ #if !defined(i386) && !defined(IS_64) #if defined(_PR_HAVE_ATOMIC_OPS) /* NOTE: * SPARC v9 (Ultras) do have an atomic test-and-set operation. But * SPARC v8 doesn't. We should detect in the init if we are running on * v8 or v9, and then use assembly where we can. * * This code uses the Solaris threads API. It can be used in both the * pthreads and Solaris threads versions of nspr20 because "POSIX threads * and Solaris threads are fully compatible even within the same process", * to quote from pthread_create(3T). */ #include <thread.h> #include <synch.h> static mutex_t _solaris_atomic = DEFAULTMUTEX; PRInt32 _MD_AtomicIncrement(PRInt32 *val) { PRInt32 rv; if (mutex_lock(&_solaris_atomic) != 0) PR_ASSERT(0); rv = ++(*val); if (mutex_unlock(&_solaris_atomic) != 0)\ PR_ASSERT(0); return rv; } PRInt32 _MD_AtomicAdd(PRInt32 *ptr, PRInt32 val) { PRInt32 rv; if (mutex_lock(&_solaris_atomic) != 0) PR_ASSERT(0); rv = ((*ptr) += val); if (mutex_unlock(&_solaris_atomic) != 0)\ PR_ASSERT(0); return rv; } PRInt32 _MD_AtomicDecrement(PRInt32 *val) { PRInt32 rv; if (mutex_lock(&_solaris_atomic) != 0) PR_ASSERT(0); rv = --(*val); if (mutex_unlock(&_solaris_atomic) != 0)\ PR_ASSERT(0); return rv; } PRInt32 _MD_AtomicSet(PRInt32 *val, PRInt32 newval) { PRInt32 rv; if (mutex_lock(&_solaris_atomic) != 0) PR_ASSERT(0); rv = *val; *val = newval; if (mutex_unlock(&_solaris_atomic) != 0)\ PR_ASSERT(0); return rv; } #endif /* _PR_HAVE_ATOMIC_OPS */ #endif /* !defined(i386) */ #if defined(_PR_GLOBAL_THREADS_ONLY) #include <signal.h> #include <errno.h> #include <fcntl.h> #include <thread.h> #include <sys/lwp.h> #include <sys/procfs.h> #include <sys/syscall.h> extern int syscall(); /* not declared in sys/syscall.h */ static sigset_t old_mask; /* store away original gc thread sigmask */ static PRIntn gcprio; /* store away original gc thread priority */ THREAD_KEY_T threadid_key; THREAD_KEY_T cpuid_key; THREAD_KEY_T last_thread_key; static sigset_t set, oldset; static void threadid_key_destructor(void *value) { PRThread *me = (PRThread *)value; PR_ASSERT(me != NULL); /* the thread could be PRIMORDIAL (thus not ATTACHED) */ if (me->flags & _PR_ATTACHED) { /* * The Solaris thread library sets the thread specific * data (the current thread) to NULL before invoking * the destructor. We need to restore it to prevent the * _PR_MD_CURRENT_THREAD() call in _PRI_DetachThread() * from attaching the thread again. */ _PR_MD_SET_CURRENT_THREAD(me); _PRI_DetachThread(); } } void _MD_EarlyInit(void) { THR_KEYCREATE(&threadid_key, threadid_key_destructor); THR_KEYCREATE(&cpuid_key, NULL); THR_KEYCREATE(&last_thread_key, NULL); sigemptyset(&set); sigaddset(&set, SIGALRM); } PRStatus _MD_CreateThread(PRThread *thread, void (*start)(void *), PRThreadPriority priority, PRThreadScope scope, PRThreadState state, PRUint32 stackSize) { PRInt32 flags; /* mask out SIGALRM for native thread creation */ thr_sigsetmask(SIG_BLOCK, &set, &oldset); /* * Note that we create joinable threads with the THR_DETACHED * flag. The reasons why we don't use thr_join to implement * PR_JoinThread are: * - We use a termination condition variable in the PRThread * structure to implement PR_JoinThread across all classic * nspr implementation strategies. * - The native threads may be recycled by NSPR to run other * new NSPR threads, so the native threads may not terminate * when the corresponding NSPR threads terminate. */ flags = THR_SUSPENDED|THR_DETACHED; if (_PR_IS_GCABLE_THREAD(thread) || (thread->flags & _PR_BOUND_THREAD) || (scope == PR_GLOBAL_BOUND_THREAD)) flags |= THR_BOUND; if (thr_create(NULL, thread->stack->stackSize, (void *(*)(void *)) start, (void *) thread, flags, &thread->md.handle)) { thr_sigsetmask(SIG_SETMASK, &oldset, NULL); return PR_FAILURE; } /* When the thread starts running, then the lwpid is set to the right * value. Until then we want to mark this as 'uninit' so that * its register state is initialized properly for GC */ thread->md.lwpid = -1; thr_sigsetmask(SIG_SETMASK, &oldset, NULL); _MD_NEW_SEM(&thread->md.waiter_sem, 0); if ((scope == PR_GLOBAL_THREAD) || (scope == PR_GLOBAL_BOUND_THREAD)) { thread->flags |= _PR_GLOBAL_SCOPE; } _MD_SET_PRIORITY(&(thread->md), priority); /* Activate the thread */ if (thr_continue( thread->md.handle ) ) { return PR_FAILURE; } return PR_SUCCESS; } void _MD_cleanup_thread(PRThread *thread) { thread_t hdl; hdl = thread->md.handle; /* ** First, suspend the thread (unless it's the active one) ** Because we suspend it first, we don't have to use LOCK_SCHEDULER to ** prevent both of us modifying the thread structure at the same time. */ if ( thread != _PR_MD_CURRENT_THREAD() ) { thr_suspend(hdl); } PR_LOG(_pr_thread_lm, PR_LOG_MIN, ("(0X%x)[DestroyThread]\n", thread)); _MD_DESTROY_SEM(&thread->md.waiter_sem); } void _MD_exit_thread(PRThread *thread) { _MD_CLEAN_THREAD(thread); _MD_SET_CURRENT_THREAD(NULL); } void _MD_SET_PRIORITY(_MDThread *md_thread, PRThreadPriority newPri) { PRIntn nativePri; if (newPri < PR_PRIORITY_FIRST) { newPri = PR_PRIORITY_FIRST; } else if (newPri > PR_PRIORITY_LAST) { newPri = PR_PRIORITY_LAST; } /* Solaris priorities are from 0 to 127 */ nativePri = newPri * 127 / PR_PRIORITY_LAST; if(thr_setprio((thread_t)md_thread->handle, nativePri)) { PR_LOG(_pr_thread_lm, PR_LOG_MIN, ("_PR_SetThreadPriority: can't set thread priority\n")); } } void _MD_WAIT_CV( struct _MDCVar *md_cv, struct _MDLock *md_lock, PRIntervalTime timeout) { struct timespec tt; PRUint32 msec; PRThread *me = _PR_MD_CURRENT_THREAD(); PR_ASSERT((!suspendAllOn) || (suspendAllThread != me)); if (PR_INTERVAL_NO_TIMEOUT == timeout) { COND_WAIT(&md_cv->cv, &md_lock->lock); } else { msec = PR_IntervalToMilliseconds(timeout); GETTIME(&tt); tt.tv_sec += msec / PR_MSEC_PER_SEC; tt.tv_nsec += (msec % PR_MSEC_PER_SEC) * PR_NSEC_PER_MSEC; /* Check for nsec overflow - otherwise we'll get an EINVAL */ if (tt.tv_nsec >= PR_NSEC_PER_SEC) { tt.tv_sec++; tt.tv_nsec -= PR_NSEC_PER_SEC; } COND_TIMEDWAIT(&md_cv->cv, &md_lock->lock, &tt); } } void _MD_lock(struct _MDLock *md_lock) { #ifdef DEBUG /* This code was used for GC testing to make sure that we didn't attempt * to grab any locks while threads are suspended. */ PRLock *lock; if ((suspendAllOn) && (suspendAllThread == _PR_MD_CURRENT_THREAD())) { lock = ((PRLock *) ((char*) (md_lock) - offsetof(PRLock,ilock))); PR_ASSERT(lock->owner == NULL); return; } #endif /* DEBUG */ mutex_lock(&md_lock->lock); } PRThread *_pr_attached_thread_tls() { PRThread *ret; thr_getspecific(threadid_key, (void **)&ret); return ret; } PRThread *_pr_current_thread_tls() { PRThread *thread; thread = _MD_GET_ATTACHED_THREAD(); if (NULL == thread) { thread = _PRI_AttachThread( PR_USER_THREAD, PR_PRIORITY_NORMAL, NULL, 0); } PR_ASSERT(thread != NULL); return thread; } PRStatus _MD_wait(PRThread *thread, PRIntervalTime ticks) { _MD_WAIT_SEM(&thread->md.waiter_sem); return PR_SUCCESS; } PRStatus _MD_WakeupWaiter(PRThread *thread) { if (thread == NULL) { return PR_SUCCESS; } _MD_POST_SEM(&thread->md.waiter_sem); return PR_SUCCESS; } _PRCPU *_pr_current_cpu_tls() { _PRCPU *ret; thr_getspecific(cpuid_key, (void **)&ret); return ret; } PRThread *_pr_last_thread_tls() { PRThread *ret; thr_getspecific(last_thread_key, (void **)&ret); return ret; } _MDLock _pr_ioq_lock; void _MD_InitIO(void) { _MD_NEW_LOCK(&_pr_ioq_lock); } PRStatus _MD_InitializeThread(PRThread *thread) { if (!_PR_IS_NATIVE_THREAD(thread)) return PR_SUCCESS; /* sol_curthread is an asm routine which grabs GR7; GR7 stores an internal * thread structure ptr used by solaris. We'll use this ptr later * with suspend/resume to find which threads are running on LWPs. */ thread->md.threadID = sol_curthread(); /* prime the sp; substract 4 so we don't hit the assert that * curr sp > base_stack */ thread->md.sp = (uint_t) thread->stack->allocBase - sizeof(long); thread->md.lwpid = _lwp_self(); thread->md.handle = THR_SELF(); /* all threads on Solaris are global threads from NSPR's perspective * since all of them are mapped to Solaris threads. */ thread->flags |= _PR_GLOBAL_SCOPE; /* For primordial/attached thread, we don't create an underlying native thread. * So, _MD_CREATE_THREAD() does not get called. We need to do initialization * like allocating thread's synchronization variables and set the underlying * native thread's priority. */ if (thread->flags & (_PR_PRIMORDIAL | _PR_ATTACHED)) { _MD_NEW_SEM(&thread->md.waiter_sem, 0); _MD_SET_PRIORITY(&(thread->md), thread->priority); } return PR_SUCCESS; } /* Sleep for n milliseconds, n < 1000 */ void solaris_msec_sleep(int n) { struct timespec ts; ts.tv_sec = 0; ts.tv_nsec = 1000000*n; if (syscall(SYS_nanosleep, &ts, 0, 0) < 0) { PR_ASSERT(0); } } #define VALID_SP(sp, bottom, top) \ (((uint_t)(sp)) > ((uint_t)(bottom)) && ((uint_t)(sp)) < ((uint_t)(top))) void solaris_record_regs(PRThread *t, prstatus_t *lwpstatus) { #ifdef sparc long *regs = (long *)&t->md.context.uc_mcontext.gregs[0]; PR_ASSERT(_PR_IS_GCABLE_THREAD(t)); PR_ASSERT(t->md.threadID == lwpstatus->pr_reg[REG_G7]); t->md.sp = lwpstatus->pr_reg[REG_SP]; PR_ASSERT(VALID_SP(t->md.sp, t->stack->stackBottom, t->stack->stackTop)); regs[0] = lwpstatus->pr_reg[R_G1]; regs[1] = lwpstatus->pr_reg[R_G2]; regs[2] = lwpstatus->pr_reg[R_G3]; regs[3] = lwpstatus->pr_reg[R_G4]; regs[4] = lwpstatus->pr_reg[R_O0]; regs[5] = lwpstatus->pr_reg[R_O1]; regs[6] = lwpstatus->pr_reg[R_O2]; regs[7] = lwpstatus->pr_reg[R_O3]; regs[8] = lwpstatus->pr_reg[R_O4]; regs[9] = lwpstatus->pr_reg[R_O5]; regs[10] = lwpstatus->pr_reg[R_O6]; regs[11] = lwpstatus->pr_reg[R_O7]; #elif defined(i386) /* * To be implemented and tested */ PR_ASSERT(0); PR_ASSERT(t->md.threadID == lwpstatus->pr_reg[GS]); t->md.sp = lwpstatus->pr_reg[UESP]; #endif } void solaris_preempt_off() { sigset_t set; (void)sigfillset(&set); syscall(SYS_sigprocmask, SIG_SETMASK, &set, &old_mask); } void solaris_preempt_on() { syscall(SYS_sigprocmask, SIG_SETMASK, &old_mask, NULL); } int solaris_open_main_proc_fd() { char buf[30]; int fd; /* Not locked, so must be created while threads coming up */ PR_snprintf(buf, sizeof(buf), "/proc/%ld", getpid()); if ( (fd = syscall(SYS_open, buf, O_RDONLY)) < 0) { return -1; } return fd; } /* Return a file descriptor for the /proc entry corresponding to the * given lwp. */ int solaris_open_lwp(lwpid_t id, int lwp_main_proc_fd) { int result; if ( (result = syscall(SYS_ioctl, lwp_main_proc_fd, PIOCOPENLWP, &id)) <0) return -1; /* exited??? */ return result; } void _MD_Begin_SuspendAll() { solaris_preempt_off(); PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("Begin_SuspendAll\n")); /* run at highest prio so I cannot be preempted */ thr_getprio(thr_self(), &gcprio); thr_setprio(thr_self(), 0x7fffffff); suspendAllOn = PR_TRUE; suspendAllThread = _PR_MD_CURRENT_THREAD(); } void _MD_End_SuspendAll() { } void _MD_End_ResumeAll() { PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("End_ResumeAll\n")); thr_setprio(thr_self(), gcprio); solaris_preempt_on(); suspendAllThread = NULL; suspendAllOn = PR_FALSE; } void _MD_Suspend(PRThread *thr) { int lwp_fd, result; prstatus_t lwpstatus; int lwp_main_proc_fd = 0; if (!_PR_IS_GCABLE_THREAD(thr) || !suspendAllOn){ /*XXX When the suspendAllOn is set, we will be trying to do lwp_suspend * during that time we can't call any thread lib or libc calls. Hence * make sure that no suspension is requested for Non gcable thread * during suspendAllOn */ PR_ASSERT(!suspendAllOn); thr_suspend(thr->md.handle); return; } /* XXX Primordial thread can't be bound to an lwp, hence there is no * way we can assume that we can get the lwp status for primordial * thread reliably. Hence we skip this for primordial thread, hoping * that the SP is saved during lock and cond. wait. * XXX - Again this is concern only for java interpreter, not for the * server, 'cause primordial thread in the server does not do java work */ if (thr->flags & _PR_PRIMORDIAL) return; /* XXX Important Note: If the start function of a thread is not called, * lwpid is -1. Then, skip this thread. This thread will get caught * in PR_NativeRunThread before calling the start function, because * we hold the pr_activeLock during suspend/resume */ /* if the thread is not started yet then don't do anything */ if (!suspendAllOn || thr->md.lwpid == -1) return; if (_lwp_suspend(thr->md.lwpid) < 0) { PR_ASSERT(0); return; } if ( (lwp_main_proc_fd = solaris_open_main_proc_fd()) < 0) { PR_ASSERT(0); return; /* XXXMB ARGH, we're hosed! */ } if ( (lwp_fd = solaris_open_lwp(thr->md.lwpid, lwp_main_proc_fd)) < 0) { PR_ASSERT(0); close(lwp_main_proc_fd); return; } if ( (result = syscall(SYS_ioctl, lwp_fd, PIOCSTATUS, &lwpstatus)) < 0) { /* Hopefully the thread just died... */ close(lwp_fd); close(lwp_main_proc_fd); return; } while ( !(lwpstatus.pr_flags & PR_STOPPED) ) { if ( (result = syscall(SYS_ioctl, lwp_fd, PIOCSTATUS, &lwpstatus)) < 0) { PR_ASSERT(0); /* ARGH SOMETHING WRONG! */ break; } solaris_msec_sleep(1); } solaris_record_regs(thr, &lwpstatus); close(lwp_fd); close(lwp_main_proc_fd); } #ifdef OLD_CODE void _MD_SuspendAll() { /* On solaris there are threads, and there are LWPs. * Calling _PR_DoSingleThread would freeze all of the threads bound to LWPs * but not necessarily stop all LWPs (for example if someone did * an attachthread of a thread which was not bound to an LWP). * So now go through all the LWPs for this process and freeze them. * * Note that if any thread which is capable of having the GC run on it must * had better be a LWP with a single bound thread on it. Otherwise, this * might not stop that thread from being run. */ PRThread *current = _PR_MD_CURRENT_THREAD(); prstatus_t status, lwpstatus; int result, index, lwp_fd; lwpid_t me = _lwp_self(); int err; int lwp_main_proc_fd; solaris_preempt_off(); /* run at highest prio so I cannot be preempted */ thr_getprio(thr_self(), &gcprio); thr_setprio(thr_self(), 0x7fffffff); current->md.sp = (uint_t)&me; /* set my own stack pointer */ if ( (lwp_main_proc_fd = solaris_open_main_proc_fd()) < 0) { PR_ASSERT(0); solaris_preempt_on(); return; /* XXXMB ARGH, we're hosed! */ } if ( (result = syscall(SYS_ioctl, lwp_main_proc_fd, PIOCSTATUS, &status)) < 0) { err = errno; PR_ASSERT(0); goto failure; /* XXXMB ARGH, we're hosed! */ } num_lwps = status.pr_nlwp; if ( (all_lwps = (lwpid_t *)PR_MALLOC((num_lwps+1) * sizeof(lwpid_t)))==NULL) { PR_ASSERT(0); goto failure; /* XXXMB ARGH, we're hosed! */ } if ( (result = syscall(SYS_ioctl, lwp_main_proc_fd, PIOCLWPIDS, all_lwps)) < 0) { PR_ASSERT(0); PR_DELETE(all_lwps); goto failure; /* XXXMB ARGH, we're hosed! */ } for (index=0; index< num_lwps; index++) { if (all_lwps[index] != me) { if (_lwp_suspend(all_lwps[index]) < 0) { /* could happen if lwp exited */ all_lwps[index] = me; /* dummy it up */ } } } /* Turns out that lwp_suspend is not a blocking call. * Go through the list and make sure they are all stopped. */ for (index=0; index< num_lwps; index++) { if (all_lwps[index] != me) { if ( (lwp_fd = solaris_open_lwp(all_lwps[index], lwp_main_proc_fd)) < 0) { PR_ASSERT(0); PR_DELETE(all_lwps); all_lwps = NULL; goto failure; /* XXXMB ARGH, we're hosed! */ } if ( (result = syscall(SYS_ioctl, lwp_fd, PIOCSTATUS, &lwpstatus)) < 0) { /* Hopefully the thread just died... */ close(lwp_fd); continue; } while ( !(lwpstatus.pr_flags & PR_STOPPED) ) { if ( (result = syscall(SYS_ioctl, lwp_fd, PIOCSTATUS, &lwpstatus)) < 0) { PR_ASSERT(0); /* ARGH SOMETHING WRONG! */ break; } solaris_msec_sleep(1); } solaris_record_regs(&lwpstatus); close(lwp_fd); } } close(lwp_main_proc_fd); return; failure: solaris_preempt_on(); thr_setprio(thr_self(), gcprio); close(lwp_main_proc_fd); return; } void _MD_ResumeAll() { int i; lwpid_t me = _lwp_self(); for (i=0; i < num_lwps; i++) { if (all_lwps[i] == me) continue; if ( _lwp_continue(all_lwps[i]) < 0) { PR_ASSERT(0); /* ARGH, we are hosed! */ } } /* restore priority and sigmask */ thr_setprio(thr_self(), gcprio); solaris_preempt_on(); PR_DELETE(all_lwps); all_lwps = NULL; } #endif /* OLD_CODE */ #ifdef USE_SETJMP PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) { if (isCurrent) { (void) setjmp(CONTEXT(t)); } *np = sizeof(CONTEXT(t)) / sizeof(PRWord); return (PRWord *) CONTEXT(t); } #else PRWord *_MD_HomeGCRegisters(PRThread *t, PRIntn isCurrent, PRIntn *np) { if (isCurrent) { (void) getcontext(CONTEXT(t)); } *np = NGREG; return (PRWord*) &t->md.context.uc_mcontext.gregs[0]; } #endif /* USE_SETJMP */ #else /* _PR_GLOBAL_THREADS_ONLY */ #if defined(_PR_LOCAL_THREADS_ONLY) void _MD_EarlyInit(void) { } void _MD_SolarisInit() { _PR_UnixInit(); } void _MD_SET_PRIORITY(_MDThread *thread, PRThreadPriority newPri) { return; } PRStatus _MD_InitializeThread(PRThread *thread) { return PR_SUCCESS; } PRStatus _MD_WAIT(PRThread *thread, PRIntervalTime ticks) { PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE)); _PR_MD_SWITCH_CONTEXT(thread); return PR_SUCCESS; } PRStatus _MD_WAKEUP_WAITER(PRThread *thread) { PR_ASSERT((thread == NULL) || (!(thread->flags & _PR_GLOBAL_SCOPE))); return PR_SUCCESS; } /* These functions should not be called for Solaris */ void _MD_YIELD(void) { PR_NOT_REACHED("_MD_YIELD should not be called for Solaris"); } PRStatus _MD_CREATE_THREAD( PRThread *thread, void (*start) (void *), PRThreadPriority priority, PRThreadScope scope, PRThreadState state, PRUint32 stackSize) { PR_NOT_REACHED("_MD_CREATE_THREAD should not be called for Solaris"); return(PR_FAILURE); } #ifdef USE_SETJMP PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) { if (isCurrent) { (void) setjmp(CONTEXT(t)); } *np = sizeof(CONTEXT(t)) / sizeof(PRWord); return (PRWord *) CONTEXT(t); } #else PRWord *_MD_HomeGCRegisters(PRThread *t, PRIntn isCurrent, PRIntn *np) { if (isCurrent) { (void) getcontext(CONTEXT(t)); } *np = NGREG; return (PRWord*) &t->md.context.uc_mcontext.gregs[0]; } #endif /* USE_SETJMP */ #endif /* _PR_LOCAL_THREADS_ONLY */ #endif /* _PR_GLOBAL_THREADS_ONLY */ #ifndef _PR_PTHREADS #if defined(i386) && defined(SOLARIS2_4) /* * Because clock_gettime() on Solaris/x86 2.4 always generates a * segmentation fault, we use an emulated version _pr_solx86_clock_gettime(), * which is implemented using gettimeofday(). */ int _pr_solx86_clock_gettime(clockid_t clock_id, struct timespec *tp) { struct timeval tv; if (clock_id != CLOCK_REALTIME) { errno = EINVAL; return -1; } gettimeofday(&tv, NULL); tp->tv_sec = tv.tv_sec; tp->tv_nsec = tv.tv_usec * 1000; return 0; } #endif /* i386 && SOLARIS2_4 */ #endif /* _PR_PTHREADS */
df6dfc0c45bdcee073424ff2d336abd3379a13e4
fa1ad2e2ac7e376fc7cb3b3a6e1bb88eed3e80be
/govern/data-security/krb-1.2.1/src/lib/rpc/rpc_dtablesize.c
000e3c47d7d48c105691457f9831cf4fd63f4a1f
[ "BSD-4-Clause", "LicenseRef-scancode-generic-export-compliance", "LicenseRef-scancode-other-permissive", "LicenseRef-scancode-mit-old-style", "BSD-4-Clause-UC", "LicenseRef-scancode-rsa-1990", "BSD-3-Clause", "MIT-CMU", "LicenseRef-scancode-mit-no-advert-export-control", "CC-BY-SA-3.0", "LicenseRef-scancode-mit-modification-obligations", "LicenseRef-scancode-proprietary-license", "GPL-2.0-or-later", "LicenseRef-scancode-michigan-disclaimer", "ISC", "LicenseRef-scancode-nrl-permission", "FreeBSD-DOC", "LicenseRef-scancode-rsa-md4", "RSA-MD", "OLDAP-2.8", "FSFULLRWD", "BSD-2-Clause", "LicenseRef-scancode-brian-gladman", "MIT", "Apache-2.0" ]
permissive
alldatacenter/alldata
7bc7713c9f1d56ad6b8e59ea03206d1073b7e047
8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6
refs/heads/master
2023-08-05T07:32:25.442740
2023-08-03T13:17:24
2023-08-03T13:17:24
213,321,771
774
250
Apache-2.0
2023-09-06T17:35:32
2019-10-07T07:36:18
null
UTF-8
C
false
false
2,433
c
rpc_dtablesize.c
/* @(#)rpc_dtablesize.c 2.1 88/07/29 4.0 RPCSRC */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)rpc_dtablesize.c 1.2 87/08/11 Copyr 1987 Sun Micro"; #endif #include <unistd.h> #include <gssrpc/rpc.h> /* * Cache the result of getdtablesize(), so we don't have to do an * expensive system call every time. */ int gssrpc__rpc_dtablesize(void) { static int size; if (size == 0) { #ifdef _SC_OPEN_MAX size = (int) sysconf(_SC_OPEN_MAX); #else size = getdtablesize(); #endif /* sysconf() can return a number larger than what will fit in an fd_set. we can't use fd's larger than this, anyway. */ #ifdef FD_SETSIZE if (size >= FD_SETSIZE) size = FD_SETSIZE-1; #endif } return (size); }
a85e4bfaa75f2f04f12411b6350080be04e12894
c26d7b0ed875357278e61627da2da0650da77986
/src/cmd/emg/file.c
b1028089a2b959fa1b3345073781182ad35aef94
[ "BSD-3-Clause", "LicenseRef-scancode-public-domain" ]
permissive
RetroBSD/retrobsd
5343d9e3c424637fc3ad5b03fe720b2744490025
486f81f6abff01c7dcc207235cd2979b226a95ff
refs/heads/master
2023-09-02T23:12:05.110883
2023-07-07T18:41:40
2023-07-07T18:41:40
18,598,087
282
59
BSD-3-Clause
2023-07-18T07:35:36
2014-04-09T13:25:46
C
UTF-8
C
false
false
9,350
c
file.c
/* This file is in the public domain. */ /* * The routines in this file handle the reading and writing of disk files. * All details about the reading and writing of the disk are in "fileio.c" */ #include <string.h> /* strncpy(3) */ #include "estruct.h" #include "edef.h" extern int mlreply(char *, char *, int); extern void mlwrite(); extern int bclear(BUFFER *); extern int ffropen(char *); extern int ffgetline(char [], int); extern int ffwopen(char *); extern int ffclose(); extern int ffputline(char [], int); extern BUFFER *bfind(); extern LINE *lalloc(); int fileread(int, int); int insfile(int, int); int readin(char []); int filewrite(int, int); int filesave(int, int); int writeout(char *); int filename(int, int); int ifile(char []); /* * Read a file into the current buffer. This is really easy; all you do it * find the name of the file, and call the standard "read a file into the * current buffer" code. Bound to "C-X C-F" */ int fileread(int f, int n) { int s; char fname[NFILEN]; if ((s = mlreply("Open file: ", fname, NFILEN)) != TRUE) return (s); return (readin(fname)); } /* * Insert a file into the current buffer. This is really easy; all you do it * find the name of the file, and call the standard "insert a file into the * current buffer" code. Bound to "C-X C-I". */ int insfile(int f, int n) { int s; char fname[NFILEN]; if ((s = mlreply("Insert file: ", fname, NFILEN)) != TRUE) return (s); return (ifile(fname)); } /* * Read file "fname" into the current buffer, blowing away any text found * there. Called by both the read and find commands. Return the final status * of the read. Also called by the mainline, to read in a file specified on * the command line as an argument. */ int readin(char fname[]) { LINE *lp1, *lp2; WINDOW *wp; BUFFER *bp; char line[NLINE]; int nbytes, s, i; int nline = 0; /* initialize here to silence a gcc warning */ int lflag; /* any lines longer than allowed? */ bp = curbp; /* Cheap */ if ((s = bclear(bp)) != TRUE) /* Might be old */ return (s); bp->b_flag &= ~(BFTEMP | BFCHG); strncpy(bp->b_fname, fname, NFILEN); if ((s = ffropen(fname)) == FIOERR) /* Hard file open */ goto out; if (s == FIOFNF) { /* File not found */ mlwrite("[New file]"); goto out; } mlwrite("[Reading file]"); lflag = FALSE; while ((s = ffgetline(line, NLINE)) == FIOSUC || s == FIOLNG) { if (s == FIOLNG) lflag = TRUE; nbytes = strlen(line); if ((lp1 = lalloc(nbytes)) == NULL) { s = FIOERR; /* Keep message on the display */ break; } lp2 = lback(curbp->b_linep); lp2->l_fp = lp1; lp1->l_fp = curbp->b_linep; lp1->l_bp = lp2; curbp->b_linep->l_bp = lp1; for (i = 0; i < nbytes; ++i) lputc(lp1, i, line[i]); ++nline; } ffclose(); /* Ignore errors */ if (s == FIOEOF) { /* Don't zap message! */ if (nline != 1) mlwrite("[Read %d lines]", nline); else mlwrite("[Read 1 line]"); } if (lflag) { if (nline != 1) mlwrite("[Read %d lines: Long lines wrapped]", nline); else mlwrite("[Read 1 line: Long lines wrapped]"); } curwp->w_bufp->b_lines = nline; out: for (wp = wheadp; wp != NULL; wp = wp->w_wndp) { if (wp->w_bufp == curbp) { wp->w_linep = lforw(curbp->b_linep); wp->w_dotp = lforw(curbp->b_linep); wp->w_doto = 0; wp->w_markp = NULL; wp->w_marko = 0; wp->w_dotline = 0; wp->w_flag |= WFMODE | WFHARD; } } if (s == FIOERR || s == FIOFNF) /* False if error */ return (FALSE); return (TRUE); } /* * Ask for a file name, and write the contents of the current buffer to that * file. Update the remembered file name and clear the buffer changed flag. * This handling of file names is different from the earlier versions, and is * more compatable with Gosling EMACS than with ITS EMACS. Bound to "C-X C-W". */ int filewrite(int f, int n) { WINDOW *wp; char fname[NFILEN]; int s; if ((s = mlreply("Write file: ", fname, NFILEN)) != TRUE) return (s); if ((s = writeout(fname)) == TRUE) { strncpy(curbp->b_fname, fname, NFILEN); curbp->b_flag &= ~BFCHG; wp = wheadp; /* Update mode lines */ while (wp != NULL) { if (wp->w_bufp == curbp) wp->w_flag |= WFMODE; wp = wp->w_wndp; } } return (s); } /* * Save the contents of the current buffer in its associatd file. No nothing * if nothing has changed (this may be a bug, not a feature). Error if there * is no remembered file name for the buffer. Bound to "C-X C-S". May get * called by "C-Z" */ int filesave(int f, int n) { WINDOW *wp; int s; if ((curbp->b_flag & BFCHG) == 0) /* Return, no changes */ return (TRUE); if (curbp->b_fname[0] == '\0') filename(f, n); /* Must have a name */ if ((s = writeout(curbp->b_fname)) == TRUE) { curbp->b_flag &= ~BFCHG; wp = wheadp; /* Update mode lines */ while (wp != NULL) { if (wp->w_bufp == curbp) wp->w_flag |= WFMODE; wp = wp->w_wndp; } } return (s); } /* * This function performs the details of file writing. Uses the file * management routines in the "fileio.c" package. The number of lines written * is displayed. Sadly, it looks inside a LINE; provide a macro for this. Most * of the grief is error checking of some sort. */ int writeout(char *fn) { LINE *lp; int nline, s; if ((s = ffwopen(fn)) != FIOSUC) /* Open writes message */ return (FALSE); mlwrite("[Writing]"); /* tell us were writing */ lp = lforw(curbp->b_linep); /* First line */ nline = 0; /* Number of lines */ while (lp != curbp->b_linep) { if ((s = ffputline(&lp->l_text[0], llength(lp))) != FIOSUC) break; ++nline; lp = lforw(lp); } if (s == FIOSUC) { /* No write error */ s = ffclose(); if (s == FIOSUC) { /* No close error */ if (nline != 1) mlwrite("[Wrote %d lines]", nline); else mlwrite("[Wrote 1 line]"); } } else /* ignore close error */ ffclose(); /* if a write error */ if (s != FIOSUC) /* some sort of error */ return (FALSE); return (TRUE); } /* * The command allows the user to modify the file name associated with the * current buffer. It is like the "f" command in UNIX "ed". The operation is * simple; just zap the name in the BUFFER structure, and mark the windows as * needing an update. You can type a blank line at the prompt if you wish. */ int filename(int f, int n) { WINDOW *wp; char fname[NFILEN]; int s; if ((s = mlreply("Name: ", fname, NFILEN)) == ABORT) return (s); if (s == FALSE) strncpy(curbp->b_fname, "", 1); else strncpy(curbp->b_fname, fname, NFILEN); wp = wheadp; /* update mode lines */ while (wp != NULL) { if (wp->w_bufp == curbp) wp->w_flag |= WFMODE; wp = wp->w_wndp; } return (TRUE); } /* * Insert file "fname" into the current buffer, Called by insert file command. * Return the final status of the read. */ int ifile(char fname[]) { LINE *lp0, *lp1, *lp2; BUFFER *bp; char line[NLINE]; int i, s, nbytes; int nline = 0; int lflag; /* any lines longer than allowed? */ bp = curbp; /* Cheap */ bp->b_flag |= BFCHG; /* we have changed */ bp->b_flag &= ~BFTEMP; /* and are not temporary */ if ((s = ffropen(fname)) == FIOERR) /* Hard file open */ goto out; if (s == FIOFNF) { /* File not found */ mlwrite("[No such file]"); return (FALSE); } mlwrite("[Inserting file]"); /* back up a line and save the mark here */ curwp->w_dotp = lback(curwp->w_dotp); curwp->w_doto = 0; curwp->w_markp = curwp->w_dotp; curwp->w_marko = 0; lflag = FALSE; while ((s = ffgetline(line, NLINE)) == FIOSUC || s == FIOLNG) { if (s == FIOLNG) lflag = TRUE; nbytes = strlen(line); if ((lp1 = lalloc(nbytes)) == NULL) { s = FIOERR; /* keep message on the */ break; /* display */ } lp0 = curwp->w_dotp; /* line previous to insert */ lp2 = lp0->l_fp; /* line after insert */ /* re-link new line between lp0 and lp2 */ lp2->l_bp = lp1; lp0->l_fp = lp1; lp1->l_bp = lp0; lp1->l_fp = lp2; /* and advance and write out the current line */ curwp->w_dotp = lp1; for (i = 0; i < nbytes; ++i) lputc(lp1, i, line[i]); ++nline; } ffclose(); /* Ignore errors */ curwp->w_markp = lforw(curwp->w_markp); if (s == FIOEOF) { /* Don't zap message! */ if (nline != 1) mlwrite("[Inserted %d lines]", nline); else mlwrite("[Inserted 1 line]"); } if (lflag) { if (nline != 1) mlwrite("[Inserted %d lines: Long lines wrapped]", nline); else mlwrite("[Inserted 1 line: Long lines wrapped]"); } out: /* advance to the next line and mark the window for changes */ curwp->w_dotp = lforw(curwp->w_dotp); curwp->w_flag |= WFHARD; /* copy window parameters back to the buffer structure */ curbp->b_dotp = curwp->w_dotp; curbp->b_doto = curwp->w_doto; curbp->b_markp = curwp->w_markp; curbp->b_marko = curwp->w_marko; /* we need to update number of lines in the buffer */ curwp->w_bufp->b_lines += nline; if (s == FIOERR) /* False if error */ return (FALSE); return (TRUE); }
910846dad8ed8976655fce0d2c1b693f5df1546e
78dc9f153549b281be709227bc9897931b06260d
/generation/WinSDK/RecompiledIdlHeaders/ucrt/corecrt_startup.h
19e6dc27866e00ebf02dbae993eef0783098302b
[ "MIT" ]
permissive
microsoft/win32metadata
dff35b4fe904d556162cee5133294c4498f1a79a
5bf233f04d45f7a697e112e9639722551103eb07
refs/heads/main
2023-09-01T19:51:22.972899
2023-08-30T21:39:44
2023-08-30T21:39:44
270,838,404
1,240
107
NOASSERTION
2023-09-14T18:49:44
2020-06-08T21:52:10
C++
UTF-8
C
false
false
5,077
h
corecrt_startup.h
// // corecrt_startup.h // // Copyright (c) Microsoft Corporation. All rights reserved. // // Declarations for the CoreCRT startup functionality, used while initializing // the CRT and during app startup and termination. // #pragma once #include <corecrt.h> #include <math.h> #include <vcruntime_startup.h> #pragma warning(push) #pragma warning(disable: _UCRT_DISABLED_WARNINGS) _UCRT_DISABLE_CLANG_WARNINGS _CRT_BEGIN_C_HEADER //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // // Exception Filters for main() and DllMain() // //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ struct _EXCEPTION_POINTERS; _ACRTIMP int __cdecl _seh_filter_dll( _In_ unsigned long _ExceptionNum, _In_ struct _EXCEPTION_POINTERS* _ExceptionPtr ); _ACRTIMP int __cdecl _seh_filter_exe( _In_ unsigned long _ExceptionNum, _In_ struct _EXCEPTION_POINTERS* _ExceptionPtr ); //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // // Miscellaneous Runtime Support // //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ typedef enum _crt_app_type { _crt_unknown_app, _crt_console_app, _crt_gui_app } _crt_app_type; _ACRTIMP _crt_app_type __cdecl _query_app_type(void); _ACRTIMP void __cdecl _set_app_type( _In_ _crt_app_type _Type ); typedef int (__cdecl *_UserMathErrorFunctionPointer)(struct _exception *); _ACRTIMP void __cdecl __setusermatherr( _UserMathErrorFunctionPointer _UserMathErrorFunction ); int __cdecl _is_c_termination_complete(void); //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // // Arguments API for main() et al. // //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ _ACRTIMP errno_t __cdecl _configure_narrow_argv( _In_ _crt_argv_mode mode ); _ACRTIMP errno_t __cdecl _configure_wide_argv( _In_ _crt_argv_mode mode ); // There is a linkopt for these to disable environment initialization when using // the static CRT, so they are not declared _ACRTIMP. int __CRTDECL _initialize_narrow_environment(void); int __CRTDECL _initialize_wide_environment(void); _ACRTIMP char** __cdecl _get_initial_narrow_environment(void); _ACRTIMP wchar_t** __cdecl _get_initial_wide_environment(void); char* __CRTDECL _get_narrow_winmain_command_line(void); wchar_t* __CRTDECL _get_wide_winmain_command_line(void); _ACRTIMP char** __cdecl __p__acmdln(void); _ACRTIMP wchar_t** __cdecl __p__wcmdln(void); #ifdef _CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY extern char* _acmdln; extern wchar_t* _wcmdln; #else #define _acmdln (*__p__acmdln()) #define _wcmdln (*__p__wcmdln()) #endif //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // // Initializer and Terminator Support // //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ typedef void (__cdecl* _PVFV)(void); typedef int (__cdecl* _PIFV)(void); typedef void (__cdecl* _PVFI)(int); #ifndef _M_CEE _ACRTIMP void __cdecl _initterm( _In_reads_(_Last - _First) _In_ _PVFV* _First, _In_ _PVFV* _Last ); _ACRTIMP int __cdecl _initterm_e( _In_reads_(_Last - _First) _PIFV* _First, _In_ _PIFV* _Last ); #endif #ifndef _CRT_ONEXIT_T_DEFINED #define _CRT_ONEXIT_T_DEFINED typedef int (__CRTDECL* _onexit_t)(void); #ifdef _M_CEE typedef int (__clrcall* _onexit_m_t)(void); #endif #endif typedef struct _onexit_table_t { _PVFV* _first; _PVFV* _last; _PVFV* _end; } _onexit_table_t; _ACRTIMP int __cdecl _initialize_onexit_table( _In_opt_ _onexit_table_t* _Table ); _ACRTIMP int __cdecl _register_onexit_function( _In_opt_ _onexit_table_t* _Table, _In_opt_ _onexit_t _Function ); _ACRTIMP int __cdecl _execute_onexit_table( _In_opt_ _onexit_table_t* _Table ); _ACRTIMP int __cdecl _crt_atexit( _In_opt_ _PVFV _Function ); _ACRTIMP int __cdecl _crt_at_quick_exit( _In_opt_ _PVFV _Function ); //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // // Static CRT Initialization Support // //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ #if _CRT_FUNCTIONS_REQUIRED _Success_(return != 0) __crt_bool __cdecl __acrt_initialize(void); _Success_(return != 0) __crt_bool __cdecl __acrt_uninitialize( _In_ __crt_bool _Terminating ); _Success_(return != 0) __crt_bool __cdecl __acrt_uninitialize_critical( _In_ __crt_bool _Terminating ); _Success_(return != 0) __crt_bool __cdecl __acrt_thread_attach(void); _Success_(return != 0) __crt_bool __cdecl __acrt_thread_detach(void); #endif // _CRT_FUNCTIONS_REQUIRED _CRT_END_C_HEADER _UCRT_RESTORE_CLANG_WARNINGS #pragma warning(pop) // _UCRT_DISABLED_WARNINGS
7499b1ce2fc2b09a0e0b616140c1430b12acd124
488e6c9b8555a253df765edc2232e8750e8b3a1b
/firmware-src/sources/commands/mfrc522_cmd.c
e3b981b5cc4f34a594e7c59ac3c71e155cfa4cbe
[ "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
devicehive/esp8266-firmware
32edadae1d919438fd13388b562979030cc4472a
eb8a61482035bfc93a343db386d4470d17fa13d6
refs/heads/develop
2021-01-01T16:44:57.970370
2019-03-28T12:48:43
2019-03-28T12:48:43
39,383,605
182
61
MIT
2018-05-07T20:43:14
2015-07-20T12:53:51
C
UTF-8
C
false
false
4,786
c
mfrc522_cmd.c
/** * @file * @brief MFRC522 command handlers. * @copyright 2016 [DeviceHive](http://devicehive.com) * @author Nikolay Khabarov */ #include "commands/mfrc522_cmd.h" #include "devices/mfrc522.h" #include "DH/adc.h" #include "dhcommand_parser.h" #include <user_interface.h> #include <osapi.h> #include <ets_forward.h> #if defined(DH_COMMANDS_MFRC522) && defined(DH_DEVICE_MFRC522) /** * @brief Do "devices/mfrc522/read" command. */ void ICACHE_FLASH_ATTR dh_handle_devices_mfrc522_read(COMMAND_RESULT *cmd_res, const char *command, const char *params, unsigned int params_len) { if (params_len) { gpio_command_params info; ALLOWED_FIELDS fields = 0; const char *err_msg = parse_params_pins_set(params, params_len, &info, DH_ADC_SUITABLE_PINS, 0, AF_CS, &fields); if (err_msg != 0) { dh_command_fail(cmd_res, err_msg); return; // FAILED } if (fields & AF_CS) { if (MFRC522_Set_CS(info.CS) != MFRC522_STATUS_OK) { dh_command_fail(cmd_res, "Unsuitable pin"); return; // FAILED } } } MFRC522_PCD_Init(); uint8_t bufferATQA[2]; uint8_t bufferSize = sizeof(bufferATQA); MFRC522_StatusCode result = MFRC522_PICC_RequestA(bufferATQA, &bufferSize); if (result == MFRC522_STATUS_OK || result == MFRC522_STATUS_COLLISION) { MFRC522_Uid *uid = MFRC522_Get_Uid(); result = MFRC522_PICC_Select(uid, 0); if (result == MFRC522_STATUS_OK) { char hexbuf[uid->size * 2 + 1]; unsigned int i; for (i = 0; i < uid->size; i++) byteToHex(uid->uidByte[i], &hexbuf[i * 2]); hexbuf[sizeof(hexbuf) - 1] = 0; cmd_res->callback(cmd_res->data, DHSTATUS_OK, RDT_FORMAT_JSON, "{\"uid\":\"0x%s\", \"type\":\"%s\"}", hexbuf, MFRC522_PICC_GetTypeName(MFRC522_PICC_GetType(uid->sak))); MFRC522_PCD_AntennaOff(); return; } } MFRC522_PICC_HaltA(); MFRC522_PCD_AntennaOff(); dh_command_fail(cmd_res, MFRC522_GetStatusCodeName(result)); } /** * @brief Do "devices/mfrc522/mifare/read" and "devices/mfrc522/mifare/write" commands. */ void ICACHE_FLASH_ATTR dh_handle_devices_mfrc522_mifare_read_write(COMMAND_RESULT *cmd_res, const char *command, const char *params, unsigned int params_len) { gpio_command_params info; ALLOWED_FIELDS fields = 0; const int is_write = (0 != os_strcmp(command, "devices/mfrc522/mifare/read")); const char *err_msg = parse_params_pins_set(params, params_len, &info, DH_ADC_SUITABLE_PINS, 0, AF_CS | AF_ADDRESS | AF_KEY | (is_write ? AF_DATA : 0), &fields); if (err_msg != 0) { dh_command_fail(cmd_res, err_msg); return; // FAILED } if (fields & AF_CS) { if (MFRC522_Set_CS(info.CS) != MFRC522_STATUS_OK) { dh_command_fail(cmd_res, "Unsuitable pin"); return; // FAILED } } if ((fields & AF_ADDRESS) == 0) { dh_command_fail(cmd_res, "Block address not specified"); return; // FAILED } if ((fields & AF_KEY) == 0) { // default key os_memset(info.storage.key.key_data, 0xFF, MF_KEY_SIZE); info.storage.key.key_len = MF_KEY_SIZE; } else if(info.storage.key.key_len != MF_KEY_SIZE) { dh_command_fail(cmd_res, "Wrong key length"); return; // FAILED } if (is_write) { if((fields & AF_DATA) == 0) { dh_command_fail(cmd_res, "Data not specified"); return; // FAILED } else if(info.data_len != 16) { dh_command_fail(cmd_res, "Data length should be 16 bytes"); return; // FAILED } } MFRC522_PCD_Init(); uint8_t bufferATQA[2]; uint8_t bufferSize = sizeof(bufferATQA); MFRC522_StatusCode result = MFRC522_PICC_RequestA(bufferATQA, &bufferSize); if (result == MFRC522_STATUS_OK || result == MFRC522_STATUS_COLLISION) { MFRC522_Uid *uid = MFRC522_Get_Uid(); result = MFRC522_PICC_Select(uid, 0); MIFARE_Key key; os_memcpy(key.keyByte, info.storage.key.key_data, MF_KEY_SIZE); if (result == MFRC522_STATUS_OK) { result = MFRC522_PCD_Authenticate(PICC_CMD_MF_AUTH_KEY_A, info.address, &key, uid); if (result == MFRC522_STATUS_OK) { uint8_t len = (sizeof(info.data) > 0xFF) ? 0xFF : sizeof(info.data); if (is_write) result = MFRC522_MIFARE_Write(info.address, (uint8_t*)info.data, info.data_len); else result = MFRC522_MIFARE_Read(info.address, (uint8_t*)info.data, &len); if (result == MFRC522_STATUS_OK) { info.count = len; if (is_write) dh_command_done(cmd_res, ""); else dh_command_done_buf(cmd_res, info.data, info.count); MFRC522_PICC_HaltA(); MFRC522_PCD_StopCrypto1(); MFRC522_PCD_AntennaOff(); return; } } } } MFRC522_PICC_HaltA(); MFRC522_PCD_StopCrypto1(); MFRC522_PCD_AntennaOff(); dh_command_fail(cmd_res, MFRC522_GetStatusCodeName(result)); } #endif /* DH_COMMANDS_MFRC522 && DH_DEVICE_MFRC522 */
bcdca663e3b1e69c61a3e69ce48cb5a972e59be6
53577556769899cbbf223e4fc02c909865e8ba91
/bugsnag-plugin-android-ndk/src/main/jni/utils/serializer/event_writer.h
6f2ddfaeffd301aebdbf4f300b0674be3eaa8c93
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "MIT" ]
permissive
bugsnag/bugsnag-android
a3beec582912f8b00c5c630c57e63974ed5e1863
773663eca1fd7abfeaccb7a0d2a3d1e586b642b2
refs/heads/next
2023-09-03T15:43:38.840650
2023-08-11T09:48:15
2023-08-11T09:48:15
2,406,783
1,112
213
NOASSERTION
2023-09-14T14:21:07
2011-09-17T21:18:06
Kotlin
UTF-8
C
false
false
221
h
event_writer.h
/** * async-safe functions for writing an event to disk */ #pragma once #include "../../bugsnag_ndk.h" bool bsg_event_write(bsg_environment *env) __asyncsafe; bool bsg_lastrun_write(bsg_environment *env) __asyncsafe;
43459bfd69fe921da67cd1405e1c6d830b2b66b7
cfa39a4c71a733f39bf6d1f32ef540d3a49d608c
/include/complex.h
5ae2f020d5fe67c1d7a87ff335fe2dd4fd957dd8
[ "MIT" ]
permissive
redox-os/relibc
7d622ae036ccfedc31cbb19e7453f9caa1df873c
1ef79540776f2290924e5d996ef38c13e9f1d505
refs/heads/master
2023-08-31T01:42:51.820667
2023-06-13T11:34:49
2023-06-13T11:34:49
123,522,329
834
73
MIT
2023-03-08T03:47:15
2018-03-02T02:58:07
Rust
UTF-8
C
false
false
30
h
complex.h
#include <openlibm_complex.h>
4526ed81c582e1886b4a1b4e73fb45b0953c86ff
d9bf5fb8eb0e8d30189d0f5ba5ffa2d267fb37aa
/tests/unittests/quat.c
789c1acd064ce8123409f769db0a84a4460107ee
[ "BSL-1.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
thaytan/OpenHMD
3fb4549c4877922202a508e920346915c25a7a3d
e12700d622450ac9d26cea92597b1bb13c397adc
refs/heads/master
2023-02-04T19:51:21.686749
2021-08-28T19:30:54
2021-08-28T19:30:54
188,549,485
131
18
BSL-1.0
2021-06-07T06:25:59
2019-05-25T09:57:45
C
UTF-8
C
false
false
3,364
c
quat.c
/* * OpenHMD - Free and Open Source API and drivers for immersive technology. * Copyright (C) 2013 Fredrik Hultin. * Copyright (C) 2013 Jakob Bornecrantz. * Distributed under the Boost 1.0 licence, see LICENSE for full text. */ /* Unit Tests - Quaternion Tests */ #include "tests.h" static const float t = 0.001; bool quatf_eq(quatf q1, quatf q2, float t) { for(int i = 0; i < 4; i++) if(!float_eq(q1.arr[i], q2.arr[i], t)){ printf("\nquat.arr[%d] == %f, expected %f\n", i, q1.arr[i], q2.arr[i]); return false; } return true; } typedef struct { vec3f v; float f; quatf q; } vec_float_quat; void test_oquatf_init_axis() { //void oquatf_init_axis(quatf* me, const vec3f* vec, float angle); vec_float_quat list[] = { { {{0, 0, 0}}, 0, {{0, 0, 0, 1}}}, { {{5, 12, 3}}, 1, {{0.1796723168488794, 0.43121356043731063, 0.10780339010932766, 0.8775825618903728}}}, { {{-2, -3, 3}}, 1, {{-0.2044277365391809, -0.30664160480877134, 0.30664160480877134, 0.8775825618903728}} }, { {{100, -3, 3}}, -300, {{0.7142339081165469, -0.021427017243496407, 0.021427017243496407, 0.6992508064783751}} }, }; int sz = sizeof(vec_float_quat); for(int i = 0; i < sizeof(list) / sz; i++){ quatf q; oquatf_init_axis(&q, &list[i].v, list[i].f); //printf("%f %f %f %f\n", q.x, q.y, q.z, q.w); TAssert(quatf_eq(q, list[i].q, t)); } } typedef struct { quatf q; vec3f v1, v2; } quat_vec2; void test_oquatf_get_rotated() { // void oquatf_get_rotated(const quatf* me, const vec3f* vec, vec3f* out_vec); quat_vec2 list[] = { { {{0, 0, 0, 0}}, {{0, 0, 0}}, {{0, 0, 0}} }, { {{0, 0, 0, 0}}, {{1, 2, 3}}, {{0, 0, 0}} }, { {{0, 0, 0, 1}}, {{1, 2, 3}}, {{1, 2, 3}} }, { {{.4, .2, .1, 1}}, {{2, 1, 0}}, {{2.18, 1.59, 0.2}} }, { {{.4, .2, .1, -1}}, {{2, 1, 0}}, {{2.58, 0.79, 0.2}} }, }; int sz = sizeof(quat_vec2); for(int i = 0; i < sizeof(list) / sz; i++){ vec3f vec; oquatf_get_rotated(&list[i].q, &list[i].v1, &vec); TAssert(vec3f_eq(vec, list[i].v2, t)); } } // TODO test_oquatf_mult void test_oquatf_mult() { } // TODO test_oquatf_normalize void test_oquatf_normalize() { } // TODO test_oquatf_get_length void test_oquatf_get_length() { } // TODO test_oquatf_get_mat4x4 void test_oquatf_get_mat4x4() { } typedef struct { quatf q1, q2; float f; } quat2_float; void test_oquatf_get_dot() { // TODO add more test cases quat2_float list[] = { { {{1, 2, 3, 1}}, {{4, 3, 2, .5}}, 16.5 }, }; int sz = sizeof(quat2_float); for(int i = 0; i < sizeof(list) / sz; i++){ TAssert(float_eq(oquatf_get_dot(&list[i].q1, &list[i].q2), list[i].f, t)); } } typedef struct { quatf q1, q2; } quat2; void test_oquatf_inverse() { // TODO add more test cases quat2 list[] = { { {{1, 2, 3, 1}}, {{-0.06666666666666667, -0.13333333333333333, -0.2, 0.06666666666666667}} }, }; int sz = sizeof(quat2); for(int i = 0; i < sizeof(list) / sz; i++){ oquatf_inverse(&list[i].q1); TAssert(quatf_eq(list[i].q1, list[i].q2, t)); } } typedef struct { quatf q1, q2, q3; } quat3; void test_oquatf_diff() { // TODO add more test cases quat3 list[] = { { {{1, 2, 3, 1}}, {{5, 3, 2, .1}}, {{0.660000, -0.680000, 0.580000, 1.140000}} }, }; int sz = sizeof(quat3); for(int i = 0; i < sizeof(list) / sz; i++){ quatf q; oquatf_diff(&list[i].q1, &list[i].q2, &q); TAssert(quatf_eq(q, list[i].q3, t)); } }
db4e297f3b413195526f72660ca298d11d032eb4
25b7cd3e4b750803565c374e59f8179c8aab276d
/h3m/h3mlib/meta/meta_push_od.c
4442c64cf13ed7dd8c1be103b2ba6d4f7f5671d2
[ "MIT" ]
permissive
potmdehex/homm3tools
320ce70e0d22dc597df440ec7c63fde9844f7dbe
6b36d1f92ea67f5ad6d4847aeaf2dfb1766d3cc5
refs/heads/master
2023-08-06T02:56:53.534443
2022-09-19T12:42:50
2022-09-19T12:42:50
40,399,205
141
29
MIT
2019-12-06T12:11:43
2015-08-08T10:15:08
C
IBM852
C
false
false
14,493
c
meta_push_od.c
// Created by John ┼kerblom 2015-01-24 #include "../h3mlib.h" #include "meta_push.h" #include "../h3m_structures/object_details/h3m_od_body_dynamic.h" #define RESET_PTR(a) if (NULL != a) { free(a); a = NULL; } static int _meta_push_od_artifact(uint32_t fm, struct H3M_OD_BODY_DYNAMIC_ARTIFACT *body, struct META_OD_ENTRY *meta_od_entry) { size_t n = 0; if (0 != body->has_guardians) { META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->guardians.mesg, body->guardians.mesg_size, 0) n = (H3M_FORMAT_ROE == fm) ? sizeof(body->guardians.creatures->roe) : sizeof(body->guardians.creatures->absod); META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->guardians.creatures, n, 0) } else { META_OBJECT_PUSH_SKIP(meta_od_entry->dyn_pointers, body, body->guardians, sizeof(body->guardians)) } return 0; } static int _meta_push_od_event(uint32_t fm, struct H3M_OD_BODY_DYNAMIC_EVENT *body, struct META_OD_ENTRY *meta_od_entry) { size_t n = 0; _meta_push_od_artifact(fm, (struct H3M_OD_BODY_DYNAMIC_ARTIFACT *)body, meta_od_entry); n = body->contents.secondary_skills_count * sizeof(*(body->contents.secondary_skills)); META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->contents.secondary_skills, n, 0) n = body->contents.artifacts_count * ((H3M_FORMAT_ROE == fm) ? sizeof(body->contents.artifacts->roe) : sizeof(body->contents.artifacts->absod)); META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->contents.artifacts, n, 0) n = body->contents.spells_count * sizeof(*(body->contents.spells)); META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->contents.spells, n, 0) n = body->contents.creatures_count * ((H3M_FORMAT_ROE == fm) ? sizeof(body->contents.creatures->roe.slots[0]) : sizeof(body->contents.creatures->absod.slots[0])); META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->contents.creatures, n, 0) return 0; } static int _meta_push_od_hero(uint32_t fm, struct H3M_OD_BODY_DYNAMIC_HERO *body, struct META_OD_ENTRY *meta_od_entry) { size_t n = 0; size_t count = 0; if (H3M_FORMAT_ROE == fm) { RESET_PTR(body->biography) RESET_PTR(body->spells) RESET_PTR(body->primary_skills) } n = (body->name) ? sizeof(body->name) + body->name->size : 0; META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->name, n, 0) if (fm < H3M_FORMAT_SOD) { META_OBJECT_PUSH_SKIP(meta_od_entry->dyn_pointers, body, body->has_experience, sizeof(body->has_experience)) } else if (fm >= H3M_FORMAT_SOD && 0 == body->has_experience) { META_OBJECT_PUSH_SKIP(meta_od_entry->dyn_pointers, body, body->experience, sizeof(body->experience)) } if (0 == body->has_face) { META_OBJECT_PUSH_SKIP(meta_od_entry->dyn_pointers, body, body->has_face, sizeof(body->has_face)) } n = (NULL != body->secondary_skills && 0 != body->has_secondary_skills) ? (sizeof(body->secondary_skills->count) + (body->secondary_skills->count * sizeof(body->secondary_skills->skills[0]))) : 0; META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->secondary_skills, n, 0) n =(H3M_FORMAT_ROE == fm) ? sizeof(body->creatures->roe) : sizeof(body->creatures->absod); META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->creatures, n, 0) if (NULL != body->artifacts) { // Get artifacts size, a bit tricky n = (H3M_FORMAT_ROE == fm) ? sizeof(body->artifacts->roe) : ((H3M_FORMAT_AB == fm) ? sizeof(body->artifacts->ab) : sizeof(body->artifacts->sod)); count = *(uint16_t *)((uint8_t *)body->artifacts + n - sizeof(uint16_t)); if (0 != count) { n += count * ((H3M_FORMAT_ROE == fm) ? sizeof(body->artifacts->roe.backpack.artifacts[0]) : sizeof(body->artifacts->absod.backpack.artifacts[0])); } META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->artifacts, n, 0) } else { META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->artifacts, 0, 0) } if (fm >= H3M_FORMAT_AB) { n = (body->biography) ? sizeof(body->biography) + body->biography->size : 0; META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->biography, n, 0) if (H3M_FORMAT_AB == fm) { META_OBJECT_PUSH_SKIP(meta_od_entry->dyn_pointers, body, body->has_spells, sizeof(body->has_spells)) } } else { n = sizeof(body->has_biography) + sizeof(body->biography) + sizeof(body->gender) + sizeof(body->has_spells) + sizeof(body->spells) + sizeof(body->has_primary_skills) + sizeof(body->primary_skills); META_OBJECT_PUSH_SKIP(meta_od_entry->dyn_pointers, body, body->has_biography, n) } if (fm >= H3M_FORMAT_AB) { n = (H3M_FORMAT_AB == fm) ? sizeof(body->spells->ab) : sizeof(body->spells->sod); META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->spells, n, 0) } if (H3M_FORMAT_AB == fm) { n = sizeof(body->has_primary_skills) + sizeof(body->primary_skills); META_OBJECT_PUSH_SKIP(meta_od_entry->dyn_pointers, body, body->has_primary_skills, n) } else if (fm >= H3M_FORMAT_SOD) { META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->primary_skills, sizeof(*(body->primary_skills)), 0) } return 0; } static int _meta_push_od_message_bearer(uint32_t fm, struct H3M_OD_BODY_DYNAMIC_MESSAGE_BEARER *body, struct META_OD_ENTRY *meta_od_entry) { META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->mesg, body->mesg_size, 0) return 0; } static int _meta_push_od_monster(uint32_t fm, struct H3M_OD_BODY_DYNAMIC_MONSTER *body, struct META_OD_ENTRY *meta_od_entry) { size_t n = 0; if (NULL == body) { return 1; } if (0 != body->has_mesg_and_treasure) { META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->mesg_and_treasure.mesg, body->mesg_and_treasure.mesg_size, 0) n = ((H3M_FORMAT_ROE == fm) ? sizeof(body->mesg_and_treasure.treasure->roe) : sizeof(body->mesg_and_treasure.treasure->absod)); META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->mesg_and_treasure.treasure, n, 0) } else { META_OBJECT_PUSH_SKIP(meta_od_entry->dyn_pointers, body, body->mesg_and_treasure, sizeof(body->mesg_and_treasure)) } return 0; } static int _meta_push_od_random_dwelling(uint32_t fm, struct H3M_OD_BODY_DYNAMIC_RANDOM_DWELLING *body, struct META_OD_ENTRY *meta_od_entry) { if (META_OBJECT_RANDOM_DWELLING_PRESET_ALIGNMENT_ABSOD == meta_od_entry->oa_type) { META_OBJECT_PUSH_SKIP(meta_od_entry->dyn_pointers, body, body->castle_absod_id, sizeof(body->castle_absod_id)) } if (META_OBJECT_RANDOM_DWELLING_PRESET_ALIGNMENT_ABSOD == meta_od_entry->oa_type || 0 != body->castle_absod_id) { META_OBJECT_PUSH_SKIP(meta_od_entry->dyn_pointers, body, body->alignment, sizeof(body->alignment)) } if (META_OBJECT_RANDOM_DWELLING_PRESET_LEVEL_ABSOD == meta_od_entry->oa_type) { META_OBJECT_PUSH_SKIP(meta_od_entry->dyn_pointers, body, body->min_level, sizeof(body->min_level) + sizeof(body->max_level)) } return 0; } static int _meta_push_od_pandoras_box(uint32_t fm, struct H3M_OD_BODY_DYNAMIC_PANDORAS_BOX *body, struct META_OD_ENTRY *meta_od_entry) { // Hack for now, these two are structured the same for guardians and contents _meta_push_od_event(fm, (struct H3M_OD_BODY_DYNAMIC_EVENT *)body, meta_od_entry); return 0; } static int _meta_push_od_quest_guard(uint32_t fm, struct H3M_OD_BODY_DYNAMIC_QUEST_GUARD *body, struct META_OD_ENTRY *meta_od_entry) { size_t n = 0; if (H3M_FORMAT_ROE == fm) { RESET_PTR(body->quest.objective); } // TODO remove this extern hack once this func has a proper place extern size_t sizeof_quest(uint8_t *quest, uint8_t quest_type); if (fm >= H3M_FORMAT_AB && 0 != body->quest_type) { n = sizeof_quest((uint8_t *)body->quest.objective, body->quest_type); META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->quest.objective, n, 0) META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->quest.deadline_and_mesg.proposal_mesg, body->quest.deadline_and_mesg.proposal_mesg_size, 0) META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->quest.deadline_and_mesg.progress_mesg, body->quest.deadline_and_mesg.progress_mesg_size, 0) META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->quest.deadline_and_mesg.completion_mesg, body->quest.deadline_and_mesg.completion_mesg_size, 0) } else { META_OBJECT_PUSH_SKIP(meta_od_entry->dyn_pointers, body, body->quest, sizeof(body->quest)) } return 0; } static int _meta_push_od_seers_hut(uint32_t fm, struct H3M_OD_BODY_DYNAMIC_SEERS_HUT *body, struct META_OD_ENTRY *meta_od_entry) { size_t n = 0; // TODO remove this extern hack once this func has a proper place extern size_t sizeof_reward(uint32_t fm, uint8_t reward_type); // Hack for now, these two are structured the same for their quest _meta_push_od_quest_guard(fm, (struct H3M_OD_BODY_DYNAMIC_QUEST_GUARD *)body, meta_od_entry); n = sizeof_reward(fm, body->reward_type); META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->reward, n, 0) return 0; } static int _meta_push_od_town(uint32_t fm, struct H3M_OD_BODY_DYNAMIC_TOWN *body, struct META_OD_ENTRY *meta_od_entry) { struct H3M_OD_BODY_EXT_TOWN_EVENT *event = NULL; struct META_DYN_ARRAY_ENTRY *entry = NULL; UT_array *p_array = NULL; size_t n = 0; meta_od_entry->has_absod_id = (fm >= H3M_FORMAT_AB); n = (body->name) ? sizeof(body->name) + body->name->size : 0; META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->name, n, 0) n = (H3M_FORMAT_ROE == fm) ? sizeof(body->creatures->roe) : sizeof(body->creatures->absod); META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->creatures, n, 0) META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->buildings, sizeof(*body->buildings), sizeof(body->has_fort)) if (H3M_FORMAT_ROE == fm) { META_OBJECT_PUSH_SKIP(meta_od_entry->dyn_pointers, body, body->must_have_spells, sizeof(body->must_have_spells)) } if (NULL != body->events) { utarray_new(p_array, &ut_ptr_icd); utarray_reserve(p_array, body->event_count); for (unsigned int i = 0; i < body->event_count; ++i) { struct META_DYN_ARRAY_ENTRY *entry = calloc(1, sizeof(*entry)); event = &body->events[i]; entry->body = (uint8_t *)event; entry->body_size = sizeof(*(body->events)); utarray_new(entry->dyn_pointers, &ut_ptr_icd); META_OBJECT_PUSH_PTR(entry->dyn_pointers, event, event->name, event->name_size, 0) META_OBJECT_PUSH_PTR(entry->dyn_pointers, event, event->mesg, event->mesg_size, 0) if (fm < H3M_FORMAT_SOD) { META_OBJECT_PUSH_SKIP(entry->dyn_pointers, event, event->applies_to_human, sizeof(event->applies_to_human)) } utarray_push_back(p_array, &entry); } META_OBJECT_PUSH_ARRAY(meta_od_entry->dyn_pointers, body, body->events, p_array) } else { META_OBJECT_PUSH_PTR(meta_od_entry->dyn_pointers, body, body->events, 0, 0) } if (fm < H3M_FORMAT_SOD) { META_OBJECT_PUSH_SKIP(meta_od_entry->dyn_pointers, body, body->alignment, sizeof(body->alignment)) } return 0; } int meta_push_od(uint32_t fm, uint8_t *body, struct META_OD_ENTRY *meta_od_entry) { switch (meta_od_entry->oa_type) { case META_OBJECT_ARTIFACT: case META_OBJECT_ARTIFACT_AB: case META_OBJECT_ARTIFACT_SOD: case META_OBJECT_RESOURCE: case META_OBJECT_SPELL_SCROLL: return _meta_push_od_artifact(fm, (struct H3M_OD_BODY_DYNAMIC_ARTIFACT *)body, meta_od_entry); case META_OBJECT_EVENT: return _meta_push_od_event(fm, (struct H3M_OD_BODY_DYNAMIC_EVENT *)body, meta_od_entry); case META_OBJECT_HERO: case META_OBJECT_PRISON: case META_OBJECT_RANDOM_HERO: return _meta_push_od_hero(fm, (struct H3M_OD_BODY_DYNAMIC_HERO *)body, meta_od_entry); case META_OBJECT_MONSTER: case META_OBJECT_MONSTER_ABSOD: return _meta_push_od_monster(fm, (struct H3M_OD_BODY_DYNAMIC_MONSTER *)body, meta_od_entry); case META_OBJECT_OCEAN_BOTTLE: case META_OBJECT_SIGN: return _meta_push_od_message_bearer(fm, (struct H3M_OD_BODY_DYNAMIC_MESSAGE_BEARER *)body, meta_od_entry); case META_OBJECT_PANDORAS_BOX: return _meta_push_od_pandoras_box(fm, (struct H3M_OD_BODY_DYNAMIC_PANDORAS_BOX *)body, meta_od_entry); case META_OBJECT_RANDOM_DWELLING_ABSOD: case META_OBJECT_RANDOM_DWELLING_PRESET_ALIGNMENT_ABSOD: case META_OBJECT_RANDOM_DWELLING_PRESET_LEVEL_ABSOD: return _meta_push_od_random_dwelling(fm, (struct H3M_OD_BODY_DYNAMIC_RANDOM_DWELLING *)body, meta_od_entry); case META_OBJECT_QUEST_GUARD: return _meta_push_od_quest_guard(fm, (struct H3M_OD_BODY_DYNAMIC_QUEST_GUARD *)body, meta_od_entry); case META_OBJECT_SEERS_HUT: return _meta_push_od_seers_hut(fm, (struct H3M_OD_BODY_DYNAMIC_SEERS_HUT *)body, meta_od_entry); case META_OBJECT_TOWN: case META_OBJECT_TOWN_ABSOD: return _meta_push_od_town(fm, (struct H3M_OD_BODY_DYNAMIC_TOWN *)body, meta_od_entry); default: *(int *)0xD47B17C5 = 0xDEADDEAD; break; } return 1; }
c6778b56b336f5a9b503461c75cf96b86b4ce334
f6bbf5befa45e753077cf8afc8f965db2d214898
/microbench/growing_regions/infinite2.c
e6b6c432746673a222f68406c9f90af8d4a46f45
[]
no_license
iu-parfunc/gibbon
4e38f1d2d0526b30476dbebd794f929943f19f12
45f39ad0322cd7a31fe04922ad6bf38e6ac36ad6
refs/heads/main
2023-08-31T11:39:58.367737
2023-08-30T23:44:33
2023-08-30T23:44:38
58,642,617
139
23
null
2023-09-12T20:40:48
2016-05-12T13:10:41
C
UTF-8
C
false
false
9,419
c
infinite2.c
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <sys/mman.h> #include <errno.h> #include <malloc.h> #include <sys/resource.h> #include <math.h> #include "rts.h" /* Infinite - regions consist of a linked list of buffers, spread throughout memory (though possible constrained to 4GB regions). Writing into these regions requires bounds-checking. The buffers can start very small at the head of the list, but probably grow geometrically in size, making the cost of traversing all of them logarithmic. */ /* -------------------------------------------------------------------------------- */ CursorTy write_tag(CursorTy cur, TagTyPacked tag) { *(TagTyPacked *) cur = tag; return cur + 1; } CursorTy write_int(CursorTy cur, IntTy i) { *(IntTy *) cur = i; return cur + sizeof(IntTy); } void write_cursor(CursorTy at, CursorTy val) { *(CursorTy *) at = val; } /* -------------------------------------------------------------------------------- */ IntTy max(IntTy a, IntTy b) { return (a > b ? a : b); } CursorTy alloc_buf_malloc (IntTy buf_size) { CursorTy buf_ptr; buf_ptr = (CursorTy) malloc(buf_size); if (buf_ptr == NULL) { fprintf(stderr, "Error: malloc failed: %s\n", strerror(errno)); abort(); } return buf_ptr; } RegionTy alloc_first_infinite_region() { CursorTy reg_start = alloc_buf_malloc(INF_REG_INIT_SIZE); return (RegionTy) {reg_start, INF_REG_INIT_SIZE}; } RegionTy alloc_infinite_region(RegionTy old) { IntTy newsize; IntTy newsize_maybe = old.size * 2; if (newsize_maybe > INF_REG_MAX_SIZE) { newsize = old.size; } else { newsize = newsize_maybe; } CursorTy reg_start = alloc_buf_malloc(newsize); return (RegionTy) {reg_start, newsize}; } RegionCursorProd bounds_check(IntTy size_scalars, RegionTy reg, CursorTy cur) { // size of redirection node // need to come up with something better here IntTy required = max(size_scalars, REDIRECTION_SIZE); IntTy space_left = (reg.start + reg.size) - cur; if (space_left > required) { return (RegionCursorProd) {reg, cur}; } else { // allocate RegionTy reg1 = alloc_infinite_region(reg); // redirect CursorTy redir = write_tag(cur, REDIRECTION_TAG); write_cursor(redir, reg1.start); return (RegionCursorProd) {reg1, reg1.start}; } } /* -------------------------------------------------------------------------------- */ RegionCursorCursorProd buildTree(RegionTy reg, CursorTy pvrtmp2, IntTy pvrtmp3) { CursorTy lout272 = (CursorTy) pvrtmp2; IntTy i270 = (IntTy) pvrtmp3; IntTy b279 = i270 == (IntTy) 0; switch (b279) { case 0: { IntTy i273 = i270 - (IntTy) 1; CursorTy l274 = lout272 + (IntTy) 1; RegionCursorCursorProd tmp_struct0 = buildTree(reg, l274, i273); RegionTy reg1 = (RegionTy) tmp_struct0.field0; CursorTy pvrtmp6 = tmp_struct0.field1; CursorTy pvrtmp7 = tmp_struct0.field2; CursorTy x275 = (CursorTy) pvrtmp6; CursorTy end_x275 = (CursorTy) pvrtmp7; IntTy sizeof_x275 = end_x275 - x275; CursorTy l276 = l274 + sizeof_x275; RegionCursorCursorProd tmp_struct1 = buildTree(reg1, l276, i273); RegionTy reg2 = (RegionTy) tmp_struct1.field0; CursorTy pvrtmp8 = tmp_struct1.field1; CursorTy pvrtmp9 = tmp_struct1.field2; CursorTy y277 = (CursorTy) pvrtmp8; CursorTy end_y277 = (CursorTy) pvrtmp9; // write tag *(TagTyPacked *) lout272 = 1; CursorTy writetag8 = lout272 + 1; CursorTy writecur9 = (CursorTy) end_x275; CursorTy writecur10 = (CursorTy) end_y277; CursorTy pvrtmp11 = (CursorTy) writecur10; CursorTy pvrtmp10 = (CursorTy) lout272; CursorTy a278 = (CursorTy) pvrtmp10; CursorTy end_a278 = (CursorTy) pvrtmp11; return (RegionCursorCursorProd) {reg2, a278, end_a278}; break; } case 1: { IntTy size_scalars = 9; /* RegionCursorProd tmp_struct2 = bounds_check(size_scalars, reg, lout272); */ /* RegionTy reg3 = tmp_struct2.field0; */ /* CursorTy lout273 = tmp_struct2.field1; */ // -------------------- */ // BOUNDS CHECK // ~~~~~~~~~~~~~~~~~~~~ RegionTy reg3; CursorTy lout273; IntTy required = MAX(size_scalars, REDIRECTION_SIZE); IntTy space_left = (reg.start + reg.size) - lout272; if (space_left > required) { reg3 = reg; lout273 = lout272; } else { // allocate reg3 = alloc_infinite_region(reg); // redirect CursorTy redir = write_tag(lout272, REDIRECTION_TAG); write_cursor(redir, reg3.start); lout273 = reg3.start; } /* -------------------- */ // write tag *(TagTyPacked *) lout273 = 0; CursorTy writetag3 = lout273 + 1; // write int *(IntTy *) writetag3 = (IntTy) 1; CursorTy writecur4 = writetag3 + sizeof(IntTy); CursorTy pvrtmp5 = (CursorTy) writecur4; CursorTy pvrtmp4 = (CursorTy) lout273; CursorTy taildc0 = (CursorTy) pvrtmp4; CursorTy end_taildc0 = (CursorTy) pvrtmp5; return (RegionCursorCursorProd) {reg3, taildc0, end_taildc0}; } } } Int64CursorProd sumTree (CursorTy in_cur) { CursorTy lin = (CursorTy) in_cur; CursorTy tail = lin + sizeof(TagTyPacked); TagTyPacked tmpval = *lin; switch(tmpval) { case 0: { IntTy val = *(IntTy *) tail; CursorTy tail2 = tail + sizeof(IntTy); return (Int64CursorProd) {val, tail2}; } case 1: { Int64CursorProd tmp_struct1 = sumTree(tail); IntTy vleft = tmp_struct1.field0; CursorTy end_left = tmp_struct1.field1; Int64CursorProd tmp_struct2 = sumTree(end_left); IntTy vright = tmp_struct2.field0; CursorTy end_right = tmp_struct2.field1; IntTy final = vleft + vright; return (Int64CursorProd) {final, end_right}; } case REDIRECTION_TAG: { CursorTy next = *(CursorTy *) tail; return sumTree(next); } } } CursorTy print_Tree(CursorTy p23) { TagTyPacked tag24 = *(TagTyPacked *) p23; CursorTy tail25 = p23 + sizeof(TagTyPacked); switch (tag24) { case 0: { fputs("(Leaf ", stdout); IntTy val26 = *(IntTy *) tail25; CursorTy tail27 = tail25 + sizeof(IntTy); printf("%lld", val26); fputs(")", stdout); return tail27; break; } case 1: { fputs("(Node ", stdout); CursorTy end_left = print_Tree(tail25); fputs(" ", stdout); CursorTy end_right = print_Tree(end_left); fputs(")", stdout); return end_right; } case REDIRECTION_TAG: { printf("-> "); CursorTy next = *(CursorTy *) tail25; print_Tree(next); } } } void print_space_required(int depth) { IntTy nodes = (1 << depth) - 1; IntTy leaves = nodes + 1; IntTy reqd = nodes + leaves + (leaves * 8); printf("Space Required: %lld bytes.\n", reqd); } int main(int argc, char *argv[]) { int depth; depth = atoi(argv[1]); // buildTree and sumTree allocations RegionTy reg; CursorTy lout; reg = alloc_first_infinite_region(); lout = reg.start; RegionCursorCursorProd tmp_struct8; CursorTy tailapp1; Int64CursorProd tmp_struct9; IntTy val; if (strcmp(argv[2],"debug") == 0) { reg = alloc_first_infinite_region(); lout = reg.start; tmp_struct8 = buildTree(reg, lout, depth); tailapp1 = tmp_struct8.field1; /* print_Tree(tailapp1); */ tmp_struct9 = sumTree(tailapp1); val = tmp_struct9.field0; printf("%lld\n", val); } else { // criterion-interactive // ~~~~~~~~~~~~~~~~~~~~~ size_t input_size = 32; size_t input_len; IntTy iters; char* input = (char *) malloc(input_size * sizeof(char)); char* iters_str = (char *) malloc(input_size * sizeof(char)); int i; // Indicate that we're ready to run benchmarks fprintf(stdout,"READY\n"); fflush(stdout); // Read criterion `START_BENCH N` input_len = getline(&input,&input_size,stdin); // while (strcmp(input,"EXIT\n") != 0) { // Extract the N ... len(START_BENCH) = 11 strncpy(iters_str, input+11, input_len-11); iters = atoll(iters_str); // ***BENCHMARK*** // Run the benchmark N times for(i = 0; i < iters; i++) { tmp_struct8 = buildTree(reg, lout, depth); tailapp1 = tmp_struct8.field1; /* print_Tree(tailapp1); */ tmp_struct9 = sumTree(tailapp1); val = tmp_struct9.field0; /* printf("%lld\n", val);x */ } // Mark the end of 1 criterion run /* fprintf(stdout,"%lld\n",iters); */ fprintf(stdout, "END_BENCH\n"); fflush(stdout); // Recur input_len = getline(&input,&input_size,stdin); } } /* print_space_required(depth); */ }
8ea36cce39aaf5dbfd5c0be14bd54ba11160718d
a11e4bdd6157b22067288d860507fa20abea033d
/src/bin/e_ipc_codec.h
d03eb95be87245787c44d0fb43e9bc41d7114565
[ "BSD-2-Clause" ]
permissive
JeffHoogland/moksha
85a0f39dc97daa61d35e64a511013d21552db288
c56013644d8cd8e32101bb38a8d1e4ebd9d47f37
refs/heads/master
2023-08-24T05:39:13.415948
2023-08-22T19:49:32
2023-08-22T19:49:32
34,704,822
179
51
NOASSERTION
2023-09-06T14:41:31
2015-04-28T02:59:19
C
UTF-8
C
false
false
5,492
h
e_ipc_codec.h
#ifdef E_TYPEDEFS #ifdef USE_IPC typedef struct _E_Ipc_Int E_Ipc_Int; typedef struct _E_Ipc_Double E_Ipc_Double; typedef struct _E_Ipc_2Int E_Ipc_2Int; typedef struct _E_Ipc_List E_Ipc_List; typedef struct _E_Ipc_Str E_Ipc_Str; typedef struct _E_Ipc_2Str E_Ipc_2Str; typedef struct _E_Ipc_Str_Int E_Ipc_Str_Int; typedef struct _E_Ipc_Str_Int_List E_Ipc_Str_Int_List; typedef struct _E_Ipc_2Str_Int E_Ipc_2Str_Int; typedef struct _E_Ipc_2Str_Int_List E_Ipc_2Str_Int_List; typedef struct _E_Ipc_4Int_2Str E_Ipc_4Int_2Str; typedef struct _E_Ipc_5Int_2Str E_Ipc_5Int_2Str; typedef struct _E_Ipc_3Int_4Str E_Ipc_3Int_4Str; typedef struct _E_Ipc_3Int_3Str E_Ipc_3Int_3Str; typedef struct _E_Ipc_Str_4Int E_Ipc_Str_4Int; #endif #else #ifndef E_IPC_CODEC_H #define E_IPC_CODEC_H #ifdef USE_IPC struct _E_Ipc_Int { int val; }; struct _E_Ipc_Double { double val; }; struct _E_Ipc_2Int { int val1, val2; }; struct _E_Ipc_List { Eina_List *list; }; struct _E_Ipc_Str { char *str; }; struct _E_Ipc_2Str { char *str1, *str2; }; struct _E_Ipc_Str_Int { char *str; int val; }; struct _E_Ipc_2Str_Int { char *str1, *str2; int val; }; struct _E_Ipc_4Int_2Str { int val1, val2, val3, val4; char *str1, *str2; }; struct _E_Ipc_5Int_2Str { int val1, val2, val3, val4, val5; char *str1, *str2; }; struct _E_Ipc_3Int_4Str { int val1, val2, val3; char *str1, *str2, *str3, *str4; }; struct _E_Ipc_3Int_3Str { int val1, val2, val3; char *str1, *str2, *str3; }; struct _E_Ipc_Str_4Int { char *str; int val1, val2, val3, val4; }; EINTERN int e_ipc_codec_init(void); EINTERN void e_ipc_codec_shutdown(void); EAPI int e_ipc_codec_int_dec(char *data, int bytes, int *dest); EAPI void *e_ipc_codec_int_enc(int val, int *size_ret); EAPI int e_ipc_codec_double_dec(char *data, int bytes, double *dest); EAPI void *e_ipc_codec_double_enc(double val, int *size_ret); EAPI int e_ipc_codec_2int_dec(char *data, int bytes, int *dest, int *dest2x); EAPI void *e_ipc_codec_2int_enc(int val1, int val2, int *size_ret); EAPI int e_ipc_codec_str_dec(char *data, int bytes, char **dest); EAPI void *e_ipc_codec_str_enc(const char *str, int *size_ret); EAPI int e_ipc_codec_str_list_dec(char *data, int bytes, Eina_List **dest); EAPI void *e_ipc_codec_str_list_enc(Eina_List *list, int *size_ret); EAPI int e_ipc_codec_2str_dec(char *data, int bytes, E_Ipc_2Str **dest); EAPI void *e_ipc_codec_2str_enc(const char *str1, const char *str2, int *size_ret); EAPI int e_ipc_codec_2str_list_dec(char *data, int bytes, Eina_List **dest); EAPI void *e_ipc_codec_2str_list_enc(Eina_List *list, int *size_ret); EAPI int e_ipc_codec_str_int_dec(char *data, int bytes, E_Ipc_Str_Int **dest); EAPI void *e_ipc_codec_str_int_enc(const char *str, int val, int *size_ret); EAPI int e_ipc_codec_str_int_list_dec(char *data, int bytes, Eina_List **dest); EAPI void *e_ipc_codec_str_int_list_enc(Eina_List *list, int *size_ret); EAPI int e_ipc_codec_2str_int_dec(char *data, int bytes, E_Ipc_2Str_Int **dest); EAPI void *e_ipc_codec_2str_int_enc(const char *str1, const char *str2, int val, int *size_ret); EAPI int e_ipc_codec_2str_int_list_dec(char *data, int bytes, Eina_List **dest); EAPI void *e_ipc_codec_2str_int_list_enc(Eina_List *list, int *size_ret); EAPI int e_ipc_codec_4int_2str_dec(char *data, int bytes, E_Ipc_4Int_2Str **dest); EAPI void *e_ipc_codec_4int_2str_enc(int val1, int val2, int val3, int val4, const char *str1, const char *str2, int *size_ret); EAPI int e_ipc_codec_4int_2str_list_dec(char *data, int bytes, Eina_List **dest); EAPI void *e_ipc_codec_4int_2str_list_enc(Eina_List *list, int *size_ret); EAPI int e_ipc_codec_5int_2str_dec(char *data, int bytes, E_Ipc_5Int_2Str **dest); EAPI void *e_ipc_codec_5int_2str_enc(int val1, int val2, int val3, int val4, int val5, const char *str1, const char *str2, int *size_ret); EAPI int e_ipc_codec_5int_2str_list_dec(char *data, int bytes, Eina_List **dest); EAPI void *e_ipc_codec_5int_2str_list_enc(Eina_List *list, int *size_ret); EAPI int e_ipc_codec_3int_4str_dec(char *data, int bytes, E_Ipc_3Int_4Str **dest); EAPI void *e_ipc_codec_3int_4str_enc(int val1, int val2, int val3, const char *str1, const char *str2, const char *str3, const char *str4, int *size_ret); EAPI int e_ipc_codec_3int_4str_list_dec(char *data, int bytes, Eina_List **dest); EAPI void *e_ipc_codec_3int_4str_list_enc(Eina_List *list, int *size_ret); EAPI int e_ipc_codec_3int_3str_dec(char *data, int bytes, E_Ipc_3Int_3Str **dest); EAPI void *e_ipc_codec_3int_3str_enc(int val1, int val2, int val3, const char *str1, const char *str2, const char *str3, int *size_ret); EAPI int e_ipc_codec_3int_3str_list_dec(char *data, int bytes, Eina_List **dest); EAPI void *e_ipc_codec_3int_3str_list_enc(Eina_List *list, int *size_ret); EAPI int e_ipc_codec_str_4int_dec(char *data, int bytes, E_Ipc_Str_4Int **dest); EAPI void *e_ipc_codec_str_4int_enc(const char *str1, int val1, int val2, int val3, int val4, int *size_ret); EAPI int e_ipc_codec_str_4int_list_dec(char *data, int bytes, Eina_List **dest); EAPI void *e_ipc_codec_str_4int_list_enc(Eina_List *list, int *size_ret); #endif #endif #endif
f997aa4822f9506d708158b354e04a7efd8c9d1a
a642c6cba1e651f1511a70279c8b9bc42457ee2f
/src/main.c
5645786c8b3bc95daa22f99c17ed6c8cc71a44a8
[]
no_license
WEREMSOFT/voxelspace-c99-opengl-linux
725c9c9d385a19748de718e8c598409aeb892374
0235233ad8ad306af63fa1c5bdaa02c1f245a823
refs/heads/multi-thread
2023-07-04T07:06:11.861770
2021-08-15T22:26:06
2021-08-15T22:26:06
389,184,226
101
15
null
2021-08-18T19:23:59
2021-07-24T19:28:07
C
UTF-8
C
false
false
152
c
main.c
#include "program/program.h" int main(void) { Program this = programCreate(); programMainLoop(this); programDestroy(this); return 0; }
edc5cea7a273b4a52a325c049c29d5391034f0d0
7e6afb4986a53c420d40a2039240f8c5ed3f9549
/3rdparty/xspublic/xstypes/xssnapshot.h
948a47c6f16a1be96f620b927b5b6dca1fe44903
[ "BSD-3-Clause" ]
permissive
MRPT/mrpt
9ea3c39a76de78eacaca61a10e7e96646647a6da
34077ec74a90b593b587f2057d3280ea520a3609
refs/heads/develop
2023-08-17T23:37:29.722496
2023-08-17T15:39:54
2023-08-17T15:39:54
13,708,826
1,695
646
BSD-3-Clause
2023-09-12T22:02:53
2013-10-19T21:09:23
C++
UTF-8
C
false
false
4,732
h
xssnapshot.h
// Copyright (c) 2003-2019 Xsens Technologies B.V. or subsidiaries worldwide. // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, // this list of conditions, and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright notice, // this list of conditions, and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // 3. Neither the names of the copyright holders nor the names of their contributors // may be used to endorse or promote products derived from this software without // specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL // THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT // OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR // TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.THE LAWS OF THE NETHERLANDS // SHALL BE EXCLUSIVELY APPLICABLE AND ANY DISPUTES SHALL BE FINALLY SETTLED UNDER THE RULES // OF ARBITRATION OF THE INTERNATIONAL CHAMBER OF COMMERCE IN THE HAGUE BY ONE OR MORE // ARBITRATORS APPOINTED IN ACCORDANCE WITH SAID RULES. // #ifndef XSSNAPSHOT_H #define XSSNAPSHOT_H #include "xstypesconfig.h" #include "xsdeviceid.h" struct XsSnapshot; #ifdef __cplusplus extern "C" { #endif #ifndef __cplusplus #define XSSNAPSHOT_INITIALIZER { XSDEVICEID_INITIALIZER, 0, 0, 0,0,0,0, 0,0,0, 0,0,0, 0, 0, 0, 0 } #endif XSTYPES_DLL_API void XsSnapshot_construct(struct XsSnapshot* thisPtr); XSTYPES_DLL_API void XsSnapshot_destruct(struct XsSnapshot* thisPtr); #ifdef __cplusplus } // extern "C" #endif enum SnapshotType { ST_Awinda = 0, // ST_Full }; typedef enum SnapshotType SnapshotType; /*! \brief A container for Snapshot data */ struct XsSnapshot { XsDeviceId m_deviceId; /*!< \brief The ID of the device that created the data */ uint32_t m_frameNumber; /*!< \brief The frame */ uint64_t m_timestamp; /*!< \brief The timestamp */ int32_t m_iQ[4]; /*!< \brief The integrated orientation */ int64_t m_iV[3]; /*!< \brief The integrated velocity */ int32_t m_mag[3]; /*!< \brief The magnetic field */ int32_t m_baro; /*!< \brief The barometric pressure */ uint16_t m_status; /*!< \brief The clipping flags of the latest interval */ uint8_t m_accClippingCounter; /*!< \brief The clipping event counter for the Acc */ uint8_t m_gyrClippingCounter; /*!< \brief The clipping event counter for the Gyr */ SnapshotType m_type; /*!< \brief The type of the snapshot (Awinda, Full) */ #ifdef __cplusplus /*! \brief Returns true if all fields of this and \a other are exactly identical */ inline bool operator == (const XsSnapshot& other) const { if (m_frameNumber != other.m_frameNumber || m_baro != other.m_baro || m_status != other.m_status || m_accClippingCounter != other.m_accClippingCounter || m_gyrClippingCounter != other.m_gyrClippingCounter|| m_type != other.m_type) return false; for (int i = 0; i < 3; ++i) { if (m_iQ[i] != other.m_iQ[i] || m_iV[i] != other.m_iV[i] || m_mag[i] != other.m_mag[i]) return false; } if (m_type == ST_Full) { if (m_iQ[3] != other.m_iQ[3] || m_timestamp != other.m_timestamp ) return false; } return true; } #endif }; typedef struct XsSnapshot XsSnapshot; /*! \brief Status flag definitions for XsSnapshot status field */ enum SnapshotStatusFlag { FSFL_ClipAccX = 0x0001, FSFL_ClipAccY = 0x0002, FSFL_ClipAccZ = 0x0004, FSFL_ClipAccMask = 0x0007, FSFL_ClipGyrX = 0x0008, FSFL_ClipGyrY = 0x0010, FSFL_ClipGyrZ = 0x0020, FSFL_ClipGyrMask = 0x0038, FSFL_ClipMagX = 0x0040, FSFL_ClipMagY = 0x0080, FSFL_ClipMagZ = 0x0100, FSFL_ClipMagMask = 0x01C0, FSFL_MagIsNew = 0x0200, FSFL_BaroIsNew = 0x0400, FSFL_RotationMask = 0x1800 }; typedef enum SnapshotStatusFlag SnapshotStatusFlag; #define FSFL_ClipAccShift 0 #define FSFL_ClipGyrShift 04 #define FSFL_ClipMagshift 6 #define FSFL_RotationShift 11 #endif
32158a4a17c7c30ca3bc8d018784131f7ebb6442
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
/SOFTWARE/A64-TERES/linux-a64/net/netfilter/nf_conntrack_expect.c
95578da760d51a2e3da22178bbf9c1b255c1ff66
[ "Linux-syscall-note", "GPL-2.0-only", "GPL-1.0-or-later", "LicenseRef-scancode-free-unknown", "Apache-2.0" ]
permissive
OLIMEX/DIY-LAPTOP
ae82f4ee79c641d9aee444db9a75f3f6709afa92
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
refs/heads/rel3
2023-08-04T01:54:19.483792
2023-04-03T07:18:12
2023-04-03T07:18:12
80,094,055
507
92
Apache-2.0
2023-04-03T07:05:59
2017-01-26T07:25:50
C
UTF-8
C
false
false
16,954
c
nf_conntrack_expect.c
/* Expectation handling for nf_conntrack. */ /* (C) 1999-2001 Paul `Rusty' Russell * (C) 2002-2006 Netfilter Core Team <coreteam@netfilter.org> * (C) 2003,2004 USAGI/WIDE Project <http://www.linux-ipv6.org> * (c) 2005-2012 Patrick McHardy <kaber@trash.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/types.h> #include <linux/netfilter.h> #include <linux/skbuff.h> #include <linux/proc_fs.h> #include <linux/seq_file.h> #include <linux/stddef.h> #include <linux/slab.h> #include <linux/err.h> #include <linux/percpu.h> #include <linux/kernel.h> #include <linux/jhash.h> #include <linux/moduleparam.h> #include <linux/export.h> #include <net/net_namespace.h> #include <net/netfilter/nf_conntrack.h> #include <net/netfilter/nf_conntrack_core.h> #include <net/netfilter/nf_conntrack_expect.h> #include <net/netfilter/nf_conntrack_helper.h> #include <net/netfilter/nf_conntrack_tuple.h> #include <net/netfilter/nf_conntrack_zones.h> unsigned int nf_ct_expect_hsize __read_mostly; EXPORT_SYMBOL_GPL(nf_ct_expect_hsize); unsigned int nf_ct_expect_max __read_mostly; static struct kmem_cache *nf_ct_expect_cachep __read_mostly; /* nf_conntrack_expect helper functions */ void nf_ct_unlink_expect_report(struct nf_conntrack_expect *exp, u32 portid, int report) { struct nf_conn_help *master_help = nfct_help(exp->master); struct net *net = nf_ct_exp_net(exp); NF_CT_ASSERT(master_help); NF_CT_ASSERT(!timer_pending(&exp->timeout)); hlist_del_rcu(&exp->hnode); net->ct.expect_count--; hlist_del(&exp->lnode); master_help->expecting[exp->class]--; nf_ct_expect_event_report(IPEXP_DESTROY, exp, portid, report); nf_ct_expect_put(exp); NF_CT_STAT_INC(net, expect_delete); } EXPORT_SYMBOL_GPL(nf_ct_unlink_expect_report); static void nf_ct_expectation_timed_out(unsigned long ul_expect) { struct nf_conntrack_expect *exp = (void *)ul_expect; spin_lock_bh(&nf_conntrack_lock); nf_ct_unlink_expect(exp); spin_unlock_bh(&nf_conntrack_lock); nf_ct_expect_put(exp); } static unsigned int nf_ct_expect_dst_hash(const struct nf_conntrack_tuple *tuple) { unsigned int hash; if (unlikely(!nf_conntrack_hash_rnd)) { init_nf_conntrack_hash_rnd(); } hash = jhash2(tuple->dst.u3.all, ARRAY_SIZE(tuple->dst.u3.all), (((tuple->dst.protonum ^ tuple->src.l3num) << 16) | (__force __u16)tuple->dst.u.all) ^ nf_conntrack_hash_rnd); return ((u64)hash * nf_ct_expect_hsize) >> 32; } struct nf_conntrack_expect * __nf_ct_expect_find(struct net *net, u16 zone, const struct nf_conntrack_tuple *tuple) { struct nf_conntrack_expect *i; unsigned int h; if (!net->ct.expect_count) return NULL; h = nf_ct_expect_dst_hash(tuple); hlist_for_each_entry_rcu(i, &net->ct.expect_hash[h], hnode) { if (nf_ct_tuple_mask_cmp(tuple, &i->tuple, &i->mask) && nf_ct_zone(i->master) == zone) return i; } return NULL; } EXPORT_SYMBOL_GPL(__nf_ct_expect_find); /* Just find a expectation corresponding to a tuple. */ struct nf_conntrack_expect * nf_ct_expect_find_get(struct net *net, u16 zone, const struct nf_conntrack_tuple *tuple) { struct nf_conntrack_expect *i; rcu_read_lock(); i = __nf_ct_expect_find(net, zone, tuple); if (i && !atomic_inc_not_zero(&i->use)) i = NULL; rcu_read_unlock(); return i; } EXPORT_SYMBOL_GPL(nf_ct_expect_find_get); /* If an expectation for this connection is found, it gets delete from * global list then returned. */ struct nf_conntrack_expect * nf_ct_find_expectation(struct net *net, u16 zone, const struct nf_conntrack_tuple *tuple) { struct nf_conntrack_expect *i, *exp = NULL; unsigned int h; if (!net->ct.expect_count) return NULL; h = nf_ct_expect_dst_hash(tuple); hlist_for_each_entry(i, &net->ct.expect_hash[h], hnode) { if (!(i->flags & NF_CT_EXPECT_INACTIVE) && nf_ct_tuple_mask_cmp(tuple, &i->tuple, &i->mask) && nf_ct_zone(i->master) == zone) { exp = i; break; } } if (!exp) return NULL; /* If master is not in hash table yet (ie. packet hasn't left this machine yet), how can other end know about expected? Hence these are not the droids you are looking for (if master ct never got confirmed, we'd hold a reference to it and weird things would happen to future packets). */ if (!nf_ct_is_confirmed(exp->master)) return NULL; if (exp->flags & NF_CT_EXPECT_PERMANENT) { atomic_inc(&exp->use); return exp; } else if (del_timer(&exp->timeout)) { nf_ct_unlink_expect(exp); return exp; } return NULL; } /* delete all expectations for this conntrack */ void nf_ct_remove_expectations(struct nf_conn *ct) { struct nf_conn_help *help = nfct_help(ct); struct nf_conntrack_expect *exp; struct hlist_node *next; /* Optimization: most connection never expect any others. */ if (!help) return; hlist_for_each_entry_safe(exp, next, &help->expectations, lnode) { if (del_timer(&exp->timeout)) { nf_ct_unlink_expect(exp); nf_ct_expect_put(exp); } } } EXPORT_SYMBOL_GPL(nf_ct_remove_expectations); /* Would two expected things clash? */ static inline int expect_clash(const struct nf_conntrack_expect *a, const struct nf_conntrack_expect *b) { /* Part covered by intersection of masks must be unequal, otherwise they clash */ struct nf_conntrack_tuple_mask intersect_mask; int count; intersect_mask.src.u.all = a->mask.src.u.all & b->mask.src.u.all; for (count = 0; count < NF_CT_TUPLE_L3SIZE; count++){ intersect_mask.src.u3.all[count] = a->mask.src.u3.all[count] & b->mask.src.u3.all[count]; } return nf_ct_tuple_mask_cmp(&a->tuple, &b->tuple, &intersect_mask) && nf_ct_zone(a->master) == nf_ct_zone(b->master); } static inline int expect_matches(const struct nf_conntrack_expect *a, const struct nf_conntrack_expect *b) { return a->master == b->master && a->class == b->class && nf_ct_tuple_equal(&a->tuple, &b->tuple) && nf_ct_tuple_mask_equal(&a->mask, &b->mask) && nf_ct_zone(a->master) == nf_ct_zone(b->master); } /* Generally a bad idea to call this: could have matched already. */ void nf_ct_unexpect_related(struct nf_conntrack_expect *exp) { spin_lock_bh(&nf_conntrack_lock); if (del_timer(&exp->timeout)) { nf_ct_unlink_expect(exp); nf_ct_expect_put(exp); } spin_unlock_bh(&nf_conntrack_lock); } EXPORT_SYMBOL_GPL(nf_ct_unexpect_related); /* We don't increase the master conntrack refcount for non-fulfilled * conntracks. During the conntrack destruction, the expectations are * always killed before the conntrack itself */ struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me) { struct nf_conntrack_expect *new; new = kmem_cache_alloc(nf_ct_expect_cachep, GFP_ATOMIC); if (!new) return NULL; new->master = me; atomic_set(&new->use, 1); return new; } EXPORT_SYMBOL_GPL(nf_ct_expect_alloc); void nf_ct_expect_init(struct nf_conntrack_expect *exp, unsigned int class, u_int8_t family, const union nf_inet_addr *saddr, const union nf_inet_addr *daddr, u_int8_t proto, const __be16 *src, const __be16 *dst) { int len; if (family == AF_INET) len = 4; else len = 16; exp->flags = 0; exp->class = class; exp->expectfn = NULL; exp->helper = NULL; exp->tuple.src.l3num = family; exp->tuple.dst.protonum = proto; if (saddr) { memcpy(&exp->tuple.src.u3, saddr, len); if (sizeof(exp->tuple.src.u3) > len) /* address needs to be cleared for nf_ct_tuple_equal */ memset((void *)&exp->tuple.src.u3 + len, 0x00, sizeof(exp->tuple.src.u3) - len); memset(&exp->mask.src.u3, 0xFF, len); if (sizeof(exp->mask.src.u3) > len) memset((void *)&exp->mask.src.u3 + len, 0x00, sizeof(exp->mask.src.u3) - len); } else { memset(&exp->tuple.src.u3, 0x00, sizeof(exp->tuple.src.u3)); memset(&exp->mask.src.u3, 0x00, sizeof(exp->mask.src.u3)); } if (src) { exp->tuple.src.u.all = *src; exp->mask.src.u.all = htons(0xFFFF); } else { exp->tuple.src.u.all = 0; exp->mask.src.u.all = 0; } memcpy(&exp->tuple.dst.u3, daddr, len); if (sizeof(exp->tuple.dst.u3) > len) /* address needs to be cleared for nf_ct_tuple_equal */ memset((void *)&exp->tuple.dst.u3 + len, 0x00, sizeof(exp->tuple.dst.u3) - len); exp->tuple.dst.u.all = *dst; } EXPORT_SYMBOL_GPL(nf_ct_expect_init); static void nf_ct_expect_free_rcu(struct rcu_head *head) { struct nf_conntrack_expect *exp; exp = container_of(head, struct nf_conntrack_expect, rcu); kmem_cache_free(nf_ct_expect_cachep, exp); } void nf_ct_expect_put(struct nf_conntrack_expect *exp) { if (atomic_dec_and_test(&exp->use)) call_rcu(&exp->rcu, nf_ct_expect_free_rcu); } EXPORT_SYMBOL_GPL(nf_ct_expect_put); static int nf_ct_expect_insert(struct nf_conntrack_expect *exp) { struct nf_conn_help *master_help = nfct_help(exp->master); struct nf_conntrack_helper *helper; struct net *net = nf_ct_exp_net(exp); unsigned int h = nf_ct_expect_dst_hash(&exp->tuple); /* two references : one for hash insert, one for the timer */ atomic_add(2, &exp->use); hlist_add_head(&exp->lnode, &master_help->expectations); master_help->expecting[exp->class]++; hlist_add_head_rcu(&exp->hnode, &net->ct.expect_hash[h]); net->ct.expect_count++; setup_timer(&exp->timeout, nf_ct_expectation_timed_out, (unsigned long)exp); helper = rcu_dereference_protected(master_help->helper, lockdep_is_held(&nf_conntrack_lock)); if (helper) { exp->timeout.expires = jiffies + helper->expect_policy[exp->class].timeout * HZ; } add_timer(&exp->timeout); NF_CT_STAT_INC(net, expect_create); return 0; } /* Race with expectations being used means we could have none to find; OK. */ static void evict_oldest_expect(struct nf_conn *master, struct nf_conntrack_expect *new) { struct nf_conn_help *master_help = nfct_help(master); struct nf_conntrack_expect *exp, *last = NULL; hlist_for_each_entry(exp, &master_help->expectations, lnode) { if (exp->class == new->class) last = exp; } if (last && del_timer(&last->timeout)) { nf_ct_unlink_expect(last); nf_ct_expect_put(last); } } static inline int __nf_ct_expect_check(struct nf_conntrack_expect *expect) { const struct nf_conntrack_expect_policy *p; struct nf_conntrack_expect *i; struct nf_conn *master = expect->master; struct nf_conn_help *master_help = nfct_help(master); struct nf_conntrack_helper *helper; struct net *net = nf_ct_exp_net(expect); struct hlist_node *next; unsigned int h; int ret = 1; if (!master_help) { ret = -ESHUTDOWN; goto out; } h = nf_ct_expect_dst_hash(&expect->tuple); hlist_for_each_entry_safe(i, next, &net->ct.expect_hash[h], hnode) { if (expect_matches(i, expect)) { if (del_timer(&i->timeout)) { nf_ct_unlink_expect(i); nf_ct_expect_put(i); break; } } else if (expect_clash(i, expect)) { ret = -EBUSY; goto out; } } /* Will be over limit? */ helper = rcu_dereference_protected(master_help->helper, lockdep_is_held(&nf_conntrack_lock)); if (helper) { p = &helper->expect_policy[expect->class]; if (p->max_expected && master_help->expecting[expect->class] >= p->max_expected) { evict_oldest_expect(master, expect); if (master_help->expecting[expect->class] >= p->max_expected) { ret = -EMFILE; goto out; } } } if (net->ct.expect_count >= nf_ct_expect_max) { net_warn_ratelimited("nf_conntrack: expectation table full\n"); ret = -EMFILE; } out: return ret; } int nf_ct_expect_related_report(struct nf_conntrack_expect *expect, u32 portid, int report) { int ret; spin_lock_bh(&nf_conntrack_lock); ret = __nf_ct_expect_check(expect); if (ret <= 0) goto out; ret = nf_ct_expect_insert(expect); if (ret < 0) goto out; spin_unlock_bh(&nf_conntrack_lock); nf_ct_expect_event_report(IPEXP_NEW, expect, portid, report); return ret; out: spin_unlock_bh(&nf_conntrack_lock); return ret; } EXPORT_SYMBOL_GPL(nf_ct_expect_related_report); #ifdef CONFIG_NF_CONNTRACK_PROCFS struct ct_expect_iter_state { struct seq_net_private p; unsigned int bucket; }; static struct hlist_node *ct_expect_get_first(struct seq_file *seq) { struct net *net = seq_file_net(seq); struct ct_expect_iter_state *st = seq->private; struct hlist_node *n; for (st->bucket = 0; st->bucket < nf_ct_expect_hsize; st->bucket++) { n = rcu_dereference(hlist_first_rcu(&net->ct.expect_hash[st->bucket])); if (n) return n; } return NULL; } static struct hlist_node *ct_expect_get_next(struct seq_file *seq, struct hlist_node *head) { struct net *net = seq_file_net(seq); struct ct_expect_iter_state *st = seq->private; head = rcu_dereference(hlist_next_rcu(head)); while (head == NULL) { if (++st->bucket >= nf_ct_expect_hsize) return NULL; head = rcu_dereference(hlist_first_rcu(&net->ct.expect_hash[st->bucket])); } return head; } static struct hlist_node *ct_expect_get_idx(struct seq_file *seq, loff_t pos) { struct hlist_node *head = ct_expect_get_first(seq); if (head) while (pos && (head = ct_expect_get_next(seq, head))) pos--; return pos ? NULL : head; } static void *exp_seq_start(struct seq_file *seq, loff_t *pos) __acquires(RCU) { rcu_read_lock(); return ct_expect_get_idx(seq, *pos); } static void *exp_seq_next(struct seq_file *seq, void *v, loff_t *pos) { (*pos)++; return ct_expect_get_next(seq, v); } static void exp_seq_stop(struct seq_file *seq, void *v) __releases(RCU) { rcu_read_unlock(); } static int exp_seq_show(struct seq_file *s, void *v) { struct nf_conntrack_expect *expect; struct nf_conntrack_helper *helper; struct hlist_node *n = v; char *delim = ""; expect = hlist_entry(n, struct nf_conntrack_expect, hnode); if (expect->timeout.function) seq_printf(s, "%ld ", timer_pending(&expect->timeout) ? (long)(expect->timeout.expires - jiffies)/HZ : 0); else seq_printf(s, "- "); seq_printf(s, "l3proto = %u proto=%u ", expect->tuple.src.l3num, expect->tuple.dst.protonum); print_tuple(s, &expect->tuple, __nf_ct_l3proto_find(expect->tuple.src.l3num), __nf_ct_l4proto_find(expect->tuple.src.l3num, expect->tuple.dst.protonum)); if (expect->flags & NF_CT_EXPECT_PERMANENT) { seq_printf(s, "PERMANENT"); delim = ","; } if (expect->flags & NF_CT_EXPECT_INACTIVE) { seq_printf(s, "%sINACTIVE", delim); delim = ","; } if (expect->flags & NF_CT_EXPECT_USERSPACE) seq_printf(s, "%sUSERSPACE", delim); helper = rcu_dereference(nfct_help(expect->master)->helper); if (helper) { seq_printf(s, "%s%s", expect->flags ? " " : "", helper->name); if (helper->expect_policy[expect->class].name) seq_printf(s, "/%s", helper->expect_policy[expect->class].name); } return seq_putc(s, '\n'); } static const struct seq_operations exp_seq_ops = { .start = exp_seq_start, .next = exp_seq_next, .stop = exp_seq_stop, .show = exp_seq_show }; static int exp_open(struct inode *inode, struct file *file) { return seq_open_net(inode, file, &exp_seq_ops, sizeof(struct ct_expect_iter_state)); } static const struct file_operations exp_file_ops = { .owner = THIS_MODULE, .open = exp_open, .read = seq_read, .llseek = seq_lseek, .release = seq_release_net, }; #endif /* CONFIG_NF_CONNTRACK_PROCFS */ static int exp_proc_init(struct net *net) { #ifdef CONFIG_NF_CONNTRACK_PROCFS struct proc_dir_entry *proc; proc = proc_create("nf_conntrack_expect", 0440, net->proc_net, &exp_file_ops); if (!proc) return -ENOMEM; #endif /* CONFIG_NF_CONNTRACK_PROCFS */ return 0; } static void exp_proc_remove(struct net *net) { #ifdef CONFIG_NF_CONNTRACK_PROCFS remove_proc_entry("nf_conntrack_expect", net->proc_net); #endif /* CONFIG_NF_CONNTRACK_PROCFS */ } module_param_named(expect_hashsize, nf_ct_expect_hsize, uint, 0400); int nf_conntrack_expect_pernet_init(struct net *net) { int err = -ENOMEM; net->ct.expect_count = 0; net->ct.expect_hash = nf_ct_alloc_hashtable(&nf_ct_expect_hsize, 0); if (net->ct.expect_hash == NULL) goto err1; err = exp_proc_init(net); if (err < 0) goto err2; return 0; err2: nf_ct_free_hashtable(net->ct.expect_hash, nf_ct_expect_hsize); err1: return err; } void nf_conntrack_expect_pernet_fini(struct net *net) { exp_proc_remove(net); nf_ct_free_hashtable(net->ct.expect_hash, nf_ct_expect_hsize); } int nf_conntrack_expect_init(void) { if (!nf_ct_expect_hsize) { nf_ct_expect_hsize = nf_conntrack_htable_size / 256; if (!nf_ct_expect_hsize) nf_ct_expect_hsize = 1; } nf_ct_expect_max = nf_ct_expect_hsize * 4; nf_ct_expect_cachep = kmem_cache_create("nf_conntrack_expect", sizeof(struct nf_conntrack_expect), 0, 0, NULL); if (!nf_ct_expect_cachep) return -ENOMEM; return 0; } void nf_conntrack_expect_fini(void) { rcu_barrier(); /* Wait for call_rcu() before destroy */ kmem_cache_destroy(nf_ct_expect_cachep); }
2769d06719e2cb581fd4db4abfd732093e1ac259
771b8d391585df59d8c7438e21e54976c4180011
/lib/libOTe/KyberOT/indcpa.c
7d0f51624ede3a003880ede04e8240e0e3d967cd
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
permissive
cryptobiu/libscapi
1f11f92065c1cea418e73b932c9810d374bac060
1f70a88548501eaca5fb635194443e7a2b871088
refs/heads/master
2023-08-10T08:34:21.304797
2022-08-16T16:48:20
2022-08-16T16:48:20
53,246,303
186
74
MIT
2023-07-20T11:01:17
2016-03-06T08:59:43
C++
UTF-8
C
false
false
5,229
c
indcpa.c
#include <string.h> #include "indcpa.h" #include "poly.h" #include "polyvec.h" #include "randombytes.h" #include "fips202.h" #include "ntt.h" #include "genmatrix.h" static void pack_pk(unsigned char *r, const polyvec *pk, const unsigned char *seed) { int i; /* polyvec_compress(r, pk); for(i=0;i<KYBER_SYMBYTES;i++) r[i+KYBER_POLYVECCOMPRESSEDBYTES] = seed[i]; */ //for(i=0;i<KYBER_POLYVECBYTES;i++) // *(r+i)=*(pk+i); polyvec_tobytes(r,pk); for(i=0;i<KYBER_SYMBYTES;i++) r[i+KYBER_POLYVECBYTES] = seed[i]; } static void unpack_pk(polyvec *pk, unsigned char *seed, const unsigned char *packedpk) { int i; /* polyvec_decompress(pk, packedpk); for(i=0;i<KYBER_SYMBYTES;i++) seed[i] = packedpk[i+KYBER_POLYVECCOMPRESSEDBYTES]; */ //polyvec_decompress(pk, packedpk); //for(i=0;i<KYBER_POLYVECBYTES;i++) // *(pk+i)=*(packedpk+i); polyvec_frombytes(pk, packedpk); for(i=0;i<KYBER_SYMBYTES;i++) seed[i] = packedpk[i+KYBER_POLYVECBYTES]; } static void pack_ciphertext(unsigned char *r, const polyvec *b, const poly *v) { polyvec_compress(r, b); poly_compress(r+KYBER_POLYVECCOMPRESSEDBYTES, v); } static void unpack_ciphertext(polyvec *b, poly *v, const unsigned char *c) { polyvec_decompress(b, c); poly_decompress(v, c+KYBER_POLYVECCOMPRESSEDBYTES); } static void pack_sk(unsigned char *r, const polyvec *sk) { polyvec_tobytes(r, sk); } static void unpack_sk(polyvec *sk, const unsigned char *packedsk) { polyvec_frombytes(sk, packedsk); } void indcpa_keypair(unsigned char *pk, unsigned char *sk) { polyvec a[KYBER_K], e, pkpv, skpv; unsigned char buf[KYBER_SYMBYTES+KYBER_SYMBYTES]; unsigned char *publicseed = buf; unsigned char *noiseseed = buf+KYBER_SYMBYTES; int i; randombytes(buf, KYBER_SYMBYTES); sha3_512(buf, buf, KYBER_SYMBYTES); genmatrix(a, publicseed, 0); #if (KYBER_K == 2) poly_getnoise4x(skpv.vec+0,skpv.vec+1,e.vec+0,e.vec+1,noiseseed,0,1,2,3); #elif (KYBER_K == 3) poly_getnoise4x(skpv.vec+0,skpv.vec+1,skpv.vec+2,e.vec+0,noiseseed,0,1,2,3); poly_getnoise(e.vec+1,noiseseed,4); poly_getnoise(e.vec+2,noiseseed,5); #elif (KYBER_K == 4) poly_getnoise4x(skpv.vec+0,skpv.vec+1,skpv.vec+2,skpv.vec+3,noiseseed,0,1,2,3); poly_getnoise4x(e.vec+0,e.vec+1,e.vec+2,e.vec+3,noiseseed,4,5,6,7); #else unsigned char nonce=0; for(i=0;i<KYBER_K;i++) poly_getnoise(skpv.vec+i,noiseseed,nonce++); for(i=0;i<KYBER_K;i++) poly_getnoise(e.vec+i,noiseseed,nonce++); #endif polyvec_ntt(&skpv); // matrix-vector multiplication for(i=0;i<KYBER_K;i++) polyvec_pointwise_acc(&pkpv.vec[i],&skpv,a+i); polyvec_invntt(&pkpv); polyvec_add(&pkpv,&pkpv,&e); pack_sk(sk, &skpv); pack_pk(pk, &pkpv, publicseed); } void indcpa_enc(unsigned char *c, const unsigned char *m, const unsigned char *pk, const unsigned char *coins) { polyvec sp, pkpv, ep, at[KYBER_K], bp; poly v, k, epp; unsigned char seed[KYBER_SYMBYTES]; int i; unpack_pk(&pkpv, seed, pk); poly_frommsg(&k, m); polyvec_ntt(&pkpv); genmatrix(at, seed, 1); #if (KYBER_K == 2) poly_getnoise4x(sp.vec+0,sp.vec+1,ep.vec+0,ep.vec+1,coins,0,1,2,3); poly_getnoise(&epp,coins,4); #else unsigned char nonce=0; for(i=0;i<KYBER_K;i++) poly_getnoise(sp.vec+i,coins,nonce++); for(i=0;i<KYBER_K;i++) poly_getnoise(ep.vec+i,coins,nonce++); poly_getnoise(&epp,coins,nonce++); #endif polyvec_ntt(&sp); // matrix-vector multiplication for(i=0;i<KYBER_K;i++) polyvec_pointwise_acc(&bp.vec[i],&sp,at+i); polyvec_invntt(&bp); polyvec_add(&bp, &bp, &ep); polyvec_pointwise_acc(&v, &pkpv, &sp); poly_invntt(&v); poly_add(&v, &v, &epp); poly_add(&v, &v, &k); pack_ciphertext(c, &bp, &v); } void indcpa_dec(unsigned char *m, const unsigned char *c, const unsigned char *sk) { polyvec bp, skpv; poly v, mp; unpack_ciphertext(&bp, &v, c); unpack_sk(&skpv, sk); polyvec_ntt(&bp); polyvec_pointwise_acc(&mp,&skpv,&bp); poly_invntt(&mp); poly_sub(&mp, &mp, &v); poly_tomsg(m, &mp); } void pkPlus(unsigned char *pk, unsigned char *pk1, unsigned char *pk2) { polyvec pkpv1,pkpv2; unsigned char seed[KYBER_SYMBYTES]; unpack_pk(&pkpv1, seed, pk1); unpack_pk(&pkpv2, seed, pk2); polyvec_add(&pkpv1, &pkpv1, &pkpv2); pack_pk(pk, &pkpv1, seed); //compute pk1-pk2 and store it in pk } void pkMinus(unsigned char *pk, unsigned char *pk1, unsigned char *pk2) { //compute pk1-pk2 and store it in pk polyvec pkpv1,pkpv2; unsigned char seed[KYBER_SYMBYTES]; unpack_pk(&pkpv1, seed, pk1); unpack_pk(&pkpv2, seed, pk2); polyvec_sub(&pkpv1, &pkpv1, &pkpv2); pack_pk(pk, &pkpv1, seed); } void returnSeed(unsigned char *seed, unsigned char *pk) { int i; for(i=0;i<KYBER_SYMBYTES;i++) *(seed+i) = *(pk+i+KYBER_POLYVECBYTES); } void setSeed(unsigned char *pk, unsigned char *seed) { int i; for(i=0;i<KYBER_SYMBYTES;i++) *(pk+i+KYBER_POLYVECBYTES)=*(seed+i); } void randomPK(unsigned char *pk,unsigned char *seed1, unsigned char *seed2) { polyvec a[KYBER_K]; genmatrix(a, seed1, 0); pack_pk(pk, &a[0], seed2); }
c7b5f820f1b8fc291cf6e90258ce6cf80862743e
1577e1cf4e89584a125cffb855ca50a9654c6d55
/libfs/FSPrivate.h
a5440381b1d5024fcbf547a205e308333d43b94d
[]
no_license
apple-open-source/macos
a4188b5c2ef113d90281d03cd1b14e5ee52ebffb
2d2b15f13487673de33297e49f00ef94af743a9a
refs/heads/master
2023-08-01T11:03:26.870408
2023-03-27T00:00:00
2023-03-27T00:00:00
180,595,052
124
24
null
2022-12-27T14:54:09
2019-04-10T14:06:23
null
UTF-8
C
false
false
8,416
h
FSPrivate.h
/* * Copyright (c) 1999-2004 Apple Computer, Inc. All Rights Reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #if !defined(__FILESYSTEM_PRIVATE__) #define __FILESYSTEM_PRIVATE__ 1 #include <sys/mount.h> #include <stdbool.h> #include <CoreFoundation/CFString.h> #include <CoreFoundation/CFURL.h> #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* Input: * 1. CFURLRef url: CFURLRef representation of current volume path * Output: * 1. CFStringRef: Localized format name for given file system path * * This function returns the localized format name for given path in * file system. */ extern CFStringRef _FSCopyLocalizedNameForVolumeFormatAtURL(CFURLRef url); /* Input: * 1. CFURLRef url: CFURLRef representation of current volume path * Output: * 1. CFStringRef: English format name for given file system path * * This function returns the English format name for given path in * file system. */ extern CFStringRef _FSCopyNameForVolumeFormatAtURL(CFURLRef url); /* Input: * 1. CFStringRef devnode: CFStringRef representation of /dev/diskXsXX * Output: * 1. CFStringRef: Localized format name for given /dev/diskXsXX * It returns "Unknown ( )" for the following conditions: * 1. If the devnode is mounted already. * 2. If the file system is not HFS or MSDOS. * * This function returns the Localized format name for /dev/diskXsXX */ extern CFStringRef _FSCopyLocalizedNameForVolumeFormatAtNode(CFStringRef devnode); /* Input: * 1. CFStringRef devnode: CFStringRef representation of /dev/diskXsXX * Output: * 1. CFStringRef: English format name for given /dev/diskXsXX * It returns "Unknown ( )" for the following conditions: * 1. If the devnode is mounted already. * 2. If the file system is not HFS or MSDOS. * * This function returns the English format name for /dev/diskXsXX */ extern CFStringRef _FSCopyNameForVolumeFormatAtNode(CFStringRef devnode); #define FS_MEDIA_DEV_ENCRYPTED 0x1 // device-level encryption #define FS_MEDIA_FDE_ENCRYPTED 0x2 // full-disk encryption #define FS_MEDIA_ENCRYPTION_CONVERTING 0x4 // encryption type is currently in flux typedef uint32_t fs_media_encryption_details_t; /* Input: * 1. CFStringRef devnode: CFStringRef representation of /dev/diskXsXX * 2. bool *encryption_status: pointer to store boolean value of encryption status. * Only valid on success. Must not be NULL. * 3. uint32_t *encryption_details: pointer to bitfield with extra encryption information. * Only valid on success. May be NULL. * Output: * 1. errno_t: 0 upon success, or an errno indicating why no information could be found. * * This function returns the encryption status for /dev/diskXsXX */ extern errno_t _FSGetMediaEncryptionStatus(CFStringRef devnode, bool *encryption_status, fs_media_encryption_details_t *encryption_details); /* Input: * 1. const char *devnode: C string representation of /dev/diskXsXX * 2. bool *encryption_status: pointer to store boolean value of encryption status. * Only valid on success. Must not be NULL. * 3. uint32_t *encryption_details: pointer to bitfield with extra encryption information. * Only valid on success. May be NULL. * Output: * 1. errno_t: 0 upon success, or an errno indicating why no information could be found. * * This function returns the encryption status for /dev/diskXsXX */ extern errno_t _FSGetMediaEncryptionStatusAtPath(const char *devnode, bool *encryption_status, fs_media_encryption_details_t *encryption_details); /* Input: * 1. const char *path: C string representation of a file system path * 2. char *typenamebuf: Buffer where to store the file system type name. * It is recommended that this buffer is at least MFSTYPENAMELEN bytes in size. * May be NULL. * 3. size_t typenamebufsize: Size of typenamebuf. Ignored if typenamebuf is NULL. * 4. uint32_t *subtypep: Pointer to a uint32_t that will contain the file * system subtype, or 0 if no subtypes are defined for the file system. May be NULL. * * Output: * 1. errno_t: 0 upon success, or an errno indicating the mode of failure. */ extern errno_t _FSGetTypeInfoForPath(const char *path, char *typenamebuf, size_t typenamebufsize, uint32_t *subtypep); /* Input: * 1. int fd: A file descriptor representing an open file object. * 2. char *typenamebuf: Buffer where to store the file system type name. * It is recommended that this buffer is at least MFSTYPENAMELEN bytes in size. * May be NULL. * 3. size_t typenamebufsize: Size of typenamebuf. Ignored if typenamebuf is NULL. * 4. uint32_t *subtypep: Pointer to a uint32_t that will contain the file * system subtype, or 0 if no subtypes are defined for the file system. May be NULL. * * Output: * 1. errno_t: 0 upon success, or an errno indicating the mode of failure. */ extern errno_t _FSGetTypeInfoForFileDescriptor(int fd, char *typenamebuf, size_t typenamebufsize, uint32_t *subtypep); /* Input: * 1. const struct statfs *sfs: A buffer to a statfs structure filled out by statfs(2) * or fstatfs(2). * 2. char *typenamebuf: Buffer where to store the file system type name. * It is recommended that this buffer is at least MFSTYPENAMELEN bytes in size. * May be NULL. * 3. size_t typenamebufsize: Size of typenamebuf. Ignored if typenamebuf is NULL. * 4. uint32_t *subtypep: Pointer to a uint32_t that will contain the file * system subtype, or 0 if no subtypes are defined for the file system. May be NULL. * * Output: * 1. errno_t: 0 upon success, or an errno indicating the mode of failure. */ extern errno_t _FSGetTypeInfoFromStatfs(const struct statfs *sfs, char *typenamebuf, size_t typenamebufsize, uint32_t *subtypep); /* Input: * 1. const char *path: C string representation of a file system path. * 2. char *locationbuf: Buffer where to store the file system location. * It is recommended that this buffer is at least MNAMELEN bytes in size. * May be NULL. * 3. size_t locationbufsize: Size of locationbuf. Ignored if locationbuf is NULL. * * Output: * 1. errno_t: 0 upon success, or an errno indicating the mode of failure. */ extern errno_t _FSGetLocationForPath(const char *path, char *locationbuf, size_t locationbufsize); /* Input: * 1. int fd: A file descriptor representing an open file object. * 2. char *locationbuf: Buffer where to store the file system location. * It is recommended that this buffer is at least MNAMELEN bytes in size. * May be NULL. * 3. size_t locationbufsize: Size of locationbuf. Ignored if locationbuf is NULL. * * Output: * 1. errno_t: 0 upon success, or an errno indicating the mode of failure. */ extern errno_t _FSGetLocationForFileDescriptor(int fd, char *locationbuf, size_t locationbufsize); /* Input: * 1. const struct statfs *sfs: A buffer to a statfs structure filled out by statfs(2) * or fstatfs(2). * 2. char *locationbuf: Buffer where to store the file system location. * It is recommended that this buffer is at least MNAMELEN bytes in size. * May be NULL. * 3. size_t locationbufsize: Size of locationbuf. Ignored if locationbuf is NULL. * * Output: * 1. errno_t: 0 upon success, or an errno indicating the mode of failure. */ extern errno_t _FSGetLocationFromStatfs(const struct statfs *sfs, char *locationbuf, size_t locationbufsize); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* !__FILESYSTEM_PRIVATE__ */
5440b82c2a1604f5ea8ead83dc738e39d373aa49
c0bfd93cd7f26a271268e504959256f1e02c6806
/components/wpa_supplicant/src/utils/ext_password.c
96e67058dbf848df2007f37e29914bfe633ff49c
[ "Apache-2.0", "BSD-3-Clause" ]
permissive
espressif/ESP8266_RTOS_SDK
606f396e92d2675d9854f0fabd88587fbbbaf267
af0cdc36fa2600033d0a09301c754008cf1503c1
refs/heads/master
2023-08-24T22:40:15.373553
2023-05-06T02:04:24
2023-05-06T02:04:24
27,584,181
3,163
1,749
Apache-2.0
2023-08-09T10:48:13
2014-12-05T09:27:12
C
UTF-8
C
false
false
2,321
c
ext_password.c
/* * External password backend * Copyright (c) 2012, Jouni Malinen <j@w1.fi> * * This software may be distributed under the terms of the BSD license. * See README for more details. */ #include "utils/includes.h" #include "utils/common.h" #include "ext_password_i.h" #ifdef CONFIG_EXT_PASSWORD_TEST extern struct ext_password_backend ext_password_test; #endif /* CONFIG_EXT_PASSWORD_TEST */ #ifdef CONFIG_EXT_PASSWORD static const struct ext_password_backend *backends[] = { #ifdef CONFIG_EXT_PASSWORD_TEST &ext_password_test, #endif /* CONFIG_EXT_PASSWORD_TEST */ NULL }; #endif struct ext_password_data { const struct ext_password_backend *backend; void *priv; }; #ifdef CONFIG_EXT_PASSWORD struct ext_password_data * ext_password_init(const char *backend, const char *params) { struct ext_password_data *data; int i; data = (struct ext_password_data *)os_zalloc(sizeof(*data)); if (data == NULL) return NULL; for (i = 0; backends[i]; i++) { if (os_strcmp(backends[i]->name, backend) == 0) { data->backend = backends[i]; break; } } if (!data->backend) { os_free(data); return NULL; } data->priv = data->backend->init(params); if (data->priv == NULL) { os_free(data); return NULL; } return data; } void ext_password_deinit(struct ext_password_data *data) { if (data && data->backend && data->priv) data->backend->deinit(data->priv); os_free(data); } struct wpabuf * ext_password_get(struct ext_password_data *data, const char *name) { if (data == NULL) return NULL; return data->backend->get(data->priv, name); } #endif /* CONFIG_EXT_PASSWORD */ struct wpabuf * ext_password_alloc(size_t len) { struct wpabuf *buf; buf = wpabuf_alloc(len); if (buf == NULL) return NULL; #ifdef __linux__ if (mlock(wpabuf_head(buf), wpabuf_len(buf)) < 0) { wpa_printf(MSG_ERROR, "EXT PW: mlock failed: %s", strerror(errno)); } #endif /* __linux__ */ return buf; } #ifdef CONFIG_EXT_PASSWORD void ext_password_free(struct wpabuf *pw) { if (pw == NULL) return; os_memset(wpabuf_mhead(pw), 0, wpabuf_len(pw)); #ifdef __linux__ if (munlock(wpabuf_head(pw), wpabuf_len(pw)) < 0) { wpa_printf(MSG_ERROR, "EXT PW: munlock failed: %s", strerror(errno)); } #endif /* __linux__ */ wpabuf_free(pw); } #endif /* CONFIG_EXT_PASSWORD */
c08d5bcee35546d33099d09cc52f9186fe7db529
f9e7d65cb784c01a0200145ba8d289afe41d4a56
/board/npcx9_evb/board.h
cac7ea99be3d9b7a0ff9d20750bd6c52127ccf5b
[ "BSD-3-Clause" ]
permissive
FrameworkComputer/EmbeddedController
ad7086769e87d0a4179eae96a7c9ff5e383ff54e
f6d6b927eed71550d3475411cfc3e59abe5cef2a
refs/heads/hx20-hx30
2023-08-08T20:45:10.621169
2023-05-26T07:03:59
2023-05-26T07:03:59
447,021,040
846
48
BSD-3-Clause
2023-05-26T07:04:59
2022-01-12T00:11:14
C
UTF-8
C
false
false
2,652
h
board.h
/* Copyright 2020 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ /* Configuration for Nuvoton M4 EB */ #ifndef __CROS_EC_BOARD_H #define __CROS_EC_BOARD_H /* EC modules */ #define CONFIG_ADC #define CONFIG_PWM #define CONFIG_SPI #define CONFIG_I2C /* Features of eSPI */ #define CONFIG_HOSTCMD_ESPI #define CONFIG_HOSTCMD_ESPI_VW_SLP_S3 #define CONFIG_HOSTCMD_ESPI_VW_SLP_S4 /* Optional features */ #define CONFIG_ENABLE_JTAG_SELECTION #define CONFIG_BOARD_VERSION_GPIO #define CONFIG_EXTPOWER_GPIO #define CONFIG_I2C_MASTER #define CONFIG_KEYBOARD_BOARD_CONFIG #define CONFIG_KEYBOARD_PROTOCOL_8042 #undef CONFIG_LOW_POWER_IDLE /* Deep Sleep Support */ #define CONFIG_POWER_BUTTON #undef CONFIG_PSTORE #define CONFIG_PWM_KBLIGHT #define CONFIG_VBOOT_HASH #define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands */ /* EC console commands */ #define CONFIG_CMD_TASKREADY #define CONFIG_CMD_STACKOVERFLOW #define CONFIG_CMD_JUMPTAGS #define CONFIG_CMD_FLASH #define CONFIG_CMD_SPI_FLASH #define CONFIG_CMD_SCRATCHPAD #define CONFIG_CMD_I2CWEDGE /* I2C port for CONFIG_CMD_I2CWEDGE */ #define I2C_PORT_MASTER NPCX_I2C_PORT0_0 #define I2C_PORT_HOST 0 /* Fans for testing */ #define CONFIG_FANS 1 #define CONFIG_KEYBOARD_KSO_HIGH_DRIVE /* Quasi-bidirectional buf for KSOs */ #define CONFIG_HIBERNATE_PSL /* Use PSL (Power Switch Logic) for hibernate */ #undef CONFIG_CLOCK_SRC_EXTERNAL /* Use external 32kHz OSC as LFCLK source */ /* Optional feature to configure npcx9 chip */ /* Select which UART Controller is the Console UART */ #undef CONFIG_CONSOLE_UART #define CONFIG_CONSOLE_UART 0 /* 0:UART1 1:UART2 */ /* * This definition below actually doesn't define which UART controller to be * used. Instead, it defines which pinouts (GPIO10/11 or GPIO64/65) are * connected to "UART1" controller. */ #define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART1 */ #define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */ #define NPCX9_PWM1_SEL 0 /* 0:GPIOC2 as I2CSCL0 1:as PWM1 */ #ifndef __ASSEMBLER__ enum adc_channel { ADC_CH_0 = 0, ADC_CH_1, ADC_CH_2, ADC_CH_3, ADC_CH_4, ADC_CH_5, ADC_CH_6, ADC_CH_7, ADC_CH_8, ADC_CH_9, ADC_CH_10, ADC_CH_11, ADC_CH_COUNT }; enum pwm_channel { PWM_CH_FAN, PWM_CH_KBLIGHT, /* Number of PWM channels */ PWM_CH_COUNT }; enum fan_channel { FAN_CH_0, /* Number of FAN channels */ FAN_CH_COUNT }; enum mft_channel { MFT_CH_0, /* Number of MFT channels */ MFT_CH_COUNT }; #include "gpio_signal.h" #endif /* !__ASSEMBLER__ */ #endif /* __CROS_EC_BOARD_H */
678953fc556139e907fa42683ed03ae580a7925e
99bdb3251fecee538e0630f15f6574054dfc1468
/bsp/hpmicro/libraries/hpm_sdk/soc/ip/hpm_pwm_regs.h
5865f0cd950ce209f2dfac161091dc61aca4011d
[ "Apache-2.0", "Zlib", "LicenseRef-scancode-proprietary-license", "MIT", "BSD-3-Clause", "X11", "BSD-4-Clause-UC", "LicenseRef-scancode-unknown-license-reference" ]
permissive
RT-Thread/rt-thread
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
3602f891211904a27dcbd51e5ba72fefce7326b2
refs/heads/master
2023-09-01T04:10:20.295801
2023-08-31T16:20:55
2023-08-31T16:20:55
7,408,108
9,599
5,805
Apache-2.0
2023-09-14T13:37:26
2013-01-02T14:49:21
C
UTF-8
C
false
false
41,495
h
hpm_pwm_regs.h
/* * Copyright (c) 2021-2023 HPMicro * * SPDX-License-Identifier: BSD-3-Clause * */ #ifndef HPM_PWM_H #define HPM_PWM_H typedef struct { __RW uint32_t UNLK; /* 0x0: Shadow registers unlock register */ union { __RW uint32_t STA; /* 0x4: Counter start register */ __RW uint32_t STA_HRPWM; /* 0x4: Counter start register */ }; union { __RW uint32_t RLD; /* 0x8: Counter reload register */ __RW uint32_t RLD_HRPWM; /* 0x8: Counter reload register */ }; union { __RW uint32_t CMP[24]; /* 0xC - 0x68: Comparator register */ __RW uint32_t CMP_HRPWM[24]; /* 0xC - 0x68: Comparator register */ }; __R uint8_t RESERVED0[12]; /* 0x6C - 0x77: Reserved */ __RW uint32_t FRCMD; /* 0x78: Force output mode register */ __RW uint32_t SHLK; /* 0x7C: Shadow registers lock register */ __RW uint32_t CHCFG[24]; /* 0x80 - 0xDC: Output channel configure register */ __R uint8_t RESERVED1[16]; /* 0xE0 - 0xEF: Reserved */ __RW uint32_t GCR; /* 0xF0: Global control register */ __RW uint32_t SHCR; /* 0xF4: Shadow register control register */ __R uint8_t RESERVED2[8]; /* 0xF8 - 0xFF: Reserved */ __R uint32_t CAPPOS[24]; /* 0x100 - 0x15C: Capture rising edge register */ __R uint8_t RESERVED3[16]; /* 0x160 - 0x16F: Reserved */ __R uint32_t CNT; /* 0x170: Counter */ __R uint8_t RESERVED4[12]; /* 0x174 - 0x17F: Reserved */ __R uint32_t CAPNEG[24]; /* 0x180 - 0x1DC: Capture falling edge register */ __R uint8_t RESERVED5[16]; /* 0x1E0 - 0x1EF: Reserved */ __R uint32_t CNTCOPY; /* 0x1F0: Counter copy */ __R uint8_t RESERVED6[12]; /* 0x1F4 - 0x1FF: Reserved */ __RW uint32_t PWMCFG[8]; /* 0x200 - 0x21C: PWM channel configure register */ __W uint32_t SR; /* 0x220: Status register */ __RW uint32_t IRQEN; /* 0x224: Interrupt request enable register */ __R uint8_t RESERVED7[4]; /* 0x228 - 0x22B: Reserved */ __RW uint32_t DMAEN; /* 0x22C: DMA request enable register */ __RW uint32_t CMPCFG[24]; /* 0x230 - 0x28C: Comparator configure register */ __R uint8_t RESERVED8[368]; /* 0x290 - 0x3FF: Reserved */ __R uint32_t ANASTS[8]; /* 0x400 - 0x41C: analog status register */ __W uint32_t HRPWM_CFG; /* 0x420: hrpwm config register */ } PWM_Type; /* Bitfield definition for register: UNLK */ /* * SHUNLK (RW) * * write 0xB0382607 to unlock the shadow registers of register offset from 0x04 to 0x78, * otherwise the shadow registers can not be written. */ #define PWM_UNLK_SHUNLK_MASK (0xFFFFFFFFUL) #define PWM_UNLK_SHUNLK_SHIFT (0U) #define PWM_UNLK_SHUNLK_SET(x) (((uint32_t)(x) << PWM_UNLK_SHUNLK_SHIFT) & PWM_UNLK_SHUNLK_MASK) #define PWM_UNLK_SHUNLK_GET(x) (((uint32_t)(x) & PWM_UNLK_SHUNLK_MASK) >> PWM_UNLK_SHUNLK_SHIFT) /* Bitfield definition for register: STA */ /* * XSTA (RW) * * pwm timer counter extended start point, should back to this value after reach xrld */ #define PWM_STA_XSTA_MASK (0xF0000000UL) #define PWM_STA_XSTA_SHIFT (28U) #define PWM_STA_XSTA_SET(x) (((uint32_t)(x) << PWM_STA_XSTA_SHIFT) & PWM_STA_XSTA_MASK) #define PWM_STA_XSTA_GET(x) (((uint32_t)(x) & PWM_STA_XSTA_MASK) >> PWM_STA_XSTA_SHIFT) /* * STA (RW) * * pwm timer counter start value * sta/rld will be loaded from shadow register to work register at main counter reload time, or software write unlk.shunlk */ #define PWM_STA_STA_MASK (0xFFFFFF0UL) #define PWM_STA_STA_SHIFT (4U) #define PWM_STA_STA_SET(x) (((uint32_t)(x) << PWM_STA_STA_SHIFT) & PWM_STA_STA_MASK) #define PWM_STA_STA_GET(x) (((uint32_t)(x) & PWM_STA_STA_MASK) >> PWM_STA_STA_SHIFT) /* Bitfield definition for register: STA_HRPWM */ /* * STA (RW) * */ #define PWM_STA_HRPWM_STA_MASK (0xFFFFFF00UL) #define PWM_STA_HRPWM_STA_SHIFT (8U) #define PWM_STA_HRPWM_STA_SET(x) (((uint32_t)(x) << PWM_STA_HRPWM_STA_SHIFT) & PWM_STA_HRPWM_STA_MASK) #define PWM_STA_HRPWM_STA_GET(x) (((uint32_t)(x) & PWM_STA_HRPWM_STA_MASK) >> PWM_STA_HRPWM_STA_SHIFT) /* Bitfield definition for register: RLD */ /* * XRLD (RW) * * timeout counter extended reload point, counter will reload to xsta after reach this point */ #define PWM_RLD_XRLD_MASK (0xF0000000UL) #define PWM_RLD_XRLD_SHIFT (28U) #define PWM_RLD_XRLD_SET(x) (((uint32_t)(x) << PWM_RLD_XRLD_SHIFT) & PWM_RLD_XRLD_MASK) #define PWM_RLD_XRLD_GET(x) (((uint32_t)(x) & PWM_RLD_XRLD_MASK) >> PWM_RLD_XRLD_SHIFT) /* * RLD (RW) * * pwm timer counter reload value */ #define PWM_RLD_RLD_MASK (0xFFFFFF0UL) #define PWM_RLD_RLD_SHIFT (4U) #define PWM_RLD_RLD_SET(x) (((uint32_t)(x) << PWM_RLD_RLD_SHIFT) & PWM_RLD_RLD_MASK) #define PWM_RLD_RLD_GET(x) (((uint32_t)(x) & PWM_RLD_RLD_MASK) >> PWM_RLD_RLD_SHIFT) /* Bitfield definition for register: RLD_HRPWM */ /* * RLD (RW) * */ #define PWM_RLD_HRPWM_RLD_MASK (0xFFFFFF00UL) #define PWM_RLD_HRPWM_RLD_SHIFT (8U) #define PWM_RLD_HRPWM_RLD_SET(x) (((uint32_t)(x) << PWM_RLD_HRPWM_RLD_SHIFT) & PWM_RLD_HRPWM_RLD_MASK) #define PWM_RLD_HRPWM_RLD_GET(x) (((uint32_t)(x) & PWM_RLD_HRPWM_RLD_MASK) >> PWM_RLD_HRPWM_RLD_SHIFT) /* * RLD_HR (RW) * * pwm timer counter reload value at high resolution, only exist if hwpwm is enabled. */ #define PWM_RLD_HRPWM_RLD_HR_MASK (0xFFU) #define PWM_RLD_HRPWM_RLD_HR_SHIFT (0U) #define PWM_RLD_HRPWM_RLD_HR_SET(x) (((uint32_t)(x) << PWM_RLD_HRPWM_RLD_HR_SHIFT) & PWM_RLD_HRPWM_RLD_HR_MASK) #define PWM_RLD_HRPWM_RLD_HR_GET(x) (((uint32_t)(x) & PWM_RLD_HRPWM_RLD_HR_MASK) >> PWM_RLD_HRPWM_RLD_HR_SHIFT) /* Bitfield definition for register: 0 */ /* * XCMP (RW) * * extended counter compare value */ #define PWM_CMP_XCMP_MASK (0xF0000000UL) #define PWM_CMP_XCMP_SHIFT (28U) #define PWM_CMP_XCMP_SET(x) (((uint32_t)(x) << PWM_CMP_XCMP_SHIFT) & PWM_CMP_XCMP_MASK) #define PWM_CMP_XCMP_GET(x) (((uint32_t)(x) & PWM_CMP_XCMP_MASK) >> PWM_CMP_XCMP_SHIFT) /* * CMP (RW) * * clock counter compare value, the compare output is 0 at default, set to 1 when compare value meet, * and clr to 0 when timer reload. Software can invert the output by setting chan_cfg.out_polarity. */ #define PWM_CMP_CMP_MASK (0xFFFFFF0UL) #define PWM_CMP_CMP_SHIFT (4U) #define PWM_CMP_CMP_SET(x) (((uint32_t)(x) << PWM_CMP_CMP_SHIFT) & PWM_CMP_CMP_MASK) #define PWM_CMP_CMP_GET(x) (((uint32_t)(x) & PWM_CMP_CMP_MASK) >> PWM_CMP_CMP_SHIFT) /* * CMPHLF (RW) * * half clock counter compare value */ #define PWM_CMP_CMPHLF_MASK (0x8U) #define PWM_CMP_CMPHLF_SHIFT (3U) #define PWM_CMP_CMPHLF_SET(x) (((uint32_t)(x) << PWM_CMP_CMPHLF_SHIFT) & PWM_CMP_CMPHLF_MASK) #define PWM_CMP_CMPHLF_GET(x) (((uint32_t)(x) & PWM_CMP_CMPHLF_MASK) >> PWM_CMP_CMPHLF_SHIFT) /* * CMPJIT (RW) * * jitter counter compare value */ #define PWM_CMP_CMPJIT_MASK (0x7U) #define PWM_CMP_CMPJIT_SHIFT (0U) #define PWM_CMP_CMPJIT_SET(x) (((uint32_t)(x) << PWM_CMP_CMPJIT_SHIFT) & PWM_CMP_CMPJIT_MASK) #define PWM_CMP_CMPJIT_GET(x) (((uint32_t)(x) & PWM_CMP_CMPJIT_MASK) >> PWM_CMP_CMPJIT_SHIFT) /* Bitfield definition for register: 0 */ /* * CMP (RW) * */ #define PWM_CMP_HRPWM_CMP_MASK (0xFFFFFF00UL) #define PWM_CMP_HRPWM_CMP_SHIFT (8U) #define PWM_CMP_HRPWM_CMP_SET(x) (((uint32_t)(x) << PWM_CMP_HRPWM_CMP_SHIFT) & PWM_CMP_HRPWM_CMP_MASK) #define PWM_CMP_HRPWM_CMP_GET(x) (((uint32_t)(x) & PWM_CMP_HRPWM_CMP_MASK) >> PWM_CMP_HRPWM_CMP_SHIFT) /* * CMP_HR (RW) * * high resolution compare value */ #define PWM_CMP_HRPWM_CMP_HR_MASK (0xFFU) #define PWM_CMP_HRPWM_CMP_HR_SHIFT (0U) #define PWM_CMP_HRPWM_CMP_HR_SET(x) (((uint32_t)(x) << PWM_CMP_HRPWM_CMP_HR_SHIFT) & PWM_CMP_HRPWM_CMP_HR_MASK) #define PWM_CMP_HRPWM_CMP_HR_GET(x) (((uint32_t)(x) & PWM_CMP_HRPWM_CMP_HR_MASK) >> PWM_CMP_HRPWM_CMP_HR_SHIFT) /* Bitfield definition for register: FRCMD */ /* * FRCMD (RW) * * 2bit for each PWM output channel (0-7); * 00: force output 0 * 01: force output 1 * 10: output highz * 11: no force */ #define PWM_FRCMD_FRCMD_MASK (0xFFFFU) #define PWM_FRCMD_FRCMD_SHIFT (0U) #define PWM_FRCMD_FRCMD_SET(x) (((uint32_t)(x) << PWM_FRCMD_FRCMD_SHIFT) & PWM_FRCMD_FRCMD_MASK) #define PWM_FRCMD_FRCMD_GET(x) (((uint32_t)(x) & PWM_FRCMD_FRCMD_MASK) >> PWM_FRCMD_FRCMD_SHIFT) /* Bitfield definition for register: SHLK */ /* * SHLK (RW) * * write 1 to lock all shawdow register, wirte access is not permitted */ #define PWM_SHLK_SHLK_MASK (0x80000000UL) #define PWM_SHLK_SHLK_SHIFT (31U) #define PWM_SHLK_SHLK_SET(x) (((uint32_t)(x) << PWM_SHLK_SHLK_SHIFT) & PWM_SHLK_SHLK_MASK) #define PWM_SHLK_SHLK_GET(x) (((uint32_t)(x) & PWM_SHLK_SHLK_MASK) >> PWM_SHLK_SHLK_SHIFT) /* Bitfield definition for register array: CHCFG */ /* * CMPSELEND (RW) * * assign the last comparator for this output channel */ #define PWM_CHCFG_CMPSELEND_MASK (0x1F000000UL) #define PWM_CHCFG_CMPSELEND_SHIFT (24U) #define PWM_CHCFG_CMPSELEND_SET(x) (((uint32_t)(x) << PWM_CHCFG_CMPSELEND_SHIFT) & PWM_CHCFG_CMPSELEND_MASK) #define PWM_CHCFG_CMPSELEND_GET(x) (((uint32_t)(x) & PWM_CHCFG_CMPSELEND_MASK) >> PWM_CHCFG_CMPSELEND_SHIFT) /* * CMPSELBEG (RW) * * assign the first comparator for this output channel */ #define PWM_CHCFG_CMPSELBEG_MASK (0x1F0000UL) #define PWM_CHCFG_CMPSELBEG_SHIFT (16U) #define PWM_CHCFG_CMPSELBEG_SET(x) (((uint32_t)(x) << PWM_CHCFG_CMPSELBEG_SHIFT) & PWM_CHCFG_CMPSELBEG_MASK) #define PWM_CHCFG_CMPSELBEG_GET(x) (((uint32_t)(x) & PWM_CHCFG_CMPSELBEG_MASK) >> PWM_CHCFG_CMPSELBEG_SHIFT) /* * OUTPOL (RW) * * output polarity, set to 1 will invert the output */ #define PWM_CHCFG_OUTPOL_MASK (0x2U) #define PWM_CHCFG_OUTPOL_SHIFT (1U) #define PWM_CHCFG_OUTPOL_SET(x) (((uint32_t)(x) << PWM_CHCFG_OUTPOL_SHIFT) & PWM_CHCFG_OUTPOL_MASK) #define PWM_CHCFG_OUTPOL_GET(x) (((uint32_t)(x) & PWM_CHCFG_OUTPOL_MASK) >> PWM_CHCFG_OUTPOL_SHIFT) /* Bitfield definition for register: GCR */ /* * FAULTI3EN (RW) * * 1- enable the internal fault input 3 */ #define PWM_GCR_FAULTI3EN_MASK (0x80000000UL) #define PWM_GCR_FAULTI3EN_SHIFT (31U) #define PWM_GCR_FAULTI3EN_SET(x) (((uint32_t)(x) << PWM_GCR_FAULTI3EN_SHIFT) & PWM_GCR_FAULTI3EN_MASK) #define PWM_GCR_FAULTI3EN_GET(x) (((uint32_t)(x) & PWM_GCR_FAULTI3EN_MASK) >> PWM_GCR_FAULTI3EN_SHIFT) /* * FAULTI2EN (RW) * * 1- enable the internal fault input 2 */ #define PWM_GCR_FAULTI2EN_MASK (0x40000000UL) #define PWM_GCR_FAULTI2EN_SHIFT (30U) #define PWM_GCR_FAULTI2EN_SET(x) (((uint32_t)(x) << PWM_GCR_FAULTI2EN_SHIFT) & PWM_GCR_FAULTI2EN_MASK) #define PWM_GCR_FAULTI2EN_GET(x) (((uint32_t)(x) & PWM_GCR_FAULTI2EN_MASK) >> PWM_GCR_FAULTI2EN_SHIFT) /* * FAULTI1EN (RW) * * 1- enable the internal fault input 1 */ #define PWM_GCR_FAULTI1EN_MASK (0x20000000UL) #define PWM_GCR_FAULTI1EN_SHIFT (29U) #define PWM_GCR_FAULTI1EN_SET(x) (((uint32_t)(x) << PWM_GCR_FAULTI1EN_SHIFT) & PWM_GCR_FAULTI1EN_MASK) #define PWM_GCR_FAULTI1EN_GET(x) (((uint32_t)(x) & PWM_GCR_FAULTI1EN_MASK) >> PWM_GCR_FAULTI1EN_SHIFT) /* * FAULTI0EN (RW) * * 1- enable the internal fault input 0 */ #define PWM_GCR_FAULTI0EN_MASK (0x10000000UL) #define PWM_GCR_FAULTI0EN_SHIFT (28U) #define PWM_GCR_FAULTI0EN_SET(x) (((uint32_t)(x) << PWM_GCR_FAULTI0EN_SHIFT) & PWM_GCR_FAULTI0EN_MASK) #define PWM_GCR_FAULTI0EN_GET(x) (((uint32_t)(x) & PWM_GCR_FAULTI0EN_MASK) >> PWM_GCR_FAULTI0EN_SHIFT) /* * DEBUGFAULT (RW) * * 1- enable debug mode output protection */ #define PWM_GCR_DEBUGFAULT_MASK (0x8000000UL) #define PWM_GCR_DEBUGFAULT_SHIFT (27U) #define PWM_GCR_DEBUGFAULT_SET(x) (((uint32_t)(x) << PWM_GCR_DEBUGFAULT_SHIFT) & PWM_GCR_DEBUGFAULT_MASK) #define PWM_GCR_DEBUGFAULT_GET(x) (((uint32_t)(x) & PWM_GCR_DEBUGFAULT_MASK) >> PWM_GCR_DEBUGFAULT_SHIFT) /* * FRCPOL (RW) * * polarity of input pwm_force, * 1- active low * 0- active high */ #define PWM_GCR_FRCPOL_MASK (0x4000000UL) #define PWM_GCR_FRCPOL_SHIFT (26U) #define PWM_GCR_FRCPOL_SET(x) (((uint32_t)(x) << PWM_GCR_FRCPOL_SHIFT) & PWM_GCR_FRCPOL_MASK) #define PWM_GCR_FRCPOL_GET(x) (((uint32_t)(x) & PWM_GCR_FRCPOL_MASK) >> PWM_GCR_FRCPOL_SHIFT) /* * HWSHDWEDG (RW) * * When hardware event is selected as shawdow register effective time and the select comparator is configured as input capture mode. * This bit assign its which edge is used as compare shadow register hardware load event. * 1- Falling edge * 0- Rising edge */ #define PWM_GCR_HWSHDWEDG_MASK (0x1000000UL) #define PWM_GCR_HWSHDWEDG_SHIFT (24U) #define PWM_GCR_HWSHDWEDG_SET(x) (((uint32_t)(x) << PWM_GCR_HWSHDWEDG_SHIFT) & PWM_GCR_HWSHDWEDG_MASK) #define PWM_GCR_HWSHDWEDG_GET(x) (((uint32_t)(x) & PWM_GCR_HWSHDWEDG_MASK) >> PWM_GCR_HWSHDWEDG_SHIFT) /* * CMPSHDWSEL (RW) * * This bitfield select one of the comparators as hardware event time to load comparator shadow registers */ #define PWM_GCR_CMPSHDWSEL_MASK (0xF80000UL) #define PWM_GCR_CMPSHDWSEL_SHIFT (19U) #define PWM_GCR_CMPSHDWSEL_SET(x) (((uint32_t)(x) << PWM_GCR_CMPSHDWSEL_SHIFT) & PWM_GCR_CMPSHDWSEL_MASK) #define PWM_GCR_CMPSHDWSEL_GET(x) (((uint32_t)(x) & PWM_GCR_CMPSHDWSEL_MASK) >> PWM_GCR_CMPSHDWSEL_SHIFT) /* * FAULTRECEDG (RW) * * When hardware load is selected as output fault recover trigger and the selected channel is capture mode. * This bit assign its effective edge of fault recover trigger. * 1- Falling edge * 0- Rising edge */ #define PWM_GCR_FAULTRECEDG_MASK (0x40000UL) #define PWM_GCR_FAULTRECEDG_SHIFT (18U) #define PWM_GCR_FAULTRECEDG_SET(x) (((uint32_t)(x) << PWM_GCR_FAULTRECEDG_SHIFT) & PWM_GCR_FAULTRECEDG_MASK) #define PWM_GCR_FAULTRECEDG_GET(x) (((uint32_t)(x) & PWM_GCR_FAULTRECEDG_MASK) >> PWM_GCR_FAULTRECEDG_SHIFT) /* * FAULTRECHWSEL (RW) * * Selec one of the 24 comparators as fault output recover trigger. */ #define PWM_GCR_FAULTRECHWSEL_MASK (0x3E000UL) #define PWM_GCR_FAULTRECHWSEL_SHIFT (13U) #define PWM_GCR_FAULTRECHWSEL_SET(x) (((uint32_t)(x) << PWM_GCR_FAULTRECHWSEL_SHIFT) & PWM_GCR_FAULTRECHWSEL_MASK) #define PWM_GCR_FAULTRECHWSEL_GET(x) (((uint32_t)(x) & PWM_GCR_FAULTRECHWSEL_MASK) >> PWM_GCR_FAULTRECHWSEL_SHIFT) /* * FAULTE1EN (RW) * * 1- enable the external fault input 1 */ #define PWM_GCR_FAULTE1EN_MASK (0x1000U) #define PWM_GCR_FAULTE1EN_SHIFT (12U) #define PWM_GCR_FAULTE1EN_SET(x) (((uint32_t)(x) << PWM_GCR_FAULTE1EN_SHIFT) & PWM_GCR_FAULTE1EN_MASK) #define PWM_GCR_FAULTE1EN_GET(x) (((uint32_t)(x) & PWM_GCR_FAULTE1EN_MASK) >> PWM_GCR_FAULTE1EN_SHIFT) /* * FAULTE0EN (RW) * * 1- enable the external fault input 0 */ #define PWM_GCR_FAULTE0EN_MASK (0x800U) #define PWM_GCR_FAULTE0EN_SHIFT (11U) #define PWM_GCR_FAULTE0EN_SET(x) (((uint32_t)(x) << PWM_GCR_FAULTE0EN_SHIFT) & PWM_GCR_FAULTE0EN_MASK) #define PWM_GCR_FAULTE0EN_GET(x) (((uint32_t)(x) & PWM_GCR_FAULTE0EN_MASK) >> PWM_GCR_FAULTE0EN_SHIFT) /* * FAULTEXPOL (RW) * * external fault polarity * 1-active low * 0-active high */ #define PWM_GCR_FAULTEXPOL_MASK (0x600U) #define PWM_GCR_FAULTEXPOL_SHIFT (9U) #define PWM_GCR_FAULTEXPOL_SET(x) (((uint32_t)(x) << PWM_GCR_FAULTEXPOL_SHIFT) & PWM_GCR_FAULTEXPOL_MASK) #define PWM_GCR_FAULTEXPOL_GET(x) (((uint32_t)(x) & PWM_GCR_FAULTEXPOL_MASK) >> PWM_GCR_FAULTEXPOL_SHIFT) /* * RLDSYNCEN (RW) * * 1- pwm timer counter reset to reload value (rld) by synci is enabled */ #define PWM_GCR_RLDSYNCEN_MASK (0x100U) #define PWM_GCR_RLDSYNCEN_SHIFT (8U) #define PWM_GCR_RLDSYNCEN_SET(x) (((uint32_t)(x) << PWM_GCR_RLDSYNCEN_SHIFT) & PWM_GCR_RLDSYNCEN_MASK) #define PWM_GCR_RLDSYNCEN_GET(x) (((uint32_t)(x) & PWM_GCR_RLDSYNCEN_MASK) >> PWM_GCR_RLDSYNCEN_SHIFT) /* * CEN (RW) * * 1- enable the pwm timer counter * 0- stop the pwm timer counter */ #define PWM_GCR_CEN_MASK (0x80U) #define PWM_GCR_CEN_SHIFT (7U) #define PWM_GCR_CEN_SET(x) (((uint32_t)(x) << PWM_GCR_CEN_SHIFT) & PWM_GCR_CEN_MASK) #define PWM_GCR_CEN_GET(x) (((uint32_t)(x) & PWM_GCR_CEN_MASK) >> PWM_GCR_CEN_SHIFT) /* * FAULTCLR (RW) * * 1- Write 1 to clear the fault condition. The output will recover if FAULTRECTIME is set to 2b'11. * User should write 1 to this bit after the active FAULT signal de-assert and before it re-assert again. */ #define PWM_GCR_FAULTCLR_MASK (0x40U) #define PWM_GCR_FAULTCLR_SHIFT (6U) #define PWM_GCR_FAULTCLR_SET(x) (((uint32_t)(x) << PWM_GCR_FAULTCLR_SHIFT) & PWM_GCR_FAULTCLR_MASK) #define PWM_GCR_FAULTCLR_GET(x) (((uint32_t)(x) & PWM_GCR_FAULTCLR_MASK) >> PWM_GCR_FAULTCLR_SHIFT) /* * XRLDSYNCEN (RW) * * 1- pwm timer extended counter (xcnt) reset to extended reload value (xrld) by synci is enabled */ #define PWM_GCR_XRLDSYNCEN_MASK (0x20U) #define PWM_GCR_XRLDSYNCEN_SHIFT (5U) #define PWM_GCR_XRLDSYNCEN_SET(x) (((uint32_t)(x) << PWM_GCR_XRLDSYNCEN_SHIFT) & PWM_GCR_XRLDSYNCEN_MASK) #define PWM_GCR_XRLDSYNCEN_GET(x) (((uint32_t)(x) & PWM_GCR_XRLDSYNCEN_MASK) >> PWM_GCR_XRLDSYNCEN_SHIFT) /* * HR_PWM_EN (RW) * * set to enable high resolution pwm, trig_cmp, start/reload register will have different definition. */ #define PWM_GCR_HR_PWM_EN_MASK (0x10U) #define PWM_GCR_HR_PWM_EN_SHIFT (4U) #define PWM_GCR_HR_PWM_EN_SET(x) (((uint32_t)(x) << PWM_GCR_HR_PWM_EN_SHIFT) & PWM_GCR_HR_PWM_EN_MASK) #define PWM_GCR_HR_PWM_EN_GET(x) (((uint32_t)(x) & PWM_GCR_HR_PWM_EN_MASK) >> PWM_GCR_HR_PWM_EN_SHIFT) /* * TIMERRESET (RW) * * set to clear current timer(total 28bit, main counter and tmout_count ). Auto clear */ #define PWM_GCR_TIMERRESET_MASK (0x8U) #define PWM_GCR_TIMERRESET_SHIFT (3U) #define PWM_GCR_TIMERRESET_SET(x) (((uint32_t)(x) << PWM_GCR_TIMERRESET_SHIFT) & PWM_GCR_TIMERRESET_MASK) #define PWM_GCR_TIMERRESET_GET(x) (((uint32_t)(x) & PWM_GCR_TIMERRESET_MASK) >> PWM_GCR_TIMERRESET_SHIFT) /* * FRCTIME (WO) * * This bit field select the force effective time * 00: force immediately * 01: force at main counter reload time * 10: force at FRCSYNCI * 11: no force */ #define PWM_GCR_FRCTIME_MASK (0x6U) #define PWM_GCR_FRCTIME_SHIFT (1U) #define PWM_GCR_FRCTIME_SET(x) (((uint32_t)(x) << PWM_GCR_FRCTIME_SHIFT) & PWM_GCR_FRCTIME_MASK) #define PWM_GCR_FRCTIME_GET(x) (((uint32_t)(x) & PWM_GCR_FRCTIME_MASK) >> PWM_GCR_FRCTIME_SHIFT) /* * SWFRC (RW) * * 1- write 1 to enable software force, if the frcsrcsel is set to 0, force will take effect */ #define PWM_GCR_SWFRC_MASK (0x1U) #define PWM_GCR_SWFRC_SHIFT (0U) #define PWM_GCR_SWFRC_SET(x) (((uint32_t)(x) << PWM_GCR_SWFRC_SHIFT) & PWM_GCR_SWFRC_MASK) #define PWM_GCR_SWFRC_GET(x) (((uint32_t)(x) & PWM_GCR_SWFRC_MASK) >> PWM_GCR_SWFRC_SHIFT) /* Bitfield definition for register: SHCR */ /* * CNT_UPDATE_RELOAD (RW) * * set to update counter working register at reload point, clear to use cnt_update_time as old version. */ #define PWM_SHCR_CNT_UPDATE_RELOAD_MASK (0x8000U) #define PWM_SHCR_CNT_UPDATE_RELOAD_SHIFT (15U) #define PWM_SHCR_CNT_UPDATE_RELOAD_SET(x) (((uint32_t)(x) << PWM_SHCR_CNT_UPDATE_RELOAD_SHIFT) & PWM_SHCR_CNT_UPDATE_RELOAD_MASK) #define PWM_SHCR_CNT_UPDATE_RELOAD_GET(x) (((uint32_t)(x) & PWM_SHCR_CNT_UPDATE_RELOAD_MASK) >> PWM_SHCR_CNT_UPDATE_RELOAD_SHIFT) /* * CNT_UPDATE_EDGE (RW) * * 0 for posedge; 1 for negedge if hardware trigger time is selected for update_time, and selected channel is capture mode, for counter shadow registers */ #define PWM_SHCR_CNT_UPDATE_EDGE_MASK (0x4000U) #define PWM_SHCR_CNT_UPDATE_EDGE_SHIFT (14U) #define PWM_SHCR_CNT_UPDATE_EDGE_SET(x) (((uint32_t)(x) << PWM_SHCR_CNT_UPDATE_EDGE_SHIFT) & PWM_SHCR_CNT_UPDATE_EDGE_MASK) #define PWM_SHCR_CNT_UPDATE_EDGE_GET(x) (((uint32_t)(x) & PWM_SHCR_CNT_UPDATE_EDGE_MASK) >> PWM_SHCR_CNT_UPDATE_EDGE_SHIFT) /* * FORCE_UPDATE_EDGE (RW) * * 0 for posedge; 1 for negedge if hardware trigger time is selected for update_time, and selected channel is capture mode, for FRCMD shadow registers */ #define PWM_SHCR_FORCE_UPDATE_EDGE_MASK (0x2000U) #define PWM_SHCR_FORCE_UPDATE_EDGE_SHIFT (13U) #define PWM_SHCR_FORCE_UPDATE_EDGE_SET(x) (((uint32_t)(x) << PWM_SHCR_FORCE_UPDATE_EDGE_SHIFT) & PWM_SHCR_FORCE_UPDATE_EDGE_MASK) #define PWM_SHCR_FORCE_UPDATE_EDGE_GET(x) (((uint32_t)(x) & PWM_SHCR_FORCE_UPDATE_EDGE_MASK) >> PWM_SHCR_FORCE_UPDATE_EDGE_SHIFT) /* * FRCSHDWSEL (RW) * * This bitfield select one of the comparators as hardware event time to load FRCMD shadow registers */ #define PWM_SHCR_FRCSHDWSEL_MASK (0x1F00U) #define PWM_SHCR_FRCSHDWSEL_SHIFT (8U) #define PWM_SHCR_FRCSHDWSEL_SET(x) (((uint32_t)(x) << PWM_SHCR_FRCSHDWSEL_SHIFT) & PWM_SHCR_FRCSHDWSEL_MASK) #define PWM_SHCR_FRCSHDWSEL_GET(x) (((uint32_t)(x) & PWM_SHCR_FRCSHDWSEL_MASK) >> PWM_SHCR_FRCSHDWSEL_SHIFT) /* * CNTSHDWSEL (RW) * * This bitfield select one of the comparators as hardware event time to load the counter related shadow registers (STA and RLD) */ #define PWM_SHCR_CNTSHDWSEL_MASK (0xF8U) #define PWM_SHCR_CNTSHDWSEL_SHIFT (3U) #define PWM_SHCR_CNTSHDWSEL_SET(x) (((uint32_t)(x) << PWM_SHCR_CNTSHDWSEL_SHIFT) & PWM_SHCR_CNTSHDWSEL_MASK) #define PWM_SHCR_CNTSHDWSEL_GET(x) (((uint32_t)(x) & PWM_SHCR_CNTSHDWSEL_MASK) >> PWM_SHCR_CNTSHDWSEL_SHIFT) /* * CNTSHDWUPT (RW) * * This bitfield select when the counter related shadow registers (STA and RLD) will be loaded to its work register * 00: after software set shlk bit of shlk register * 01: immediately after the register being modified * 10: after hardware event assert, user can select one of the comparators to generate this hardware event. * The comparator can be either output compare mode or input capture mode. * 11: after SHSYNCI assert */ #define PWM_SHCR_CNTSHDWUPT_MASK (0x6U) #define PWM_SHCR_CNTSHDWUPT_SHIFT (1U) #define PWM_SHCR_CNTSHDWUPT_SET(x) (((uint32_t)(x) << PWM_SHCR_CNTSHDWUPT_SHIFT) & PWM_SHCR_CNTSHDWUPT_MASK) #define PWM_SHCR_CNTSHDWUPT_GET(x) (((uint32_t)(x) & PWM_SHCR_CNTSHDWUPT_MASK) >> PWM_SHCR_CNTSHDWUPT_SHIFT) /* * SHLKEN (RW) * * 1- enable shadow registers lock feature, * 0- disable shadow registers lock, shlk bit will always be 0 */ #define PWM_SHCR_SHLKEN_MASK (0x1U) #define PWM_SHCR_SHLKEN_SHIFT (0U) #define PWM_SHCR_SHLKEN_SET(x) (((uint32_t)(x) << PWM_SHCR_SHLKEN_SHIFT) & PWM_SHCR_SHLKEN_MASK) #define PWM_SHCR_SHLKEN_GET(x) (((uint32_t)(x) & PWM_SHCR_SHLKEN_MASK) >> PWM_SHCR_SHLKEN_SHIFT) /* Bitfield definition for register array: CAPPOS */ /* * CAPPOS (RO) * * counter value captured at input posedge */ #define PWM_CAPPOS_CAPPOS_MASK (0xFFFFFFF0UL) #define PWM_CAPPOS_CAPPOS_SHIFT (4U) #define PWM_CAPPOS_CAPPOS_GET(x) (((uint32_t)(x) & PWM_CAPPOS_CAPPOS_MASK) >> PWM_CAPPOS_CAPPOS_SHIFT) /* Bitfield definition for register: CNT */ /* * XCNT (RO) * * current extended counter value */ #define PWM_CNT_XCNT_MASK (0xF0000000UL) #define PWM_CNT_XCNT_SHIFT (28U) #define PWM_CNT_XCNT_GET(x) (((uint32_t)(x) & PWM_CNT_XCNT_MASK) >> PWM_CNT_XCNT_SHIFT) /* * CNT (RO) * * current clock counter value */ #define PWM_CNT_CNT_MASK (0xFFFFFF0UL) #define PWM_CNT_CNT_SHIFT (4U) #define PWM_CNT_CNT_GET(x) (((uint32_t)(x) & PWM_CNT_CNT_MASK) >> PWM_CNT_CNT_SHIFT) /* Bitfield definition for register array: CAPNEG */ /* * CAPNEG (RO) * * counter value captured at input signal falling edge */ #define PWM_CAPNEG_CAPNEG_MASK (0xFFFFFFFFUL) #define PWM_CAPNEG_CAPNEG_SHIFT (0U) #define PWM_CAPNEG_CAPNEG_GET(x) (((uint32_t)(x) & PWM_CAPNEG_CAPNEG_MASK) >> PWM_CAPNEG_CAPNEG_SHIFT) /* Bitfield definition for register: CNTCOPY */ /* * XCNT (RO) * * current extended counter value */ #define PWM_CNTCOPY_XCNT_MASK (0xF0000000UL) #define PWM_CNTCOPY_XCNT_SHIFT (28U) #define PWM_CNTCOPY_XCNT_GET(x) (((uint32_t)(x) & PWM_CNTCOPY_XCNT_MASK) >> PWM_CNTCOPY_XCNT_SHIFT) /* * CNT (RO) * * current clock counter value */ #define PWM_CNTCOPY_CNT_MASK (0xFFFFFF0UL) #define PWM_CNTCOPY_CNT_SHIFT (4U) #define PWM_CNTCOPY_CNT_GET(x) (((uint32_t)(x) & PWM_CNTCOPY_CNT_MASK) >> PWM_CNTCOPY_CNT_SHIFT) /* Bitfield definition for register array: PWMCFG */ /* * HR_UPDATE_MODE (RW) * * 0: update the hr value for the first edge at reload point; * 1: update the hr value for the first edge at the last edge; * all others will be updated at previous edge * for pair mode, only pwm_cfg 0/2/4/6 are used */ #define PWM_PWMCFG_HR_UPDATE_MODE_MASK (0x20000000UL) #define PWM_PWMCFG_HR_UPDATE_MODE_SHIFT (29U) #define PWM_PWMCFG_HR_UPDATE_MODE_SET(x) (((uint32_t)(x) << PWM_PWMCFG_HR_UPDATE_MODE_SHIFT) & PWM_PWMCFG_HR_UPDATE_MODE_MASK) #define PWM_PWMCFG_HR_UPDATE_MODE_GET(x) (((uint32_t)(x) & PWM_PWMCFG_HR_UPDATE_MODE_MASK) >> PWM_PWMCFG_HR_UPDATE_MODE_SHIFT) /* * OEN (RW) * * PWM output enable * 1- output is enabled * 0- output is disabled */ #define PWM_PWMCFG_OEN_MASK (0x10000000UL) #define PWM_PWMCFG_OEN_SHIFT (28U) #define PWM_PWMCFG_OEN_SET(x) (((uint32_t)(x) << PWM_PWMCFG_OEN_SHIFT) & PWM_PWMCFG_OEN_MASK) #define PWM_PWMCFG_OEN_GET(x) (((uint32_t)(x) & PWM_PWMCFG_OEN_MASK) >> PWM_PWMCFG_OEN_SHIFT) /* * FRCSHDWUPT (RW) * * This bitfield select when the FRCMD shadow register will be loaded to its work register * 00: after software set shlk bit of shlk register * 01: immediately after the register being modified * 10: after hardware event assert, user can select one of the comparators to generate this hardware event. * The comparator can be either output compare mode or input capture mode. * 11: after SHSYNCI assert */ #define PWM_PWMCFG_FRCSHDWUPT_MASK (0xC000000UL) #define PWM_PWMCFG_FRCSHDWUPT_SHIFT (26U) #define PWM_PWMCFG_FRCSHDWUPT_SET(x) (((uint32_t)(x) << PWM_PWMCFG_FRCSHDWUPT_SHIFT) & PWM_PWMCFG_FRCSHDWUPT_MASK) #define PWM_PWMCFG_FRCSHDWUPT_GET(x) (((uint32_t)(x) & PWM_PWMCFG_FRCSHDWUPT_MASK) >> PWM_PWMCFG_FRCSHDWUPT_SHIFT) /* * FAULTMODE (RW) * * This bitfield defines the PWM output status when fault condition happen * 00: force output 0 * 01: force output 1 * 1x: output highz */ #define PWM_PWMCFG_FAULTMODE_MASK (0x3000000UL) #define PWM_PWMCFG_FAULTMODE_SHIFT (24U) #define PWM_PWMCFG_FAULTMODE_SET(x) (((uint32_t)(x) << PWM_PWMCFG_FAULTMODE_SHIFT) & PWM_PWMCFG_FAULTMODE_MASK) #define PWM_PWMCFG_FAULTMODE_GET(x) (((uint32_t)(x) & PWM_PWMCFG_FAULTMODE_MASK) >> PWM_PWMCFG_FAULTMODE_SHIFT) /* * FAULTRECTIME (RW) * * This bitfield select when to recover PWM output after fault condition removed. * 00: immediately * 01: after pwm timer counter reload time * 10: after hardware event assert, user can select one of the comparators to generate this hardware event. * The comparator can be either output compare mode or input capture mode. * 11: after software write faultclr bit in GCR register */ #define PWM_PWMCFG_FAULTRECTIME_MASK (0xC00000UL) #define PWM_PWMCFG_FAULTRECTIME_SHIFT (22U) #define PWM_PWMCFG_FAULTRECTIME_SET(x) (((uint32_t)(x) << PWM_PWMCFG_FAULTRECTIME_SHIFT) & PWM_PWMCFG_FAULTRECTIME_MASK) #define PWM_PWMCFG_FAULTRECTIME_GET(x) (((uint32_t)(x) & PWM_PWMCFG_FAULTRECTIME_MASK) >> PWM_PWMCFG_FAULTRECTIME_SHIFT) /* * FRCSRCSEL (RW) * * Select sources for force output * 0- force output is enabled when FRCI assert * 1- force output is enabled by software write swfrc to 1 */ #define PWM_PWMCFG_FRCSRCSEL_MASK (0x200000UL) #define PWM_PWMCFG_FRCSRCSEL_SHIFT (21U) #define PWM_PWMCFG_FRCSRCSEL_SET(x) (((uint32_t)(x) << PWM_PWMCFG_FRCSRCSEL_SHIFT) & PWM_PWMCFG_FRCSRCSEL_MASK) #define PWM_PWMCFG_FRCSRCSEL_GET(x) (((uint32_t)(x) & PWM_PWMCFG_FRCSRCSEL_MASK) >> PWM_PWMCFG_FRCSRCSEL_SHIFT) /* * PAIR (RW) * * 1- PWM output is in pair mode. Note the two PWM outputs need to be both set to pair mode. * 0- PWM output is in indepandent mode. */ #define PWM_PWMCFG_PAIR_MASK (0x100000UL) #define PWM_PWMCFG_PAIR_SHIFT (20U) #define PWM_PWMCFG_PAIR_SET(x) (((uint32_t)(x) << PWM_PWMCFG_PAIR_SHIFT) & PWM_PWMCFG_PAIR_MASK) #define PWM_PWMCFG_PAIR_GET(x) (((uint32_t)(x) & PWM_PWMCFG_PAIR_MASK) >> PWM_PWMCFG_PAIR_SHIFT) /* * DEADAREA (RW) * * This bitfield define the PWM pair deadarea length. The unit is 0.5 cycle. The minimum length of deadarea is 1 cycle. * Note: user should configure pair bit and this bitfield before PWM output is enabled. */ #define PWM_PWMCFG_DEADAREA_MASK (0xFFFFFUL) #define PWM_PWMCFG_DEADAREA_SHIFT (0U) #define PWM_PWMCFG_DEADAREA_SET(x) (((uint32_t)(x) << PWM_PWMCFG_DEADAREA_SHIFT) & PWM_PWMCFG_DEADAREA_MASK) #define PWM_PWMCFG_DEADAREA_GET(x) (((uint32_t)(x) & PWM_PWMCFG_DEADAREA_MASK) >> PWM_PWMCFG_DEADAREA_SHIFT) /* Bitfield definition for register: SR */ /* * FAULTF (W1C) * * fault condition flag */ #define PWM_SR_FAULTF_MASK (0x8000000UL) #define PWM_SR_FAULTF_SHIFT (27U) #define PWM_SR_FAULTF_SET(x) (((uint32_t)(x) << PWM_SR_FAULTF_SHIFT) & PWM_SR_FAULTF_MASK) #define PWM_SR_FAULTF_GET(x) (((uint32_t)(x) & PWM_SR_FAULTF_MASK) >> PWM_SR_FAULTF_SHIFT) /* * XRLDF (W1C) * * extended reload flag, this flag set when xcnt count to xrld value or when SYNCI assert */ #define PWM_SR_XRLDF_MASK (0x4000000UL) #define PWM_SR_XRLDF_SHIFT (26U) #define PWM_SR_XRLDF_SET(x) (((uint32_t)(x) << PWM_SR_XRLDF_SHIFT) & PWM_SR_XRLDF_MASK) #define PWM_SR_XRLDF_GET(x) (((uint32_t)(x) & PWM_SR_XRLDF_MASK) >> PWM_SR_XRLDF_SHIFT) /* * HALFRLDF (W1C) * * half reload flag, this flag set when cnt count to rld/2 */ #define PWM_SR_HALFRLDF_MASK (0x2000000UL) #define PWM_SR_HALFRLDF_SHIFT (25U) #define PWM_SR_HALFRLDF_SET(x) (((uint32_t)(x) << PWM_SR_HALFRLDF_SHIFT) & PWM_SR_HALFRLDF_MASK) #define PWM_SR_HALFRLDF_GET(x) (((uint32_t)(x) & PWM_SR_HALFRLDF_MASK) >> PWM_SR_HALFRLDF_SHIFT) /* * RLDF (W1C) * * reload flag, this flag set when cnt count to rld value or when SYNCI assert */ #define PWM_SR_RLDF_MASK (0x1000000UL) #define PWM_SR_RLDF_SHIFT (24U) #define PWM_SR_RLDF_SET(x) (((uint32_t)(x) << PWM_SR_RLDF_SHIFT) & PWM_SR_RLDF_MASK) #define PWM_SR_RLDF_GET(x) (((uint32_t)(x) & PWM_SR_RLDF_MASK) >> PWM_SR_RLDF_SHIFT) /* * CMPFX (W1C) * * comparator output compare or input capture flag */ #define PWM_SR_CMPFX_MASK (0xFFFFFFUL) #define PWM_SR_CMPFX_SHIFT (0U) #define PWM_SR_CMPFX_SET(x) (((uint32_t)(x) << PWM_SR_CMPFX_SHIFT) & PWM_SR_CMPFX_MASK) #define PWM_SR_CMPFX_GET(x) (((uint32_t)(x) & PWM_SR_CMPFX_MASK) >> PWM_SR_CMPFX_SHIFT) /* Bitfield definition for register: IRQEN */ /* * FAULTIRQE (RW) * * fault condition interrupt enable */ #define PWM_IRQEN_FAULTIRQE_MASK (0x8000000UL) #define PWM_IRQEN_FAULTIRQE_SHIFT (27U) #define PWM_IRQEN_FAULTIRQE_SET(x) (((uint32_t)(x) << PWM_IRQEN_FAULTIRQE_SHIFT) & PWM_IRQEN_FAULTIRQE_MASK) #define PWM_IRQEN_FAULTIRQE_GET(x) (((uint32_t)(x) & PWM_IRQEN_FAULTIRQE_MASK) >> PWM_IRQEN_FAULTIRQE_SHIFT) /* * XRLDIRQE (RW) * * extended reload flag interrupt enable */ #define PWM_IRQEN_XRLDIRQE_MASK (0x4000000UL) #define PWM_IRQEN_XRLDIRQE_SHIFT (26U) #define PWM_IRQEN_XRLDIRQE_SET(x) (((uint32_t)(x) << PWM_IRQEN_XRLDIRQE_SHIFT) & PWM_IRQEN_XRLDIRQE_MASK) #define PWM_IRQEN_XRLDIRQE_GET(x) (((uint32_t)(x) & PWM_IRQEN_XRLDIRQE_MASK) >> PWM_IRQEN_XRLDIRQE_SHIFT) /* * HALFRLDIRQE (RW) * * half reload flag interrupt enable */ #define PWM_IRQEN_HALFRLDIRQE_MASK (0x2000000UL) #define PWM_IRQEN_HALFRLDIRQE_SHIFT (25U) #define PWM_IRQEN_HALFRLDIRQE_SET(x) (((uint32_t)(x) << PWM_IRQEN_HALFRLDIRQE_SHIFT) & PWM_IRQEN_HALFRLDIRQE_MASK) #define PWM_IRQEN_HALFRLDIRQE_GET(x) (((uint32_t)(x) & PWM_IRQEN_HALFRLDIRQE_MASK) >> PWM_IRQEN_HALFRLDIRQE_SHIFT) /* * RLDIRQE (RW) * * reload flag interrupt enable */ #define PWM_IRQEN_RLDIRQE_MASK (0x1000000UL) #define PWM_IRQEN_RLDIRQE_SHIFT (24U) #define PWM_IRQEN_RLDIRQE_SET(x) (((uint32_t)(x) << PWM_IRQEN_RLDIRQE_SHIFT) & PWM_IRQEN_RLDIRQE_MASK) #define PWM_IRQEN_RLDIRQE_GET(x) (((uint32_t)(x) & PWM_IRQEN_RLDIRQE_MASK) >> PWM_IRQEN_RLDIRQE_SHIFT) /* * CMPIRQEX (RW) * * comparator output compare or input capture flag interrupt enable */ #define PWM_IRQEN_CMPIRQEX_MASK (0xFFFFFFUL) #define PWM_IRQEN_CMPIRQEX_SHIFT (0U) #define PWM_IRQEN_CMPIRQEX_SET(x) (((uint32_t)(x) << PWM_IRQEN_CMPIRQEX_SHIFT) & PWM_IRQEN_CMPIRQEX_MASK) #define PWM_IRQEN_CMPIRQEX_GET(x) (((uint32_t)(x) & PWM_IRQEN_CMPIRQEX_MASK) >> PWM_IRQEN_CMPIRQEX_SHIFT) /* Bitfield definition for register: DMAEN */ /* * FAULTEN (RW) * * fault condition DMA request enable */ #define PWM_DMAEN_FAULTEN_MASK (0x8000000UL) #define PWM_DMAEN_FAULTEN_SHIFT (27U) #define PWM_DMAEN_FAULTEN_SET(x) (((uint32_t)(x) << PWM_DMAEN_FAULTEN_SHIFT) & PWM_DMAEN_FAULTEN_MASK) #define PWM_DMAEN_FAULTEN_GET(x) (((uint32_t)(x) & PWM_DMAEN_FAULTEN_MASK) >> PWM_DMAEN_FAULTEN_SHIFT) /* * XRLDEN (RW) * * extended reload flag DMA request enable */ #define PWM_DMAEN_XRLDEN_MASK (0x4000000UL) #define PWM_DMAEN_XRLDEN_SHIFT (26U) #define PWM_DMAEN_XRLDEN_SET(x) (((uint32_t)(x) << PWM_DMAEN_XRLDEN_SHIFT) & PWM_DMAEN_XRLDEN_MASK) #define PWM_DMAEN_XRLDEN_GET(x) (((uint32_t)(x) & PWM_DMAEN_XRLDEN_MASK) >> PWM_DMAEN_XRLDEN_SHIFT) /* * HALFRLDEN (RW) * * half reload flag DMA request enable */ #define PWM_DMAEN_HALFRLDEN_MASK (0x2000000UL) #define PWM_DMAEN_HALFRLDEN_SHIFT (25U) #define PWM_DMAEN_HALFRLDEN_SET(x) (((uint32_t)(x) << PWM_DMAEN_HALFRLDEN_SHIFT) & PWM_DMAEN_HALFRLDEN_MASK) #define PWM_DMAEN_HALFRLDEN_GET(x) (((uint32_t)(x) & PWM_DMAEN_HALFRLDEN_MASK) >> PWM_DMAEN_HALFRLDEN_SHIFT) /* * RLDEN (RW) * * reload flag DMA request enable */ #define PWM_DMAEN_RLDEN_MASK (0x1000000UL) #define PWM_DMAEN_RLDEN_SHIFT (24U) #define PWM_DMAEN_RLDEN_SET(x) (((uint32_t)(x) << PWM_DMAEN_RLDEN_SHIFT) & PWM_DMAEN_RLDEN_MASK) #define PWM_DMAEN_RLDEN_GET(x) (((uint32_t)(x) & PWM_DMAEN_RLDEN_MASK) >> PWM_DMAEN_RLDEN_SHIFT) /* * CMPENX (RW) * * comparator output compare or input capture flag DMA request enable */ #define PWM_DMAEN_CMPENX_MASK (0xFFFFFFUL) #define PWM_DMAEN_CMPENX_SHIFT (0U) #define PWM_DMAEN_CMPENX_SET(x) (((uint32_t)(x) << PWM_DMAEN_CMPENX_SHIFT) & PWM_DMAEN_CMPENX_MASK) #define PWM_DMAEN_CMPENX_GET(x) (((uint32_t)(x) & PWM_DMAEN_CMPENX_MASK) >> PWM_DMAEN_CMPENX_SHIFT) /* Bitfield definition for register array: CMPCFG */ /* * XCNTCMPEN (RW) * * This bitfield enable the comparator to compare xcmp with xcnt. */ #define PWM_CMPCFG_XCNTCMPEN_MASK (0xF0U) #define PWM_CMPCFG_XCNTCMPEN_SHIFT (4U) #define PWM_CMPCFG_XCNTCMPEN_SET(x) (((uint32_t)(x) << PWM_CMPCFG_XCNTCMPEN_SHIFT) & PWM_CMPCFG_XCNTCMPEN_MASK) #define PWM_CMPCFG_XCNTCMPEN_GET(x) (((uint32_t)(x) & PWM_CMPCFG_XCNTCMPEN_MASK) >> PWM_CMPCFG_XCNTCMPEN_SHIFT) /* * CMPSHDWUPT (RW) * * This bitfield select when the comparator shadow register will be loaded to its work register * 00: after software set shlk bit of shlk register * 01: immediately after the register being modified * 10: after hardware event assert, user can select one of the comparators to generate this hardware event. * The comparator can be either output compare mode or input capture mode. * 11: after SHSYNCI assert */ #define PWM_CMPCFG_CMPSHDWUPT_MASK (0xCU) #define PWM_CMPCFG_CMPSHDWUPT_SHIFT (2U) #define PWM_CMPCFG_CMPSHDWUPT_SET(x) (((uint32_t)(x) << PWM_CMPCFG_CMPSHDWUPT_SHIFT) & PWM_CMPCFG_CMPSHDWUPT_MASK) #define PWM_CMPCFG_CMPSHDWUPT_GET(x) (((uint32_t)(x) & PWM_CMPCFG_CMPSHDWUPT_MASK) >> PWM_CMPCFG_CMPSHDWUPT_SHIFT) /* * CMPMODE (RW) * * comparator mode * 0- output compare mode * 1- input capture mode */ #define PWM_CMPCFG_CMPMODE_MASK (0x2U) #define PWM_CMPCFG_CMPMODE_SHIFT (1U) #define PWM_CMPCFG_CMPMODE_SET(x) (((uint32_t)(x) << PWM_CMPCFG_CMPMODE_SHIFT) & PWM_CMPCFG_CMPMODE_MASK) #define PWM_CMPCFG_CMPMODE_GET(x) (((uint32_t)(x) & PWM_CMPCFG_CMPMODE_MASK) >> PWM_CMPCFG_CMPMODE_SHIFT) /* Bitfield definition for register array: ANASTS */ /* * CALON (RO) * * calibration status. * will be set by hardware after setting cal_start. * cleared after calibration finished */ #define PWM_ANASTS_CALON_MASK (0x80000000UL) #define PWM_ANASTS_CALON_SHIFT (31U) #define PWM_ANASTS_CALON_GET(x) (((uint32_t)(x) & PWM_ANASTS_CALON_MASK) >> PWM_ANASTS_CALON_SHIFT) /* Bitfield definition for register: HRPWM_CFG */ /* * CAL_START (WO) * * calibration start. * software setting this bit to start calibration process. * each bit for one channel. */ #define PWM_HRPWM_CFG_CAL_START_MASK (0xFFU) #define PWM_HRPWM_CFG_CAL_START_SHIFT (0U) #define PWM_HRPWM_CFG_CAL_START_SET(x) (((uint32_t)(x) << PWM_HRPWM_CFG_CAL_START_SHIFT) & PWM_HRPWM_CFG_CAL_START_MASK) #define PWM_HRPWM_CFG_CAL_START_GET(x) (((uint32_t)(x) & PWM_HRPWM_CFG_CAL_START_MASK) >> PWM_HRPWM_CFG_CAL_START_SHIFT) /* CMP register group index macro definition */ #define PWM_CMP_0 (0UL) #define PWM_CMP_1 (1UL) #define PWM_CMP_2 (2UL) #define PWM_CMP_3 (3UL) #define PWM_CMP_4 (4UL) #define PWM_CMP_5 (5UL) #define PWM_CMP_6 (6UL) #define PWM_CMP_7 (7UL) #define PWM_CMP_8 (8UL) #define PWM_CMP_9 (9UL) #define PWM_CMP_10 (10UL) #define PWM_CMP_11 (11UL) #define PWM_CMP_12 (12UL) #define PWM_CMP_13 (13UL) #define PWM_CMP_14 (14UL) #define PWM_CMP_15 (15UL) #define PWM_CMP_16 (16UL) #define PWM_CMP_17 (17UL) #define PWM_CMP_18 (18UL) #define PWM_CMP_19 (19UL) #define PWM_CMP_20 (20UL) #define PWM_CMP_21 (21UL) #define PWM_CMP_22 (22UL) #define PWM_CMP_23 (23UL) /* CMP_HRPWM register group index macro definition */ #define PWM_CMP_HRPWM_0 (0UL) #define PWM_CMP_HRPWM_1 (1UL) #define PWM_CMP_HRPWM_2 (2UL) #define PWM_CMP_HRPWM_3 (3UL) #define PWM_CMP_HRPWM_4 (4UL) #define PWM_CMP_HRPWM_5 (5UL) #define PWM_CMP_HRPWM_6 (6UL) #define PWM_CMP_HRPWM_7 (7UL) #define PWM_CMP_HRPWM_8 (8UL) #define PWM_CMP_HRPWM_9 (9UL) #define PWM_CMP_HRPWM_10 (10UL) #define PWM_CMP_HRPWM_11 (11UL) #define PWM_CMP_HRPWM_12 (12UL) #define PWM_CMP_HRPWM_13 (13UL) #define PWM_CMP_HRPWM_14 (14UL) #define PWM_CMP_HRPWM_15 (15UL) #define PWM_CMP_HRPWM_16 (16UL) #define PWM_CMP_HRPWM_17 (17UL) #define PWM_CMP_HRPWM_18 (18UL) #define PWM_CMP_HRPWM_19 (19UL) #define PWM_CMP_HRPWM_20 (20UL) #define PWM_CMP_HRPWM_21 (21UL) #define PWM_CMP_HRPWM_22 (22UL) #define PWM_CMP_HRPWM_23 (23UL) /* CHCFG register group index macro definition */ #define PWM_CHCFG_0 (0UL) #define PWM_CHCFG_1 (1UL) #define PWM_CHCFG_2 (2UL) #define PWM_CHCFG_3 (3UL) #define PWM_CHCFG_4 (4UL) #define PWM_CHCFG_5 (5UL) #define PWM_CHCFG_6 (6UL) #define PWM_CHCFG_7 (7UL) #define PWM_CHCFG_8 (8UL) #define PWM_CHCFG_9 (9UL) #define PWM_CHCFG_10 (10UL) #define PWM_CHCFG_11 (11UL) #define PWM_CHCFG_12 (12UL) #define PWM_CHCFG_13 (13UL) #define PWM_CHCFG_14 (14UL) #define PWM_CHCFG_15 (15UL) #define PWM_CHCFG_16 (16UL) #define PWM_CHCFG_17 (17UL) #define PWM_CHCFG_18 (18UL) #define PWM_CHCFG_19 (19UL) #define PWM_CHCFG_20 (20UL) #define PWM_CHCFG_21 (21UL) #define PWM_CHCFG_22 (22UL) #define PWM_CHCFG_23 (23UL) /* CAPPOS register group index macro definition */ #define PWM_CAPPOS_0 (0UL) #define PWM_CAPPOS_1 (1UL) #define PWM_CAPPOS_2 (2UL) #define PWM_CAPPOS_3 (3UL) #define PWM_CAPPOS_4 (4UL) #define PWM_CAPPOS_5 (5UL) #define PWM_CAPPOS_6 (6UL) #define PWM_CAPPOS_7 (7UL) #define PWM_CAPPOS_8 (8UL) #define PWM_CAPPOS_9 (9UL) #define PWM_CAPPOS_10 (10UL) #define PWM_CAPPOS_11 (11UL) #define PWM_CAPPOS_12 (12UL) #define PWM_CAPPOS_13 (13UL) #define PWM_CAPPOS_14 (14UL) #define PWM_CAPPOS_15 (15UL) #define PWM_CAPPOS_16 (16UL) #define PWM_CAPPOS_17 (17UL) #define PWM_CAPPOS_18 (18UL) #define PWM_CAPPOS_19 (19UL) #define PWM_CAPPOS_20 (20UL) #define PWM_CAPPOS_21 (21UL) #define PWM_CAPPOS_22 (22UL) #define PWM_CAPPOS_23 (23UL) /* CAPNEG register group index macro definition */ #define PWM_CAPNEG_0 (0UL) #define PWM_CAPNEG_1 (1UL) #define PWM_CAPNEG_2 (2UL) #define PWM_CAPNEG_3 (3UL) #define PWM_CAPNEG_4 (4UL) #define PWM_CAPNEG_5 (5UL) #define PWM_CAPNEG_6 (6UL) #define PWM_CAPNEG_7 (7UL) #define PWM_CAPNEG_8 (8UL) #define PWM_CAPNEG_9 (9UL) #define PWM_CAPNEG_10 (10UL) #define PWM_CAPNEG_11 (11UL) #define PWM_CAPNEG_12 (12UL) #define PWM_CAPNEG_13 (13UL) #define PWM_CAPNEG_14 (14UL) #define PWM_CAPNEG_15 (15UL) #define PWM_CAPNEG_16 (16UL) #define PWM_CAPNEG_17 (17UL) #define PWM_CAPNEG_18 (18UL) #define PWM_CAPNEG_19 (19UL) #define PWM_CAPNEG_20 (20UL) #define PWM_CAPNEG_21 (21UL) #define PWM_CAPNEG_22 (22UL) #define PWM_CAPNEG_23 (23UL) /* PWMCFG register group index macro definition */ #define PWM_PWMCFG_0 (0UL) #define PWM_PWMCFG_1 (1UL) #define PWM_PWMCFG_2 (2UL) #define PWM_PWMCFG_3 (3UL) #define PWM_PWMCFG_4 (4UL) #define PWM_PWMCFG_5 (5UL) #define PWM_PWMCFG_6 (6UL) #define PWM_PWMCFG_7 (7UL) /* CMPCFG register group index macro definition */ #define PWM_CMPCFG_CMPCFG0 (0UL) #define PWM_CMPCFG_1 (1UL) #define PWM_CMPCFG_2 (2UL) #define PWM_CMPCFG_3 (3UL) #define PWM_CMPCFG_4 (4UL) #define PWM_CMPCFG_5 (5UL) #define PWM_CMPCFG_6 (6UL) #define PWM_CMPCFG_7 (7UL) #define PWM_CMPCFG_8 (8UL) #define PWM_CMPCFG_9 (9UL) #define PWM_CMPCFG_10 (10UL) #define PWM_CMPCFG_11 (11UL) #define PWM_CMPCFG_12 (12UL) #define PWM_CMPCFG_13 (13UL) #define PWM_CMPCFG_14 (14UL) #define PWM_CMPCFG_15 (15UL) #define PWM_CMPCFG_16 (16UL) #define PWM_CMPCFG_17 (17UL) #define PWM_CMPCFG_18 (18UL) #define PWM_CMPCFG_19 (19UL) #define PWM_CMPCFG_20 (20UL) #define PWM_CMPCFG_21 (21UL) #define PWM_CMPCFG_22 (22UL) #define PWM_CMPCFG_23 (23UL) /* ANASTS register group index macro definition */ #define PWM_ANASTS_0 (0UL) #define PWM_ANASTS_1 (1UL) #define PWM_ANASTS_2 (2UL) #define PWM_ANASTS_3 (3UL) #define PWM_ANASTS_4 (4UL) #define PWM_ANASTS_5 (5UL) #define PWM_ANASTS_6 (6UL) #define PWM_ANASTS_7 (7UL) #endif /* HPM_PWM_H */
f50aefa749171450588beef76e8e18117e67d83d
2249ea163713b21f14fdf8784ba3ef3c0b540d1a
/lib/nauty/naututil.h
c9f6bee2a6adbb390a20d0c2a6f5be7bfe783298
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0", "MIT" ]
permissive
lsils/mockturtle
58c106fc957f17206e062b5428055778c68b4a69
82fce07b7204b14fc4c53fd35c284b7ea68f05fd
refs/heads/master
2023-08-31T04:18:37.954364
2023-08-24T12:05:37
2023-08-24T12:05:37
131,001,448
159
80
MIT
2023-08-24T09:43:55
2018-04-25T12:15:49
C++
UTF-8
C
false
false
14,856
h
naututil.h
/***************************************************************************** * This is the header file for versions 2.6 of naututil.c and dreadnaut.c. * * naututil.h. Generated from naututil-h.in by configure. *****************************************************************************/ /* The parts between the ==== lines are modified by configure when creating naututil.h out of naututil-h.in. If configure is not being used, it is necessary to check they are correct. ====================================================================*/ /* Check whether various headers are available */ #define HAVE_ISATTY 1 /* if isatty() is available */ #define HAVE_TIMES 1 /* if times() is available */ #define HAVE_TIME 1 /* if time() is available */ #define HAVE_GETRUSAGE 1 /* if getrusage() is available */ #define HAVE_GETTIMEOFDAY 1 /* if gettimeofday() */ /*==================================================================*/ /***************************************************************************** * * * Copyright (1984-2016) Brendan McKay. All rights reserved. * * Subject to the waivers and disclaimers in nauty.h. * * * * CHANGE HISTORY * * 10-Nov-87 : final changes for version 1.2 * * 5-Dec-87 : changes for version 1.3 : * * - added declarations of readinteger() and readstring() * * - added definition of DEFEXT : default file-name * * extension for dreadnaut input files * * 28-Sep-88 : changes for version 1.4 : * * - added support for PC Turbo C * * 29-Nov-88 : - added getc macro for AZTEC C on MAC * * 23-Mar-89 : changes for version 1.5 : * * - added DREADVERSION macro * * - added optional ANSI function prototypes * * - changed file name to naututil.h * * - moved ALLOCS to nauty.h and defined DYNALLOC * * 25-Mar-89 : - added declaration of twopaths() * * 29-Mar-89 : - added declaration of putmapping() * * 4-Apr-89 : - added declarations of triples, quadruples, adjtriang * * - only define ERRFILE if not in nauty.h * * 25-Apr-89 : - added declarations of cellquads,distances,getbigcells * * 26-Apr-89 : - added declarations of indsets,cliques,cellquins * * - removed declarations of ptncode and equitable * * 27-Apr-89 : - added declaration of putquotient * * 18-Aug-89 : - added new arg to putset, and changed mathon * * 2-Mar-90 : - added declarations of celltrips, cellcliq, cellind * * - changed declarations to use EXTPROC * * 12-Mar-90 : - added changes for Cray version * * 20-Mar-90 : - added changes for THINK version * * 27-Mar-90 : - split SYS_MSDOS into SYS_PCMS4 and SYS_PCMS5 * * 13-Oct-90 : changes for version 1.6 : * * - changed CPUTIME to use HZ on Unix for times() * * 14-Oct-90 : - added SYS_APOLLO variant * * 19-Oct-90 : - changed CPUTIME defs for BSDUNIX to avoid conficting * * declarations of size_t and ptrdiff_t in gcc * * 27-Aug-92 : changes for version 1.7 : * * - added SYS_IBMC variant * * - removed workaround for bad gcc installation * * 5-Jun-93 : changes for version 1.8 : * * - changed CRAY version of CPUTIME to use CLK_TCK * * if HZ could not be found (making 1.7+) * * 30-Jul-93 : - added SYS_ALPHA variant * * 17-Sep-93 : changes for version 1.9 : * * - declared adjacencies() * * 24-Feb-94 : changes for version 1.10 : * * - added version SYS_AMIGAAZT (making 1.9+) * * 19-Apr-95 : - added C++ prototype wrapper * * 6-Mar-96 : - added SYS_ALPHA32 code * * 23-Jul-96 : changes for version 2.0 : * * - changed readstring() declaration * * - removed DYNALLOC definition * * - added sublabel() definition * * 15-Aug-96 : - added sethash() definition * * 30-Aug-96 : - added KRAN and D. Knuth routines * * 16-Sep-96 : - fixed the above! * * 7-Feb-96 : - declared nautinv_null() and setnbhd() * * 4-Sep-97 : - arg of time() is type time_t*, was long* * * 22-Sep-97 : - defined fileno() and time_t for SYS_PCTURBO * * 10-Dec-97 : - revised KRAN for new rng.c from Knuth * * 18-Feb-98 : - changed time() to time_t for Unix * * 21-Oct-98 : - changed short to shortish as needed * * 9-Jan-00 : - declared nautinv_check() and naututil_check() * * 16-Nov-00 : - applied changes logged in nauty.h * * 22-Apr-01 : changes for version 2.1 : * * - prototypes for nautinv.c are now in nautinv.h * * - CPUTIME for UNIX uses CLK_TCK (needs revision!) * * 2-Jun-01 : - prototype for converse() * * 18-Oct-01 : - complete revision; sysdeps in separate files * * 28-Aug-02 : changes for version 2.2 : * * - revised for autoconf * * 17-Nov-02 : added explicit "extern" where it was implicit before * * 11-Apr-02 : added rangraph2() * * 10-Sep-07 : Define CPUTIME=0.0 for hosts that don't provide it * * 4-Nov-09 : added readgraph_sg(), putgraph_sg(), putcanon_sg() * * 10-Nov-09 : removed types shortish and permutation * * 14-Nov-09 : added relabel_sg(), copy_sg(), putdegs_sg(), * * sublabel_sg() * * 19-Nov-09 : added individualise() * * 20-Nov-09 : added hashgraph_sg(), listhash(), hashgraph() * * 19-Dec-09 : added ranreg(), rangraph2_sg() * * 5-Jun-10 : added mathon_sg() and converse_sg() * * 10-Jun-10 : added putquotient_sg() and complement_sg() * * 15-Jan-12 : added TLS_ATTR to static declarations * * 3-Mar-12 : added putorbitsplus() and putset_firstbold() * * 17-Mar-12 : include naurng.h and remove redundant lines * * 1-Nov-15 : changes for version 2.6 : * * - prototypes for putdegseq(), putdegseq_sg() * * 17-Dec-15 : prototype for readgraph_swg() * * 6-Apr-16 : prototype for countcells() * * * * ++++++ This file is automatically generated, don't edit it by hand! ++++++ * * *****************************************************************************/ #include "nauty.h" /* which includes stdio.h */ #include "nausparse.h" #include "naurng.h" /* At this point we can assume that <sys/types.h>, <unistd.h>, <stddef.h>, <stdlib.h>, <string.h> or <strings.h> and <malloc.h> if necessary have been included if they exist. */ #ifdef __cplusplus extern "C" { #endif extern void complement(graph*,int,int); extern void converse(graph*,int,int); extern void converse_sg(sparsegraph*, sparsegraph*); extern void copycomment(FILE*,FILE*,int); extern void complement_sg(sparsegraph*, sparsegraph*); extern int countcells(int*,int,int); extern void flushline(FILE*); extern void fixit(int*,int*,int*,int,int); extern int getint(FILE*); extern int getint_sl(FILE*); extern long hash(set*,long,int); extern long hashgraph(graph*,int,int,long); extern long hashgraph_sg(sparsegraph*,long); extern void individualise(int*,int*,int,int,int*,int*,int); extern long listhash(int*,int,long); extern void mathon(graph*,int,int,graph*,int,int); extern void mathon_sg(sparsegraph*,sparsegraph*); extern void naututil_check(int,int,int,int); extern void naututil_freedyn(void); extern void putcanon(FILE*,int*,graph*,int,int,int); extern void putcanon_sg(FILE*,int*,sparsegraph*,int); extern void putdegs(FILE*,graph*,int,int,int); extern void putdegs_sg(FILE*,sparsegraph*,int); extern void putdegseq(FILE*,graph*,int,int,int); extern void putdegseq_sg(FILE*,sparsegraph*,int); extern void putgraph(FILE*,graph*,int,int,int); extern void putgraph_sg(FILE*,sparsegraph*,int); extern void putmapping(FILE*,int*,int,int*,int,int,int); extern void putorbits(FILE*,int*,int,int); extern void putorbitsplus(FILE*,int*,int,int); extern void putptn(FILE*,int*,int*,int,int,int); extern void putquotient(FILE*,graph*,int*,int*,int,int,int,int); extern void putquotient_sg(FILE*,sparsegraph*,int*,int*,int,int); extern void putset(FILE*,set*,int*,int,int,boolean); extern void putset_firstbold(FILE*,set*,int*,int,int,boolean); extern void rangraph(graph*,boolean,int,int,int); extern void rangraph2(graph*,boolean,int,int,int,int); extern void rangraph2_sg(sparsegraph*,boolean,int,int,int); extern void ranreg_sg(sparsegraph *sg, int degree, int n); extern void ranperm(int*,int); extern void readgraph(FILE*,graph*,boolean,boolean,boolean,int,int,int); extern void readgraph_sg(FILE*,sparsegraph*,boolean,boolean,int,int); extern void readgraph_swg(FILE*,sparsegraph*,boolean,boolean,int,int); extern boolean readinteger(FILE*,int*); extern boolean readinteger_sl(FILE*,int*); extern void readperm(FILE*,int*,boolean,int); extern void readptn(FILE*,int*,int*,int*,boolean,int); extern void readvperm(FILE*,int*,boolean,int,int*); extern boolean readstring(FILE*,char*,int); extern void relabel(graph*,int*,int*,graph*,int,int); extern void relabel_sg(sparsegraph*,int*,int*,sparsegraph*); extern long sethash(set*,int,long,int); extern int setinter(set*,set*,int); extern int setsize(set*,int); extern void sublabel(graph*,int*,int,graph*,int,int); extern void sublabel_sg(sparsegraph*,int*,int,sparsegraph*); extern int subpartition(int*,int*,int,int*,int); extern void unitptn(int*,int*,int*,int); #ifdef __cplusplus } #endif #define MAXREG 8 /* Used to limit ranreg_sg() degree */ #define PROMPTFILE stdout /* where to write prompts */ #ifndef ERRFILE #define ERRFILE stderr /* where to write error messages */ #endif #define MAXIFILES 10 /* how many input files can be open at once */ #define EXIT exit(0) /* how to stop normally */ #define DEFEXT ".dre" /* extension for dreadnaut files */ /************************************************************************* The following macros may represent differences between system. This file contains the UNIX/POSIX editions. For other systems, a separate file of definitions is read in first. That file should define the variables NAUTY_*_DEFINED for sections that are to replace the UNIX versions. See the provided examples for more details. If your system does not have a predefined macro you can use to cause a definitions file to be read, you have to make up one and arrange for it to be defined when this file is read. The system-dependent files can also redefine the macros just ahead of this comment. **************************************************************************/ #ifdef __weirdmachine__ #include "weird.h" /* Some weird machine (ILLUSTRATION ONLY) */ #endif /*************************************************************************/ #ifndef NAUTY_PROMPT_DEFINED #if HAVE_ISATTY #define DOPROMPT(fp) (isatty(fileno(fp)) && isatty(fileno(PROMPTFILE))) #else #define DOPROMPT(fp) (curfile==0) #endif #endif /*NAUTY_PROMPT_DEFINED*/ /*************************************************************************/ #ifndef NAUTY_OPEN_DEFINED #define OPENOUT(fp,name,append) fp = fopen(name,(append)?"a":"w") #endif /*NAUTY_OPEN_DEFINED*/ /*************************************************************************/ #ifndef NAUTY_CPU_DEFINED #if HAVE_TIMES #include <sys/times.h> #define CPUDEFS static TLS_ATTR struct tms timebuffer; #ifndef CLK_TCK #include <time.h> #endif #if !defined(CLK_TCK) && defined(_SC_CLK_TCK) #define CLK_TCK sysconf(_SC_CLK_TCK) #endif #ifndef CLK_TCK #define CLK_TCK 60 #endif #define CPUTIME (times(&timebuffer),\ (double)(timebuffer.tms_utime + timebuffer.tms_stime) / CLK_TCK) #else #if HAVE_GETRUSAGE #include <sys/time.h> #include <sys/resource.h> #define CPUDEFS struct rusage ruse; #define CPUTIME (getrusage(RUSAGE_SELF,&ruse),\ ruse.ru_utime.tv_sec + ruse.ru_stime.tv_sec + \ 1e-6 * (ruse.ru_utime.tv_usec + ruse.ru_stime.tv_usec)) #endif #endif #ifndef CPUTIME #define CPUTIME 0.0 #endif #endif /*NAUTY_CPU_DEFINED*/ /*************************************************************************/ #ifndef NAUTY_SEED_DEFINED #if HAVE_GETTIMEOFDAY #include <sys/time.h> #define INITSEED \ {struct timeval nauty_tv; \ struct timezone nauty_tz; \ gettimeofday(&nauty_tv,&nauty_tz); \ seed = ((nauty_tv.tv_sec<<10) + (nauty_tv.tv_usec>>10)) & 0x7FFFFFFFL;} #else #if HAVE_TIME #include <time.h> #define INITSEED seed = ((time((time_t*)NULL)<<1) | 1) & 0x7FFFFFFFL #endif #endif #endif /*NAUTY_SEED_DEFINED*/ /* ++++++ This file is automatically generated, don't edit it by hand! ++++++ */
397bd820bb55adcd76c37757ba2a7baef1cb60e0
7c857119fe1505b1d80d6e62969661c06dc1a2f4
/MdePkg/Include/Protocol/VariableWrite.h
850e29640eae7afa0a2ad99c863db40333522f29
[ "BSD-2-Clause" ]
permissive
CloverHackyColor/CloverBootloader
7042ca7dd6b513d22be591a295e49071ae1482ee
2711170df4f60b2ae5aa20add3e00f35cf57b7e5
refs/heads/master
2023-08-30T22:14:34.590134
2023-08-27T19:14:02
2023-08-27T19:14:02
205,810,121
4,734
770
BSD-2-Clause
2023-09-03T12:41:33
2019-09-02T08:22:14
C
UTF-8
C
false
false
1,855
h
VariableWrite.h
/** @file Variable Write Architectural Protocol as defined in PI Specification VOLUME 2 DXE This provides the services required to set nonvolatile environment variables. This protocol must be produced by a runtime DXE driver and may be consumed only by the DXE Foundation. The DXE driver that produces this protocol must be a runtime driver. This driver may update the SetVariable() field of the UEFI Runtime Services Table. After the UEFI Runtime Services Table has been initialized, the driver must install the EFI_VARIABLE_WRITE_ARCH_PROTOCOL_GUID on a new handle with a NULL interface pointer. The installation of this protocol informs the DXE Foundation that the write services for nonvolatile environment variables are now available and that the DXE Foundation must update the 32-bit CRC of the UEFI Runtime Services Table. The full complement of environment variable services are not available until both this protocol and EFI_VARIABLE_ARCH_PROTOCOL are installed. DXE drivers that require read-only access or read/write access to volatile environment variables must have the EFI_VARIABLE_WRITE_ARCH_PROTOCOL in their dependency expressions. DXE drivers that require write access to nonvolatile environment variables must have this architectural protocol in their dependency expressions. Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent **/ #ifndef __ARCH_PROTOCOL_VARIABLE_WRITE_ARCH_H__ #define __ARCH_PROTOCOL_VARIABLE_WRITE_ARCH_H__ /// /// Global ID for the Variable Write Architectural Protocol /// #define EFI_VARIABLE_WRITE_ARCH_PROTOCOL_GUID \ { 0x6441f818, 0x6362, 0x4e44, {0xb5, 0x70, 0x7d, 0xba, 0x31, 0xdd, 0x24, 0x53 } } extern EFI_GUID gEfiVariableWriteArchProtocolGuid; #endif
0adda46711612cb593644e5445a383d25e9ea5ef
cc09d82fa5e80d15ea4a0c356a5bd0ee0a4e9976
/Source/PersistDB.h
6584aa025cbd51e1496f87a3b27f9e5724f16d3b
[ "MIT" ]
permissive
PersistX/PersistDB
e08a24f7a7e121df871471a131497d19d0519100
af72b29851fc07d182903c52f5b95daf8f699849
refs/heads/master
2022-03-10T05:21:18.173065
2019-07-03T12:35:57
2019-07-03T12:35:57
90,478,227
480
11
MIT
2022-01-03T15:58:21
2017-05-06T17:02:24
Swift
UTF-8
C
false
false
219
h
PersistDB.h
@import Foundation; //! Project version number for PersistDB. FOUNDATION_EXPORT double PersistDBVersionNumber; //! Project version string for PersistDB. FOUNDATION_EXPORT const unsigned char PersistDBVersionString[];
bf18abc37007f9acee519188e706c8778727cf73
e73547787354afd9b717ea57fe8dd0695d161821
/src/world/area_kzn/kzn_03/kzn_03_3_entity.c
cfcfb0b019e95bd57c8293038d0e9de3b08fecd3
[]
no_license
pmret/papermario
8b514b19653cef8d6145e47499b3636b8c474a37
9774b26d93f1045dd2a67e502b6efc9599fb6c31
refs/heads/main
2023-08-31T07:09:48.951514
2023-08-21T18:07:08
2023-08-21T18:07:08
287,151,133
904
139
null
2023-09-14T02:44:23
2020-08-13T01:22:57
C
UTF-8
C
false
false
5,470
c
kzn_03_3_entity.c
#include "kzn_03.h" #include "entity.h" #include "world/common/todo/UnsetCamera0MoveFlag1.inc.c" #include "world/common/todo/SetCamera0MoveFlag1.inc.c" API_CALLABLE(N(IsPlayerOnFirstCliff)) { s32 result = -1; if (gPlayerStatus.lastGoodPos.y > 800.0) { result = 0; } if (gPlayerStatus.lastGoodPos.y < 680.0) { result = 1; } if (result >= 0) { evt_set_variable(script, MV_PlayerCliffState, result); } return ApiStatus_BLOCK; } EvtScript N(EVS_TetherCameraToPlayer) = { EVT_LOOP(0) EVT_CALL(GetPlayerPos, LVar0, LVar1, LVar2) EVT_CALL(SetCamTarget, CAM_DEFAULT, LVar0, LVar1, LVar2) EVT_WAIT(1) EVT_END_LOOP EVT_RETURN EVT_END }; EvtScript N(EVS_UseSpringA) = { EVT_CALL(DisablePlayerInput, TRUE) EVT_CALL(DisablePlayerPhysics, TRUE) EVT_CALL(SetPlayerActionState, ACTION_STATE_IDLE) EVT_WAIT(1) EVT_CALL(SetPlayerActionState, ACTION_STATE_LAUNCH) EVT_WAIT(1) EVT_CALL(N(UnsetCamera0MoveFlag1)) EVT_EXEC_GET_TID(N(EVS_TetherCameraToPlayer), LVarA) EVT_CALL(SetPlayerJumpscale, EVT_FLOAT(0.7)) EVT_CALL(PlayerJump, 335, 290, 360, 40) EVT_CALL(SetPlayerFlagBits, PS_FLAG_FLYING, TRUE) EVT_CALL(SetPlayerActionState, ACTION_STATE_FALLING) EVT_CALL(DisablePlayerPhysics, FALSE) EVT_KILL_THREAD(LVarA) EVT_CALL(N(SetCamera0MoveFlag1)) EVT_RETURN EVT_END }; EvtScript N(EVS_UseSpringB) = { EVT_CALL(DisablePlayerPhysics, TRUE) EVT_CALL(SetPlayerActionState, ACTION_STATE_IDLE) EVT_WAIT(1) EVT_CALL(SetPlayerActionState, ACTION_STATE_JUMP) EVT_WAIT(1) EVT_CALL(N(UnsetCamera0MoveFlag1)) EVT_EXEC_GET_TID(N(EVS_TetherCameraToPlayer), LVarA) EVT_CALL(SetPlayerJumpscale, EVT_FLOAT(0.7)) EVT_CALL(PlayerJump, 350, 470, 210, 40) EVT_CALL(SetPlayerActionState, ACTION_STATE_LAND) EVT_CALL(DisablePlayerPhysics, FALSE) EVT_CALL(DisablePlayerInput, FALSE) EVT_KILL_THREAD(LVarA) EVT_CALL(N(SetCamera0MoveFlag1)) EVT_RETURN EVT_END }; EvtScript N(EVS_UseSpringC) = { EVT_CALL(DisablePlayerInput, TRUE) EVT_CALL(DisablePlayerPhysics, TRUE) EVT_CALL(SetPlayerActionState, ACTION_STATE_IDLE) EVT_WAIT(1) EVT_CALL(SetPlayerActionState, ACTION_STATE_JUMP) EVT_WAIT(1) EVT_CALL(N(UnsetCamera0MoveFlag1)) EVT_EXEC_GET_TID(N(EVS_TetherCameraToPlayer), LVarA) EVT_IF_EQ(MV_PlayerCliffState, 0) EVT_CALL(SetPlayerJumpscale, EVT_FLOAT(1.4)) EVT_CALL(PlayerJump, -470, 670, 71, 18) EVT_ELSE EVT_CALL(SetPlayerJumpscale, EVT_FLOAT(0.7)) EVT_CALL(PlayerJump, -384, 870, -22, 40) EVT_END_IF EVT_CALL(SetPlayerActionState, ACTION_STATE_LAND) EVT_CALL(DisablePlayerPhysics, FALSE) EVT_CALL(DisablePlayerInput, FALSE) EVT_KILL_THREAD(LVarA) EVT_CALL(N(SetCamera0MoveFlag1)) EVT_RETURN EVT_END }; EvtScript N(EVS_OnBreakBlock) = { EVT_SET(GB_StoryProgress, STORY_CH5_SMASHED_ULTRA_BLOCK) EVT_RETURN EVT_END }; EvtScript N(EVS_MakeEntities) = { EVT_CALL(MakeEntity, EVT_PTR(Entity_SavePoint), 365, 530, 135, 0, MAKE_ENTITY_END) EVT_CALL(MakeItemEntity, ITEM_FIRE_SHIELD, 75, 290, 235, ITEM_SPAWN_MODE_FIXED_NEVER_VANISH, GF_KZN03_Item_FireShield) EVT_CALL(MakeEntity, EVT_PTR(Entity_BrickBlock), 215, 745, -105, 0, MAKE_ENTITY_END) EVT_CALL(MakeEntity, EVT_PTR(Entity_BrickBlock), 85, 770, -105, 0, MAKE_ENTITY_END) EVT_CALL(MakeItemEntity, ITEM_POW_BLOCK, 85, 795, -105, ITEM_SPAWN_MODE_FALL_NEVER_VANISH, GF_KZN03_Item_POWBlock) EVT_CALL(MakeEntity, EVT_PTR(Entity_YellowBlock), 35, 730, -105, 0, ITEM_COIN, MAKE_ENTITY_END) EVT_CALL(AssignBlockFlag, GF_KZN03_ItemBlock_CoinA) EVT_CALL(MakeEntity, EVT_PTR(Entity_YellowBlock), -15, 730, -105, 0, ITEM_COIN, MAKE_ENTITY_END) EVT_CALL(AssignBlockFlag, GF_KZN03_ItemBlock_CoinB) EVT_CALL(MakeEntity, EVT_PTR(Entity_YellowBlock), -65, 730, -105, 0, ITEM_COIN, MAKE_ENTITY_END) EVT_CALL(AssignBlockFlag, GF_KZN03_ItemBlock_CoinC) EVT_CALL(MakeEntity, EVT_PTR(Entity_YellowBlock), -115, 730, -105, 0, ITEM_COIN, MAKE_ENTITY_END) EVT_CALL(AssignBlockFlag, GF_KZN03_ItemBlock_CoinD) EVT_IF_LT(GB_StoryProgress, STORY_CH5_SMASHED_ULTRA_BLOCK) EVT_CALL(MakeEntity, EVT_PTR(Entity_Hammer3Block), 490, 470, 210, 0, MAKE_ENTITY_END) EVT_CALL(AssignScript, EVT_PTR(N(EVS_OnBreakBlock))) EVT_THREAD EVT_LOOP(0) EVT_IF_GE(GB_StoryProgress, STORY_CH5_SMASHED_ULTRA_BLOCK) EVT_BREAK_LOOP EVT_END_IF EVT_WAIT(1) EVT_END_LOOP EVT_CALL(ModifyColliderFlags, MODIFY_COLLIDER_FLAGS_SET_BITS, COLLIDER_on_off, COLLIDER_FLAGS_UPPER_MASK) EVT_END_THREAD EVT_ELSE EVT_CALL(ModifyColliderFlags, MODIFY_COLLIDER_FLAGS_SET_BITS, COLLIDER_on_off, COLLIDER_FLAGS_UPPER_MASK) EVT_END_IF EVT_CALL(MakeEntity, EVT_PTR(Entity_ScriptSpring), 160, 30, 350, 0, MAKE_ENTITY_END) EVT_CALL(AssignScript, EVT_PTR(N(EVS_UseSpringA))) EVT_CALL(MakeEntity, EVT_PTR(Entity_ScriptSpring), 335, 265, 360, 0, MAKE_ENTITY_END) EVT_CALL(AssignScript, EVT_PTR(N(EVS_UseSpringB))) EVT_THREAD EVT_CALL(N(IsPlayerOnFirstCliff)) EVT_END_THREAD EVT_CALL(MakeEntity, EVT_PTR(Entity_ScriptSpring), -410, 645, 120, 0, MAKE_ENTITY_END) EVT_CALL(AssignScript, EVT_PTR(N(EVS_UseSpringC))) EVT_RETURN EVT_END };
5fb778fae22112fabf2e042b2c2a96d5e6a69cf3
79d343002bb63a44f8ab0dbac0c9f4ec54078c3a
/lib/include/avx512vp2intersectintrin.h
5d3cb48cfd20f2882ea0d3ad24449ad7f84a59bb
[ "MIT" ]
permissive
ziglang/zig
4aa75d8d3bcc9e39bf61d265fd84b7f005623fc5
f4c9e19bc3213c2bc7e03d7b06d7129882f39f6c
refs/heads/master
2023-08-31T13:16:45.980913
2023-08-31T05:50:29
2023-08-31T05:50:29
40,276,274
25,560
2,399
MIT
2023-09-14T21:09:50
2015-08-06T00:51:28
Zig
UTF-8
C
false
false
2,974
h
avx512vp2intersectintrin.h
/*===------- avx512vpintersectintrin.h - VP2INTERSECT intrinsics ------------=== * * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * *===-----------------------------------------------------------------------=== */ #ifndef __IMMINTRIN_H #error "Never use <avx512vp2intersect.h> directly; include <immintrin.h> instead." #endif #ifndef _AVX512VP2INTERSECT_H #define _AVX512VP2INTERSECT_H #define __DEFAULT_FN_ATTRS \ __attribute__((__always_inline__, __nodebug__, __target__("avx512vp2intersect"), \ __min_vector_width__(512))) /// Store, in an even/odd pair of mask registers, the indicators of the /// locations of value matches between dwords in operands __a and __b. /// /// \headerfile <x86intrin.h> /// /// This intrinsic corresponds to the <c> VP2INTERSECTD </c> instruction. /// /// \param __a /// A 512-bit vector of [16 x i32]. /// \param __b /// A 512-bit vector of [16 x i32] /// \param __m0 /// A pointer point to 16-bit mask /// \param __m1 /// A pointer point to 16-bit mask static __inline__ void __DEFAULT_FN_ATTRS _mm512_2intersect_epi32(__m512i __a, __m512i __b, __mmask16 *__m0, __mmask16 *__m1) { __builtin_ia32_vp2intersect_d_512((__v16si)__a, (__v16si)__b, __m0, __m1); } /// Store, in an even/odd pair of mask registers, the indicators of the /// locations of value matches between quadwords in operands __a and __b. /// /// \headerfile <x86intrin.h> /// /// This intrinsic corresponds to the <c> VP2INTERSECTQ </c> instruction. /// /// \param __a /// A 512-bit vector of [8 x i64]. /// \param __b /// A 512-bit vector of [8 x i64] /// \param __m0 /// A pointer point to 8-bit mask /// \param __m1 /// A pointer point to 8-bit mask static __inline__ void __DEFAULT_FN_ATTRS _mm512_2intersect_epi64(__m512i __a, __m512i __b, __mmask8 *__m0, __mmask8 *__m1) { __builtin_ia32_vp2intersect_q_512((__v8di)__a, (__v8di)__b, __m0, __m1); } #undef __DEFAULT_FN_ATTRS #endif
eb0cba09b8043629adc9e6511a338cc9e1be8713
7b92efd7dfb60d9b0a498871d5ffa699d0cf7d9e
/src/ext/card10/l0dables/modules/trng.c
7faa2909c6f90843c647ccaacd27db24273d1d5f
[ "ISC" ]
permissive
shinyblink/sled
854499be7c589b2d705050b41b8324ed66948e45
9d8e60ccbf6d8a30db83f41a8a4435d4c6b317a1
refs/heads/master
2023-07-24T08:30:03.348039
2023-07-08T14:00:54
2023-07-08T22:17:15
115,367,599
107
20
ISC
2023-07-08T22:17:17
2017-12-25T23:06:04
C
UTF-8
C
false
false
178
c
trng.c
#include "epicardium.h" #include "trng.h" int epic_trng_read(uint8_t *dest, size_t size) { if (dest == NULL) return -EFAULT; TRNG_Read(MXC_TRNG, dest, size); return 0; }
3ec278596adb882855179c63dfdf5612201c8043
28d0f8c01599f8f6c711bdde0b59f9c2cd221203
/tests/rump/rumpkern/h_client/h_forkcli.c
f09f482348a0b2ba9a41314b8c848b7709e06d2c
[]
no_license
NetBSD/src
1a9cbc22ed778be638b37869ed4fb5c8dd616166
23ee83f7c0aea0777bd89d8ebd7f0cde9880d13c
refs/heads/trunk
2023-08-31T13:24:58.105962
2023-08-27T15:50:47
2023-08-27T15:50:47
88,439,547
656
348
null
2023-07-20T20:07:24
2017-04-16T20:03:43
null
UTF-8
C
false
false
3,611
c
h_forkcli.c
/* $NetBSD: h_forkcli.c,v 1.2 2019/07/16 17:29:18 martin Exp $ */ #include <sys/types.h> #include <sys/wait.h> #include <err.h> #include <errno.h> #include <fcntl.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <rump/rump_syscalls.h> #include <rump/rumpclient.h> static void simple(void) { struct rumpclient_fork *rf; pid_t pid1, pid2; int fd, status; if ((pid1 = rump_sys_getpid()) < 2) errx(1, "unexpected pid %d", pid1); fd = rump_sys_open("/dev/null", O_CREAT | O_RDWR, 0600); if (rump_sys_write(fd, &fd, sizeof(fd)) != sizeof(fd)) errx(1, "write newlyopened /dev/null"); if ((rf = rumpclient_prefork()) == NULL) err(1, "prefork"); switch (fork()) { case -1: err(1, "fork"); break; case 0: if (rumpclient_fork_init(rf) == -1) err(1, "postfork init failed"); if ((pid2 = rump_sys_getpid()) < 2) errx(1, "unexpected pid %d", pid2); if (pid1 == pid2) errx(1, "child and parent pids are equal"); /* check that we can access the fd, the close it and exit */ if (rump_sys_write(fd, &fd, sizeof(fd)) != sizeof(fd)) errx(1, "write child /dev/null"); rump_sys_close(fd); break; default: /* * check that we can access the fd, wait for the child, and * check we can still access the fd */ if (rump_sys_write(fd, &fd, sizeof(fd)) != sizeof(fd)) errx(1, "write parent /dev/null"); if (wait(&status) == -1) err(1, "wait failed"); if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) errx(1, "child exited with status %d", status); if (rump_sys_write(fd, &fd, sizeof(fd)) != sizeof(fd)) errx(1, "write parent /dev/null"); break; } } static void cancel(void) { /* XXX: not implemented in client / server !!! */ } #define TESTSTR "i am your fatherrrrrrr" #define TESTSLEN (sizeof(TESTSTR)-1) static void pipecomm(void) { struct rumpclient_fork *rf; char buf[TESTSLEN+1]; int pipetti[2]; int status; if (rump_sys_pipe(pipetti) == -1) errx(1, "pipe"); if ((rf = rumpclient_prefork()) == NULL) err(1, "prefork"); switch (fork()) { case -1: err(1, "fork"); break; case 0: if (rumpclient_fork_init(rf) == -1) err(1, "postfork init failed"); memset(buf, 0, sizeof(buf)); if (rump_sys_read(pipetti[0], buf, TESTSLEN) != TESTSLEN) err(1, "pipe read"); if (strcmp(TESTSTR, buf) != 0) errx(1, "teststring doesn't match, got %s", buf); break; default: if (rump_sys_write(pipetti[1], TESTSTR, TESTSLEN) != TESTSLEN) err(1, "pipe write"); if (wait(&status) == -1) err(1, "wait failed"); if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) errx(1, "child exited with status %d", status); break; } } static void fakeauth(void) { struct rumpclient_fork *rf; uint32_t *auth; int rv; if ((rf = rumpclient_prefork()) == NULL) err(1, "prefork"); /* XXX: we know the internal structure of rf */ auth = (void *)rf; *(auth+3) = *(auth+3) ^ 0x1; rv = rumpclient_fork_init(rf); if (!(rv == -1 && errno == ESRCH)) exit(1); } struct parsa { const char *arg; /* sp arg, el */ void (*spring)(void); /* spring into action */ } paragus[] = { { "simple", simple }, { "cancel", cancel }, { "pipecomm", pipecomm }, { "fakeauth", fakeauth }, }; int main(int argc, char *argv[]) { unsigned i; if (argc != 2) errx(1, "invalid usage"); if (rumpclient_init() == -1) err(1, "rumpclient init"); for (i = 0; i < __arraycount(paragus); i++) { if (strcmp(argv[1], paragus[i].arg) == 0) { paragus[i].spring(); break; } } if (i == __arraycount(paragus)) { printf("invalid test %s\n", argv[1]); exit(1); } exit(0); }
62d9b77de237f0f37608e73494b1bdd15bed0379
35c04ea32351dc95bc18d46e5c70dda9c1e08668
/Examples/KDS/tinyK20/LoRaMac-node/src/system/gps.c
f72697c2970f680bdbbfa427ff84b2a9676e65c3
[ "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
ErichStyger/mcuoneclipse
0f8e7a2056a26ed79d9d4a0afd64777ff0b2b2fe
04ad311b11860ae5f8285316010961a87fa06d0c
refs/heads/master
2023-08-28T22:54:08.501719
2023-08-25T15:11:44
2023-08-25T15:11:44
7,446,094
620
1,191
NOASSERTION
2020-10-16T03:13:28
2013-01-04T19:38:12
Batchfile
UTF-8
C
false
false
20,691
c
gps.c
/* / _____) _ | | ( (____ _____ ____ _| |_ _____ ____| |__ \____ \| ___ | (_ _) ___ |/ ___) _ \ _____) ) ____| | | || |_| ____( (___| | | | (______/|_____)_|_|_| \__)_____)\____)_| |_| (C)2013 Semtech Description: Generic driver for any GPS receiver License: Revised BSD License, see LICENSE.TXT file include in the project Maintainer: Miguel Luis and Gregory Cristian */ #include <stdint.h> #include <stdlib.h> #include <math.h> #include <time.h> #include <stdio.h> #include <string.h> #include "board.h" #include "gps.h" #if defined(USE_LORA_MESH) #include "LoRaMesh.h" #endif #define LOG_LEVEL_ERROR #include "debug.h" #define TRIGGER_GPS_CNT 10 /* Various type of NMEA data we can receive with the Gps */ const char NmeaDataTypeGPGGA[] = "GPGGA"; const char NmeaDataTypeGPGSA[] = "GPGSA"; const char NmeaDataTypeGPGSV[] = "GPGSV"; const char NmeaDataTypeGPRMC[] = "GPRMC"; /* Value used for the conversion of the position from DMS to decimal */ const int32_t MaxNorthPosition = 8388607; // 2^23 - 1 const int32_t MaxSouthPosition = 8388608; // -2^23 const int32_t MaxEastPosition = 8388607; // 2^23 - 1 const int32_t MaxWestPosition = 8388608; // -2^23 tNmeaGpsData NmeaGpsData; static double Latitude = 0; static double Longitude = 0; static int32_t LatitudeBinary = 0; static int32_t LongitudeBinary = 0; static uint16_t GroundSpeedBinary = 0; static uint16_t TrackBinary = 0; static uint16_t AltitudeBinary = 0xFFFF; static uint32_t PpsCnt = 0; static time_t gpsUnixTime; static bool bGpsHasFix = false; static bool bGpsHasValidDateTime = false; static bool PpsDetected = false; void GpsPpsHandler( bool *parseData ) { PpsDetected = true; PpsCnt++; gpsUnixTime++; *parseData = false; #if defined(USE_LORA_MESH) if ( bGpsHasFix && bGpsHasValidDateTime ) { LoRaMesh_TimeSynch(gpsUnixTime); } #endif if ( PpsCnt >= TRIGGER_GPS_CNT ) { PpsCnt = 0; BlockLowPowerDuringTask(true); *parseData = true; } } void GpsInit( void ) { PpsDetected = false; gpsUnixTime = 0u; /* Reset datetime to make sure it is current */ for ( uint8_t i = 0; i < 11; i++ ) { NmeaGpsData.NmeaUtcTime[i] = 0x00u; if ( i < 8 ) { NmeaGpsData.NmeaDate[i] = 0x00u; } } GpsMcuInit(); } bool GpsGetPpsDetectedState( void ) { bool state = false; __disable_irq(); state = PpsDetected; PpsDetected = false; __enable_irq(); return state; } bool GpsHasFix( void ) { return bGpsHasFix; } bool GpsHasValidDateTime( void ) { return bGpsHasValidDateTime; } bool GpsValidateDateTime( struct tm *dt ) { if ( NmeaGpsData.NmeaUtcTime[0] > '2' || NmeaGpsData.NmeaUtcTime[0] < '0' ) { return false; } else if ( NmeaGpsData.NmeaUtcTime[1] > '9' || NmeaGpsData.NmeaUtcTime[1] < '0' ) { return false; } else if ( NmeaGpsData.NmeaUtcTime[2] > '6' || NmeaGpsData.NmeaUtcTime[2] < '0' ) { return false; } else if ( NmeaGpsData.NmeaUtcTime[3] > '9' || NmeaGpsData.NmeaUtcTime[3] < '0' ) { return false; } else if ( NmeaGpsData.NmeaUtcTime[4] > '6' || NmeaGpsData.NmeaUtcTime[4] < '0' ) { return false; } else if ( NmeaGpsData.NmeaUtcTime[5] > '9' || NmeaGpsData.NmeaUtcTime[5] < '0' ) { return false; } else if ( NmeaGpsData.NmeaDate[0] > '3' || NmeaGpsData.NmeaDate[0] < '0' ) { return false; } else if ( NmeaGpsData.NmeaDate[1] > '9' || NmeaGpsData.NmeaDate[1] < '0' ) { return false; } else if ( NmeaGpsData.NmeaDate[2] > '1' || NmeaGpsData.NmeaDate[2] < '0' ) { return false; } else if ( NmeaGpsData.NmeaDate[3] > '9' || NmeaGpsData.NmeaDate[3] < '0' ) { return false; } else if ( NmeaGpsData.NmeaDate[4] > '9' || NmeaGpsData.NmeaDate[4] < '0' ) { return false; } else if ( NmeaGpsData.NmeaDate[5] > '9' || NmeaGpsData.NmeaDate[5] < '0' ) { return false; } /* Valid datetime */ dt->tm_hour = ((NmeaGpsData.NmeaUtcTime[0] - 0x30) * 10) + (NmeaGpsData.NmeaUtcTime[1] - 0x30); dt->tm_min = ((NmeaGpsData.NmeaUtcTime[2] - 0x30) * 10) + (NmeaGpsData.NmeaUtcTime[3] - 0x30); dt->tm_sec = ((NmeaGpsData.NmeaUtcTime[4] - 0x30) * 10) + (NmeaGpsData.NmeaUtcTime[5] - 0x30); dt->tm_mday = ((NmeaGpsData.NmeaDate[0] - 0x30) * 10) + (NmeaGpsData.NmeaDate[1] - 0x30); dt->tm_mon = ((NmeaGpsData.NmeaDate[2] - 0x30) * 10) + (NmeaGpsData.NmeaDate[3] - 0x30) - 1; dt->tm_year = (2000 - 1900) + ((NmeaGpsData.NmeaDate[4] - 0x30) * 10) + (NmeaGpsData.NmeaDate[5] - 0x30); dt->tm_isdst = -1; return true; } void GpsConvertPositionIntoBinary( void ) { #if 1 int32_t valueTmp1, valueTmp2; uint16_t i; valueTmp1 = (NmeaGpsData.NmeaLatitude[0] * 10 + NmeaGpsData.NmeaLatitude[1]) * 10000000; valueTmp1 += (NmeaGpsData.NmeaLatitude[2] * 10 + NmeaGpsData.NmeaLatitude[3]) * 100000; valueTmp1 += (NmeaGpsData.NmeaLatitude[5] * 1000 + NmeaGpsData.NmeaLatitude[6] * 100 + NmeaGpsData.NmeaLatitude[7] * 10 + NmeaGpsData.NmeaLatitude[8]); LatitudeBinary = valueTmp1; if ( NmeaGpsData.NmeaLatitudePole[0] == 'S' ) { LatitudeBinary *= -1; } valueTmp2 = (NmeaGpsData.NmeaLongitude[0] * 100 + NmeaGpsData.NmeaLongitude[1] * 10 + NmeaGpsData.NmeaLongitude[2]) * 1000000; valueTmp2 += (NmeaGpsData.NmeaLongitude[3] * 10 + NmeaGpsData.NmeaLongitude[4]) * 10000; valueTmp2 += (NmeaGpsData.NmeaLongitude[6] * 1000 + NmeaGpsData.NmeaLongitude[7] * 100 + NmeaGpsData.NmeaLongitude[8] * 10 + NmeaGpsData.NmeaLongitude[9]); LongitudeBinary = valueTmp2; if ( NmeaGpsData.NmeaLongitudePole[0] == 'W' ) { LongitudeBinary *= -1; } // Convert the altitude from ASCII to uint8_t values for ( i = 0; i < 8; i++ ) { NmeaGpsData.NmeaAltitude[i] = NmeaGpsData.NmeaAltitude[i] & 0xF; } AltitudeBinary = (NmeaGpsData.NmeaAltitude[0] * 1000) + (NmeaGpsData.NmeaAltitude[1] * 100) + (NmeaGpsData.NmeaAltitude[2] * 10) + (NmeaGpsData.NmeaAltitude[4]); // Convert the ground speed from ASCII to uint8_t values for ( i = 0; i < 8; i++ ) { NmeaGpsData.NmeaSpeed[i] = NmeaGpsData.NmeaSpeed[i] & 0xF; } GroundSpeedBinary = (NmeaGpsData.NmeaSpeed[0] * 100) + (NmeaGpsData.NmeaSpeed[2] * 10) + (NmeaGpsData.NmeaSpeed[3]); // Convert the detection angle from ASCII to uint8_t values for ( i = 0; i < 8; i++ ) { NmeaGpsData.NmeaDetectionAngle[i] = NmeaGpsData.NmeaDetectionAngle[i] & 0xF; } TrackBinary = (NmeaGpsData.NmeaDetectionAngle[0] * 10000) + (NmeaGpsData.NmeaDetectionAngle[1] * 1000) + (NmeaGpsData.NmeaDetectionAngle[2] * 100) + (NmeaGpsData.NmeaDetectionAngle[4] * 10) + (NmeaGpsData.NmeaDetectionAngle[5]); #else long double temp; if ( Latitude >= 0 ) // North { temp = Latitude * MaxNorthPosition; LatitudeBinary = temp / 90; } else // South { temp = Latitude * MaxSouthPosition; LatitudeBinary = temp / 90; } if ( Longitude >= 0 ) // East { temp = Longitude * MaxEastPosition; LongitudeBinary = temp / 180; } else // West { temp = Longitude * MaxWestPosition; LongitudeBinary = temp / 180; } #endif } void GpsConvertUnixTimeFromStringToNumerical( void ) { struct tm dateTime; if ( GpsValidateDateTime(&dateTime) ) { gpsUnixTime = mktime(&dateTime); bGpsHasValidDateTime = true; } else { bGpsHasValidDateTime = false; } } void GpsConvertPositionFromStringToNumerical( void ) { int i; double valueTmp1; double valueTmp2; double valueTmp3; double valueTmp4; // Convert the latitude from ASCII to uint8_t values for ( i = 0; i < 10; i++ ) { NmeaGpsData.NmeaLatitude[i] = NmeaGpsData.NmeaLatitude[i] & 0xF; } // Convert latitude from degree/minute/second (DMS) format into decimal valueTmp1 = (double) NmeaGpsData.NmeaLatitude[0] * 10.0 + (double) NmeaGpsData.NmeaLatitude[1]; valueTmp2 = (double) NmeaGpsData.NmeaLatitude[2] * 10.0 + (double) NmeaGpsData.NmeaLatitude[3]; valueTmp3 = (double) NmeaGpsData.NmeaLatitude[5] * 1000.0 + (double) NmeaGpsData.NmeaLatitude[6] * 100.0 + (double) NmeaGpsData.NmeaLatitude[7] * 10.0 + (double) NmeaGpsData.NmeaLatitude[8]; Latitude = valueTmp1 + ((valueTmp2 + (valueTmp3 * 0.0001)) / 60.0); if ( NmeaGpsData.NmeaLatitudePole[0] == 'S' ) { Latitude *= -1; } // Convert the longitude from ASCII to uint8_t values for ( i = 0; i < 10; i++ ) { NmeaGpsData.NmeaLongitude[i] = NmeaGpsData.NmeaLongitude[i] & 0xF; } // Convert longitude from degree/minute/second (DMS) format into decimal valueTmp1 = (double) NmeaGpsData.NmeaLongitude[0] * 100.0 + (double) NmeaGpsData.NmeaLongitude[1] * 10.0 + (double) NmeaGpsData.NmeaLongitude[2]; valueTmp2 = (double) NmeaGpsData.NmeaLongitude[3] * 10.0 + (double) NmeaGpsData.NmeaLongitude[4]; valueTmp3 = (double) NmeaGpsData.NmeaLongitude[6] * 1000.0 + (double) NmeaGpsData.NmeaLongitude[7] * 100; valueTmp4 = (double) NmeaGpsData.NmeaLongitude[8] * 10.0 + (double) NmeaGpsData.NmeaLongitude[9]; Longitude = valueTmp1 + (valueTmp2 / 60.0) + (((valueTmp3 + valueTmp4) * 0.0001) / 60.0); if ( NmeaGpsData.NmeaLongitudePole[0] == 'W' ) { Longitude *= -1; } } time_t GpsGetCurrentUnixTime( void ) { return gpsUnixTime; } uint8_t GpsGetLatestGpsPositionDouble( double *lati, double *longi ) { uint8_t status = FAIL; if ( GpsHasFix() == true ) { status = SUCCESS; } else { GpsResetPosition(); } *lati = Latitude; *longi = Longitude; return status; } uint8_t GpsGetLatestGpsPositionBinary( int32_t *latiBin, int32_t *longiBin ) { uint8_t status = FAIL; __disable_irq(); if ( GpsHasFix() == true ) { status = SUCCESS; } else { GpsResetPosition(); } *latiBin = LatitudeBinary; *longiBin = LongitudeBinary; __enable_irq(); return status; } uint8_t GpsGetDistanceToLatestGpsPositionBinary( int32_t latiBin, int32_t longiBin, uint32_t *distance ) { return SUCCESS; } uint16_t GpsGetLatestGpsAltitude( void ) { uint16_t altBin; __disable_irq(); if ( GpsHasFix() == true ) { altBin = AltitudeBinary; } else { altBin = 0xFFFF; } __enable_irq(); return altBin; } uint8_t GpsGetLatestTrack( uint16_t *groundSpeed, uint16_t *track ) { uint8_t status = FAIL; __disable_irq(); if ( GpsHasFix() == true ) { *groundSpeed = GroundSpeedBinary; *track = TrackBinary; status = SUCCESS; } __enable_irq(); return status; } /*! * Calculates the checksum for a NMEA sentence * * Skip the first '$' if necessary and calculate checksum until '*' character is * reached (or buffSize exceeded). * * \retval chkPosIdx Position of the checksum in the sentence */ int32_t GpsNmeaChecksum( char *nmeaStr, size_t nmeaStrSize, uint8_t * checksum ) { int i = 0; uint8_t checkNum = 0; // Check input parameters if ( (nmeaStr == NULL) || (checksum == NULL) || (nmeaStrSize <= 1) ) { return -1; } // Skip the first '$' if necessary if ( nmeaStr[i] == '$' ) { i += 1; } // XOR until '*' or max length is reached while ( nmeaStr[i] != '*' ) { checkNum ^= nmeaStr[i]; i += 1; if ( i >= nmeaStrSize ) { return -1; } } // Convert checksum value to 2 hexadecimal characters checksum[0] = Nibble2HexChar(checkNum / 16); // upper nibble checksum[1] = Nibble2HexChar(checkNum % 16); // lower nibble return i + 1; } /*! * Calculate the checksum of a NMEA frame and compare it to the checksum that is * present at the end of it. * Return true if it matches */ static bool GpsNmeaValidateChecksum( char *serialBuff, size_t buffSize ) { int32_t checksumIndex; uint8_t checksum[2]; // 2 characters to calculate NMEA checksum checksumIndex = GpsNmeaChecksum(serialBuff, buffSize, checksum); // could we calculate a verification checksum ? if ( checksumIndex < 0 ) { return false; } // check if there are enough char in the serial buffer to read checksum if ( checksumIndex >= (buffSize - 2) ) { return false; } // check the checksum if ( (serialBuff[checksumIndex] == checksum[0]) && (serialBuff[checksumIndex + 1] == checksum[1]) ) { return true; } else { return false; } } uint8_t GpsParseGpsData( char *rxBuffer, size_t rxBufferSize ) { uint8_t i = 1; uint8_t j = 0; uint8_t fieldSize = 0; if ( rxBuffer[0] != '$' ) { return FAIL; } if ( GpsNmeaValidateChecksum(rxBuffer, rxBufferSize) == false ) { return FAIL; } fieldSize = 0; while ( rxBuffer[i + fieldSize++] != ',' ) { if ( fieldSize > 6 ) { return FAIL; } } for ( j = 0; j < fieldSize; j++, i++ ) { NmeaGpsData.NmeaDataType[j] = rxBuffer[i]; } // Parse the GPGGA data if ( strncmp((const char*) NmeaGpsData.NmeaDataType, (const char*) NmeaDataTypeGPGGA, 5) == 0 ) { // NmeaUtcTime fieldSize = 0; while ( rxBuffer[i + fieldSize++] != ',' ) { if ( fieldSize > 11 ) { return FAIL; } } for ( j = 0; j < fieldSize; j++, i++ ) { NmeaGpsData.NmeaUtcTime[j] = rxBuffer[i]; } // NmeaLatitude fieldSize = 0; while ( rxBuffer[i + fieldSize++] != ',' ) { if ( fieldSize > 10 ) { return FAIL; } } for ( j = 0; j < fieldSize; j++, i++ ) { NmeaGpsData.NmeaLatitude[j] = rxBuffer[i]; } // NmeaLatitudePole fieldSize = 0; while ( rxBuffer[i + fieldSize++] != ',' ) { if ( fieldSize > 2 ) { return FAIL; } } for ( j = 0; j < fieldSize; j++, i++ ) { NmeaGpsData.NmeaLatitudePole[j] = rxBuffer[i]; } // NmeaLongitude fieldSize = 0; while ( rxBuffer[i + fieldSize++] != ',' ) { if ( fieldSize > 11 ) { return FAIL; } } for ( j = 0; j < fieldSize; j++, i++ ) { NmeaGpsData.NmeaLongitude[j] = rxBuffer[i]; } // NmeaLongitudePole fieldSize = 0; while ( rxBuffer[i + fieldSize++] != ',' ) { if ( fieldSize > 2 ) { return FAIL; } } for ( j = 0; j < fieldSize; j++, i++ ) { NmeaGpsData.NmeaLongitudePole[j] = rxBuffer[i]; } // NmeaFixQuality fieldSize = 0; while ( rxBuffer[i + fieldSize++] != ',' ) { if ( fieldSize > 2 ) { return FAIL; } } for ( j = 0; j < fieldSize; j++, i++ ) { NmeaGpsData.NmeaFixQuality[j] = rxBuffer[i]; } if ( NmeaGpsData.NmeaFixQuality[0] > 0x30 ) { bGpsHasFix = true; } else { bGpsHasFix = false; } // NmeaSatelliteTracked fieldSize = 0; while ( rxBuffer[i + fieldSize++] != ',' ) { if ( fieldSize > 3 ) { return FAIL; } } for ( j = 0; j < fieldSize; j++, i++ ) { NmeaGpsData.NmeaSatelliteTracked[j] = rxBuffer[i]; } // NmeaHorizontalDilution fieldSize = 0; while ( rxBuffer[i + fieldSize++] != ',' ) { if ( fieldSize > 6 ) { return FAIL; } } for ( j = 0; j < fieldSize; j++, i++ ) { NmeaGpsData.NmeaHorizontalDilution[j] = rxBuffer[i]; } // NmeaAltitude fieldSize = 0; while ( rxBuffer[i + fieldSize++] != ',' ) { if ( fieldSize > 8 ) { return FAIL; } } for ( j = 0; j < fieldSize; j++, i++ ) { NmeaGpsData.NmeaAltitude[j] = rxBuffer[i]; } // NmeaAltitudeUnit fieldSize = 0; while ( rxBuffer[i + fieldSize++] != ',' ) { if ( fieldSize > 2 ) { return FAIL; } } for ( j = 0; j < fieldSize; j++, i++ ) { NmeaGpsData.NmeaAltitudeUnit[j] = rxBuffer[i]; } // NmeaHeightGeoid fieldSize = 0; while ( rxBuffer[i + fieldSize++] != ',' ) { if ( fieldSize > 8 ) { return FAIL; } } for ( j = 0; j < fieldSize; j++, i++ ) { NmeaGpsData.NmeaHeightGeoid[j] = rxBuffer[i]; } // NmeaHeightGeoidUnit fieldSize = 0; while ( rxBuffer[i + fieldSize++] != ',' ) { if ( fieldSize > 2 ) { return FAIL; } } for ( j = 0; j < fieldSize; j++, i++ ) { NmeaGpsData.NmeaHeightGeoidUnit[j] = rxBuffer[i]; } GpsFormatGpsData(); return SUCCESS; } else if ( strncmp((const char*) NmeaGpsData.NmeaDataType, (const char*) NmeaDataTypeGPRMC, 5) == 0 ) { // NmeaUtcTime fieldSize = 0; while ( rxBuffer[i + fieldSize++] != ',' ) { if ( fieldSize > 11 ) { return FAIL; } } for ( j = 0; j < fieldSize; j++, i++ ) { NmeaGpsData.NmeaUtcTime[j] = rxBuffer[i]; } // NmeaDataStatus fieldSize = 0; while ( rxBuffer[i + fieldSize++] != ',' ) { if ( fieldSize > 2 ) { return FAIL; } } for ( j = 0; j < fieldSize; j++, i++ ) { NmeaGpsData.NmeaDataStatus[j] = rxBuffer[i]; } // NmeaLatitude fieldSize = 0; while ( rxBuffer[i + fieldSize++] != ',' ) { if ( fieldSize > 10 ) { return FAIL; } } for ( j = 0; j < fieldSize; j++, i++ ) { NmeaGpsData.NmeaLatitude[j] = rxBuffer[i]; } // NmeaLatitudePole fieldSize = 0; while ( rxBuffer[i + fieldSize++] != ',' ) { if ( fieldSize > 2 ) { return FAIL; } } for ( j = 0; j < fieldSize; j++, i++ ) { NmeaGpsData.NmeaLatitudePole[j] = rxBuffer[i]; } // NmeaLongitude fieldSize = 0; while ( rxBuffer[i + fieldSize++] != ',' ) { if ( fieldSize > 11 ) { return FAIL; } } for ( j = 0; j < fieldSize; j++, i++ ) { NmeaGpsData.NmeaLongitude[j] = rxBuffer[i]; } // NmeaLongitudePole fieldSize = 0; while ( rxBuffer[i + fieldSize++] != ',' ) { if ( fieldSize > 2 ) { return FAIL; } } for ( j = 0; j < fieldSize; j++, i++ ) { NmeaGpsData.NmeaLongitudePole[j] = rxBuffer[i]; } // NmeaSpeed fieldSize = 0; while ( rxBuffer[i + fieldSize++] != ',' ) { if ( fieldSize > 8 ) { return FAIL; } } for ( j = 0; j < fieldSize; j++, i++ ) { NmeaGpsData.NmeaSpeed[j] = rxBuffer[i]; } // NmeaDetectionAngle fieldSize = 0; while ( rxBuffer[i + fieldSize++] != ',' ) { if ( fieldSize > 8 ) { return FAIL; } } for ( j = 0; j < fieldSize; j++, i++ ) { NmeaGpsData.NmeaDetectionAngle[j] = rxBuffer[i]; } // NmeaDate fieldSize = 0; while ( rxBuffer[i + fieldSize++] != ',' ) { if ( fieldSize > 8 ) { return FAIL; } } for ( j = 0; j < fieldSize; j++, i++ ) { NmeaGpsData.NmeaDate[j] = rxBuffer[i]; } GpsFormatGpsData(); return SUCCESS; } else { return FAIL; } } void GpsFormatGpsData( void ) { GpsConvertPositionFromStringToNumerical(); GpsConvertPositionIntoBinary(); GpsConvertUnixTimeFromStringToNumerical(); } void GpsResetPosition( void ) { AltitudeBinary = 0xFFFF; Latitude = 0; Longitude = 0; LatitudeBinary = 0; LongitudeBinary = 0; }
3914b8461aa69ec176845eff1d3f5bc44e2c3f82
fff6d13af91db925a94b3e3474108fafd519bba0
/src/Main/jkHudCameraView.h
4e85858705d646a135a011d28b5e79ffb549b497
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
shinyquagsire23/OpenJKDF2
94f1364628924ac944466107606b91c6faeec3df
b79b8c210878b6f276ed3d1a5dad91d9219e6ce1
refs/heads/master
2023-07-08T16:41:38.986577
2023-06-28T08:47:39
2023-06-28T08:47:39
139,542,792
381
34
NOASSERTION
2023-06-28T08:47:40
2018-07-03T07:09:45
C
UTF-8
C
false
false
291
h
jkHudCameraView.h
#ifndef _MAIN_JKHUDCAMERAVIEW_H #define _MAIN_JKHUDCAMERAVIEW_H #include "types.h" void jkHudCameraView_Startup(void); void jkHudCameraView_Shutdown(void); int jkHudCameraView_Open(void); void jkHudCameraView_Close(void); void jkHudCameraView_Draw(void); #endif // _MAIN_JKHUDCAMERAVIEW_H
6890332826b7d2ec95ce45c7fc2a89ef51bba374
a11e4bdd6157b22067288d860507fa20abea033d
/src/modules/wizard/page_160.c
d56c47af8969df2ca39b01fb3cec7d9a13263e91
[ "BSD-2-Clause" ]
permissive
JeffHoogland/moksha
85a0f39dc97daa61d35e64a511013d21552db288
c56013644d8cd8e32101bb38a8d1e4ebd9d47f37
refs/heads/master
2023-08-24T05:39:13.415948
2023-08-22T19:49:32
2023-08-22T19:49:32
34,704,822
179
51
NOASSERTION
2023-09-06T14:41:31
2015-04-28T02:59:19
C
UTF-8
C
false
false
1,162
c
page_160.c
/* Setup favorites and desktop links */ #include "e_wizard.h" /* EAPI int wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons __UNUSED__) { return 1; } EAPI int wizard_page_shutdown(E_Wizard_Page *pg __UNUSED__) { return 1; } */ EAPI int wizard_page_show(E_Wizard_Page *pg __UNUSED__) { #ifndef ENABLE_BODHI Eina_List *files; char buf[PATH_MAX], buf2[PATH_MAX], *file; // make desktop dir ecore_file_mkpath(efreet_desktop_dir_get()); snprintf(buf, sizeof(buf), "%s/desktop", e_wizard_dir_get()); files = ecore_file_ls(buf); if (!files) return 0; EINA_LIST_FREE(files, file) { snprintf(buf, sizeof(buf), "%s/desktop/%s", e_wizard_dir_get(), file); snprintf(buf2, sizeof(buf2), "%s/%s", efreet_desktop_dir_get(), file); ecore_file_cp(buf, buf2); free(file); } #endif return 0; /* 1 == show ui, and wait for user, 0 == just continue */ } /* EAPI int wizard_page_hide(E_Wizard_Page *pg __UNUSED__) { return 1; } EAPI int wizard_page_apply(E_Wizard_Page *pg __UNUSED__) { return 1; } */
a2b903298a9bc5df3d9e34abe8b1af031d0840fb
ea401c3e792a50364fe11f7cea0f35f99e8f4bde
/bigneuron_ported/cher/EPBscore_C_code/check_1_obj.c
744f8692a882345cbc1fd482b001373715e55480
[ "MIT" ]
permissive
Vaa3D/vaa3d_tools
edb696aa3b9b59acaf83d6d27c6ae0a14bf75fe9
e6974d5223ae70474efaa85e1253f5df1814fae8
refs/heads/master
2023-08-03T06:12:01.013752
2023-08-02T07:26:01
2023-08-02T07:26:01
50,527,925
107
86
MIT
2023-05-22T23:43:48
2016-01-27T18:19:17
C++
UTF-8
C
false
false
1,870
c
check_1_obj.c
/* * Copyrighted, Research Foundation of SUNY, 1998 */ #include "stdafx.h" #include <stdio.h> #include <math.h> #include "maset.h" int check_one_obj(int *obj, int obj_size, int nx, int nxy, int (*proc_func)(int, int, int, int, int, int)) { int i, j, x1, x2, y1, y2, z1, z2; int tmp_pt, search_stop_pt, done_stop_pt, pt1, pt2; int is_connected; int tot_moved, curr_moved; if( obj_size == 1 ) return 1; /* one voxel in the object */ tmp_pt = obj[0]; obj[0] = obj[obj_size -1]; obj[obj_size-1] = tmp_pt; search_stop_pt = obj_size - 2; done_stop_pt = obj_size -1; tot_moved = 1; for( i = obj_size -1; i >= done_stop_pt; i-- ) { pt1 = obj[i]; Ind_2_ijk(pt1,x1,y1,z1,nx,nxy); curr_moved = 0; for( j = 0; j <= search_stop_pt; j++ ) { pt2 = obj[j]; Ind_2_ijk(pt2,x2,y2,z2,nx,nxy); is_connected = (*proc_func)(x1,x2,y1,y2,z1,z2); if( is_connected ) { obj[j] = obj[search_stop_pt]; obj[search_stop_pt] = pt2; search_stop_pt--; done_stop_pt--; curr_moved++; if( search_stop_pt < 0 ) return 1; j--; /* check moved point ! */ } } tot_moved += curr_moved; } return 0; } int is_6_connected(int x1, int x2, int y1, int y2, int z1, int z2) { int absx, absy, absz, abssum; int ans; absx = abs(x1-x2); absy = abs(y1-y2); absz = abs(z1-z2); abssum = absx + absy + absz; ans = ( abssum == 1 ) ? 1 : 0; return ans; } int is_26_connected(int x1, int x2, int y1, int y2, int z1, int z2) { int absx, absy, absz; int ans; absx = abs(x1-x2); absy = abs(y1-y2); absz = abs(z1-z2); ans = ( (absx <= 1) && (absy <= 1) && (absz <= 1) ) ? 1 : 0; return ans; } void dbg_print_check_one_object(int *check_obj, int obj_size) { int i; for( i = 0; i < obj_size; i++ ) { fprintf(stderr,"%d) %d\n",i+1,check_obj[i]); fprintf(stdout,"%d) %d\n",i+1,check_obj[i]); } }
b435e89ceb3e1852a9e442cb572bc219c7eded32
6ff85b80c6fe1b3ad5416a304b93551a5e80de10
/C/Allocation/BinaryTree.c
dfe1befb05306e61cb13bc9e7101308c905c71ba
[ "MIT" ]
permissive
maniero/SOpt
c600cc2333e0a47ce013be3516bbb8080502ff2a
5d17e1a9cbf115eaea6d30af2079d0c92ffff7a3
refs/heads/master
2023-08-10T16:48:46.058739
2023-08-10T13:42:17
2023-08-10T13:42:17
78,631,930
1,002
136
MIT
2023-01-28T12:10:01
2017-01-11T11:19:24
C#
UTF-8
C
false
false
883
c
BinaryTree.c
#include <stdio.h> #include <stdlib.h> typedef struct no { int info; struct no *esq; struct no *dir; } Node; Node *insere(Node *arv, int valor) { if (arv == NULL) { arv = malloc(sizeof(Node)); arv->info = valor; arv->esq = NULL; arv->dir = NULL; return arv; } else if (valor > arv->info) { arv->dir = insere(arv->dir, valor); return arv->dir; } else { arv->esq = insere(arv->esq, valor); return arv->esq; } } void imprime (Node *arv) { if (arv != NULL) { imprime(arv->esq); printf("\n %d", arv->info); imprime(arv->dir); } } int main (void) { Node *arv = malloc(sizeof(Node)); arv->info = 1; arv->dir = NULL; arv->esq = NULL; insere(arv, 2); insere(arv, 3); imprime(arv); } //http://pt.stackoverflow.com/q/190689/101
27573e27ddfd951f9b68d836c769a1901cad3119
7e1cd9b94c0c8c443f993362dc185dfc35ceb963
/interface/khronos/vg/vg_int.h
4ddbb6a96cf5e6765527151d31833e0abaf62da3
[ "BSD-3-Clause" ]
permissive
raspberrypi/userland
92e557234bb6d7f701066543e0efc36dfb54a52c
cc1ca18fb0689b01cc2ca2aa4b400dcee624a213
refs/heads/master
2023-08-20T15:41:23.695645
2023-04-19T10:38:04
2023-04-20T13:36:13
6,367,886
1,608
928
BSD-3-Clause
2023-09-13T09:54:26
2012-10-24T09:58:46
C
UTF-8
C
false
false
2,083
h
vg_int.h
/* Copyright (c) 2012, Broadcom Europe Ltd All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef VG_INT_H #define VG_INT_H /* object types as used on the client the server has a separate notion of object types, defined in middleware/khronos/vg/vg_server.c, which includes partially constructed objects ("blueprints") and a distinction between images and child images */ typedef enum { VG_CLIENT_OBJECT_TYPE_FONT = 0, VG_CLIENT_OBJECT_TYPE_IMAGE = 1, VG_CLIENT_OBJECT_TYPE_MASK_LAYER = 2, VG_CLIENT_OBJECT_TYPE_PAINT = 3, VG_CLIENT_OBJECT_TYPE_PATH = 4 } VG_CLIENT_OBJECT_TYPE_T; #endif
e279589cd3615487e5b4880012b80e0343634e7f
879443e54e57c9076ce801bc71dfc06e0514cb3e
/main/fontx.c
8f3af724401caed3671bcfedc5ab0a7a55348d22
[ "MIT" ]
permissive
nopnop2002/esp-idf-st7789
2b94ecef8f1226c8b9d98ed0a40136692e30bc1d
8ce1372e24b21cc5ff3a31f4aac81c7fefe18731
refs/heads/master
2023-07-09T22:21:44.530937
2023-07-09T07:26:44
2023-07-09T07:26:44
189,789,425
199
54
MIT
2023-09-12T11:46:10
2019-06-02T00:25:06
C
UTF-8
C
false
false
17,718
c
fontx.c
#include <stdio.h> #include <string.h> #include <inttypes.h> #include <sys/unistd.h> #include <sys/stat.h> #include "esp_err.h" #include "esp_log.h" #include "esp_spiffs.h" #include "fontx.h" #define FontxDebug 0 // for Debug // フォントファイルパスを構造体に保存 void AddFontx(FontxFile *fx, const char *path) { memset(fx, 0, sizeof(FontxFile)); fx->path = path; fx->opened = false; } // フォント構造体を初期化 void InitFontx(FontxFile *fxs, const char *f0, const char *f1) { AddFontx(&fxs[0], f0); AddFontx(&fxs[1], f1); } // フォントファイルをOPEN bool OpenFontx(FontxFile *fx) { FILE *f; if(!fx->opened){ if(FontxDebug)printf("[openFont]fx->path=[%s]\n",fx->path); f = fopen(fx->path, "r"); if(FontxDebug)printf("[openFont]fopen=%p\n",f); if (f == NULL) { fx->valid = false; printf("Fontx:%s not found.\n",fx->path); return fx->valid ; } fx->opened = true; fx->file = f; char buf[18]; if (fread(buf, 1, sizeof(buf), fx->file) != sizeof(buf)) { fx->valid = false; printf("Fontx:%s not FONTX format.\n",fx->path); fclose(fx->file); return fx->valid ; } if(FontxDebug) { for(int i=0;i<sizeof(buf);i++) { printf("buf[%d]=0x%x\n",i,buf[i]); } } memcpy(fx->fxname, &buf[6], 8); fx->w = buf[14]; fx->h = buf[15]; fx->is_ank = (buf[16] == 0); fx->bc = buf[17]; fx->fsz = (fx->w + 7)/8 * fx->h; if(fx->fsz > FontxGlyphBufSize){ printf("Fontx:%s is too big font size.\n",fx->path); fx->valid = false; fclose(fx->file); return fx->valid ; } fx->valid = true; } return fx->valid; } // フォントファイルをCLOSE void CloseFontx(FontxFile *fx) { if(fx->opened){ fclose(fx->file); fx->opened = false; } } // フォント構造体の表示 void DumpFontx(FontxFile *fxs) { for(int i=0;i<2;i++) { printf("fxs[%d]->path=%s\n",i,fxs[i].path); printf("fxs[%d]->opened=%d\n",i,fxs[i].opened); printf("fxs[%d]->fxname=%s\n",i,fxs[i].fxname); printf("fxs[%d]->valid=%d\n",i,fxs[i].valid); printf("fxs[%d]->is_ank=%d\n",i,fxs[i].is_ank); printf("fxs[%d]->w=%d\n",i,fxs[i].w); printf("fxs[%d]->h=%d\n",i,fxs[i].h); printf("fxs[%d]->fsz=%d\n",i,fxs[i].fsz); printf("fxs[%d]->bc=%d\n",i,fxs[i].bc); } } uint8_t getFortWidth(FontxFile *fx) { printf("fx->w=%d\n",fx->w); return(fx->w); } uint8_t getFortHeight(FontxFile *fx) { printf("fx->h=%d\n",fx->h); return(fx->h); } /* フォントファイルからフォントパターンを取り出す フォントの並び(16X16ドット) 00000000 01111111 12345678 90123456 01 pGlyph[000] pGlyph[001] 02 pGlyph[002] pGlyph[003] 03 pGlyph[004] pGlyph[005] 04 pGlyph[006] pGlyph[007] 05 pGlyph[008] pGlyph[009] 06 pGlyph[010] pGlyph[011] 07 pGlyph[012] pGlyph[013] 08 pGlyph[014] pGlyph[015] 09 pGlyph[016] pGlyph[017] 10 pGlyph[018] pGlyph[019] 11 pGlyph[020] pGlyph[021] 12 pGlyph[022] pGlyph[023] 13 pGlyph[024] pGlyph[025] 14 pGlyph[026] pGlyph[027] 15 pGlyph[028] pGlyph[029] 16 pGlyph[030] pGlyph[031] フォントの並び(24X24ドット) 00000000 01111111 11122222 12345678 90123456 78901234 01 pGlyph[000] pGlyph[001] pGlyph[002] 02 pGlyph[003] pGlyph[004] pGlyph[005] 03 pGlyph[006] pGlyph[007] pGlyph[008] 04 pGlyph[009] pGlyph[010] pGlyph[011] 05 pGlyph[012] pGlyph[013] pGlyph[014] 06 pGlyph[015] pGlyph[016] pGlyph[017] 07 pGlyph[018] pGlyph[019] pGlyph[020] 08 pGlyph[021] pGlyph[022] pGlyph[023] 09 pGlyph[024] pGlyph[025] pGlyph[026] 10 pGlyph[027] pGlyph[028] pGlyph[029] 11 pGlyph[030] pGlyph[031] pGlyph[032] 12 pGlyph[033] pGlyph[034] pGlyph[035] 13 pGlyph[036] pGlyph[037] pGlyph[038] 14 pGlyph[039] pGlyph[040] pGlyph[041] 15 pGlyph[042] pGlyph[043] pGlyph[044] 16 pGlyph[045] pGlyph[046] pGlyph[047] 17 pGlyph[048] pGlyph[049] pGlyph[050] 18 pGlyph[051] pGlyph[052] pGlyph[053] 19 pGlyph[054] pGlyph[055] pGlyph[056] 20 pGlyph[057] pGlyph[058] pGlyph[059] 21 pGlyph[060] pGlyph[061] pGlyph[062] 22 pGlyph[063] pGlyph[064] pGlyph[065] 23 pGlyph[066] pGlyph[067] pGlyph[068] 24 pGlyph[069] pGlyph[070] pGlyph[071] フォントの並び(32X32ドット) 00000000 01111111 11122222 22222333 12345678 90123456 78901234 56789012 01 pGlyph[000] pGlyph[001] pGlyph[002] pGlyph[003] 02 pGlyph[004] pGlyph[005] pGlyph[006] pGlyph[007] 03 pGlyph[008] pGlyph[009] pGlyph[010] pGlyph[011] 04 pGlyph[012] pGlyph[013] pGlyph[014] pGlyph[015] 05 pGlyph[016] pGlyph[017] pGlyph[018] pGlyph[019] 06 pGlyph[020] pGlyph[021] pGlyph[022] pGlyph[023] 07 pGlyph[024] pGlyph[025] pGlyph[026] pGlyph[027] 08 pGlyph[028] pGlyph[029] pGlyph[030] pGlyph[031] 09 pGlyph[032] pGlyph[033] pGlyph[034] pGlyph[035] 10 pGlyph[036] pGlyph[037] pGlyph[038] pGlyph[039] 11 pGlyph[040] pGlyph[041] pGlyph[042] pGlyph[043] 12 pGlyph[044] pGlyph[045] pGlyph[046] pGlyph[047] 13 pGlyph[048] pGlyph[049] pGlyph[050] pGlyph[051] 14 pGlyph[052] pGlyph[053] pGlyph[054] pGlyph[055] 15 pGlyph[056] pGlyph[057] pGlyph[058] pGlyph[059] 16 pGlyph[060] pGlyph[061] pGlyph[062] pGlyph[063] 17 pGlyph[064] pGlyph[065] pGlyph[066] pGlyph[067] 18 pGlyph[068] pGlyph[069] pGlyph[070] pGlyph[071] 19 pGlyph[072] pGlyph[073] pGlyph[074] pGlyph[075] 20 pGlyph[076] pGlyph[077] pGlyph[078] pGlyph[079] 21 pGlyph[080] pGlyph[081] pGlyph[082] pGlyph[083] 22 pGlyph[084] pGlyph[085] pGlyph[086] pGlyph[087] 23 pGlyph[088] pGlyph[089] pGlyph[090] pGlyph[091] 24 pGlyph[092] pGlyph[093] pGlyph[094] pGlyph[095] 25 pGlyph[096] pGlyph[097] pGlyph[098] pGlyph[099] 26 pGlyph[100] pGlyph[101] pGlyph[102] pGlyph[103] 27 pGlyph[104] pGlyph[105] pGlyph[106] pGlyph[107] 28 pGlyph[108] pGlyph[109] pGlyph[110] pGlyph[111] 29 pGlyph[112] pGlyph[113] pGlyph[114] pGlyph[115] 30 pGlyph[116] pGlyph[117] pGlyph[118] pGlyph[119] 31 pGlyph[120] pGlyph[121] pGlyph[122] pGlyph[123] 32 pGlyph[124] pGlyph[125] pGlyph[127] pGlyph[128] */ bool GetFontx(FontxFile *fxs, uint8_t ascii , uint8_t *pGlyph, uint8_t *pw, uint8_t *ph) { int i; uint32_t offset; if(FontxDebug)printf("[GetFontx]ascii=0x%x\n",ascii); for(i=0; i<2; i++){ //for(i=0; i<1; i++){ if(!OpenFontx(&fxs[i])) continue; if(FontxDebug)printf("[GetFontx]openFontxFile[%d] ok\n",i); //if(ascii < 0xFF){ if(fxs[i].is_ank){ if(FontxDebug)printf("[GetFontx]fxs.is_ank fxs.fsz=%d\n",fxs[i].fsz); offset = 17 + ascii * fxs[i].fsz; if(FontxDebug)printf("[GetFontx]offset=%"PRIu32"\n",offset); if(fseek(fxs[i].file, offset, SEEK_SET)) { printf("Fontx:seek(%"PRIu32") failed.\n",offset); return false; } if(fread(pGlyph, 1, fxs[i].fsz, fxs[i].file) != fxs[i].fsz) { printf("Fontx:fread failed.\n"); return false; } if(pw) *pw = fxs[i].w; if(ph) *ph = fxs[i].h; return true; } //} } return false; } /* フォントパターンをビットマップイメージに変換する fonts(16X16ドット) 00000000 01111111 12345678 90123456 01 pGlyph[000] pGlyph[001] 02 pGlyph[002] pGlyph[003] 03 pGlyph[004] pGlyph[005] 04 pGlyph[006] pGlyph[007] 05 pGlyph[008] pGlyph[009] 06 pGlyph[010] pGlyph[011] 07 pGlyph[012] pGlyph[013] 08 pGlyph[014] pGlyph[015] 09 pGlyph[016] pGlyph[017] 10 pGlyph[018] pGlyph[019] 11 pGlyph[020] pGlyph[021] 12 pGlyph[022] pGlyph[023] 13 pGlyph[024] pGlyph[025] 14 pGlyph[026] pGlyph[027] 15 pGlyph[028] pGlyph[029] 16 pGlyph[030] pGlyph[031] line[32*4] 01 line[000] line[001] line[002] .... line[014] line[015] line[016-031](Not use) | 07 line[000] line[001] line[002] .... line[014] line[015] line[016-031](Not use) 08 line[032] line[033] line[034] .... line[046] line[047] line[048-063](Not use) | 16 line[032] line[033] line[034] .... line[046] line[047] line[048-063](Not use) fonts(24X24ドット) 00000000 01111111 11122222 12345678 90123456 78901234 01 pGlyph[000] pGlyph[001] pGlyph[002] 02 pGlyph[003] pGlyph[004] pGlyph[005] 03 pGlyph[006] pGlyph[007] pGlyph[008] 04 pGlyph[009] pGlyph[010] pGlyph[011] 05 pGlyph[012] pGlyph[013] pGlyph[014] 06 pGlyph[015] pGlyph[016] pGlyph[017] 07 pGlyph[018] pGlyph[019] pGlyph[020] 08 pGlyph[021] pGlyph[022] pGlyph[023] 09 pGlyph[024] pGlyph[025] pGlyph[026] 10 pGlyph[027] pGlyph[028] pGlyph[029] 11 pGlyph[030] pGlyph[031] pGlyph[032] 12 pGlyph[033] pGlyph[034] pGlyph[035] 13 pGlyph[036] pGlyph[037] pGlyph[038] 14 pGlyph[039] pGlyph[040] pGlyph[041] 15 pGlyph[042] pGlyph[043] pGlyph[044] 16 pGlyph[045] pGlyph[046] pGlyph[047] 17 pGlyph[048] pGlyph[049] pGlyph[050] 18 pGlyph[051] pGlyph[052] pGlyph[053] 19 pGlyph[054] pGlyph[055] pGlyph[056] 20 pGlyph[057] pGlyph[058] pGlyph[059] 21 pGlyph[060] pGlyph[061] pGlyph[062] 22 pGlyph[063] pGlyph[064] pGlyph[065] 23 pGlyph[066] pGlyph[067] pGlyph[068] 24 pGlyph[069] pGlyph[070] pGlyph[071] line[32*4] 01 line[000] line[001] line[002] .... line[022] line[023] line[024-031](Not use) | 08 line[000] line[001] line[002] .... line[022] line[023] line[024-031](Not use) 09 line[032] line[033] line[034] .... line[054] line[055] line[056-063](Not use) | 16 line[032] line[033] line[034] .... line[054] line[055] line[056-063](Not use) 17 line[064] line[065] line[066] .... line[086] line[087] line[088-095](Not use) | 24 line[064] line[065] line[066] .... line[086] line[087] line[088-095](Not use) fonts(32X32ドット) 00000000 01111111 11122222 22222333 12345678 90123456 78901234 56789012 01 pGlyph[000] pGlyph[001] pGlyph[002] pGlyph[003] 02 pGlyph[004] pGlyph[005] pGlyph[006] pGlyph[007] 03 pGlyph[008] pGlyph[009] pGlyph[010] pGlyph[011] 04 pGlyph[012] pGlyph[013] pGlyph[014] pGlyph[015] 05 pGlyph[016] pGlyph[017] pGlyph[018] pGlyph[019] 06 pGlyph[020] pGlyph[021] pGlyph[022] pGlyph[023] 07 pGlyph[024] pGlyph[025] pGlyph[026] pGlyph[027] 08 pGlyph[028] pGlyph[029] pGlyph[030] pGlyph[031] 09 pGlyph[032] pGlyph[033] pGlyph[034] pGlyph[035] 10 pGlyph[036] pGlyph[037] pGlyph[038] pGlyph[039] 11 pGlyph[040] pGlyph[041] pGlyph[042] pGlyph[043] 12 pGlyph[044] pGlyph[045] pGlyph[046] pGlyph[047] 13 pGlyph[048] pGlyph[049] pGlyph[050] pGlyph[051] 14 pGlyph[052] pGlyph[053] pGlyph[054] pGlyph[055] 15 pGlyph[056] pGlyph[057] pGlyph[058] pGlyph[059] 16 pGlyph[060] pGlyph[061] pGlyph[062] pGlyph[063] 17 pGlyph[064] pGlyph[065] pGlyph[066] pGlyph[067] 18 pGlyph[068] pGlyph[069] pGlyph[070] pGlyph[071] 19 pGlyph[072] pGlyph[073] pGlyph[074] pGlyph[075] 20 pGlyph[076] pGlyph[077] pGlyph[078] pGlyph[079] 21 pGlyph[080] pGlyph[081] pGlyph[082] pGlyph[083] 22 pGlyph[084] pGlyph[085] pGlyph[086] pGlyph[087] 23 pGlyph[088] pGlyph[089] pGlyph[090] pGlyph[091] 24 pGlyph[092] pGlyph[093] pGlyph[094] pGlyph[095] 25 pGlyph[096] pGlyph[097] pGlyph[098] pGlyph[099] 26 pGlyph[100] pGlyph[101] pGlyph[102] pGlyph[103] 27 pGlyph[104] pGlyph[105] pGlyph[106] pGlyph[107] 28 pGlyph[108] pGlyph[109] pGlyph[110] pGlyph[111] 29 pGlyph[112] pGlyph[113] pGlyph[114] pGlyph[115] 30 pGlyph[116] pGlyph[117] pGlyph[118] pGlyph[119] 31 pGlyph[120] pGlyph[121] pGlyph[122] pGlyph[123] 32 pGlyph[124] pGlyph[125] pGlyph[127] pGlyph[128] line[32*4] 01 line[000] line[001] line[002] .... line[030] line[031] | 08 line[000] line[001] line[002] .... line[030] line[031] 09 line[032] line[033] line[034] .... line[062] line[063] | 16 line[032] line[033] line[034] .... line[062] line[063] 17 line[064] line[065] line[066] .... line[094] line[095] | 24 line[064] line[065] line[066] .... line[094] line[095] 25 line[096] line[097] line[098] .... line[126] line[127] | 32 line[096] line[097] line[098] .... line[126] line[127] */ void Font2Bitmap(uint8_t *fonts, uint8_t *line, uint8_t w, uint8_t h, uint8_t inverse) { int x,y; for(y=0; y<(h/8); y++){ for(x=0; x<w; x++){ line[y*32+x] = 0; } } int mask = 7; int fontp; fontp = 0; for(y=0; y<h; y++){ for(x=0; x<w; x++){ uint8_t d = fonts[fontp+x/8]; uint8_t linep = (y/8)*32+x; if (d & (0x80 >> (x % 8))) line[linep] = line[linep] + (1 << mask); } mask--; if (mask < 0) mask = 7; fontp += (w + 7)/8; } if (inverse) { for(y=0; y<(h/8); y++){ for(x=0; x<w; x++){ line[y*32+x] = RotateByte(line[y*32+x]); } } } } // アンダーラインを追加 void UnderlineBitmap(uint8_t *line, uint8_t w, uint8_t h) { int x,y; uint8_t wk; for(y=0; y<(h/8); y++){ for(x=0; x<w; x++){ wk = line[y*32+x]; if ( (y+1) == (h/8)) line[y*32+x] = wk + 0x80; } } } // ビットマップを反転 void ReversBitmap(uint8_t *line, uint8_t w, uint8_t h) { int x,y; uint8_t wk; for(y=0; y<(h/8); y++){ for(x=0; x<w; x++){ wk = line[y*32+x]; line[y*32+x] = ~wk; } } } // フォントパターンの表示 void ShowFont(uint8_t *fonts, uint8_t pw, uint8_t ph) { int x,y,fpos; printf("[ShowFont pw=%d ph=%d]\n",pw,ph); fpos=0; for (y=0;y<ph;y++) { printf("%02d",y); for (x=0;x<pw;x++) { if (fonts[fpos+x/8] & (0x80 >> (x % 8))) { printf("*"); } else { printf("."); } } printf("\n"); fpos=fpos+(pw+7)/8; } printf("\n"); } // Bitmapの表示 void ShowBitmap(uint8_t *bitmap, uint8_t pw, uint8_t ph) { int x,y,fpos; printf("[ShowBitmap pw=%d ph=%d]\n",pw,ph); #if 0 for (y=0;y<(ph+7)/8;y++) { for (x=0;x<pw;x++) { printf("%02x ",bitmap[x+y*32]); } printf("\n"); } #endif fpos=0; for (y=0;y<ph;y++) { printf("%02d",y); for (x=0;x<pw;x++) { //printf("b=%x m=%x\n",bitmap[x+(y/8)*32],0x80 >> fpos); if (bitmap[x+(y/8)*32] & (0x80 >> fpos)) { printf("*"); } else { printf("."); } } printf("\n"); fpos++; if (fpos > 7) fpos = 0; } printf("\n"); } // 8ビットデータを反転 uint8_t RotateByte(uint8_t ch1) { uint8_t ch2 = 0; int j; for (j=0;j<8;j++) { ch2 = (ch2 << 1) + (ch1 & 0x01); ch1 = ch1 >> 1; } return ch2; } #if 0 // UTF code(3Byte) を SJIS Code(2 Byte) に変換 // https://www.mgo-tec.com/blog-entry-utf8sjis01.html uint16_t UTF2SJIS(spiffs_file fd, uint8_t *utf8) { uint32_t offset = 0; uint32_t ret; uint32_t UTF8uint = utf8[0]*256*256 + utf8[1]*256 + utf8[2]; if(utf8[0]>=0xC2 && utf8[0]<=0xD1){ //0xB0からS_JISコード実データ。0x00-0xAFまではライセンス文ヘッダなのでそれをカット。 offset = ((utf8[0]*256 + utf8[1])-0xC2A2)*2 + 0xB0; //文字"¢" UTF8コード C2A2~、S_jisコード8191 }else if(utf8[0]==0xE2 && utf8[1]>=0x80){ offset = (UTF8uint-0xE28090)*2 + 0x1EEC; //文字"‐" UTF8コード E28090~、S_jisコード815D }else if(utf8[0]==0xE3 && utf8[1]>=0x80){ offset = (UTF8uint-0xE38080)*2 + 0x9DCC; //スペース UTF8コード E38080~、S_jisコード8140 }else if(utf8[0]==0xE4 && utf8[1]>=0x80){ offset = (UTF8uint-0xE4B880)*2 + 0x11CCC; //文字"一" UTF8コード E4B880~、S_jisコード88EA }else if(utf8[0]==0xE5 && utf8[1]>=0x80){ offset = (UTF8uint-0xE58085)*2 + 0x12BCC; //文字"倅" UTF8コード E58085~、S_jisコード98E4 }else if(utf8[0]==0xE6 && utf8[1]>=0x80){ offset = (UTF8uint-0xE6808E)*2 + 0x1AAC2; //文字"怎" UTF8コード E6808E~、S_jisコード9C83 }else if(utf8[0]==0xE7 && utf8[1]>=0x80){ offset = (UTF8uint-0xE78081)*2 + 0x229A6; //文字"瀁" UTF8コード E78081~、S_jisコードE066 }else if(utf8[0]==0xE8 && utf8[1]>=0x80){ offset = (UTF8uint-0xE88080)*2 + 0x2A8A4; //文字"耀" UTF8コード E88080~、S_jisコード9773 }else if(utf8[0]==0xE9 && utf8[1]>=0x80){ offset = (UTF8uint-0xE98080)*2 + 0x327A4; //文字"退" UTF8コード E98080~、S_jisコード91DE }else if(utf8[0]>=0xEF && utf8[1]>=0xBC){ offset = (UTF8uint-0xEFBC81)*2 + 0x3A6A4; //文字"!" UTF8コード EFBC81~、S_jisコード8149 if(utf8[0]==0xEF && utf8[1]==0xBD && utf8[2]==0x9E){ offset = 0x3A8DE; // "~" UTF8コード EFBD9E、S_jisコード8160 } } if(FontxDebug)printf("[UTF2SJIS] offset=%d\n",offset); char buf[2]; ret = SPIFFS_lseek(&fs, fd, offset, SPIFFS_SEEK_SET); if(FontxDebug)printf("[UTF2SJIS] lseek ret=%d\n",ret); if (ret != offset) { printf("UTF2SJIS:seek(%u) failed.\n",offset); return 0; } if (SPIFFS_read(&fs, fd, buf, sizeof(buf)) != sizeof(buf)) { printf("UTF2SJIS:read failed.\n"); return 0; } if(FontxDebug)printf("[UTF2SJIS] sjis=0x%x%x\n",buf[0],buf[1]); return buf[0]*256+buf[1]; } // UTFを含む文字列をSJISに変換 int String2SJIS(spiffs_file fd, unsigned char *str_in, size_t stlen, uint16_t *sjis, size_t ssize) { int i; uint8_t sp; uint8_t c1 = 0; uint8_t c2 = 0; uint8_t utf8[3]; uint16_t sjis2; int spos = 0; for(i=0;i<stlen;i++) { sp = str_in[i]; if(FontxDebug)printf("[String2SJIS]sp[%d]=%x\n",i,sp); if ((sp & 0xf0) == 0xe0) { // 上位4ビットが1110なら、3バイト文字の1バイト目 c1 = sp; } else if ((sp & 0xc0) == 0x80) { // 上位2ビットが10なら、他バイト文字の2バイト目以降 if (c2 == 0) { c2 = sp; } else { if (c1 == 0xef && c2 == 0xbd) { if(FontxDebug)printf("[String2SJIS]hankaku kana %x-%x-%x\n",c1,c2,sp); sjis2 = sp; if(FontxDebug)printf("[String2SJIS]sjis2=%x\n",sjis2); if (spos < ssize) sjis[spos++] = sjis2; } else if (c1 == 0xef && c2 == 0xbe) { if(FontxDebug)printf("[String2SJIS]hankaku kana %x-%x-%x\n",c1,c2,sp); sjis2 = 0xc0 + (sp - 0x80); if(FontxDebug)printf("[String2SJIS]sjis2=%x\n",sjis2); if (spos < ssize) sjis[spos++] = sjis2; } else { if(FontxDebug)printf("[String2SJIS]UTF8 %x-%x-%x\n",c1,c2,sp); utf8[0] = c1; utf8[1] = c2; utf8[2] = sp; sjis2 = UTF2SJIS(fd, utf8); if(FontxDebug)printf("[String2SJIS]sjis2=%x\n",sjis2); if (spos < ssize) sjis[spos++] = sjis2; } c1 = c2 = 0; } } else if ((sp & 0x80) == 0) { // 1バイト文字の場合 if(FontxDebug)printf("[String2SJIS]ANK %x\n",sp); if (spos < ssize) sjis[spos++] = sp; } } return spos; } #endif
3f0b52fe341b01ca707050b74994c27387b5f019
77861deda8b3046bdda221d3cb80b77e84b14523
/avx-piecewise/api.h
4ec6e35149b635333b961c6be54a71e21f273d74
[ "BSD-2-Clause" ]
permissive
WojciechMula/toys
b73f09212ca19f1e76bbf2afaa5ad2efcea95175
6110b59de45dc1ce44388b21c6437eff49a7655c
refs/heads/master
2023-08-18T12:54:25.919406
2023-08-05T09:20:14
2023-08-05T09:20:14
14,905,115
302
44
BSD-2-Clause
2020-04-17T17:10:42
2013-12-03T20:35:37
C++
UTF-8
C
false
false
108
h
api.h
float evaluate(float x, float* x_boudary, float* a, float* b);
9e65c2b33cb20b1a903f1852c191479e5ad057c9
60f27032d05f5977ae6a871a968022b674a6ddd1
/mettle/src/c2.h
d2e422116271c36a00602d758ac3443482df82b5
[ "BSD-3-Clause" ]
permissive
rapid7/mettle
bcd759a181fee81fa68c7cd15e0b84b71b2f0ff9
7274a2413952be0c612fcacf2eb1cc1119c2b840
refs/heads/master
2023-08-04T15:14:09.902863
2023-07-27T17:32:21
2023-07-27T17:32:21
31,543,393
411
137
null
2023-07-26T11:44:50
2015-03-02T14:14:41
C
UTF-8
C
false
false
1,857
h
c2.h
/** * @brief c2 transport manager * @file c2.h */ #ifndef _C2_H_ #define _C2_H_ #include <ev.h> #include "buffer_queue.h" struct c2; struct c2 * c2_new(struct ev_loop *loop); int c2_add_transport_uri(struct c2 *c2, const char *uri); int c2_start(struct c2 *c2); int c2_close(struct c2 *c2); void c2_free(struct c2 *c2); #define C2_REACHABLE 0x01 typedef void (*c2_data_cb)(struct c2 *c2, void *arg); typedef void (*c2_event_cb)(struct c2 *c2, int event, void *arg); void c2_set_cbs(struct c2 *be, c2_data_cb read_cb, c2_data_cb write_cb, c2_event_cb event_cb, void *cb_arg); ssize_t c2_read(struct c2 *c2, void *buf, size_t buflen); ssize_t c2_write(struct c2 *c2, void *buf, size_t buflen); struct buffer_queue* c2_ingress_queue(struct c2 *c2); struct buffer_queue* c2_egress_queue(struct c2 *c2); /* * Transport API */ struct c2_transport; struct c2_transport_cbs { int (*init)(struct c2_transport *t); void (*start)(struct c2_transport *t); void (*egress)(struct c2_transport *t, struct buffer_queue *egress); void (*stop)(struct c2_transport *t); void (*free)(struct c2_transport *t); }; int c2_register_transport_type(struct c2 *c2, const char *proto, struct c2_transport_cbs *cbs); struct c2_transport* c2_get_current_transport(struct c2 *c2); const char * c2_transport_uri(struct c2_transport *t); const char * c2_transport_dest(struct c2_transport *t); struct ev_loop * c2_transport_loop(struct c2_transport *loop); void * c2_transport_get_ctx(struct c2_transport *t); void c2_transport_set_ctx(struct c2_transport *t, void *ctx); void c2_transport_reachable(struct c2_transport *t); void c2_transport_unreachable(struct c2_transport *t); void c2_transport_ingress_buf(struct c2_transport *t, void *buf, size_t buflen); void c2_transport_ingress_queue(struct c2_transport *t, struct buffer_queue *src); #endif
a515cbf574fd3c09da9c9f99c91d3c9ce65a271f
25146d3cc79fd1fbb6578d2c64249fdbd6bfac65
/certfields/all-fields/main.c
f8324e9754ac61ec43f97c2973fc42ef26586c20
[]
no_license
wolfSSL/wolfssl-examples
5bb55c47be03bf55dfa1552f6b391557b6b31d90
7d373b14fe9a4283f9d70818fafab8b5ff863de1
refs/heads/master
2023-08-17T07:09:39.061991
2023-08-15T15:13:27
2023-08-15T15:13:27
21,290,295
237
191
null
2023-09-12T22:57:33
2014-06-27T21:50:12
C
UTF-8
C
false
false
6,548
c
main.c
/* main.c * * Copyright (C) 2006-2020 wolfSSL Inc. * * This file is part of wolfSSL. * * wolfSSL is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * wolfSSL is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ /* * Example of parsing a DER-encoded certificate and extracting * public key and subject name information. * */ #include <stdio.h> #include <wolfssl/options.h> #include <wolfssl/ssl.h> #include <wolfssl/wolfcrypt/rsa.h> #include <wolfssl/wolfcrypt/asn.h> #include <wolfssl/openssl/x509v3.h> #ifdef OPENSSL_EXTRA enum { RSA_KEY_TYPE = 2, ECC_KEY_TYPE = 3, }; static void err_sys(const char* msg, int ret) { if (ret) { printf("ERROR: %s, ret = %d\n", msg, ret); } else { printf("ERROR: %s\n", msg); } exit(EXIT_FAILURE); } #endif int main(int argc, char** argv) { int ret, i; #ifdef OPENSSL_EXTRA int sigType; int nameSz; int derCertSz; byte derCert[4096]; word32 idx; FILE* file; char* certFile; int keyType; RsaKey pubKeyRsa; ecc_key pubKeyEcc; WOLFSSL_X509* cert; WOLFSSL_EVP_PKEY* pubKeyTmp; WOLFSSL_X509_NAME* name; char commonName[80]; char countryName[80]; char localityName[80]; char stateName[80]; char orgName[80]; char orgUnit[80]; STACK_OF(GENERAL_NAME)* sk; /* ------ PARSE ORIGINAL SELF-SIGNED CERTIFICATE ------ */ if (argc < 3) { printf("USAGE:\n" "./app derCert keyType\n" "EXAMPLE(s):\n" " ./app myCert.der RSA\n" " ./app myCert.der ECC\n"); err_sys("invalid input", -1); } certFile = argv[1]; /* certFile to check */ keyType = (XMEMCMP(argv[2], "RSA", 3) == 0) ? RSA_KEY_TYPE : (XMEMCMP(argv[2], "ECC", 3) == 0) ? ECC_KEY_TYPE : 0; /* key */ if (keyType == 0) err_sys("unsupported keyType", -1); /* open and read DER-formatted cert into buffer */ file = fopen(certFile, "rb"); if (!file) err_sys("can't open client certificate", 0); derCertSz = fread(derCert, 1, sizeof(derCert), file); fclose(file); /* convert cert from DER to internal WOLFSSL_X509 struct */ cert = wolfSSL_X509_d2i(&cert, derCert, derCertSz); if (cert == NULL) err_sys("Failed to convert DER to WOLFSSL_X509", 0); /* ------ EXTRACT CERTIFICATE ELEMENTS ------ */ /* extract PUBLIC KEY from cert */ pubKeyTmp = wolfSSL_X509_get_pubkey(cert); if (pubKeyTmp == NULL) err_sys("wolfSSL_X509_get_pubkey failed", 0); /* always initialize both key structs since both are free'd at the end */ ret = wc_InitRsaKey(&pubKeyRsa, NULL); ret |= wc_ecc_init(&pubKeyEcc); if (ret != 0) err_sys("init key failed", ret); idx = 0; if (keyType == RSA_KEY_TYPE) { ret = wc_RsaPublicKeyDecode((byte*)pubKeyTmp->pkey.ptr, &idx, &pubKeyRsa, pubKeyTmp->pkey_sz); } else { ret = wc_EccPublicKeyDecode((byte*)pubKeyTmp->pkey.ptr, &idx, &pubKeyEcc, pubKeyTmp->pkey_sz); } if (ret != 0) err_sys("wc_RsaPublicKeyDecode failed", ret); printf("PUBLIC KEY:\n"); for (i = 0; i < pubKeyTmp->pkey_sz; i++) { printf("%02X", pubKeyTmp->pkey.ptr[i] & 0xFF); } printf("\n"); /* extract signatureType */ sigType = wolfSSL_X509_get_signature_type(cert); if (sigType == 0) err_sys("wolfSSL_X509_get_signature_type failed", 0); printf("SIG TYPE = %d\n", sigType); /* extract subjectName info */ name = wolfSSL_X509_get_subject_name(cert); if (name == NULL) err_sys("wolfSSL_X509_get_subject_name failed", 0); nameSz = wolfSSL_X509_NAME_get_text_by_NID(name, NID_commonName, commonName, sizeof(commonName)); printf("CN = %s (%d)\n", commonName, nameSz); nameSz = wolfSSL_X509_NAME_get_text_by_NID(name, NID_countryName, countryName, sizeof(countryName)); printf("COUNTRY = %s (%d)\n", countryName, nameSz); nameSz = wolfSSL_X509_NAME_get_text_by_NID(name, NID_localityName, localityName, sizeof(localityName)); printf("LOCALITY = %s (%d)\n", localityName, nameSz); nameSz = wolfSSL_X509_NAME_get_text_by_NID(name, NID_stateOrProvinceName, stateName, sizeof(stateName)); printf("STATE = %s (%d)\n", stateName, nameSz); nameSz = wolfSSL_X509_NAME_get_text_by_NID(name, NID_organizationName, orgName, sizeof(orgName)); printf("ORG = %s (%d)\n", orgName, nameSz); nameSz = wolfSSL_X509_NAME_get_text_by_NID(name, NID_organizationalUnitName, orgUnit, sizeof(orgUnit)); printf("ORG UNIT = %s (%d)\n", orgUnit, nameSz); sk = X509_get_ext_d2i(cert, NID_subject_alt_name, NULL, NULL); for (i = 0; i < sk_GENERAL_NAME_num(sk); i++) { GENERAL_NAME* gn = sk_GENERAL_NAME_value(sk, i); if (gn->type == GEN_DNS) { printf("DNS:%s\n", gn->d.dNSName->strData); } else if (gn->type == GEN_IPADD) { printf("IP:"); int j; for (j = 0; j < gn->d.ip->length; j++) { if (j < gn->d.ip->length - 1) printf("%u.", (uint8_t)gn->d.ip->strData[j]); else printf("%u", (uint8_t)gn->d.ip->strData[j]); } printf("\n"); } else { printf("Other type: %d\n", gn->type); } } wolfSSL_EVP_PKEY_free(pubKeyTmp); wolfSSL_X509_free(cert); wc_FreeRsaKey(&pubKeyRsa); wc_ecc_free(&pubKeyEcc); #else (void) i; printf("Please configure wolfSSL with --enable-opensslextra\n"); ret = -1; #endif return ret; }
204b36a7e4ea8d7b0cb2cb26236a1cff0acf9b66
9de0cec678bc4a3bec2b4adabef9f39ff5b4afac
/PWGHF/treeHF/PWGHFtreeHFLinkDef.h
0189234dff628977bc72f63df09f7c7391cbcbc1
[]
permissive
alisw/AliPhysics
91bf1bd01ab2af656a25ff10b25e618a63667d3e
5df28b2b415e78e81273b0d9bf5c1b99feda3348
refs/heads/master
2023-08-31T20:41:44.927176
2023-08-31T14:51:12
2023-08-31T14:51:12
61,661,378
129
1,150
BSD-3-Clause
2023-09-14T18:48:45
2016-06-21T19:31:29
C++
UTF-8
C
false
false
1,013
h
PWGHFtreeHFLinkDef.h
#ifdef __CINT__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ class AliAnalysisTaskSEHFTreeCreator+; #pragma link C++ class AliHFJet+; #pragma link C++ class AliHFTreeHandler+; #pragma link C++ class AliHFTreeHandlerD0toKpi+; #pragma link C++ class AliHFTreeHandlerDplustoKpipi+; #pragma link C++ class AliHFTreeHandlerDstoKKpi+; #pragma link C++ class AliHFTreeHandlerBplustoD0pi+; #pragma link C++ class AliHFTreeHandlerBstoDspi+; #pragma link C++ class AliHFTreeHandlerLctopKpi+; #pragma link C++ class AliHFTreeHandlerDstartoKpipi+; #pragma link C++ class AliHFTreeHandlerLc2V0bachelor+; #pragma link C++ class AliHFTreeHandlerLbtoLcpi+; #pragma link C++ class AliJetTreeHandler+; #pragma link C++ class AliHFTreeHandlerInclusiveJet+; #pragma link C++ class AliParticleTreeHandler+; #pragma link C++ class AliTrackletTreeHandler+; #ifdef HAVE_FASTJET #pragma link C++ class AliHFJetFinder+; #endif #endif
6afd77a5fb8866c140cdd87e06a782476fe3bfcb
028173f576b5f2364b800bbfca3dc6be8a238bc3
/include/asio2/bho/predef/platform.h
6389df4b6929858634662dcdef6047032bde1dde
[ "ICU", "BSL-1.0" ]
permissive
zhllxt/asio2
ca6f98b0c599ebb3eeb13cd79ddb9db6e8ca3666
ac8c79964d79020091e38fcbb4ae9dccccb3b03c
refs/heads/main
2023-09-02T18:56:45.036564
2023-05-09T04:57:23
2023-05-09T04:57:23
108,554,985
636
166
BSL-1.0
2023-04-10T09:27:16
2017-10-27T14:17:35
C++
UTF-8
C
false
false
1,052
h
platform.h
/* Copyright Rene Rivera 2013-2015 Copyright (c) Microsoft Corporation 2014 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ #if !defined(BHO_PREDEF_PLATFORM_H) || defined(BHO_PREDEF_INTERNAL_GENERATE_TESTS) #ifndef BHO_PREDEF_PLATFORM_H #define BHO_PREDEF_PLATFORM_H #endif #include <asio2/bho/predef/platform/android.h> #include <asio2/bho/predef/platform/cloudabi.h> #include <asio2/bho/predef/platform/mingw.h> #include <asio2/bho/predef/platform/mingw32.h> #include <asio2/bho/predef/platform/mingw64.h> #include <asio2/bho/predef/platform/windows_uwp.h> #include <asio2/bho/predef/platform/windows_desktop.h> #include <asio2/bho/predef/platform/windows_phone.h> #include <asio2/bho/predef/platform/windows_server.h> #include <asio2/bho/predef/platform/windows_store.h> #include <asio2/bho/predef/platform/windows_system.h> #include <asio2/bho/predef/platform/windows_runtime.h> // deprecated #include <asio2/bho/predef/platform/ios.h> #endif
f4e064b939d05a070d57a9aed0a3a0375e8ee7f3
0744dcc5394cebf57ebcba343747af6871b67017
/framework/src/media/codec/mp3/pvmp3_audio_type_defs.h
cf1edee87316fb34c33f697fcf8e2b33e60e743c
[ "Apache-2.0" ]
permissive
Samsung/TizenRT
96abf62f1853f61fcf91ff14671a5e0c6ca48fdb
1a5c2e00a4b1bbf4c505bbf5cc6a8259e926f686
refs/heads/master
2023-08-31T08:59:33.327998
2023-08-08T06:09:20
2023-08-31T04:38:20
82,517,252
590
719
Apache-2.0
2023-09-14T06:54:49
2017-02-20T04:38:30
C
UTF-8
C
false
false
2,843
h
pvmp3_audio_type_defs.h
/****************************************************************** * * Copyright 2018 Samsung Electronics All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ******************************************************************/ /* ------------------------------------------------------------------ * Copyright (C) 1998-2009 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. * See the License for the specific language governing permissions * and limitations under the License. * ------------------------------------------------------------------- */ /* ------------------------------------------------------------------------------ PacketVideo Corp. MP3 Decoder Library Filename: pvmp3_audio_type_defs.h Date: 09/21/2007 ------------------------------------------------------------------------------ REVISION HISTORY Description: ------------------------------------------------------------------------------ INCLUDE DESCRIPTION This file was derived from a number of standards bodies. The type definitions below were created from some of the best practices observed in the standards bodies. This file is dependent on limits.h for defining the bit widths. In an ANSI C environment limits.h is expected to always be present and contain the following definitions: SCHAR_MIN SCHAR_MAX UCHAR_MAX INT_MAX INT_MIN UINT_MAX SHRT_MIN SHRT_MAX USHRT_MAX LONG_MIN LONG_MAX ULONG_MAX ------------------------------------------------------------------------------ */ #ifndef PVMP3_AUDIO_TYPE_DEFS_H #define PVMP3_AUDIO_TYPE_DEFS_H #include <stdint.h> typedef int8_t int8; typedef uint8_t uint8; typedef int16_t int16; typedef uint16_t uint16; typedef int32_t int32; typedef uint32_t uint32; typedef int64_t int64; typedef uint64_t uint64; typedef int32_t Int32; #endif /* PVMP3_AUDIO_TYPE_DEFS_H */
865ff4db6ff1c290049738184c4665aeee407e23
dfb9c45447721431326cc16bb7655cca7b20eeb9
/src/elem/XCheckbox.h
7b797ce0c74805806a3b0b13b662e29c7da72c67
[ "LicenseRef-scancode-proprietary-license", "MIT" ]
permissive
ImpulseAdventure/GUIslice
6257ec4b2a02205b7c1ba00b8795e573609fb1bf
e002baae1ac7cd6c504a26aea78dd81fdc21fcb7
refs/heads/master
2023-08-04T20:51:27.740337
2022-04-09T16:23:57
2022-04-09T16:23:57
69,373,650
993
216
MIT
2022-04-09T16:30:29
2016-09-27T15:55:00
C
UTF-8
C
false
false
13,141
h
XCheckbox.h
#ifndef _GUISLICE_EX_XCHECKBOX_H_ #define _GUISLICE_EX_XCHECKBOX_H_ #include "GUIslice.h" // ======================================================================= // GUIslice library extension: Checkbox/Radio button control // - Calvin Hass // - https://www.impulseadventure.com/elec/guislice-gui.html // - https://github.com/ImpulseAdventure/GUIslice // ======================================================================= // // The MIT License // // Copyright 2016-2020 Calvin Hass // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // ======================================================================= /// \file XCheckbox.h #ifdef __cplusplus extern "C" { #endif // __cplusplus // ============================================================================ // Extended Element: Checkbox // ============================================================================ // Define unique identifier for extended element type // - Select any number above GSLC_TYPE_BASE_EXTEND #define GSLC_TYPEX_CHECKBOX GSLC_TYPE_BASE_EXTEND + 1 /// Checkbox drawing style typedef enum { GSLCX_CHECKBOX_STYLE_BOX, ///< Inner box GSLCX_CHECKBOX_STYLE_X, ///< Crossed GSLCX_CHECKBOX_STYLE_ROUND, ///< Circular } gslc_teXCheckboxStyle; /// Callback function for checkbox/radio element state change /// - nSelId: Selected element's ID or GSLC_ID_NONE /// - bChecked: Element was selected if true, false otherwise typedef bool (*GSLC_CB_XCHECKBOX)(void* pvGui,void* pvElemRef,int16_t nSelId, bool bChecked); // Extended element data structures // - These data structures are maintained in the gslc_tsElem // structure via the pXData pointer /// Extended data for Checkbox element typedef struct { bool bRadio; ///< Radio-button operation if true gslc_teXCheckboxStyle nStyle; ///< Drawing style for element bool bChecked; ///< Indicates if it is selected (checked) gslc_tsColor colCheck; ///< Color of checked inner fill GSLC_CB_XCHECKBOX pfuncXToggle; ///< Callback event to say element has changed } gslc_tsXCheckbox; /// /// Create a Checkbox or Radio button Element /// /// \param[in] pGui: Pointer to GUI /// \param[in] nElemId: Element ID to assign (0..16383 or GSLC_ID_AUTO to autogen) /// \param[in] nPage: Page ID to attach element to /// \param[in] pXData: Ptr to extended element data structure /// \param[in] rElem: Rectangle coordinates defining checkbox size /// \param[in] bRadio: Radio-button functionality if true /// \param[in] nStyle: Drawing style for checkbox / radio button /// \param[in] colCheck: Color for inner fill when checked /// \param[in] bChecked: Default state /// /// \return Pointer to Element reference or NULL if failure /// gslc_tsElemRef* gslc_ElemXCheckboxCreate(gslc_tsGui* pGui,int16_t nElemId,int16_t nPage, gslc_tsXCheckbox* pXData,gslc_tsRect rElem,bool bRadio, gslc_teXCheckboxStyle nStyle,gslc_tsColor colCheck,bool bChecked); /// /// Get a Checkbox element's current state /// /// \param[in] pGui: Pointer to GUI /// \param[in] pElemRef: Pointer to Element reference /// /// \return Current state /// bool gslc_ElemXCheckboxGetState(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef); /// /// Set a Checkbox element's current state /// /// \param[in] pGui: Pointer to GUI /// \param[in] pElemRef: Pointer to Element reference /// \param[in] bChecked: New state /// /// \return none /// void gslc_ElemXCheckboxSetState(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,bool bChecked); /// /// Find the checkbox within a group that has been checked /// /// \param[in] pGui: Pointer to GUI /// \param[in] nGroupId: Group ID to search /// /// \return Element Ptr or NULL if none checked /// gslc_tsElemRef* gslc_ElemXCheckboxFindChecked(gslc_tsGui* pGui,int16_t nGroupId); /// /// Toggle a Checkbox element's current state /// /// \param[in] pGui: Pointer to GUI /// \param[in] pElemRef: Pointer to Element reference /// /// \return none /// void gslc_ElemXCheckboxToggleState(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef); /// /// Assign the state callback function for a checkbox/radio button /// /// \param[in] pGui: Pointer to GUI /// \param[in] pElemRef: Pointer to Element reference /// \param[in] pfuncCb: Function pointer to callback routine (or NULL for none) /// /// \return none /// void gslc_ElemXCheckboxSetStateFunc(gslc_tsGui* pGui, gslc_tsElemRef* pElemRef, GSLC_CB_XCHECKBOX pfuncCb); /// /// Draw a Checkbox element on the screen /// - Called from gslc_ElemDraw() /// /// \param[in] pvGui: Void ptr to GUI (typecast to gslc_tsGui*) /// \param[in] pvElemRef: Void ptr to Element reference (typecast to gslc_tsElemRef*) /// \param[in] eRedraw: Redraw mode /// /// \return true if success, false otherwise /// bool gslc_ElemXCheckboxDraw(void* pvGui,void* pvElemRef,gslc_teRedrawType eRedraw); /// /// Handle touch events to Checkbox element /// - Called from gslc_ElemSendEventTouch() /// /// \param[in] pvGui: Void ptr to GUI (typecast to gslc_tsGui*) /// \param[in] pvElemRef: Void ptr to Element reference (typecast to gslc_tsElemRef*) /// \param[in] eTouch: Touch event type /// \param[in] nRelX: Touch X coord relative to element /// \param[in] nRelY: Touch Y coord relative to element /// /// \return true if success, false otherwise /// bool gslc_ElemXCheckboxTouch(void* pvGui,void* pvElemRef,gslc_teTouch eTouch,int16_t nRelX,int16_t nRelY); // ============================================================================ // ------------------------------------------------------------------------ // Read-only element macros // ------------------------------------------------------------------------ // Macro initializers for Read-Only Elements in Flash/PROGMEM // /// \def gslc_ElemXCheckboxCreate_P(pGui,nElemId,nPage,nX,nY,nW,nH,nGroup,bRadio_,nStyle_,colCheck_,bChecked_) /// /// Create a Checkbox or Radio button Element in Flash /// /// \param[in] pGui: Pointer to GUI /// \param[in] nElemId: Unique element ID to assign /// \param[in] nPage: Page ID to attach element to /// \param[in] nX: X coordinate of element /// \param[in] nY: Y coordinate of element /// \param[in] nW: Width of element /// \param[in] nH: Height of element /// \param[in] colFill: Color for the control background fill /// \param[in] bFillEn: True if background filled, false otherwise (recommend True) /// \param[in] nGroup: Group ID that radio buttons belong to (else GSLC_GROUP_NONE) /// \param[in] bRadio_: Radio-button functionality if true /// \param[in] nStyle_: Drawing style for checkbox / radio button /// \param[in] colCheck_: Color for inner fill when checked /// \param[in] bChecked_: Default state /// /// \return none /// #if (GSLC_USE_PROGMEM) #define gslc_ElemXCheckboxCreate_P(pGui,nElemId,nPage,nX,nY,nW,nH,colFill,bFillEn,nGroup,bRadio_,nStyle_,colCheck_,bChecked_) \ static const uint16_t nFeatures##nElemId = GSLC_ELEM_FEA_VALID | \ GSLC_ELEM_FEA_GLOW_EN | GSLC_ELEM_FEA_CLICK_EN | (bFillEn?GSLC_ELEM_FEA_FILL_EN:0); \ static gslc_tsXCheckbox sCheckbox##nElemId; \ sCheckbox##nElemId.bRadio = bRadio_; \ sCheckbox##nElemId.bChecked = bChecked_; \ sCheckbox##nElemId.colCheck = colCheck_; \ sCheckbox##nElemId.nStyle = nStyle_; \ static const gslc_tsElem sElem##nElemId PROGMEM = { \ nElemId, \ nFeatures##nElemId, \ GSLC_TYPEX_CHECKBOX, \ (gslc_tsRect){nX,nY,nW,nH}, \ nGroup, \ GSLC_COL_GRAY,colFill,GSLC_COL_WHITE,GSLC_COL_BLACK, \ (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \ (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \ NULL, \ NULL, \ 0, \ (gslc_teTxtFlags)(GSLC_TXT_DEFAULT), \ GSLC_COL_WHITE, \ GSLC_COL_WHITE, \ GSLC_ALIGN_MID_MID, \ 0, \ 0, \ NULL, \ (void*)(&sCheckbox##nElemId), \ NULL, \ &gslc_ElemXCheckboxDraw, \ &gslc_ElemXCheckboxTouch, \ NULL, \ }; \ gslc_ElemAdd(pGui,nPage,(gslc_tsElem*)&sElem##nElemId, \ (gslc_teElemRefFlags)(GSLC_ELEMREF_SRC_PROG | GSLC_ELEMREF_VISIBLE | GSLC_ELEMREF_REDRAW_FULL)); #else #define gslc_ElemXCheckboxCreate_P(pGui,nElemId,nPage,nX,nY,nW,nH,colFill,bFillEn,nGroup,bRadio_,nStyle_,colCheck_,bChecked_) \ static const uint16_t nFeatures##nElemId = GSLC_ELEM_FEA_VALID | \ GSLC_ELEM_FEA_GLOW_EN | GSLC_ELEM_FEA_CLICK_EN | (bFillEn?GSLC_ELEM_FEA_FILL_EN:0); \ static gslc_tsXCheckbox sCheckbox##nElemId; \ sCheckbox##nElemId.bRadio = bRadio_; \ sCheckbox##nElemId.bChecked = bChecked_; \ sCheckbox##nElemId.colCheck = colCheck_; \ sCheckbox##nElemId.nStyle = nStyle_; \ static const gslc_tsElem sElem##nElemId = { \ nElemId, \ nFeatures##nElemId, \ GSLC_TYPEX_CHECKBOX, \ (gslc_tsRect){nX,nY,nW,nH}, \ nGroup, \ GSLC_COL_GRAY,colFill,GSLC_COL_WHITE,GSLC_COL_BLACK, \ (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \ (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \ NULL, \ NULL, \ 0, \ (gslc_teTxtFlags)(GSLC_TXT_DEFAULT), \ GSLC_COL_WHITE, \ GSLC_COL_WHITE, \ GSLC_ALIGN_MID_MID, \ 0, \ 0, \ NULL, \ (void*)(&sCheckbox##nElemId), \ NULL, \ &gslc_ElemXCheckboxDraw, \ &gslc_ElemXCheckboxTouch, \ NULL, \ }; \ gslc_ElemAdd(pGui,nPage,(gslc_tsElem*)&sElem##nElemId, \ (gslc_teElemRefFlags)(GSLC_ELEMREF_SRC_CONST | GSLC_ELEMREF_VISIBLE | GSLC_ELEMREF_REDRAW_FULL)); #endif #ifdef __cplusplus } #endif // __cplusplus #endif // _GUISLICE_EX_XCHECKBOX_H_
97e7186d928f738e2c04d6c26250e3388b8e88dc
54a60696114ae0fc8233baf0111f3b0cf72be5b9
/inform6/Inform6/files.c
773b29bb1328ff095638e55efbc31f3526a9ab5e
[ "LicenseRef-scancode-warranty-disclaimer", "Artistic-2.0", "Glulxe", "LicenseRef-scancode-free-unknown" ]
permissive
ganelson/inform
de89a3df0fa5b40660707a7c66853cf5b066b1c9
56be55c4879b133a37fcd55fcd2452868a881551
refs/heads/master
2023-09-01T01:08:43.133920
2023-08-31T23:06:22
2023-08-31T23:06:22
169,170,146
1,130
63
Artistic-2.0
2023-09-12T09:56:18
2019-02-05T00:18:15
C
UTF-8
C
false
false
60,709
c
files.c
/* ------------------------------------------------------------------------- */ /* "files" : File handling for source code, the transcript file and the */ /* debugging information file; file handling and splicing of */ /* the output file. */ /* */ /* Note that filenaming conventions are left to the top-level */ /* routines in "inform.c", since they are tied up with ICL */ /* settings and are very host OS-dependent. */ /* */ /* Part of Inform 6.41 */ /* copyright (c) Graham Nelson 1993 - 2022 */ /* */ /* ------------------------------------------------------------------------- */ #include "header.h" int total_files; /* Number of files so far, including #include and #origsource files */ int total_input_files; /* Number of source files so far (excludes #origsource) */ int current_input_file; /* Most recently-opened source file */ static int current_origsource_file; /* Most recently-used #origsource */ int32 total_chars_read; /* Characters read in (from all source files put together) */ static int checksum_low_byte, /* For calculating the Z-machine's */ checksum_high_byte; /* "verify" checksum */ static int32 checksum_long; /* For the Glulx checksum, */ static int checksum_count; /* similarly */ /* ------------------------------------------------------------------------- */ /* Most of the information about source files is kept by "lexer.c"; this */ /* level is only concerned with file names and handles. */ /* ------------------------------------------------------------------------- */ FileId *InputFiles=NULL; /* Ids for all the source files Allocated to total_files */ static memory_list InputFiles_memlist; /* ------------------------------------------------------------------------- */ /* When emitting debug information, we won't have addresses of routines, */ /* sequence points, Glulx objects (addresses of Z-machine objects aren't */ /* needed), globals, arrays, or grammar lines. We only have their */ /* offsets from base addresses, which won't be known until the end of */ /* compilation. Since everything else in the relevant debug records is */ /* known much earlier and is less convenient to store up, we emit the */ /* debug records with a placeholder value and then backpatch these */ /* placeholders. The following structs each store either an offset or a */ /* symbol index and the point in the debug information file where the */ /* corresponding address should be written once the base address is known. */ /* ------------------------------------------------------------------------- */ #define INITIAL_DEBUG_INFORMATION_BACKPATCH_ALLOCATION 65536 typedef struct value_and_backpatch_position_struct { int32 value; fpos_t backpatch_position; } value_and_backpatch_position; typedef struct debug_backpatch_accumulator_struct { int32 number_of_values_to_backpatch; int32 number_of_available_backpatches; value_and_backpatch_position *values_and_backpatch_positions; int32 (* backpatching_function)(int32); } debug_backpatch_accumulator; static debug_backpatch_accumulator object_backpatch_accumulator; static debug_backpatch_accumulator packed_code_backpatch_accumulator; static debug_backpatch_accumulator code_backpatch_accumulator; static debug_backpatch_accumulator global_backpatch_accumulator; static debug_backpatch_accumulator array_backpatch_accumulator; static debug_backpatch_accumulator grammar_backpatch_accumulator; /* ------------------------------------------------------------------------- */ /* Opening and closing source code files */ /* ------------------------------------------------------------------------- */ #if defined(PC_WIN32) && defined(HAS_REALPATH) #include <windows.h> char *realpath(const char *path, char *resolved_path) { return GetFullPathNameA(path,PATHLEN,resolved_path,NULL) != 0 ? resolved_path : 0; } #endif extern void load_sourcefile(char *filename_given, int same_directory_flag) { /* Meaning: open a new file of Inform source. (The lexer picks up on this by noticing that input_file has increased.) */ char name[PATHLEN]; #ifdef HAS_REALPATH char absolute_name[PATHLEN]; #endif int x = 0; FILE *handle; ensure_memory_list_available(&InputFiles_memlist, total_files+1); do { x = translate_in_filename(x, name, filename_given, same_directory_flag, (total_files==0)?1:0); handle = fopen(name,"r"); } while ((handle == NULL) && (x != 0)); InputFiles[total_files].filename = my_malloc(strlen(name)+1, "filename storage"); strcpy(InputFiles[total_files].filename, name); if (debugfile_switch) { debug_file_printf("<source index=\"%d\">", total_files); debug_file_printf("<given-path>"); debug_file_print_with_entities(filename_given); debug_file_printf("</given-path>"); #ifdef HAS_REALPATH if (realpath(name, absolute_name)) { debug_file_printf("<resolved-path>"); debug_file_print_with_entities(absolute_name); debug_file_printf("</resolved-path>"); } #endif debug_file_printf("<language>Inform 6</language>"); debug_file_printf("</source>"); } InputFiles[total_files].handle = handle; if (InputFiles[total_files].handle==NULL) fatalerror_named("Couldn't open source file", name); InputFiles[total_files].is_input = TRUE; InputFiles[total_files].initial_buffering = TRUE; if (files_trace_setting > 0) printf("Opening file \"%s\"\n",name); total_files++; total_input_files++; current_input_file = total_files; } static void close_sourcefile(int file_number) { if (InputFiles[file_number-1].handle == NULL) return; /* Close this file. But keep the InputFiles entry around, including its filename. */ if (ferror(InputFiles[file_number-1].handle)) fatalerror_named("I/O failure: couldn't read from source file", InputFiles[file_number-1].filename); fclose(InputFiles[file_number-1].handle); InputFiles[file_number-1].handle = NULL; if (files_trace_setting > 0) { char *str = (InputFiles[file_number-1].initial_buffering ? " (in initial buffering)" : ""); printf("Closing file \"%s\"%s\n", InputFiles[file_number-1].filename, str); } } extern void close_all_source(void) { int i; for (i=0; i<total_files; i++) close_sourcefile(i+1); } /* ------------------------------------------------------------------------- */ /* Register an #origsource filename. This goes in the InputFiles table, */ /* but we do not open the file or advance current_input_file. */ /* ------------------------------------------------------------------------- */ extern int register_orig_sourcefile(char *filename) { int ix; char *name; /* If the filename has already been used as an origsource filename, return that entry. We check the most-recently-used file first, and then search the list. */ if (current_origsource_file > 0 && current_origsource_file <= total_files) { if (!strcmp(filename, InputFiles[current_origsource_file-1].filename)) return current_origsource_file; } for (ix=0; ix<total_files; ix++) { if (InputFiles[ix].is_input) continue; if (!strcmp(filename, InputFiles[ix].filename)) { current_origsource_file = ix+1; return current_origsource_file; } } /* This filename has never been used before. Allocate a new InputFiles entry. */ name = filename; /* no translation */ ensure_memory_list_available(&InputFiles_memlist, total_files+1); InputFiles[total_files].filename = my_malloc(strlen(name)+1, "filename storage"); strcpy(InputFiles[total_files].filename, name); if (debugfile_switch) { debug_file_printf("<source index=\"%d\">", total_files); debug_file_printf("<given-path>"); debug_file_print_with_entities(filename); debug_file_printf("</given-path>"); debug_file_printf("<language>Inform 7</language>"); debug_file_printf("</source>"); } InputFiles[total_files].handle = NULL; InputFiles[total_files].is_input = FALSE; InputFiles[total_files].initial_buffering = FALSE; total_files++; current_origsource_file = total_files; return current_origsource_file; } /* ------------------------------------------------------------------------- */ /* Feeding source code up into the lexical analyser's buffer */ /* (see "lexer.c" for its specification) */ /* ------------------------------------------------------------------------- */ extern int file_load_chars(int file_number, char *buffer, int length) { int read_in; FILE *handle; if (file_number-1 > total_files) { buffer[0] = 0; return 1; } handle = InputFiles[file_number-1].handle; if (handle == NULL) { buffer[0] = 0; return 1; } read_in = fread(buffer, 1, length, handle); total_chars_read += read_in; if (read_in == length) return length; close_sourcefile(file_number); if (file_number == 1) { buffer[read_in] = 0; buffer[read_in+1] = 0; buffer[read_in+2] = 0; buffer[read_in+3] = 0; } else { buffer[read_in] = '\n'; buffer[read_in+1] = ' '; buffer[read_in+2] = ' '; buffer[read_in+3] = ' '; } return(-(read_in+4)); } /* ------------------------------------------------------------------------- */ /* Final assembly and output of the story file. */ /* ------------------------------------------------------------------------- */ FILE *sf_handle; static void sf_put(int c) { if (!glulx_mode) { /* The checksum is the unsigned sum mod 65536 of the bytes in the story file from 0x0040 (first byte after header) to the end. */ checksum_low_byte += c; if (checksum_low_byte>=256) { checksum_low_byte-=256; if (++checksum_high_byte==256) checksum_high_byte=0; } } else { /* The checksum is the unsigned 32-bit sum of the entire story file, considered as a list of 32-bit words, with the checksum field being zero. */ switch (checksum_count) { case 0: checksum_long += (((int32)(c & 0xFF)) << 24); break; case 1: checksum_long += (((int32)(c & 0xFF)) << 16); break; case 2: checksum_long += (((int32)(c & 0xFF)) << 8); break; case 3: checksum_long += ((int32)(c & 0xFF)); break; } checksum_count = (checksum_count+1) & 3; } fputc(c, sf_handle); } /* Recursive procedure to generate the Glulx compression table. */ static void output_compression(int entnum, int32 *size, int *count) { huffentity_t *ent = &(huff_entities[entnum]); int32 val; char *cx; sf_put(ent->type); (*size)++; (*count)++; switch (ent->type) { case 0: val = Write_Strings_At + huff_entities[ent->u.branch[0]].addr; sf_put((val >> 24) & 0xFF); sf_put((val >> 16) & 0xFF); sf_put((val >> 8) & 0xFF); sf_put((val) & 0xFF); (*size) += 4; val = Write_Strings_At + huff_entities[ent->u.branch[1]].addr; sf_put((val >> 24) & 0xFF); sf_put((val >> 16) & 0xFF); sf_put((val >> 8) & 0xFF); sf_put((val) & 0xFF); (*size) += 4; output_compression(ent->u.branch[0], size, count); output_compression(ent->u.branch[1], size, count); break; case 1: /* no data */ break; case 2: sf_put(ent->u.ch); (*size) += 1; break; case 3: cx = (char *)abbreviations_at + ent->u.val*MAX_ABBREV_LENGTH; while (*cx) { sf_put(*cx); cx++; (*size) += 1; } sf_put('\0'); (*size) += 1; break; case 4: val = unicode_usage_entries[ent->u.val].ch; sf_put((val >> 24) & 0xFF); sf_put((val >> 16) & 0xFF); sf_put((val >> 8) & 0xFF); sf_put((val) & 0xFF); (*size) += 4; break; case 9: val = abbreviations_offset + 4 + ent->u.val*4; sf_put((val >> 24) & 0xFF); sf_put((val >> 16) & 0xFF); sf_put((val >> 8) & 0xFF); sf_put((val) & 0xFF); (*size) += 4; break; } } static void output_file_z(void) { char new_name[PATHLEN]; int32 length, blanks=0, size, i, j, offset; uint32 code_length, size_before_code, next_cons_check; int use_function; ASSERT_ZCODE(); /* At this point, construct_storyfile() has just been called. */ /* Enter the length information into the header. */ length=((int32) Write_Strings_At) + static_strings_extent; while ((length%length_scale_factor)!=0) { length++; blanks++; } length=length/length_scale_factor; zmachine_paged_memory[26]=(length & 0xff00)/0x100; zmachine_paged_memory[27]=(length & 0xff); /* To assist interpreters running a paged virtual memory system, Inform writes files which are padded with zeros to the next multiple of 0.5K. This calculates the number of bytes of padding needed: */ while (((length_scale_factor*length)+blanks-1)%512 != 511) blanks++; translate_out_filename(new_name, Code_Name); sf_handle = fopen(new_name,"wb"); if (sf_handle == NULL) fatalerror_named("Couldn't open output file", new_name); #ifdef MAC_MPW /* Set the type and creator to Andrew Plotkin's MaxZip, a popular Z-code interpreter on the Macintosh */ fsetfileinfo(new_name, 'mxZR', 'ZCOD'); #endif /* (1) Output the paged memory. */ for (i=0;i<64;i++) fputc(zmachine_paged_memory[i], sf_handle); size = 64; checksum_low_byte = 0; checksum_high_byte = 0; for (i=64; i<Write_Code_At; i++) { sf_put(zmachine_paged_memory[i]); size++; } /* (2) Output the compiled code area. */ if (!OMIT_UNUSED_ROUTINES) { /* This is the old-fashioned case, which is easy. All of zcode_area (zmachine_pc bytes) will be output. next_cons_check will be ignored, because j will never reach it. */ code_length = zmachine_pc; use_function = TRUE; next_cons_check = code_length+1; } else { /* With dead function stripping, life is more complicated. j will run from 0 to zmachine_pc, but only code_length of those should be output. next_cons_check is the location of the next function break; that's where we check whether we're in a live function or a dead one. (This logic is simplified by the assumption that a backpatch marker will never straddle a function break.) */ if (zmachine_pc != df_total_size_before_stripping) compiler_error("Code size does not match (zmachine_pc and df_total_size)."); code_length = df_total_size_after_stripping; use_function = TRUE; next_cons_check = 0; df_prepare_function_iterate(); } size_before_code = size; j=0; for (i=0; i<zcode_backpatch_size; i=i+3) { int long_flag = TRUE; offset = 256*zcode_backpatch_table[i+1] + zcode_backpatch_table[i+2]; backpatch_error_flag = FALSE; backpatch_marker = zcode_backpatch_table[i]; if (backpatch_marker >= 0x80) long_flag = FALSE; backpatch_marker &= 0x7f; offset = offset + (backpatch_marker/32)*0x10000; while (offset+0x30000 < j) { offset += 0x40000; long_flag = !long_flag; } backpatch_marker &= 0x1f; /* All code up until the next backpatch marker gets flushed out as-is. (Unless we're in a stripped-out function.) */ while (j<offset) { if (!use_function) { while (j<offset && j<next_cons_check) { j++; } } else { while (j<offset && j<next_cons_check) { size++; sf_put(zcode_area[j]); j++; } } if (j == next_cons_check) next_cons_check = df_next_function_iterate(&use_function); } if (long_flag) { int32 v = zcode_area[j]; v = 256*v + (zcode_area[j+1]); j += 2; if (use_function) { v = backpatch_value(v); sf_put(v/256); sf_put(v%256); size += 2; } } else { int32 v = zcode_area[j]; j++; if (use_function) { v = backpatch_value(v); sf_put(v); size++; } } if (j > next_cons_check) compiler_error("Backpatch appears to straddle function break"); if (backpatch_error_flag) { printf("*** %s zcode offset=%08lx backpatch offset=%08lx ***\n", (long_flag)?"long":"short", (long int) j, (long int) i); } } /* Flush out the last bit of zcode_area, after the last backpatch marker. */ offset = zmachine_pc; while (j<offset) { if (!use_function) { while (j<offset && j<next_cons_check) { j++; } } else { while (j<offset && j<next_cons_check) { size++; sf_put(zcode_area[j]); j++; } } if (j == next_cons_check) next_cons_check = df_next_function_iterate(&use_function); } if (size_before_code + code_length != size) compiler_error("Code output length did not match"); /* (3) Output any null bytes (required to reach a packed address) before the strings area. */ while (size<Write_Strings_At) { sf_put(0); size++; } /* (4) Output the static strings area. */ for (i=0; i<static_strings_extent; i++) { sf_put(static_strings_area[i]); size++; } /* (5) When modules existed, we output link data here. */ /* (6) Output null bytes to reach a multiple of 0.5K. */ while (blanks>0) { sf_put(0); blanks--; } if (ferror(sf_handle)) fatalerror("I/O failure: couldn't write to story file"); fseek(sf_handle, 28, SEEK_SET); fputc(checksum_high_byte, sf_handle); fputc(checksum_low_byte, sf_handle); if (ferror(sf_handle)) fatalerror("I/O failure: couldn't backtrack on story file for checksum"); fclose(sf_handle); /* Write a copy of the header into the debugging information file (mainly so that it can be used to identify which story file matches with which debugging info file). */ if (debugfile_switch) { debug_file_printf("<story-file-prefix>"); for (i = 0; i < 63; i += 3) { if (i == 27) { debug_file_print_base_64_triple (zmachine_paged_memory[27], checksum_high_byte, checksum_low_byte); } else { debug_file_print_base_64_triple (zmachine_paged_memory[i], zmachine_paged_memory[i + 1], zmachine_paged_memory[i + 2]); } } debug_file_print_base_64_single(zmachine_paged_memory[63]); debug_file_printf("</story-file-prefix>"); } #ifdef ARCHIMEDES { char settype_command[PATHLEN]; sprintf(settype_command, "settype %s %s", new_name, riscos_file_type()); system(settype_command); } #endif #ifdef MAC_FACE InformFiletypes (new_name, INF_ZCODE_TYPE); #endif } static void output_file_g(void) { char new_name[PATHLEN]; int32 size, i, j, offset; int32 VersionNum; uint32 code_length, size_before_code, next_cons_check; int use_function; int first_byte_of_triple, second_byte_of_triple, third_byte_of_triple; ASSERT_GLULX(); /* At this point, construct_storyfile() has just been called. */ translate_out_filename(new_name, Code_Name); sf_handle = fopen(new_name,"wb+"); if (sf_handle == NULL) fatalerror_named("Couldn't open output file", new_name); #ifdef MAC_MPW /* Set the type and creator to Andrew Plotkin's MaxZip, a popular Z-code interpreter on the Macintosh */ fsetfileinfo(new_name, 'mxZR', 'GLUL'); #endif checksum_long = 0; checksum_count = 0; /* Determine the version number. */ VersionNum = 0x00020000; /* Increase for various features the game may have used. */ if (no_unicode_chars != 0 || (uses_unicode_features)) { VersionNum = 0x00030000; } if (uses_memheap_features) { VersionNum = 0x00030100; } if (uses_acceleration_features) { VersionNum = 0x00030101; } if (uses_float_features) { VersionNum = 0x00030102; } if (uses_double_features || uses_extundo_features) { VersionNum = 0x00030103; } /* And check if the user has requested a specific version. */ if (requested_glulx_version) { if (requested_glulx_version < VersionNum) { static char error_message_buff[256]; sprintf(error_message_buff, "Version 0x%08lx requested, but \ game features require version 0x%08lx", (long)requested_glulx_version, (long)VersionNum); warning(error_message_buff); } else { VersionNum = requested_glulx_version; } } /* (1) Output the header. We use sf_put here, instead of fputc, because the header is included in the checksum. */ /* Magic number */ sf_put('G'); sf_put('l'); sf_put('u'); sf_put('l'); /* Version number. */ sf_put((VersionNum >> 24)); sf_put((VersionNum >> 16)); sf_put((VersionNum >> 8)); sf_put((VersionNum)); /* RAMSTART */ sf_put((Write_RAM_At >> 24)); sf_put((Write_RAM_At >> 16)); sf_put((Write_RAM_At >> 8)); sf_put((Write_RAM_At)); /* EXTSTART, or game file size */ sf_put((Out_Size >> 24)); sf_put((Out_Size >> 16)); sf_put((Out_Size >> 8)); sf_put((Out_Size)); /* ENDMEM, which the game file size plus MEMORY_MAP_EXTENSION */ i = Out_Size + MEMORY_MAP_EXTENSION; sf_put((i >> 24)); sf_put((i >> 16)); sf_put((i >> 8)); sf_put((i)); /* STACKSIZE */ sf_put((MAX_STACK_SIZE >> 24)); sf_put((MAX_STACK_SIZE >> 16)); sf_put((MAX_STACK_SIZE >> 8)); sf_put((MAX_STACK_SIZE)); /* Initial function to call. Inform sets things up so that this is the start of the executable-code area. */ sf_put((Write_Code_At >> 24)); sf_put((Write_Code_At >> 16)); sf_put((Write_Code_At >> 8)); sf_put((Write_Code_At)); /* String-encoding table. */ sf_put((Write_Strings_At >> 24)); sf_put((Write_Strings_At >> 16)); sf_put((Write_Strings_At >> 8)); sf_put((Write_Strings_At)); /* Checksum -- zero for the moment. */ sf_put(0x00); sf_put(0x00); sf_put(0x00); sf_put(0x00); size = GLULX_HEADER_SIZE; /* (1a) Output the eight-byte memory layout identifier. */ sf_put('I'); sf_put('n'); sf_put('f'); sf_put('o'); sf_put(0); sf_put(1); sf_put(0); sf_put(0); /* (1b) Output the rest of the Inform-specific data. */ /* Inform version number */ sf_put('0' + ((RELEASE_NUMBER/100)%10)); sf_put('.'); sf_put('0' + ((RELEASE_NUMBER/10)%10)); sf_put('0' + RELEASE_NUMBER%10); /* Glulx back-end version number */ sf_put('0' + ((GLULX_RELEASE_NUMBER/100)%10)); sf_put('.'); sf_put('0' + ((GLULX_RELEASE_NUMBER/10)%10)); sf_put('0' + GLULX_RELEASE_NUMBER%10); /* Game release number */ sf_put((release_number>>8) & 0xFF); sf_put(release_number & 0xFF); /* Game serial number */ { char serialnum[8]; write_serial_number(serialnum); for (i=0; i<6; i++) sf_put(serialnum[i]); } size += GLULX_STATIC_ROM_SIZE; /* (2) Output the compiled code area. */ if (!OMIT_UNUSED_ROUTINES) { /* This is the old-fashioned case, which is easy. All of zcode_area (zmachine_pc bytes) will be output. next_cons_check will be ignored, because j will never reach it. */ code_length = zmachine_pc; use_function = TRUE; next_cons_check = code_length+1; } else { /* With dead function stripping, life is more complicated. j will run from 0 to zmachine_pc, but only code_length of those should be output. next_cons_check is the location of the next function break; that's where we check whether we're in a live function or a dead one. (This logic is simplified by the assumption that a backpatch marker will never straddle a function break.) */ if (zmachine_pc != df_total_size_before_stripping) compiler_error("Code size does not match (zmachine_pc and df_total_size)."); code_length = df_total_size_after_stripping; use_function = TRUE; next_cons_check = 0; df_prepare_function_iterate(); } size_before_code = size; j=0; for (i=0; i<zcode_backpatch_size; i=i+6) { int data_len; int32 v; offset = (zcode_backpatch_table[i+2] << 24) | (zcode_backpatch_table[i+3] << 16) | (zcode_backpatch_table[i+4] << 8) | (zcode_backpatch_table[i+5]); backpatch_error_flag = FALSE; backpatch_marker = zcode_backpatch_table[i]; data_len = zcode_backpatch_table[i+1]; /* All code up until the next backpatch marker gets flushed out as-is. (Unless we're in a stripped-out function.) */ while (j<offset) { if (!use_function) { while (j<offset && j<next_cons_check) { j++; } } else { while (j<offset && j<next_cons_check) { size++; sf_put(zcode_area[j]); j++; } } if (j == next_cons_check) next_cons_check = df_next_function_iterate(&use_function); } /* Write out the converted value of the backpatch marker. (Unless we're in a stripped-out function.) */ switch (data_len) { case 4: v = (zcode_area[j]); v = (v << 8) | (zcode_area[j+1]); v = (v << 8) | (zcode_area[j+2]); v = (v << 8) | (zcode_area[j+3]); j += 4; if (!use_function) break; v = backpatch_value(v); sf_put((v >> 24) & 0xFF); sf_put((v >> 16) & 0xFF); sf_put((v >> 8) & 0xFF); sf_put((v) & 0xFF); size += 4; break; case 2: v = (zcode_area[j]); v = (v << 8) | (zcode_area[j+1]); j += 2; if (!use_function) break; v = backpatch_value(v); if (v >= 0x10000) { printf("*** backpatch value does not fit ***\n"); backpatch_error_flag = TRUE; } sf_put((v >> 8) & 0xFF); sf_put((v) & 0xFF); size += 2; break; case 1: v = (zcode_area[j]); j += 1; if (!use_function) break; v = backpatch_value(v); if (v >= 0x100) { printf("*** backpatch value does not fit ***\n"); backpatch_error_flag = TRUE; } sf_put((v) & 0xFF); size += 1; break; default: printf("*** unknown backpatch data len = %d ***\n", data_len); backpatch_error_flag = TRUE; } if (j > next_cons_check) compiler_error("Backpatch appears to straddle function break"); if (backpatch_error_flag) { printf("*** %d bytes zcode offset=%08lx backpatch offset=%08lx ***\n", data_len, (long int) j, (long int) i); } } /* Flush out the last bit of zcode_area, after the last backpatch marker. */ offset = zmachine_pc; while (j<offset) { if (!use_function) { while (j<offset && j<next_cons_check) { j++; } } else { while (j<offset && j<next_cons_check) { size++; sf_put(zcode_area[j]); j++; } } if (j == next_cons_check) next_cons_check = df_next_function_iterate(&use_function); } if (size_before_code + code_length != size) compiler_error("Code output length did not match"); /* (4) Output the static strings area. */ { int32 ix, lx; int ch, jx, curbyte, bx; int depth, checkcount; huffbitlist_t *bits; int32 origsize; origsize = size; if (compression_switch) { /* The 12-byte table header. */ lx = compression_table_size; sf_put((lx >> 24) & 0xFF); sf_put((lx >> 16) & 0xFF); sf_put((lx >> 8) & 0xFF); sf_put((lx) & 0xFF); size += 4; sf_put((no_huff_entities >> 24) & 0xFF); sf_put((no_huff_entities >> 16) & 0xFF); sf_put((no_huff_entities >> 8) & 0xFF); sf_put((no_huff_entities) & 0xFF); size += 4; lx = Write_Strings_At + 12; sf_put((lx >> 24) & 0xFF); sf_put((lx >> 16) & 0xFF); sf_put((lx >> 8) & 0xFF); sf_put((lx) & 0xFF); size += 4; checkcount = 0; output_compression(huff_entity_root, &size, &checkcount); if (checkcount != no_huff_entities) compiler_error("Compression table count mismatch."); } if (size - origsize != compression_table_size) compiler_error("Compression table size mismatch."); origsize = size; for (lx=0, ix=0; lx<no_strings; lx++) { int escapelen=0, escapetype=0; int done=FALSE; int32 escapeval=0; if (compression_switch) sf_put(0xE1); /* type byte -- compressed string */ else sf_put(0xE0); /* type byte -- non-compressed string */ size++; jx = 0; curbyte = 0; while (!done) { ch = static_strings_area[ix]; ix++; if (ix > static_strings_extent || ch < 0) compiler_error("Read too much not-yet-compressed text."); if (escapelen == -1) { escapelen = 0; if (ch == '@') { ch = '@'; } else if (ch == '0') { ch = '\0'; } else if (ch == 'A' || ch == 'D' || ch == 'U') { escapelen = 4; escapetype = ch; escapeval = 0; continue; } else { compiler_error("Strange @ escape in processed text."); } } else if (escapelen) { escapeval = (escapeval << 4) | ((ch-'A') & 0x0F); escapelen--; if (escapelen == 0) { if (escapetype == 'A') { ch = huff_abbrev_start+escapeval; } else if (escapetype == 'D') { ch = huff_dynam_start+escapeval; } else if (escapetype == 'U') { ch = huff_unicode_start+escapeval; } else { compiler_error("Strange @ escape in processed text."); } } else continue; } else { if (ch == '@') { escapelen = -1; continue; } if (ch == 0) { ch = 256; done = TRUE; } } if (compression_switch) { bits = &(huff_entities[ch].bits); depth = huff_entities[ch].depth; for (bx=0; bx<depth; bx++) { if (bits->b[bx / 8] & (1 << (bx % 8))) curbyte |= (1 << jx); jx++; if (jx == 8) { sf_put(curbyte); size++; curbyte = 0; jx = 0; } } } else { if (ch >= huff_dynam_start) { sf_put(' '); sf_put(' '); sf_put(' '); size += 3; } else if (ch >= huff_abbrev_start) { /* nothing */ } else { /* 256, the string terminator, comes out as zero */ sf_put(ch & 0xFF); size++; } } } if (compression_switch && jx) { sf_put(curbyte); size++; } } if (size - origsize != compression_string_size) compiler_error("Compression string size mismatch."); } /* (5) Output static arrays (if any). */ { /* We have to backpatch entries mentioned in staticarray_backpatch_table. */ int32 size_before_arrays = size; int32 val, ix, jx; for (ix=0, jx=0; ix<staticarray_backpatch_size; ix += 5) { backpatch_error_flag = FALSE; backpatch_marker = staticarray_backpatch_table[ix]; /* datalen is always 4 for array backpatching */ offset = (staticarray_backpatch_table[ix+1] << 24) | (staticarray_backpatch_table[ix+2] << 16) | (staticarray_backpatch_table[ix+3] << 8) | (staticarray_backpatch_table[ix+4]); while (jx<offset) { sf_put(static_array_area[jx]); size++; jx++; } /* Write out the converted value of the backpatch marker. */ val = static_array_area[jx++]; val = (val << 8) | static_array_area[jx++]; val = (val << 8) | static_array_area[jx++]; val = (val << 8) | static_array_area[jx++]; val = backpatch_value(val); sf_put((val >> 24) & 0xFF); sf_put((val >> 16) & 0xFF); sf_put((val >> 8) & 0xFF); sf_put((val) & 0xFF); size += 4; } /* Flush out the last bit of static_array_area, after the last backpatch marker. */ offset = static_array_area_size; while (jx<offset) { sf_put(static_array_area[jx]); size++; jx++; } if (size_before_arrays + static_array_area_size != size) compiler_error("Static array output length did not match"); } /* (5.5) Output any null bytes (required to reach a GPAGESIZE address) before RAMSTART. */ while (size % GPAGESIZE) { sf_put(0); size++; } /* (6) Output RAM. */ for (i=0; i<RAM_Size; i++) { sf_put(zmachine_paged_memory[i]); size++; } if (ferror(sf_handle)) fatalerror("I/O failure: couldn't write to story file"); fseek(sf_handle, 32, SEEK_SET); fputc((checksum_long >> 24) & 0xFF, sf_handle); fputc((checksum_long >> 16) & 0xFF, sf_handle); fputc((checksum_long >> 8) & 0xFF, sf_handle); fputc((checksum_long) & 0xFF, sf_handle); if (ferror(sf_handle)) fatalerror("I/O failure: couldn't backtrack on story file for checksum"); /* Write a copy of the first 64 bytes into the debugging information file (mainly so that it can be used to identify which story file matches with which debugging info file). */ if (debugfile_switch) { fseek(sf_handle, 0L, SEEK_SET); debug_file_printf("<story-file-prefix>"); for (i = 0; i < 63; i += 3) { first_byte_of_triple = fgetc(sf_handle); second_byte_of_triple = fgetc(sf_handle); third_byte_of_triple = fgetc(sf_handle); debug_file_print_base_64_triple (first_byte_of_triple, second_byte_of_triple, third_byte_of_triple); } debug_file_print_base_64_single(fgetc(sf_handle)); debug_file_printf("</story-file-prefix>"); } fclose(sf_handle); #ifdef ARCHIMEDES { char settype_command[PATHLEN]; sprintf(settype_command, "settype %s %s", new_name, riscos_file_type()); system(settype_command); } #endif #ifdef MAC_FACE InformFiletypes (new_name, INF_GLULX_TYPE); #endif } extern void output_file(void) { if (!glulx_mode) output_file_z(); else output_file_g(); } /* ------------------------------------------------------------------------- */ /* Output the text transcript file (only called if there is to be one). */ /* ------------------------------------------------------------------------- */ FILE *transcript_file_handle; int transcript_open; extern void write_to_transcript_file(char *text, int linetype) { if (TRANSCRIPT_FORMAT == 1) { char ch = '?'; switch (linetype) { case STRCTX_INFO: ch = 'I'; break; case STRCTX_GAME: ch = 'G'; break; case STRCTX_GAMEOPC: ch = 'H'; break; case STRCTX_VENEER: ch = 'V'; break; case STRCTX_VENEEROPC: ch = 'W'; break; case STRCTX_LOWSTRING: ch = 'L'; break; case STRCTX_ABBREV: ch = 'A'; break; case STRCTX_DICT: ch = 'D'; break; case STRCTX_OBJNAME: ch = 'O'; break; case STRCTX_SYMBOL: ch = 'S'; break; case STRCTX_INFIX: ch = 'X'; break; } fputc(ch, transcript_file_handle); fputs(": ", transcript_file_handle); } fputs(text, transcript_file_handle); fputc('\n', transcript_file_handle); } extern void open_transcript_file(char *what_of) { char topline_buffer[256]; transcript_file_handle = fopen(Transcript_Name,"w"); if (transcript_file_handle==NULL) fatalerror_named("Couldn't open transcript file", Transcript_Name); transcript_open = TRUE; sprintf(topline_buffer, "Transcript of the text of \"%s\"", what_of); write_to_transcript_file(topline_buffer, STRCTX_INFO); sprintf(topline_buffer, "[From %s]", banner_line); write_to_transcript_file(topline_buffer, STRCTX_INFO); if (TRANSCRIPT_FORMAT == 1) { write_to_transcript_file("[I:info, G:game text, V:veneer text, L:lowmem string, A:abbreviation, D:dict word, O:object name, S:symbol, X:infix]", STRCTX_INFO); if (!glulx_mode) write_to_transcript_file("[H:game text inline in opcode, W:veneer text inline in opcode]", STRCTX_INFO); } write_to_transcript_file("", STRCTX_INFO); } extern void abort_transcript_file(void) { if (transcript_switch && transcript_open) fclose(transcript_file_handle); transcript_open = FALSE; } extern void close_transcript_file(void) { char botline_buffer[256]; char sn_buffer[7]; write_serial_number(sn_buffer); sprintf(botline_buffer, "[End of transcript: release %d, serial %s]", release_number, sn_buffer); write_to_transcript_file("", STRCTX_INFO); write_to_transcript_file(botline_buffer, STRCTX_INFO); write_to_transcript_file("", STRCTX_INFO); if (ferror(transcript_file_handle)) fatalerror("I/O failure: couldn't write to transcript file"); fclose(transcript_file_handle); transcript_open = FALSE; #ifdef ARCHIMEDES { char settype_command[PATHLEN]; sprintf(settype_command, "settype %s text", Transcript_Name); system(settype_command); } #endif #ifdef MAC_FACE InformFiletypes (Transcript_Name, INF_TEXT_TYPE); #endif } /* ------------------------------------------------------------------------- */ /* Access to the debugging information file. */ /* ------------------------------------------------------------------------- */ static FILE *Debug_fp; /* Handle of debugging info file */ static void open_debug_file(void) { Debug_fp=fopen(Debugging_Name,"wb"); if (Debug_fp==NULL) fatalerror_named("Couldn't open debugging information file", Debugging_Name); } extern void nullify_debug_file_position(maybe_file_position *position) { position->valid = 0; } static void close_debug_file(void) { fclose(Debug_fp); #ifdef MAC_FACE InformFiletypes (Debugging_Name, INF_DEBUG_TYPE); #endif } extern void begin_debug_file(void) { open_debug_file(); debug_file_printf("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); debug_file_printf("<inform-story-file version=\"1.0\" "); debug_file_printf("content-creator=\"Inform\" "); debug_file_printf ("content-creator-version=\"%d.%d%d\">", (VNUMBER / 100) % 10, (VNUMBER / 10) % 10, VNUMBER % 10); } extern void debug_file_printf(const char*format, ...) { va_list argument_pointer; va_start(argument_pointer, format); vfprintf(Debug_fp, format, argument_pointer); va_end(argument_pointer); if (ferror(Debug_fp)) { fatalerror("I/O failure: can't write to debugging information file"); } } extern void debug_file_print_with_entities(const char*string) { int index = 0; char character; for (character = string[index]; character; character = string[++index]) { switch(character) { case '"': debug_file_printf("&quot;"); break; case '&': debug_file_printf("&amp;"); break; case '\'': debug_file_printf("&apos;"); break; case '<': debug_file_printf("&lt;"); break; case '>': debug_file_printf("&gt;"); break; default: debug_file_printf("%c", character); break; } } } static char base_64_digits[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' }; extern void debug_file_print_base_64_triple (uchar first, uchar second, uchar third) { debug_file_printf ("%c%c%c%c", base_64_digits[first >> 2], base_64_digits[((first & 3) << 4) | (second >> 4)], base_64_digits[((second & 15) << 2) | (third >> 6)], base_64_digits[third & 63]); } extern void debug_file_print_base_64_pair(uchar first, uchar second) { debug_file_printf ("%c%c%c=", base_64_digits[first >> 2], base_64_digits[((first & 3) << 4) | (second >> 4)], base_64_digits[(second & 15) << 2]); } extern void debug_file_print_base_64_single(uchar first) { debug_file_printf ("%c%c==", base_64_digits[first >> 2], base_64_digits[(first & 3) << 4]); } static void write_debug_location_internals(debug_location location) { debug_file_printf("<file-index>%d</file-index>", location.file_index - 1); debug_file_printf ("<file-position>%d</file-position>", location.beginning_byte_index); debug_file_printf ("<line>%d</line>", location.beginning_line_number); debug_file_printf ("<character>%d</character>", location.beginning_character_number); if (location.beginning_byte_index != location.end_byte_index || location.beginning_line_number != location.end_line_number || location.beginning_character_number != location.end_character_number) { debug_file_printf ("<end-file-position>%d</end-file-position>", location.end_byte_index); debug_file_printf ("<end-line>%d</end-line>", location.end_line_number); debug_file_printf ("<end-character>%d</end-character>", location.end_character_number); } } static void write_debug_location_origsource_internals(debug_location location) { debug_file_printf ("<file-index>%d</file-index>", location.orig_file_index - 1); if (location.orig_beg_line_number) debug_file_printf ("<line>%d</line>", location.orig_beg_line_number); if (location.orig_beg_char_number) debug_file_printf ("<character>%d</character>", location.orig_beg_char_number); } extern void write_debug_location(debug_location location) { if (location.file_index && location.file_index != 255) { debug_file_printf("<source-code-location>"); write_debug_location_internals(location); debug_file_printf("</source-code-location>"); } if (location.orig_file_index) { debug_file_printf("<source-code-location>"); write_debug_location_origsource_internals(location); debug_file_printf("</source-code-location>"); } } extern void write_debug_locations(debug_locations locations) { if (locations.next) { const debug_locations*current = &locations; unsigned int index = 0; for (; current; current = current->next, ++index) { debug_file_printf("<source-code-location index=\"%d\">", index); write_debug_location_internals(current->location); debug_file_printf("</source-code-location>"); } if (locations.location.orig_file_index) { debug_file_printf("<source-code-location>"); write_debug_location_origsource_internals(locations.location); debug_file_printf("</source-code-location>"); } } else { write_debug_location(locations.location); } } extern void write_debug_optional_identifier(int32 symbol_index) { if (symbols[symbol_index].type != ROUTINE_T) { compiler_error ("Attempt to write a replaceable identifier for a non-routine"); } if (symbol_debug_info[symbol_index].replacement_backpatch_pos.valid) { if (fsetpos (Debug_fp, &symbol_debug_info[symbol_index].replacement_backpatch_pos.position)) { fatalerror("I/O failure: can't seek in debugging information file"); } debug_file_printf ("<identifier artificial=\"true\">%s " "(superseded replacement)</identifier>", symbols[symbol_index].name); if (fseek(Debug_fp, 0L, SEEK_END)) { fatalerror("I/O failure: can't seek in debugging information file"); } } fgetpos (Debug_fp, &symbol_debug_info[symbol_index].replacement_backpatch_pos.position); symbol_debug_info[symbol_index].replacement_backpatch_pos.valid = TRUE; debug_file_printf("<identifier>%s</identifier>", symbols[symbol_index].name); /* Space for: artificial="true" (superseded replacement) */ debug_file_printf(" "); } extern void write_debug_symbol_backpatch(int32 symbol_index) { if (symbol_debug_info[symbol_index].backpatch_pos.valid) { compiler_error("Symbol entry incorrectly reused in debug information " "file backpatching"); } fgetpos(Debug_fp, &symbol_debug_info[symbol_index].backpatch_pos.position); symbol_debug_info[symbol_index].backpatch_pos.valid = TRUE; /* Reserve space for up to 10 digits plus a negative sign. */ debug_file_printf("*BACKPATCH*"); } extern void write_debug_symbol_optional_backpatch(int32 symbol_index) { if (symbol_debug_info[symbol_index].backpatch_pos.valid) { compiler_error("Symbol entry incorrectly reused in debug information " "file backpatching"); } /* Reserve space for open and close value tags and up to 10 digits plus a negative sign, but take the backpatch position just inside the element, so that we'll be in the same case as above if the symbol is eventually defined. */ debug_file_printf("<value>"); fgetpos(Debug_fp, &symbol_debug_info[symbol_index].backpatch_pos.position); symbol_debug_info[symbol_index].backpatch_pos.valid = TRUE; debug_file_printf("*BACKPATCH*</value>"); } static void write_debug_backpatch (debug_backpatch_accumulator *accumulator, int32 value) { if (accumulator->number_of_values_to_backpatch == accumulator->number_of_available_backpatches) { my_realloc(&accumulator->values_and_backpatch_positions, sizeof(value_and_backpatch_position) * accumulator->number_of_available_backpatches, 2 * sizeof(value_and_backpatch_position) * accumulator->number_of_available_backpatches, "values and debug information backpatch positions"); accumulator->number_of_available_backpatches *= 2; } accumulator->values_and_backpatch_positions [accumulator->number_of_values_to_backpatch].value = value; fgetpos (Debug_fp, &accumulator->values_and_backpatch_positions [accumulator->number_of_values_to_backpatch].backpatch_position); ++(accumulator->number_of_values_to_backpatch); /* Reserve space for up to 10 digits plus a negative sign. */ debug_file_printf("*BACKPATCH*"); } extern void write_debug_object_backpatch(int32 object_number) { if (glulx_mode) { write_debug_backpatch(&object_backpatch_accumulator, object_number - 1); } else { debug_file_printf("%d", object_number); } } static int32 backpatch_object_address(int32 index) { return object_tree_offset + OBJECT_BYTE_LENGTH * index; } extern void write_debug_packed_code_backpatch(int32 offset) { write_debug_backpatch(&packed_code_backpatch_accumulator, offset); } static int32 backpatch_packed_code_address(int32 offset) { if (OMIT_UNUSED_ROUTINES) { int stripped; offset = df_stripped_offset_for_code_offset(offset, &stripped); if (stripped) return 0; } return (code_offset + offset) / scale_factor; } extern void write_debug_code_backpatch(int32 offset) { write_debug_backpatch(&code_backpatch_accumulator, offset); } static int32 backpatch_code_address(int32 offset) { if (OMIT_UNUSED_ROUTINES) { int stripped; offset = df_stripped_offset_for_code_offset(offset, &stripped); if (stripped) return 0; } return code_offset + offset; } extern void write_debug_global_backpatch(int32 offset) { write_debug_backpatch(&global_backpatch_accumulator, offset); } static int32 backpatch_global_address(int32 offset) { return variables_offset + WORDSIZE * (offset - MAX_LOCAL_VARIABLES); } extern void write_debug_array_backpatch(int32 offset) { write_debug_backpatch(&array_backpatch_accumulator, offset); } static int32 backpatch_array_address(int32 offset) { return (glulx_mode ? arrays_offset : variables_offset) + offset; } extern void write_debug_grammar_backpatch(int32 offset) { write_debug_backpatch(&grammar_backpatch_accumulator, offset); } static int32 backpatch_grammar_address(int32 offset) { return grammar_table_offset + offset; } extern void begin_writing_debug_sections() { debug_file_printf("<story-file-section>"); debug_file_printf("<type>header</type>"); debug_file_printf("<address>0</address>"); } extern void write_debug_section(const char*name, int32 beginning_address) { debug_file_printf("<end-address>%d</end-address>", beginning_address); debug_file_printf("</story-file-section>"); debug_file_printf("<story-file-section>"); debug_file_printf("<type>"); debug_file_print_with_entities(name); debug_file_printf("</type>"); debug_file_printf("<address>%d</address>", beginning_address); } extern void end_writing_debug_sections(int32 end_address) { debug_file_printf("<end-address>%d</end-address>", end_address); debug_file_printf("</story-file-section>"); } extern void write_debug_undef(int32 symbol_index) { if (!symbol_debug_info[symbol_index].backpatch_pos.valid) { compiler_error ("Attempt to erase debugging information never written or since " "erased"); } if (symbols[symbol_index].type != CONSTANT_T) { compiler_error ("Attempt to erase debugging information for a non-constant " "because of an #undef"); } if (fsetpos (Debug_fp, &symbol_debug_info[symbol_index].backpatch_pos.position)) { fatalerror("I/O failure: can't seek in debugging information file"); } /* There are 7 characters in ``<value>''. */ if (fseek(Debug_fp, -7L, SEEK_CUR)) { fatalerror("I/O failure: can't seek in debugging information file"); } /* Overwrite: <value>*BACKPATCH*</value> */ debug_file_printf(" "); nullify_debug_file_position (&symbol_debug_info[symbol_index].backpatch_pos); if (fseek(Debug_fp, 0L, SEEK_END)) { fatalerror("I/O failure: can't seek in debugging information file"); } } static void apply_debug_information_backpatches (debug_backpatch_accumulator *accumulator) { int32 backpatch_index, backpatch_value; for (backpatch_index = accumulator->number_of_values_to_backpatch; backpatch_index--;) { if (fsetpos (Debug_fp, &accumulator->values_and_backpatch_positions [backpatch_index].backpatch_position)) { fatalerror ("I/O failure: can't seek in debugging information file"); } backpatch_value = (*accumulator->backpatching_function) (accumulator->values_and_backpatch_positions [backpatch_index].value); debug_file_printf ("%11d", /* Space for up to 10 digits plus a negative sign. */ backpatch_value); } } static void apply_debug_information_symbol_backpatches() { int backpatch_symbol; for (backpatch_symbol = no_symbols; backpatch_symbol--;) { if (symbol_debug_info[backpatch_symbol].backpatch_pos.valid) { if (fsetpos(Debug_fp, &symbol_debug_info[backpatch_symbol].backpatch_pos.position)) { fatalerror ("I/O failure: can't seek in debugging information file"); } debug_file_printf("%11d", symbols[backpatch_symbol].value); } } } static void write_debug_system_constants() { int *system_constant_list = glulx_mode ? glulx_system_constant_list : z_system_constant_list; int system_constant_index = 0; /* Store system constants. */ for (; system_constant_list[system_constant_index] != -1; ++system_constant_index) { int system_constant = system_constant_list[system_constant_index]; debug_file_printf("<constant>"); debug_file_printf ("<identifier>#%s</identifier>", system_constants.keywords[system_constant]); debug_file_printf ("<value>%d</value>", value_of_system_constant(system_constant)); debug_file_printf("</constant>"); } } extern void end_debug_file() { write_debug_system_constants(); debug_file_printf("</inform-story-file>\n"); if (glulx_mode) { apply_debug_information_backpatches(&object_backpatch_accumulator); } else { apply_debug_information_backpatches(&packed_code_backpatch_accumulator); } apply_debug_information_backpatches(&code_backpatch_accumulator); apply_debug_information_backpatches(&global_backpatch_accumulator); apply_debug_information_backpatches(&array_backpatch_accumulator); apply_debug_information_backpatches(&grammar_backpatch_accumulator); apply_debug_information_symbol_backpatches(); close_debug_file(); } /* ========================================================================= */ /* Data structure management routines */ /* ------------------------------------------------------------------------- */ extern void init_files_vars(void) { malloced_bytes = 0; checksum_low_byte = 0; /* Z-code */ checksum_high_byte = 0; checksum_long = 0; /* Glulx */ checksum_count = 0; transcript_open = FALSE; } extern void files_begin_prepass(void) { total_files = 0; total_input_files = 0; current_input_file = 0; current_origsource_file = 0; } extern void files_begin_pass(void) { total_chars_read=0; } static void initialise_accumulator (debug_backpatch_accumulator *accumulator, int32 (* backpatching_function)(int32)) { accumulator->number_of_values_to_backpatch = 0; accumulator->number_of_available_backpatches = INITIAL_DEBUG_INFORMATION_BACKPATCH_ALLOCATION; accumulator->values_and_backpatch_positions = my_malloc (sizeof(value_and_backpatch_position) * accumulator->number_of_available_backpatches, "values and debug information backpatch positions"); accumulator->backpatching_function = backpatching_function; } extern void files_allocate_arrays(void) { initialise_memory_list(&InputFiles_memlist, sizeof(FileId), 16, (void**)&InputFiles, "input file storage"); if (debugfile_switch) { if (glulx_mode) { initialise_accumulator (&object_backpatch_accumulator, &backpatch_object_address); } else { initialise_accumulator (&packed_code_backpatch_accumulator, &backpatch_packed_code_address); } initialise_accumulator (&code_backpatch_accumulator, &backpatch_code_address); initialise_accumulator (&global_backpatch_accumulator, &backpatch_global_address); initialise_accumulator (&array_backpatch_accumulator, &backpatch_array_address); initialise_accumulator (&grammar_backpatch_accumulator, &backpatch_grammar_address); } } static void tear_down_accumulator(debug_backpatch_accumulator *accumulator) { my_free (&(accumulator->values_and_backpatch_positions), "values and debug information backpatch positions"); } extern void files_free_arrays(void) { int ix; for (ix=0; ix<total_files; ix++) { my_free(&InputFiles[ix].filename, "filename storage"); } deallocate_memory_list(&InputFiles_memlist); if (debugfile_switch) { if (!glulx_mode) { tear_down_accumulator(&object_backpatch_accumulator); } else { tear_down_accumulator(&packed_code_backpatch_accumulator); } tear_down_accumulator(&code_backpatch_accumulator); tear_down_accumulator(&global_backpatch_accumulator); tear_down_accumulator(&array_backpatch_accumulator); tear_down_accumulator(&grammar_backpatch_accumulator); } } /* ========================================================================= */
5c2696251f065c751dd5e0f6454d2de77f17dcd0
8e56b05b32a978eb170e01409a7aaaa1fc755979
/include/sys/fdt.h
94c7487e7cecd10e12718d356d1523f2c1a3961a
[]
permissive
cahirwpz/mimiker
d71f37c2c6efc58a0026e8e4cfcd676d85ef7445
5343231aeeeb0d16b2419f84405f52981dc51c07
refs/heads/master
2023-09-01T20:20:07.256932
2023-08-30T18:36:27
2023-08-30T18:36:27
46,346,617
278
67
BSD-3-Clause
2023-09-14T16:57:32
2015-11-17T12:46:47
C
UTF-8
C
false
false
8,830
h
fdt.h
/* * Based on the following FreeBSD files: * - `sys/dev/fdt/fdt_common.c`, * - `sys/dev/ofw/openfirm.c`, * - `sys/dev/ofw/ofw_fdt.c`. * * More details regarding most presented functions can be found on appropriate * FreeBSD manual pages. */ #ifndef _SYS_FDT_H_ #define _SYS_FDT_H_ #include <sys/types.h> #define FDT_MAX_RSV_MEM_REGS 16 #define FDT_MAX_REG_TUPLES 16 #define FDT_MAX_ICELLS 3 #define FDT_MAX_INTRS 16 typedef uint32_t phandle_t; typedef uint32_t pcell_t; #define FDT_NODEV ((phandle_t)-1) /* * FDT memory region. */ typedef struct fdt_mem_reg { u_long addr; u_long size; } fdt_mem_reg_t; /* * FDT interrupt resource. */ typedef struct fdt_intr { pcell_t tuple[FDT_MAX_ICELLS]; int icells; phandle_t iparent; } fdt_intr_t; /* * FDT initialization. * * Must be called during MD bootstrap before the kernel environment is built. * This is the first FDT function that gets called. * * Arguments: * - `va`: FDT kernel virtual address */ void FDT_init(void *va); /* * Find the package handle of a pointed device in the device tree. * * Arguments: * - `device`: device path * * Returns: * - `FDT_NODEV`: the path could not be found * - otherwise: phandle of the requested device */ phandle_t FDT_finddevice(const char *device); /* * Obtain the handle of the first child of device node `node`. * * Returns: * - `FDT_NODEV`: the node doesn't have any subnodes * - otherwise: phandle of the first child */ phandle_t FDT_child(phandle_t node); /* * Obtain the handle of the next sibling of device node `node`. * * `FDT_child` and `FDT_peer` are used to iterate over all children * of a given device node. Here is example code: * * for (phandle_t child = FDT_child(rsv); child != FDT_NODEV; * child = FDT_peer(child)) { * ... * } * * Returns: * - `FDT_NODEV`: the node doesn't have any siblings * - otherwise: phandle of the peer */ phandle_t FDT_peer(phandle_t node); /* * Get the handle of the parent of device node `node`. * * Returns * - `FDT_NODEV`: the pointed node or FDT state is invalid * - 0: `node` is the root node * - otherwise: phandle of the parent node */ phandle_t FDT_parent(phandle_t node); /* * Returns a pointer to the name of `node`. */ const char *FDT_getname(phandle_t node); /* * Obtain the length of the value associated with property `propname` * in node `node`. * * Returns: * - >= 0: the actual length * - -1: the property does not exist in the pointed node */ ssize_t FDT_getproplen(phandle_t node, const char *propname); /* * Verify if node `node` has property specified by `propname`. * * Returns: * - 1: the device node has the `propname` property * - 0: the property does not exist in the pointed node */ int FDT_hasprop(phandle_t node, const char *propname); /* * Copy maximum of `buflen` bytes from the value associated with the property * `propname` of the device node `node` into the memory specified by `buf`. * * `buflen` is specified in bytes not in cells. * * Returns: * - >= 0: actual size of the property in bytes * - -1: the property does not exist in the pointed node */ ssize_t FDT_getprop(phandle_t node, const char *propname, pcell_t *buf, size_t buflen); /* * The same as `FDT_getprop` but the copied cells are converted * from big-endian to host byte order. * * `buflen` must be divisible by 4 (`sizeof(pcell_t)`), * otherwise -1 is returned. */ ssize_t FDT_getencprop(phandle_t node, const char *propname, pcell_t *buf, size_t buflen); /* * Like `FDT_getencprop` but if `node` doesn't contain `propname`, * the function looks for its closest ancestor equipped with the property. */ ssize_t FDT_searchencprop(phandle_t node, const char *propname, pcell_t *buf, size_t len); /* * Copy the value of property `porpname` of device node `node` * into a newly allocated area returned via `bufp`. * * `propname` must be a property consisting of elements each of `elsz` bytes. * * Returns: * - >= 0: number of elements composing `propname` * - -1: the property does not exist or its length is not divisible by `elsz` */ ssize_t FDT_getprop_alloc_multi(phandle_t node, const char *propname, int elsz, void **bufp); /* * The same as `FDT_getprop_alloc_multi` but the copied cells are converted * from big-endian to host byte order. */ ssize_t FDT_getencprop_alloc_multi(phandle_t node, const char *propname, int elsz, void **bufp); /* * Free memory allocated by an `FDT_*alloc*` function. */ void FDT_free(void *buf); /* * Obtain the "#address-cells" and "#size-cells" properties * of device node `node`. * * Arguments: * - `addr_cellsp`: dst of the "#address-cells" property value * - `size_cellsp`: dst of the "#size-cells" property value * * Returns * - 0: success * - `ERANGE`: either "#address-cells" or "#size-cells" specifies a value * that cannot be handled by the FDT module */ int FDT_addrsize_cells(phandle_t node, int *addr_cellsp, int *size_cellsp); /* * Obtain the "#interrupt-cells" property of device node `node`. * * Arguments: * - `intr_cellsp`: dst for the property value * * Returns * - 0: success * - `ERANGE`: "#interrupt-cells" specifies a value * that cannot be handled by the FDT module */ int FDT_intr_cells(phandle_t node, int *intr_cellsp); /* * Convert a 32- or 64-bit value contained in cell buffer `data` * into an unsigned long host value. * * Arguments: * - `cells`: specified the size of the value contained in `data` * (`sizeof(uint32_t)` or `sizeof(uint64_t)`) */ u_long FDT_data_get(pcell_t *data, int cells); /* * Convert an (addr, size) property contained in `data` to host unsigned long * values. * * Arguments: * - `addr_cells`: size of the address portion * - `size_cells`: size of the size portion * - `addrp`: dst for the converted address * - `sizep`: dst for the converted size * * Returns: * - 0: success * - `ERANGE`: the property is too big to be handled by the FDT module */ int FDT_data_to_res(pcell_t *data, int addr_cells, int size_cells, u_long *addrp, u_long *sizep); /* * Obtain reserved memory regions of the FDT. * * The FDT module handles up to `FDT_MAX_RSV_MEM_REGS` reserved memory regions. * It is assumed that the length of provided memory region buffer `mrs` * is at least `FDT_MAX_RSV_MEM_REGS`. * * Arguments: * - `mrs`: FDT memory region buffer. This will be populated by the call. * - `cntp`: The number of reserved memory regions contained in the FDT. * * Returns: * - 0: success * - `ENXIO`: the "/reserved-memory" device node could not be found * - `ERANGE`: subnodes of the "/reserved-memory" node are too big * to be handled by the FDT module, or there is too much of them */ int FDT_get_reserved_mem(fdt_mem_reg_t *mrs, size_t *cntp); /* * Obtain physical memory regions of the FDT. * * The FDT module handles up to `FDT_MAX_REG_TUPLES` memory regions. * It is assumed that the length of provided memory region buffer `mrs` * is at least `FDT_MAX_REG_TUPLES`. * * Arguments: * - `mrs`: FDT memory region buffer. This will be populated by the call. * - `cntp`: The number of memory regions contained in the FDT. * - `sizep`: Total size of all physical memory regions. * * Returns: * - 0: success * - `ENXIO`: the "/memory" device node could not be found or it does not * contain a region property * - `ERANGE`: the region property is too big or the totalsize of * physical memory is zero */ int FDT_get_mem(fdt_mem_reg_t *mrs, size_t *cntp, size_t *sizep); /* * Obtain the boundaries of the initial ramdisk specified in the "/chosen" * device node. * * Arguments: * - `mr`: FDT memory region to fill by the call * * Returns: * - 0: success * - `ENXIO`: the "/chosen" node could not be found or the initrd boundaries * are not included in the node * - `ERANGE`: either start address of end address property is too big * to be handled by the FDT module */ int FDT_get_chosen_initrd(fdt_mem_reg_t *mr); /* * Obtain the bootargs property of the "/chosen" node. * * Arguments: * - `bootargsp`: dst for the address of the bootargs property in the FDT blob * * Returns: * - 0: success * - `ENXIO`: the "/chosen" node could not be found or the bootargs property * is not included */ int FDT_get_chosen_bootargs(const char **bootargsp); /* * Check whether device node `node` is compatible * with device specified by `compatible`. * * All compatible strings of the device are examined. * * Return: * - 0: no match * - 1: match */ int FDT_is_compatible(phandle_t node, const char *compatible); #endif /* !_SYS_FDT_H_ */
f8dd5bb08a69ea81681bba150bb034b92fb3fb40
6b46ce351ec9ffeff88c29054ee0e3da960fdf61
/DrOpt/dropt/include/dropt.h
2cd66b17e85c18e7af4bf0a45ce9379a97c0be9b
[ "Zlib", "Apache-2.0" ]
permissive
libgdx/packr
5deb312986195c0b18dad051cc99864db1fd8e16
11da843b4baac1d6eaa1453db892c54185a36f82
refs/heads/master
2023-08-05T02:59:35.358843
2022-05-26T03:46:01
2022-05-26T03:46:01
18,188,420
1,695
195
Apache-2.0
2023-01-12T03:30:49
2014-03-27T19:24:30
C
UTF-8
C
false
false
8,308
h
dropt.h
/** dropt.h * * A deliberately rudimentary command-line option parser. * * Version 1.1.1 * * Copyright (c) 2006-2012 James D. Lin <jameslin@cal.berkeley.edu> * * The latest version of this file can be downloaded from: * <http://www.taenarum.com/software/dropt/> * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * * 3. This notice may not be removed or altered from any source distribution. */ #ifndef DROPT_H #define DROPT_H #include <stdio.h> #include <wchar.h> #ifdef __cplusplus extern "C" { #endif #ifndef DROPT_USE_WCHAR #if defined _UNICODE && (defined _MSC_VER || defined DROPT_NO_STRING_BUFFERS) #define DROPT_USE_WCHAR 1 #endif #endif #ifdef DROPT_USE_WCHAR /* This may be used for both char and string literals. */ #define DROPT_TEXT_LITERAL(s) L ## s typedef wchar_t dropt_char; #else #define DROPT_TEXT_LITERAL(s) s typedef char dropt_char; #endif enum { /* Errors in the range [0x00, 0x7F] are reserved for dropt. */ dropt_error_none, dropt_error_unknown, dropt_error_bad_configuration, dropt_error_insufficient_memory, dropt_error_invalid_option, dropt_error_insufficient_arguments, dropt_error_mismatch, dropt_error_overflow, dropt_error_underflow, /* Errors in the range [0x80, 0xFFFF] are free for clients to use. */ dropt_error_custom_start = 0x80, dropt_error_custom_last = 0xFFFF }; typedef unsigned int dropt_error; typedef unsigned char dropt_bool; /* Opaque. */ typedef struct dropt_context dropt_context; /** dropt_option_handler_func callbacks are responsible for parsing * individual options. * * dropt_option_handler_decl may be used for declaring the callback * functions; dropt_option_handler_func is the actual function pointer * type. * * optionArgument will be NULL if no argument is specified for an option. * It will be the empty string if the user explicitly passed an empty * string as the argument (e.g. --option=""). * * An option that doesn't expect an argument still can receive a non-NULL * value for optionArgument if the user explicitly specified one (e.g. * --option=arg). * * If the option's argument is optional, the handler might be called * twice: once with a candidate argument, and if that argument is rejected * by the handler, again with no argument. Handlers should be aware of * this if they have side-effects. * * handlerData is the client-specified value specified in the dropt_option * table. */ typedef dropt_error dropt_option_handler_decl(dropt_context* context, const dropt_char* optionArgument, void* handlerData); typedef dropt_option_handler_decl* dropt_option_handler_func; /** dropt_error_handler_func callbacks are responsible for generating error * messages. The returned string must be allocated on the heap and must * be freeable with free(). */ typedef dropt_char* (*dropt_error_handler_func)(dropt_error error, const dropt_char* optionName, const dropt_char* optionArgument, void* handlerData); /** dropt_strncmp_func callbacks allow callers to provide their own (possibly * case-insensitive) string comparison function. */ typedef int (*dropt_strncmp_func)(const dropt_char* s, const dropt_char* t, size_t n); /** Properties defining each option: * * short_name: * The option's short name (e.g. the 'h' in -h). * Use '\0' if the option has no short name. * * long_name: * The option's long name (e.g. "help" in --help). * Use NULL if the option has no long name. * * description: * The description shown when generating help. * May be NULL for undocumented options. * * arg_description: * The description for the option's argument (e.g. --option=argument * or --option argument), printed when generating help. If NULL, the * option does not take an argument. * * handler: * The handler callback and data invoked in response to encountering * the option. * * handler_data: * Callback data for the handler. For typical handlers, this is * usually the address of a variable for the handler to modify. * * attr: * Miscellaneous attributes. See below. */ typedef struct dropt_option { dropt_char short_name; const dropt_char* long_name; const dropt_char* description; const dropt_char* arg_description; dropt_option_handler_func handler; void* handler_data; unsigned int attr; } dropt_option; /** Bitwise flags for option attributes: * * dropt_attr_halt: * Stop processing when this option is encountered. * * dropt_attr_hidden: * Don't list the option when generating help. Use this for * undocumented options. * * dropt_attr_optional_val: * The option's argument is optional. If an option has this * attribute, the handler callback may be invoked twice (once with a * potential argument, and if that fails, again with a NULL argument). */ enum { dropt_attr_halt = (1 << 0), dropt_attr_hidden = (1 << 1), dropt_attr_optional_val = (1 << 2) }; typedef struct dropt_help_params { unsigned int indent; unsigned int description_start_column; dropt_bool blank_lines_between_options; } dropt_help_params; dropt_context* dropt_new_context(const dropt_option* options); void dropt_free_context(dropt_context* context); const dropt_option* dropt_get_options(const dropt_context* context); void dropt_set_error_handler(dropt_context* context, dropt_error_handler_func handler, void* handlerData); void dropt_set_strncmp(dropt_context* context, dropt_strncmp_func cmp); /* Use this only for backward compatibility purposes. */ void dropt_allow_concatenated_arguments(dropt_context* context, dropt_bool allow); dropt_char** dropt_parse(dropt_context* context, int argc, dropt_char** argv); dropt_error dropt_get_error(const dropt_context* context); void dropt_get_error_details(const dropt_context* context, dropt_char** optionName, dropt_char** optionArgument); const dropt_char* dropt_get_error_message(dropt_context* context); void dropt_clear_error(dropt_context* context); #ifndef DROPT_NO_STRING_BUFFERS dropt_char* dropt_default_error_handler(dropt_error error, const dropt_char* optionName, const dropt_char* optionArgument); void dropt_init_help_params(dropt_help_params* helpParams); dropt_char* dropt_get_help(const dropt_context* context, const dropt_help_params* helpParams); void dropt_print_help(FILE* f, const dropt_context* context, const dropt_help_params* helpParams); #endif /* Stock option handlers for common types. */ dropt_option_handler_decl dropt_handle_bool; dropt_option_handler_decl dropt_handle_verbose_bool; dropt_option_handler_decl dropt_handle_int; dropt_option_handler_decl dropt_handle_uint; dropt_option_handler_decl dropt_handle_double; dropt_option_handler_decl dropt_handle_string; #define DROPT_MISUSE(message) dropt_misuse(message, __FILE__, __LINE__) void dropt_misuse(const char* message, const char* filename, int line); #ifdef __cplusplus } /* extern "C" */ #endif #endif /* DROPT_H */
c8cffe12336098ac5b8c8921e3557e8f2d0edf3d
73b0f9c30d07993ad74f7f2bcbc0fe61f1d1a3ce
/native/iosTest/Pods/Headers/Private/RCT-Folly/folly/io/async/TimeoutManager.h
9191c0b6dbb2b22b40ab0b121617d19aae68225b
[ "MIT" ]
permissive
Nozbe/WatermelonDB
84771a637e2c93474220fadee442e5c4ade40f7e
fd41fe279e229e9b5013b1dddf777cd7919e1d2d
refs/heads/master
2023-08-16T18:24:04.893973
2023-08-11T11:44:46
2023-08-11T11:44:46
146,468,829
9,358
670
MIT
2023-09-10T08:04:55
2018-08-28T15:32:05
JavaScript
UTF-8
C
false
false
59
h
TimeoutManager.h
../../../../../../RCT-Folly/folly/io/async/TimeoutManager.h
a8f09a840617cda0e27e7991474d05d7c14d98d1
30c2631ed046d7662476b94fb7f5286c47377f60
/src/addons/parser.c
8e02040903f56b539ad06f6df37d285a291b718a
[ "MIT" ]
permissive
SanderMertens/flecs
a840093340f0d1eb2bd30ec1585296f81f2aab39
41fb856c4e1162f44b59d7881ef508d64d56bf10
refs/heads/master
2023-08-24T16:21:41.790084
2023-08-24T08:38:57
2023-08-24T08:49:52
146,155,284
4,731
456
MIT
2023-09-05T16:01:58
2018-08-26T05:53:05
C
UTF-8
C
false
false
27,904
c
parser.c
/** * @file addons/parser.c * @brief Parser addon. */ #include "flecs.h" #ifdef FLECS_PARSER #include "../private_api.h" #include <ctype.h> #define TOK_COLON ':' #define TOK_AND ',' #define TOK_OR "||" #define TOK_NOT '!' #define TOK_OPTIONAL '?' #define TOK_BITWISE_OR '|' #define TOK_BRACKET_OPEN '[' #define TOK_BRACKET_CLOSE ']' #define TOK_SCOPE_OPEN '{' #define TOK_SCOPE_CLOSE '}' #define TOK_VARIABLE '$' #define TOK_PAREN_OPEN '(' #define TOK_PAREN_CLOSE ')' #define TOK_EQ "==" #define TOK_NEQ "!=" #define TOK_MATCH "~=" #define TOK_EXPR_STRING '"' #define TOK_SELF "self" #define TOK_UP "up" #define TOK_DOWN "down" #define TOK_CASCADE "cascade" #define TOK_PARENT "parent" #define TOK_OVERRIDE "OVERRIDE" #define TOK_ROLE_AND "AND" #define TOK_ROLE_OR "OR" #define TOK_ROLE_NOT "NOT" #define TOK_ROLE_TOGGLE "TOGGLE" #define TOK_IN "in" #define TOK_OUT "out" #define TOK_INOUT "inout" #define TOK_INOUT_NONE "none" static const ecs_id_t ECS_OR = (1ull << 59); static const ecs_id_t ECS_NOT = (1ull << 58); #define ECS_MAX_TOKEN_SIZE (256) typedef char ecs_token_t[ECS_MAX_TOKEN_SIZE]; const char* ecs_parse_ws_eol( const char *ptr) { while (isspace(*ptr)) { ptr ++; } return ptr; } const char* ecs_parse_ws( const char *ptr) { while ((*ptr != '\n') && isspace(*ptr)) { ptr ++; } return ptr; } const char* ecs_parse_digit( const char *ptr, char *token) { char *tptr = token; char ch = ptr[0]; if (!isdigit(ch) && ch != '-') { ecs_parser_error(NULL, NULL, 0, "invalid start of number '%s'", ptr); return NULL; } tptr[0] = ch; tptr ++; ptr ++; for (; (ch = *ptr); ptr ++) { if (!isdigit(ch) && (ch != '.') && (ch != 'e')) { break; } tptr[0] = ch; tptr ++; } tptr[0] = '\0'; return ptr; } /* -- Private functions -- */ bool flecs_isident( char ch) { return isalpha(ch) || (ch == '_'); } static bool flecs_valid_identifier_start_char( char ch) { if (ch && (flecs_isident(ch) || (ch == '*') || (ch == '0') || (ch == TOK_VARIABLE) || isdigit(ch))) { return true; } return false; } static bool flecs_valid_token_start_char( char ch) { if ((ch == '"') || (ch == '{') || (ch == '}') || (ch == ',') || (ch == '-') || (ch == '[') || (ch == ']') || (ch == '`') || flecs_valid_identifier_start_char(ch)) { return true; } return false; } static bool flecs_valid_token_char( char ch) { if (ch && (flecs_isident(ch) || isdigit(ch) || ch == '.' || ch == '"')) { return true; } return false; } static bool flecs_valid_operator_char( char ch) { if (ch == TOK_OPTIONAL || ch == TOK_NOT) { return true; } return false; } const char* ecs_parse_token( const char *name, const char *expr, const char *ptr, char *token_out, char delim) { int64_t column = ptr - expr; ptr = ecs_parse_ws(ptr); char *tptr = token_out, ch = ptr[0]; if (!flecs_valid_token_start_char(ch)) { if (ch == '\0' || ch == '\n') { ecs_parser_error(name, expr, column, "unexpected end of expression"); } else { ecs_parser_error(name, expr, column, "invalid start of token '%s'", ptr); } return NULL; } tptr[0] = ch; tptr ++; ptr ++; if (ch == '{' || ch == '}' || ch == '[' || ch == ']' || ch == ',' || ch == '`') { tptr[0] = 0; return ptr; } int tmpl_nesting = 0; bool in_str = ch == '"'; for (; (ch = *ptr); ptr ++) { if (ch == '<') { tmpl_nesting ++; } else if (ch == '>') { if (!tmpl_nesting) { break; } tmpl_nesting --; } else if (ch == '"') { in_str = !in_str; } else if (!flecs_valid_token_char(ch) && !in_str) { break; } if (delim && (ch == delim)) { break; } tptr[0] = ch; tptr ++; } tptr[0] = '\0'; if (tmpl_nesting != 0) { ecs_parser_error(name, expr, column, "identifier '%s' has mismatching < > pairs", ptr); return NULL; } const char *next_ptr = ecs_parse_ws(ptr); if (next_ptr[0] == ':' && next_ptr != ptr) { /* Whitespace between token and : is significant */ ptr = next_ptr - 1; } else { ptr = next_ptr; } return ptr; } const char* ecs_parse_identifier( const char *name, const char *expr, const char *ptr, char *token_out) { if (!flecs_valid_identifier_start_char(ptr[0]) && (ptr[0] != '"')) { ecs_parser_error(name, expr, (ptr - expr), "expected start of identifier"); return NULL; } ptr = ecs_parse_token(name, expr, ptr, token_out, 0); return ptr; } static int flecs_parse_identifier( const char *token, ecs_term_id_t *out) { const char *tptr = token; if (tptr[0] == TOK_VARIABLE && tptr[1]) { out->flags |= EcsIsVariable; tptr ++; } if (tptr[0] == TOK_EXPR_STRING && tptr[1]) { out->flags |= EcsIsName; tptr ++; if (tptr[0] == TOK_NOT) { /* Already parsed */ tptr ++; } } char *name = ecs_os_strdup(tptr); out->name = name; ecs_size_t len = ecs_os_strlen(name); if (out->flags & EcsIsName) { if (name[len - 1] != TOK_EXPR_STRING) { ecs_parser_error(NULL, token, 0, "missing '\"' at end of string"); return -1; } else { name[len - 1] = '\0'; } } return 0; } static ecs_entity_t flecs_parse_role( const char *name, const char *sig, int64_t column, const char *token) { if (!ecs_os_strcmp(token, TOK_ROLE_AND)) { return ECS_AND; } else if (!ecs_os_strcmp(token, TOK_ROLE_OR)) { return ECS_OR; } else if (!ecs_os_strcmp(token, TOK_ROLE_NOT)) { return ECS_NOT; } else if (!ecs_os_strcmp(token, TOK_OVERRIDE)) { return ECS_OVERRIDE; } else if (!ecs_os_strcmp(token, TOK_ROLE_TOGGLE)) { return ECS_TOGGLE; } else { ecs_parser_error(name, sig, column, "invalid role '%s'", token); return 0; } } static ecs_oper_kind_t flecs_parse_operator( char ch) { if (ch == TOK_OPTIONAL) { return EcsOptional; } else if (ch == TOK_NOT) { return EcsNot; } else { ecs_throw(ECS_INTERNAL_ERROR, NULL); } error: return 0; } static const char* flecs_parse_annotation( const char *name, const char *sig, int64_t column, const char *ptr, ecs_inout_kind_t *inout_kind_out) { char token[ECS_MAX_TOKEN_SIZE]; ptr = ecs_parse_identifier(name, sig, ptr, token); if (!ptr) { return NULL; } if (!ecs_os_strcmp(token, TOK_IN)) { *inout_kind_out = EcsIn; } else if (!ecs_os_strcmp(token, TOK_OUT)) { *inout_kind_out = EcsOut; } else if (!ecs_os_strcmp(token, TOK_INOUT)) { *inout_kind_out = EcsInOut; } else if (!ecs_os_strcmp(token, TOK_INOUT_NONE)) { *inout_kind_out = EcsInOutNone; } ptr = ecs_parse_ws(ptr); if (ptr[0] != TOK_BRACKET_CLOSE) { ecs_parser_error(name, sig, column, "expected ]"); return NULL; } return ptr + 1; } static uint8_t flecs_parse_set_token( const char *token) { if (!ecs_os_strcmp(token, TOK_SELF)) { return EcsSelf; } else if (!ecs_os_strcmp(token, TOK_UP)) { return EcsUp; } else if (!ecs_os_strcmp(token, TOK_DOWN)) { return EcsDown; } else if (!ecs_os_strcmp(token, TOK_CASCADE)) { return EcsCascade; } else if (!ecs_os_strcmp(token, TOK_PARENT)) { return EcsParent; } else { return 0; } } static const char* flecs_parse_term_flags( const ecs_world_t *world, const char *name, const char *expr, int64_t column, const char *ptr, char *token, ecs_term_id_t *id, char tok_end) { char token_buf[ECS_MAX_TOKEN_SIZE] = {0}; if (!token) { token = token_buf; ptr = ecs_parse_identifier(name, expr, ptr, token); if (!ptr) { return NULL; } } do { uint8_t tok = flecs_parse_set_token(token); if (!tok) { ecs_parser_error(name, expr, column, "invalid set token '%s'", token); return NULL; } if (id->flags & tok) { ecs_parser_error(name, expr, column, "duplicate set token '%s'", token); return NULL; } id->flags |= tok; if (ptr[0] == TOK_PAREN_OPEN) { ptr ++; /* Relationship (overrides IsA default) */ if (!isdigit(ptr[0]) && flecs_valid_token_start_char(ptr[0])) { ptr = ecs_parse_identifier(name, expr, ptr, token); if (!ptr) { return NULL; } id->trav = ecs_lookup_fullpath(world, token); if (!id->trav) { ecs_parser_error(name, expr, column, "unresolved identifier '%s'", token); return NULL; } if (ptr[0] == TOK_AND) { ptr = ecs_parse_ws(ptr + 1); } else if (ptr[0] != TOK_PAREN_CLOSE) { ecs_parser_error(name, expr, column, "expected ',' or ')'"); return NULL; } } if (ptr[0] != TOK_PAREN_CLOSE) { ecs_parser_error(name, expr, column, "expected ')', got '%c'", ptr[0]); return NULL; } else { ptr = ecs_parse_ws(ptr + 1); if (ptr[0] != tok_end && ptr[0] != TOK_AND && ptr[0] != 0) { ecs_parser_error(name, expr, column, "expected end of set expr"); return NULL; } } } /* Next token in set expression */ if (ptr[0] == TOK_BITWISE_OR) { ptr ++; if (flecs_valid_token_start_char(ptr[0])) { ptr = ecs_parse_identifier(name, expr, ptr, token); if (!ptr) { return NULL; } } /* End of set expression */ } else if (ptr[0] == tok_end || ptr[0] == TOK_AND || !ptr[0]) { break; } } while (true); return ptr; } static const char* flecs_parse_arguments( const ecs_world_t *world, const char *name, const char *expr, int64_t column, const char *ptr, char *token, ecs_term_t *term) { (void)column; int32_t arg = 0; do { if (flecs_valid_token_start_char(ptr[0])) { if (arg == 2) { ecs_parser_error(name, expr, (ptr - expr), "too many arguments in term"); return NULL; } ptr = ecs_parse_identifier(name, expr, ptr, token); if (!ptr) { return NULL; } ecs_term_id_t *term_id = NULL; if (arg == 0) { term_id = &term->src; } else if (arg == 1) { term_id = &term->second; } /* If token is a colon, the token is an identifier followed by a * set expression. */ if (ptr[0] == TOK_COLON) { if (flecs_parse_identifier(token, term_id)) { ecs_parser_error(name, expr, (ptr - expr), "invalid identifier '%s'", token); return NULL; } ptr = ecs_parse_ws(ptr + 1); ptr = flecs_parse_term_flags(world, name, expr, (ptr - expr), ptr, NULL, term_id, TOK_PAREN_CLOSE); if (!ptr) { return NULL; } /* Check for term flags */ } else if (!ecs_os_strcmp(token, TOK_CASCADE) || !ecs_os_strcmp(token, TOK_SELF) || !ecs_os_strcmp(token, TOK_UP) || !ecs_os_strcmp(token, TOK_DOWN) || !(ecs_os_strcmp(token, TOK_PARENT))) { ptr = flecs_parse_term_flags(world, name, expr, (ptr - expr), ptr, token, term_id, TOK_PAREN_CLOSE); if (!ptr) { return NULL; } /* Regular identifier */ } else if (flecs_parse_identifier(token, term_id)) { ecs_parser_error(name, expr, (ptr - expr), "invalid identifier '%s'", token); return NULL; } if (ptr[0] == TOK_AND) { ptr = ecs_parse_ws(ptr + 1); term->id_flags = ECS_PAIR; } else if (ptr[0] == TOK_PAREN_CLOSE) { ptr = ecs_parse_ws(ptr + 1); break; } else { ecs_parser_error(name, expr, (ptr - expr), "expected ',' or ')'"); return NULL; } } else { ecs_parser_error(name, expr, (ptr - expr), "expected identifier or set expression"); return NULL; } arg ++; } while (true); return ptr; } static void flecs_parser_unexpected_char( const char *name, const char *expr, const char *ptr, char ch) { if (ch && (ch != '\n')) { ecs_parser_error(name, expr, (ptr - expr), "unexpected character '%c'", ch); } else { ecs_parser_error(name, expr, (ptr - expr), "unexpected end of term"); } } static const char* flecs_parse_term( const ecs_world_t *world, const char *name, const char *expr, ecs_term_t *term_out) { const char *ptr = expr; char token[ECS_MAX_TOKEN_SIZE] = {0}; ecs_term_t term = { .move = true /* parser never owns resources */ }; ptr = ecs_parse_ws(ptr); /* Inout specifiers always come first */ if (ptr[0] == TOK_BRACKET_OPEN) { ptr = flecs_parse_annotation(name, expr, (ptr - expr), ptr + 1, &term.inout); if (!ptr) { goto error; } ptr = ecs_parse_ws(ptr); } if (flecs_valid_operator_char(ptr[0])) { term.oper = flecs_parse_operator(ptr[0]); ptr = ecs_parse_ws(ptr + 1); } /* If next token is the start of an identifier, it could be either a type * role, source or component identifier */ if (flecs_valid_identifier_start_char(ptr[0])) { ptr = ecs_parse_identifier(name, expr, ptr, token); if (!ptr) { goto error; } /* Is token a type role? */ if (ptr[0] == TOK_BITWISE_OR && ptr[1] != TOK_BITWISE_OR) { ptr ++; goto flecs_parse_role; } /* Is token a predicate? */ if (ptr[0] == TOK_PAREN_OPEN) { goto parse_predicate; } /* Next token must be a predicate */ goto parse_predicate; /* Pair with implicit subject */ } else if (ptr[0] == TOK_PAREN_OPEN) { goto parse_pair; /* Open query scope */ } else if (ptr[0] == TOK_SCOPE_OPEN) { term.first.id = EcsScopeOpen; term.src.id = 0; term.src.flags = EcsIsEntity; term.inout = EcsInOutNone; goto parse_done; /* Close query scope */ } else if (ptr[0] == TOK_SCOPE_CLOSE) { term.first.id = EcsScopeClose; term.src.id = 0; term.src.flags = EcsIsEntity; term.inout = EcsInOutNone; ptr = ecs_parse_ws(ptr + 1); goto parse_done; /* Nothing else expected here */ } else { flecs_parser_unexpected_char(name, expr, ptr, ptr[0]); goto error; } flecs_parse_role: term.id_flags = flecs_parse_role(name, expr, (ptr - expr), token); if (!term.id_flags) { goto error; } ptr = ecs_parse_ws(ptr); /* If next token is the source token, this is an empty source */ if (flecs_valid_token_start_char(ptr[0])) { ptr = ecs_parse_identifier(name, expr, ptr, token); if (!ptr) { goto error; } /* If not, it's a predicate */ goto parse_predicate; } else if (ptr[0] == TOK_PAREN_OPEN) { goto parse_pair; } else { ecs_parser_error(name, expr, (ptr - expr), "expected identifier after role"); goto error; } parse_predicate: if (flecs_parse_identifier(token, &term.first)) { ecs_parser_error(name, expr, (ptr - expr), "invalid identifier '%s'", token); goto error; } /* Set expression */ if (ptr[0] == TOK_COLON) { ptr = ecs_parse_ws(ptr + 1); ptr = flecs_parse_term_flags(world, name, expr, (ptr - expr), ptr, NULL, &term.first, TOK_COLON); if (!ptr) { goto error; } ptr = ecs_parse_ws(ptr); if (ptr[0] == TOK_AND || !ptr[0]) { goto parse_done; } if (ptr[0] != TOK_COLON) { ecs_parser_error(name, expr, (ptr - expr), "unexpected token '%c' after predicate set expression", ptr[0]); goto error; } ptr = ecs_parse_ws(ptr + 1); } else if (!ecs_os_strncmp(ptr, TOK_EQ, 2)) { ptr = ecs_parse_ws(ptr + 2); goto parse_eq; } else if (!ecs_os_strncmp(ptr, TOK_NEQ, 2)) { ptr = ecs_parse_ws(ptr + 2); goto parse_neq; } else if (!ecs_os_strncmp(ptr, TOK_MATCH, 2)) { ptr = ecs_parse_ws(ptr + 2); goto parse_match; } else { ptr = ecs_parse_ws(ptr); } if (ptr[0] == TOK_PAREN_OPEN) { ptr ++; if (ptr[0] == TOK_PAREN_CLOSE) { term.src.flags = EcsIsEntity; term.src.id = 0; ptr ++; ptr = ecs_parse_ws(ptr); } else { ptr = flecs_parse_arguments( world, name, expr, (ptr - expr), ptr, token, &term); } goto parse_done; } goto parse_done; parse_eq: term.src = term.first; term.first = (ecs_term_id_t){0}; term.first.id = EcsPredEq; goto parse_right_operand; parse_neq: term.src = term.first; term.first = (ecs_term_id_t){0}; term.first.id = EcsPredEq; if (term.oper != EcsAnd) { ecs_parser_error(name, expr, (ptr - expr), "invalid operator combination"); goto error; } term.oper = EcsNot; goto parse_right_operand; parse_match: term.src = term.first; term.first = (ecs_term_id_t){0}; term.first.id = EcsPredMatch; goto parse_right_operand; parse_right_operand: if (flecs_valid_token_start_char(ptr[0])) { ptr = ecs_parse_identifier(name, expr, ptr, token); if (!ptr) { goto error; } if (term.first.id == EcsPredMatch) { if (token[0] == '"' && token[1] == '!') { term.oper = EcsNot; } } if (flecs_parse_identifier(token, &term.second)) { ecs_parser_error(name, expr, (ptr - expr), "invalid identifier '%s'", token); goto error; } term.src.flags &= ~EcsTraverseFlags; term.src.flags |= EcsSelf; term.inout = EcsInOutNone; } else { ecs_parser_error(name, expr, (ptr - expr), "expected identifier"); goto error; } goto parse_done; parse_pair: ptr = ecs_parse_identifier(name, expr, ptr + 1, token); if (!ptr) { goto error; } if (ptr[0] == TOK_COLON) { ptr = ecs_parse_ws(ptr + 1); ptr = flecs_parse_term_flags(world, name, expr, (ptr - expr), ptr, NULL, &term.first, TOK_PAREN_CLOSE); if (!ptr) { goto error; } } if (ptr[0] == TOK_AND) { ptr = ecs_parse_ws(ptr + 1); if (ptr[0] == TOK_PAREN_CLOSE) { ecs_parser_error(name, expr, (ptr - expr), "expected identifier for second element of pair"); goto error; } term.src.id = EcsThis; term.src.flags |= EcsIsVariable; goto parse_pair_predicate; } else if (ptr[0] == TOK_PAREN_CLOSE) { term.src.id = EcsThis; term.src.flags |= EcsIsVariable; goto parse_pair_predicate; } else { flecs_parser_unexpected_char(name, expr, ptr, ptr[0]); goto error; } parse_pair_predicate: if (flecs_parse_identifier(token, &term.first)) { ecs_parser_error(name, expr, (ptr - expr), "invalid identifier '%s'", token); goto error; } ptr = ecs_parse_ws(ptr); if (flecs_valid_token_start_char(ptr[0])) { ptr = ecs_parse_identifier(name, expr, ptr, token); if (!ptr) { goto error; } if (ptr[0] == TOK_COLON) { ptr = ecs_parse_ws(ptr + 1); ptr = flecs_parse_term_flags(world, name, expr, (ptr - expr), ptr, NULL, &term.second, TOK_PAREN_CLOSE); if (!ptr) { goto error; } } if (ptr[0] == TOK_PAREN_CLOSE) { ptr ++; goto parse_pair_object; } else { flecs_parser_unexpected_char(name, expr, ptr, ptr[0]); goto error; } } else if (ptr[0] == TOK_PAREN_CLOSE) { /* No object */ ptr ++; goto parse_done; } else { ecs_parser_error(name, expr, (ptr - expr), "expected pair object or ')'"); goto error; } parse_pair_object: if (flecs_parse_identifier(token, &term.second)) { ecs_parser_error(name, expr, (ptr - expr), "invalid identifier '%s'", token); goto error; } if (term.id_flags == 0) { term.id_flags = ECS_PAIR; } ptr = ecs_parse_ws(ptr); goto parse_done; parse_done: *term_out = term; return ptr; error: ecs_term_fini(&term); *term_out = (ecs_term_t){0}; return NULL; } static bool flecs_is_valid_end_of_term( const char *ptr) { if ((ptr[0] == TOK_AND) || /* another term with And operator */ (ptr[0] == TOK_OR[0]) || /* another term with Or operator */ (ptr[0] == '\n') || /* newlines are valid */ (ptr[0] == '\0') || /* end of string */ (ptr[0] == '/') || /* comment (in plecs) */ (ptr[0] == '{') || /* scope (in plecs) */ (ptr[0] == '}') || (ptr[0] == ':') || /* inheritance (in plecs) */ (ptr[0] == '=')) /* assignment (in plecs) */ { return true; } return false; } char* ecs_parse_term( const ecs_world_t *world, const char *name, const char *expr, const char *ptr, ecs_term_t *term) { ecs_check(world != NULL, ECS_INVALID_PARAMETER, NULL); ecs_check(ptr != NULL, ECS_INVALID_PARAMETER, NULL); ecs_check(term != NULL, ECS_INVALID_PARAMETER, NULL); ecs_term_id_t *src = &term->src; if (ptr != expr) { if (ptr[0]) { if (ptr[0] == ',') { ptr ++; } else if (ptr[0] == '|') { ptr += 2; } else if (ptr[0] == '{') { ptr ++; } else if (ptr[0] == '}') { /* nothing to be done */ } else { ecs_parser_error(name, expr, (ptr - expr), "invalid preceding token"); } } } ptr = ecs_parse_ws_eol(ptr); if (!ptr[0]) { *term = (ecs_term_t){0}; return ECS_CONST_CAST(char*, ptr); } if (ptr == expr && !strcmp(expr, "0")) { return ECS_CONST_CAST(char*, &ptr[1]); } /* Parse next element */ ptr = flecs_parse_term(world, name, ptr, term); if (!ptr) { goto error; } /* Check for $() notation */ if (term->first.name && !ecs_os_strcmp(term->first.name, "$")) { if (term->src.name) { /* Safe, parser owns name */ ecs_os_free(ECS_CONST_CAST(char*, term->first.name)); term->first = term->src; if (term->second.name) { term->src = term->second; } else { term->src.id = EcsThis; term->src.name = NULL; term->src.flags |= EcsIsVariable; } term->second.name = ecs_os_strdup(term->first.name); term->second.flags |= EcsIsVariable; } } /* Post-parse consistency checks */ /* If next token is OR, term is part of an OR expression */ if (!ecs_os_strncmp(ptr, TOK_OR, 2)) { /* An OR operator must always follow an AND or another OR */ if (term->oper != EcsAnd) { ecs_parser_error(name, expr, (ptr - expr), "cannot combine || with other operators"); goto error; } term->oper = EcsOr; } /* Term must either end in end of expression, AND or OR token */ if (!flecs_is_valid_end_of_term(ptr)) { if (!flecs_isident(ptr[0]) || ((ptr != expr) && (ptr[-1] != ' '))) { ecs_parser_error(name, expr, (ptr - expr), "expected end of expression or next term"); goto error; } } /* If the term just contained a 0, the expression has nothing. Ensure * that after the 0 nothing else follows */ if (term->first.name && !ecs_os_strcmp(term->first.name, "0")) { if (ptr[0]) { ecs_parser_error(name, expr, (ptr - expr), "unexpected term after 0"); goto error; } if (src->flags != 0) { ecs_parser_error(name, expr, (ptr - expr), "invalid combination of 0 with non-default subject"); goto error; } src->flags = EcsIsEntity; src->id = 0; /* Safe, parser owns string */ ecs_os_free(ECS_CONST_CAST(char*, term->first.name)); term->first.name = NULL; } /* Cannot combine EcsIsEntity/0 with operators other than AND */ if (term->oper != EcsAnd && ecs_term_match_0(term)) { if (term->first.id != EcsScopeOpen && term->first.id != EcsScopeClose) { ecs_parser_error(name, expr, (ptr - expr), "invalid operator for empty source"); goto error; } } /* Automatically assign This if entity is not assigned and the set is * nothing */ if (!(src->flags & EcsIsEntity)) { if (!src->name) { if (!src->id) { src->id = EcsThis; src->flags |= EcsIsVariable; } } } if (src->name && !ecs_os_strcmp(src->name, "0")) { src->id = 0; src->flags = EcsIsEntity; } /* Process role */ if (term->id_flags == ECS_AND) { term->oper = EcsAndFrom; term->id_flags = 0; } else if (term->id_flags == ECS_OR) { term->oper = EcsOrFrom; term->id_flags = 0; } else if (term->id_flags == ECS_NOT) { term->oper = EcsNotFrom; term->id_flags = 0; } ptr = ecs_parse_ws(ptr); return ECS_CONST_CAST(char*, ptr); error: if (term) { ecs_term_fini(term); } return NULL; } #endif
b9780778d06d33f4ad78281fc769d9d6857beda1
41c7328eadeab5ed7c0584b7db51996a05dd9f2d
/F1:F103/pl2303_snippet_naked/proto.c
5c7a9c27075efbc350d0ce9b0036393d5a130cea
[]
no_license
eddyem/stm32samples
1c00ccb8593ea270cae536c85f178a522f704ed5
dce73d358b1fca3e7fa397f5c6d0d5c1cb28aba0
refs/heads/master
2023-07-28T11:13:10.361942
2023-07-24T20:04:22
2023-07-24T20:04:22
32,647,425
152
42
null
null
null
null
UTF-8
C
false
false
1,582
c
proto.c
/* * This file is part of the pl2303 project. * Copyright 2020 Edward V. Emelianov <edward.emelianoff@gmail.com>. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "proto.h" #include "usb.h" #define USND(str) do{USB_send((uint8_t*)str, sizeof(str)-1);}while(0) const char *parse_cmd(const char *buf){ if(buf[1] != '\n') return buf; switch(*buf){ /*case 'p': pin_toggle(USBPU_port, USBPU_pin); USND("USB pullup is "); if(pin_read(USBPU_port, USBPU_pin)) USND("off\n"); else USND("on\n"); return NULL; break;*/ case 'R': USND("Soft reset\n"); NVIC_SystemReset(); break; case 'W': USND("Wait for reboot\n"); while(1){nop();}; break; default: // help return "'R' - software reset\n" "'W' - test watchdog\n" ; break; } return NULL; }
b354a9584381f5baf0ff21313a78151ee1a75ea2
10a8580aa44d33b7458429023c00de8c01ceda98
/agent/php_user_instrument_hashmap_key.h
5d8168c08f23b859d07ba5f7d591a10a8c9256b2
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
newrelic/newrelic-php-agent
87ad20e0a5abf0d2855e7d27a25c36454ae4389a
dfb359f0dbb53e4cbc5106b52c8f3807c7fc8d42
refs/heads/main
2023-08-15T10:28:24.372352
2023-08-14T17:29:31
2023-08-14T17:29:31
302,112,572
116
67
Apache-2.0
2023-09-13T18:33:47
2020-10-07T17:35:01
C
UTF-8
C
false
false
1,280
h
php_user_instrument_hashmap_key.h
/* * Copyright 2022 New Relic Corporation. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ /* * This file contains structure and API for the key of the hashmap that's used * to lookup the instrumentation of user functions. */ #ifndef PHP_USER_INSTRUMENT_HASHMAP_KEY_HDR #define PHP_USER_INSTRUMENT_HASHMAP_KEY_HDR #include "php_includes.h" #if ZEND_MODULE_API_NO >= ZEND_7_4_X_API_NO /* * The hashmap key constructed from zend_function metadata */ typedef struct _nr_php_wraprec_hashmap_key { /* using refcounted zend_string for performance */ zend_string* scope_name; zend_string* function_name; zend_string* filename; uint32_t lineno; } nr_php_wraprec_hashmap_key_t; /* * Purpose : Populate key with zend_function's metadata. * * Params : 1. Pointer to the key to initialize * 2. Pointer to zend_function with metadata * * Returns : void */ extern void nr_php_wraprec_hashmap_key_set(nr_php_wraprec_hashmap_key_t*, const zend_function*); /* * Purpose : Release zend_strings referenced by the key. * * Params : 1. Pointer to the key with metadata to release * * Returns : void */ extern void nr_php_wraprec_hashmap_key_release(nr_php_wraprec_hashmap_key_t*); #endif #endif
8ed35bf65a2ce67a68ad0487e4671c8112fd9917
fdbb74a95924e2677466614f6ab6e2bb13b2a95a
/third_party/python/Modules/unicodedata_isnormalized.c
a9c3bdef3ba507f2ebb297f4aff8fc0faac1102c
[ "Python-2.0", "GPL-1.0-or-later", "LicenseRef-scancode-python-cwi", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-other-copyleft", "ISC" ]
permissive
jart/cosmopolitan
fb11b5658939023977060a7c6c71a74093d9cb44
0d748ad58e1063dd1f8560f18a0c75293b9415b7
refs/heads/master
2023-09-06T09:17:29.303607
2023-09-02T03:49:13
2023-09-02T03:50:18
272,457,606
11,887
435
ISC
2023-09-14T17:47:58
2020-06-15T14:16:13
C
UTF-8
C
false
false
2,202
c
unicodedata_isnormalized.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi│ ╞══════════════════════════════════════════════════════════════════════════════╡ │ Python 3 │ │ https://docs.python.org/3/license.html │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "third_party/python/Modules/unicodedata.h" /* clang-format off */ /** * Returns 1 if the input is certainly normalized, 0 if it might not be. */ int _PyUnicode_IsNormalized(PyObject *self, PyObject *input, int nfc, int k) { int kind; void *data; Py_ssize_t i, len; unsigned char prev_combining = 0, quickcheck_mask; /* An older version of the database is requested, quickchecks must be disabled. */ if (self && UCD_Check(self)) return 0; /* The two quickcheck bits at this shift mean 0=Yes, 1=Maybe, 2=No, as described in http://unicode.org/reports/tr15/#Annex8. */ quickcheck_mask = 3 << ((nfc ? 4 : 0) + (k ? 2 : 0)); i = 0; kind = PyUnicode_KIND(input); data = PyUnicode_DATA(input); len = PyUnicode_GET_LENGTH(input); while (i < len) { Py_UCS4 ch = PyUnicode_READ(kind, data, i++); const _PyUnicode_Record *record = _PyUnicode_GetRecord(ch); unsigned char combining = record->combining; unsigned char quickcheck = record->normalization_quick_check; if (quickcheck & quickcheck_mask) return 0; /* this string might need normalization */ if (combining && prev_combining > combining) return 0; /* non-canonical sort order, not normalized */ prev_combining = combining; } return 1; /* certainly normalized */ }
654f3257a29b91ca64554eb60edf96f76d02549a
06e63eafe97e0d887efd3b9ff51e3f0885fed9eb
/wdoc/norwegian_log_htm.h
7e44486d06587def221028088f0b204e5bbe2390
[]
no_license
vitotai/BrewPiLess
a63b79e10b52cd325e4b4d38b9f2776531b0ba21
2bad79f370eafc6f3d0df393277b5985ced1155e
refs/heads/master
2023-07-26T16:05:52.656689
2023-07-24T07:49:32
2023-07-24T07:49:32
63,991,508
332
165
null
2023-02-24T18:56:43
2016-07-23T00:34:53
C
UTF-8
C
false
false
74,737
h
norwegian_log_htm.h
const unsigned char logging_htm_gz[] PROGMEM = { 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xed, 0x7d, 0xdb, 0x76, 0xdb, 0x46, 0xb2, 0xe8, 0xf3, 0xc9, 0x57, 0x40, 0x98, 0xb1, 0x44, 0x8c, 0x40, 0x10, 0xa4, 0x48, 0x59, 0x22, 0x05, 0x6a, 0x26, 0x4e, 0x1c, 0x7b, 0x4f, 0x9c, 0x78, 0x22, 0x65, 0xb2, 0x67, 0x49, 0xda, 0x5e, 0x20, 0xd1, 0x24, 0x11, 0x81, 0x00, 0x37, 0x00, 0xea, 0x12, 0x9a, 0xf3, 0x1d, 0xe7, 0x07, 0xf6, 0x3f, 0xe4, 0x3d, 0x3f, 0x76, 0xaa, 0xfa, 0x02, 0x74, 0xe3, 0x42, 0x52, 0xb1, 0x33, 0x99, 0xb5, 0x8f, 0xed, 0x25, 0x09, 0xe8, 0xae, 0xae, 0xae, 0xae, 0xae, 0x5b, 0x57, 0x37, 0x80, 0xb3, 0xbd, 0x2f, 0xbe, 0x7d, 0x71, 0xf9, 0x8f, 0xb7, 0x5f, 0x6a, 0xb3, 0x74, 0x1e, 0x0c, 0xcf, 0xf0, 0xb7, 0x16, 0xb8, 0xe1, 0xd4, 0xd1, 0x43,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, 0xdb, 0xd3, 0xe5, 0xc9, 0x56, 0x44, 0x25, 0x74, 0x72, 0xcd, 0x1a, 0x30, 0xbe, 0xd3, 0x49, 0x22, 0xc5, 0x01, 0x87, 0xef, 0xdf, 0xb7, 0xf7, 0xc0, 0xfc, 0x28, 0xd3, 0x6d, 0x80, 0x59, 0x52, 0x38, 0x91, 0x35, 0xd2, 0x40, 0x55, 0xc6, 0xc4, 0xeb, 0xeb, 0x87, 0xe1, 0xa1, 0xae, 0x51, 0x1b, 0x07, 0xd7, 0xc5, 0xe6, 0xa6, 0xda, 0x8d, 0xb3, 0x67, 0x9b, 0x14, 0x84, 0x72, 0xb3, 0x81, 0xd5, 0x19, 0x87, 0x4a, 0xa0, 0x68, 0x8f, 0xd0, 0x51, 0x28, 0xc3, 0x51, 0x46, 0xc0, 0x2c, 0x55, 0x26, 0xbb, 0x7c, 0x6a, 0xce, 0xa5, 0x39, 0x58, 0xf7, 0x79, 0x21, 0x60, 0x17, 0x4a, 0x25, 0x37, 0x10, 0x65, 0xe7, 0x14, 0x52, 0xdc, 0x21, 0x29, 0xee, 0xbd, 0x0c, 0x07, 0xb7, 0xe7, 0x68, 0x2a, 0xfa, 0xf4, 0x92, 0x89, 0x10, 0x23, 0x55, 0x86, 0xca, 0x0a, 0x8b, 0x24, 0x64, 0x15, 0xd0, 0x12, 0x45, 0x46, 0x41, 0x2d, 0x06, 0xfd, 0xfe, 0xbd, 0x74, 0x23, 0x73, 0x06, 0x0c, 0x80, 0x7b, 0x47, 0x14, 0x3b, 0x61, 0x46, 0x26, 0xa8, 0x11, 0xf7, 0x42, 0xab, 0x79, 0x5f, 0x7f, 0xfb, 0xed, 0xc5, 0xa5, 0x6e, 0x82, 0x55, 0xec, 0xeb, 0xad, 0xc9, 0x62, 0x99, 0x26, 0xba, 0x89, 0x52, 0xd4, 0xd7, 0x17, 0x2e, 0x38, 0x5f, 0x3a, 0x49, 0xfb, 0x99, 0x47, 0x3e, 0x64, 0xa6, 0xf3, 0xf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;
c8a1f09791d6d866b6920a4d2805376b7a54f2d4
8838eb997879add5759b6dfb23f9a646464e53ca
/platform/lego_nxt/cmds/bt_control/bt_control.c
92f73724430796410640b7092ead115636770771
[ "BSD-2-Clause" ]
permissive
embox/embox
d6aacec876978522f01cdc4b8de37a668c6f4c80
98e3c06e33f3fdac10a29c069c20775568e0a6d1
refs/heads/master
2023-09-04T03:02:20.165042
2023-09-02T14:55:31
2023-09-02T14:55:31
33,078,138
1,087
325
BSD-2-Clause
2023-09-14T16:58:34
2015-03-29T15:27:48
C
UTF-8
C
false
false
1,541
c
bt_control.c
/** * @file * @brief * * @date 31.10.2011 * @author Anton Bondarev */ #include <stddef.h> #include <embox/cmd.h> #include <pnet/core/repo.h> #include <pnet/core/types.h> #include <pnet/core/graph.h> #include <pnet/node/direct_comm.h> #include <drivers/bluetooth/lego/blue_core4.h> EMBOX_CMD(bt_main); static struct net_node *add_mod(const char *str_id, struct pnet_graph *graph, struct net_node *prev) { struct net_node *node = pnet_get_module(str_id); if (node == NULL) { return NULL; } pnet_graph_add_node(graph, node); pnet_node_link(prev, node); return node; } static int bt_main(int argc, char **argv) { struct pnet_graph *graph ; struct net_node *hw_data, *hw_ctrl, *bc_data, *bc_ctrl, *dc_format_data, *dc_format_ctrl, *dc_exec; graph = pnet_graph_create("bt lego"); hw_data = pnet_get_module(BLUETOOTH_HW_BLUE_CORE4_DATA); pnet_graph_add_src(graph, hw_data); assert(hw_data); hw_ctrl = pnet_get_module(BLUETOOTH_HW_BLUE_CORE4_CTRL); pnet_graph_add_src(graph, hw_ctrl); assert(hw_ctrl); bc_data = add_mod(BLUETOOTH_DRV_BLUE_CORE4_DATA, graph, hw_data); bc_ctrl = add_mod(BLUETOOTH_DRV_BLUE_CORE4_CTRL, graph, hw_ctrl); assert(bc_data); assert(bc_ctrl); dc_format_data = add_mod(PNET_NODE_DIRECT_COMM_FORMATION_DATA, graph, bc_data); dc_format_ctrl = add_mod(PNET_NODE_DIRECT_COMM_FORMATION_CTRL, graph, bc_ctrl); assert(dc_format_data); assert(dc_format_ctrl); dc_exec = add_mod(PNET_NODE_DIRECT_COMM_EXECUTER, graph, dc_format_data); assert(dc_exec); return pnet_graph_start(graph); }
85b10c90f3462eab4067ee1407f5139bee93d794
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
/SOFTWARE/A64-TERES/u-boot_new/arch/nios2/cpu/cpu.c
e0dcbc201f32fe6fa34f6fbece7d92cd4cfa9903
[ "GPL-2.0-or-later", "LicenseRef-scancode-free-unknown", "Apache-2.0" ]
permissive
OLIMEX/DIY-LAPTOP
ae82f4ee79c641d9aee444db9a75f3f6709afa92
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
refs/heads/rel3
2023-08-04T01:54:19.483792
2023-04-03T07:18:12
2023-04-03T07:18:12
80,094,055
507
92
Apache-2.0
2023-04-03T07:05:59
2017-01-26T07:25:50
C
UTF-8
C
false
false
966
c
cpu.c
/* * (C) Copyright 2004, Psyent Corporation <www.psyent.com> * Scott McNutt <smcnutt@psyent.com> * * SPDX-License-Identifier: GPL-2.0+ */ #include <common.h> #include <nios2.h> #include <nios2-io.h> #include <asm/cache.h> #if defined (CONFIG_SYS_NIOS_SYSID_BASE) extern void display_sysid (void); #endif /* CONFIG_SYS_NIOS_SYSID_BASE */ int checkcpu (void) { printf ("CPU : Nios-II\n"); #if !defined(CONFIG_SYS_NIOS_SYSID_BASE) printf ("SYSID : <unknown>\n"); #else display_sysid (); #endif return (0); } int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { disable_interrupts(); /* indirect call to go beyond 256MB limitation of toolchain */ nios2_callr(CONFIG_SYS_RESET_ADDR); return 0; } int dcache_status(void) { return 1; } void dcache_enable(void) { flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE); } void dcache_disable(void) { flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE); }
5124186cb007b5c6b5c3d4ed68c9527a997ed032
aa3befea459382dc5c01c925653d54f435b3fb0f
/boards/arm/imxrt/teensy-4.x/src/imxrt_i2c.c
b7e05bb6b4bd896efb0771c1403ae9318b5d7d9b
[ "MIT-open-group", "BSD-3-Clause", "HPND-sell-variant", "BSD-4-Clause-UC", "LicenseRef-scancode-warranty-disclaimer", "MIT-0", "LicenseRef-scancode-bsd-atmel", "LicenseRef-scancode-gary-s-brown", "LicenseRef-scancode-proprietary-license", "SunPro", "MIT", "LicenseRef-scancode-public-domain-disclaimer", "LicenseRef-scancode-other-permissive", "HPND", "ISC", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "GPL-1.0-or-later", "CC-BY-2.0", "CC-BY-4.0" ]
permissive
apache/nuttx
14519a7bff4a87935d94fb8fb2b19edb501c7cec
606b6d9310fb25c7d92c6f95bf61737e3c79fa0f
refs/heads/master
2023-08-25T06:55:45.822534
2023-08-23T16:03:31
2023-08-24T21:25:47
228,103,273
407
241
Apache-2.0
2023-09-14T18:26:05
2019-12-14T23:27:55
C
UTF-8
C
false
false
3,271
c
imxrt_i2c.c
/**************************************************************************** * boards/arm/imxrt/teensy-4.x/src/imxrt_i2c.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The * ASF licenses this file to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance with the * License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. * ****************************************************************************/ /**************************************************************************** * Included Files ****************************************************************************/ #include <nuttx/config.h> #include <stdbool.h> #include <errno.h> #include <debug.h> #include <nuttx/i2c/i2c_master.h> #include <nuttx/sensors/bmp280.h> #include <imxrt_lpi2c.h> #include "teensy-4.h" #ifdef CONFIG_IMXRT_LPI2C #define BMP280_LPI2C 3 /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** * Name: imxrt_i2c_register * * Description: * Register I2C driver * ****************************************************************************/ #ifdef CONFIG_I2C_DRIVER static void imxrt_i2c_register(int bus) { struct i2c_master_s *i2c; int ret; i2c = imxrt_i2cbus_initialize(bus); if (i2c == NULL) { serr("ERROR: Failed to get I2C%d interface\n", bus); } else { ret = i2c_register(i2c, bus); if (ret < 0) { serr("ERROR: Failed to register I2C%d driver: %d\n", bus, ret); imxrt_i2cbus_uninitialize(i2c); } } #ifdef SENSORS_BMP280 if (BMP280_LPI2C == bus) { /* Register the BMP280 driver */ ret = bmp280_register(0, i2c); if (ret < 0) { serr("ERROR: Failed to register BMP280\n"); } } #endif } #endif /**************************************************************************** * Name: imxrt_i2c_setup * * Description: * Choose which I2C driver should be initialize * ****************************************************************************/ void imxrt_i2c_setup() { #if defined(CONFIG_I2C_DRIVER) && defined(CONFIG_IMXRT_LPI2C1) imxrt_i2c_register(1); #endif #if defined(CONFIG_I2C_DRIVER) && defined(CONFIG_IMXRT_LPI2C2) serr("ERROR: LPI2C2 is not on Teensy-4.x board\n"); #endif #if defined(CONFIG_I2C_DRIVER) && defined(CONFIG_IMXRT_LPI2C3) imxrt_i2c_register(3); #endif #if defined(CONFIG_I2C_DRIVER) && defined(CONFIG_IMXRT_LPI2C4) imxrt_i2c_register(4); #endif } #endif /* CONFIG_IMXRT_LPI2C */
ee77ffa79b204daf51df3fd7e93c95491df28316
e73547787354afd9b717ea57fe8dd0695d161821
/src/collision.c
bc4e86b88bc0da2cdd37f24fca333c262d40a8de
[]
no_license
pmret/papermario
8b514b19653cef8d6145e47499b3636b8c474a37
9774b26d93f1045dd2a67e502b6efc9599fb6c31
refs/heads/main
2023-08-31T07:09:48.951514
2023-08-21T18:07:08
2023-08-21T18:07:08
287,151,133
904
139
null
2023-09-14T02:44:23
2020-08-13T01:22:57
C
UTF-8
C
false
false
38,713
c
collision.c
#include "common.h" #include "model.h" typedef struct HitFile { /* 0x00 */ u32 collisionOffset; /* 0x04 */ u32 zoneOffset; } HitFile; // size = 0x08 typedef struct ColliderBackupEntry { /* 0x00 */ s32 flags; /* 0x04 */ s16 parentModelIndex; /* 0x06 */ char pad_06[2]; } ColliderBackupEntry; // size = 0x08 typedef struct HitFileHeader { /* 0x00 */ s16 numColliders; /* 0x02 */ char pad_02[2]; /* 0x04 */ s32 collidersOffset; /* 0x08 */ s16 numVertices; /* 0x0A */ char pad_0A[2]; /* 0x0C */ s32 verticesOffset; /* 0x10 */ s16 boundingBoxesDataSize; /* 0x12 */ char pad_12[2]; /* 0x14 */ s32 boundingBoxesOffset; } HitFileHeader; // size = 0x18 typedef struct HitAssetCollider { /* 0x00 */ s16 boundingBoxOffset; /* 0x02 */ s16 nextSibling; /* 0x04 */ s16 firstChild; /* 0x06 */ s16 numTriangles; /* 0x08 */ s32 trianglesOffset; } HitAssetCollider; // size = 0x0C SHIFT_BSS CollisionData gCollisionData; SHIFT_BSS CollisionData gZoneCollisionData; SHIFT_BSS f32 gCollisionRayStartX; SHIFT_BSS f32 gCollisionRayStartY; SHIFT_BSS f32 gCollisionRayStartZ; SHIFT_BSS f32 gCollisionRayDirX; SHIFT_BSS f32 gCollisionRayDirY; SHIFT_BSS f32 gCollisionRayDirZ; SHIFT_BSS f32 gCollisionPointX; SHIFT_BSS f32 gCollisionPointY; SHIFT_BSS f32 gCollisionPointZ; SHIFT_BSS f32 gCollisionRayLength; SHIFT_BSS f32 gCollisionNormalX; SHIFT_BSS f32 gCollisionNormalY; SHIFT_BSS f32 gCollisionNormalZ; SHIFT_BSS ColliderBackupEntry* gCollisionDataBackup; SHIFT_BSS ColliderBackupEntry* gCollisionDataZoneBackup; extern Vec3s gEntityColliderFaces[]; extern Vec3f gEntityColliderNormals[]; s32 collision_heap_create(void); void* collision_heap_malloc(s32 size); void collision_heap_free(void*); void load_hit_data(s32 idx, HitFile* hit); void _add_hit_vert_to_buffer(Vec3f** buf, Vec3f* vert, s32* bufSize); s32 _get_hit_vert_index_from_buffer(Vec3f** buffer, Vec3f* vert, s32* bufferSize); void backup_map_collision_data(void) { CollisionData* collisionData; Collider* collider; ColliderBackupEntry* backupEntry; s32 i; collisionData = &gCollisionData; gCollisionDataBackup = general_heap_malloc(collisionData->numColliders * sizeof(ColliderBackupEntry)); for (i = 0, backupEntry = gCollisionDataBackup; i < collisionData->numColliders; i++, backupEntry++) { collider = &collisionData->colliderList[i]; backupEntry->flags = collider->flags; backupEntry->parentModelIndex = collider->parentModelIndex; } collisionData = &gZoneCollisionData; gCollisionDataZoneBackup = general_heap_malloc(collisionData->numColliders * sizeof(ColliderBackupEntry)); for (i = 0, backupEntry = gCollisionDataZoneBackup; i < collisionData->numColliders; i++, backupEntry++) { collider = &collisionData->colliderList[i]; backupEntry->flags = collider->flags; backupEntry->parentModelIndex = collider->parentModelIndex; } gZoneCollisionData.numColliders = 0; } void func_8005AF84(void) { } void func_8005AF8C(void) { } void initialize_collision(void) { gCollisionData.numColliders = 0; gZoneCollisionData.numColliders = 0; collision_heap_create(); } void load_map_hit_asset(void) { u32 assetSize; MapSettings* map = get_current_map_settings(); void* compressedData = load_asset_by_name(wMapHitName, &assetSize); HitFile* uncompressedData = heap_malloc(assetSize); decode_yay0(compressedData, uncompressedData); general_heap_free(compressedData); map->hitAssetCollisionOffset = uncompressedData->collisionOffset; map->hitAssetZoneOffset = uncompressedData->zoneOffset; load_hit_data(0, uncompressedData); // Colliders load_hit_data(1, uncompressedData); // Zones heap_free(uncompressedData); } void restore_map_collision_data(void) { CollisionData* collisionData; Collider* collider; ColliderBackupEntry* backupEntry; s32 i; load_map_hit_asset(); collisionData = &gCollisionData; for (i = 0, backupEntry = gCollisionDataBackup; i < collisionData->numColliders; i++, backupEntry++) { collider = &collisionData->colliderList[i]; collider->flags = backupEntry->flags; collider->parentModelIndex = backupEntry->parentModelIndex; if (collider->flags != -1 && collider->flags & COLLIDER_FLAG_HAS_MODEL_PARENT) { parent_collider_to_model(i, collider->parentModelIndex); update_collider_transform(i); } } collisionData = &gZoneCollisionData; for (i = 0, backupEntry = gCollisionDataZoneBackup; i < collisionData->numColliders; i++, backupEntry++) { collider = &collisionData->colliderList[i]; collider->flags = backupEntry->flags; collider->parentModelIndex = backupEntry->parentModelIndex; } general_heap_free(gCollisionDataBackup); general_heap_free(gCollisionDataZoneBackup); } void load_battle_hit_asset(const char* hitName) { if (hitName == NULL) { gCollisionData.numColliders = 0; } else { u32 assetSize; MapSettings* map = get_current_map_settings(); void* compressedData = load_asset_by_name(hitName, &assetSize); HitFile* uncompressedData = heap_malloc(assetSize); decode_yay0(compressedData, uncompressedData); general_heap_free(compressedData); map->hitAssetCollisionOffset = uncompressedData->collisionOffset; load_hit_data(0, uncompressedData); heap_free(uncompressedData); } } void load_hit_data(s32 idx, HitFile* hit) { s32 collisionOffset; MapSettings* map; CollisionData* collisionData; HitFileHeader* assetCollisionData; Vec3f* vertices; Vec3s* assetVertices; u32* boundingBox; u32* assetBoundingBox; Collider* collider; HitAssetCollider* assetCollider; ColliderTriangle* triangle; s32* trianglePacked; s16 numTriangles; s32 i,j; f32 e13_y, e21_z, e13_z, e21_y, e21_x, e13_x, normalX, normalY, normalZ, coeff; assetCollisionData = NULL; collisionData = NULL; map = get_current_map_settings(); switch (idx) { case 0: // Colliders collisionOffset = map->hitAssetCollisionOffset; if (collisionOffset == 0) { return; } assetCollisionData = (HitFileHeader*)((void*)hit + collisionOffset); collisionData = &gCollisionData; break; case 1: // Zones collisionOffset = map->hitAssetZoneOffset; if (collisionOffset == 0) { return; } assetCollisionData = (HitFileHeader*)((void*)hit + collisionOffset); collisionData = &gZoneCollisionData; break; } assetBoundingBox = (u32*)((void*)hit + assetCollisionData->boundingBoxesOffset); collisionData->aabbs = collision_heap_malloc(assetCollisionData->boundingBoxesDataSize * 4); for (i = 0, boundingBox = (u32*)(collisionData->aabbs); i < assetCollisionData->boundingBoxesDataSize; assetBoundingBox++, boundingBox++, i++) { *boundingBox = *assetBoundingBox; } assetVertices = (Vec3s*)((void*)hit + assetCollisionData->verticesOffset); collisionData->vertices = collision_heap_malloc(assetCollisionData->numVertices * sizeof(Vec3f)); for (i = 0, vertices = collisionData->vertices; i < assetCollisionData->numVertices; vertices++, assetVertices++, i++) { vertices->x = assetVertices->x; vertices->y = assetVertices->y; vertices->z = assetVertices->z; } assetCollider = (HitAssetCollider*)((void*)hit + assetCollisionData->collidersOffset); collider = collisionData->colliderList = collision_heap_malloc(assetCollisionData->numColliders * sizeof(Collider)); collisionData->numColliders = assetCollisionData->numColliders; for (i = 0; i < assetCollisionData->numColliders; assetCollider++, collider++, i++) { collider->flags = 0; collider->nextSibling = assetCollider->nextSibling; collider->firstChild = assetCollider->firstChild; collider->numTriangles = assetCollider->numTriangles; numTriangles = collider->numTriangles; if (numTriangles) { collider->triangleTable = triangle = collision_heap_malloc(assetCollider->numTriangles * sizeof(ColliderTriangle)); if (assetCollider->boundingBoxOffset < 0) { collider->aabb = NULL; } else { collider->aabb = (ColliderBoundingBox*)((u32*)(collisionData->aabbs) + assetCollider->boundingBoxOffset); if (idx == 0) { collider->aabb->min.x -= 1; collider->aabb->min.y -= 1; collider->aabb->min.z -= 1; collider->aabb->max.x += 1; collider->aabb->max.y += 1; collider->aabb->max.z += 1; collider->flags = collider->aabb->flagsForCollider; } } trianglePacked = (s32*)((void*)hit + assetCollider->trianglesOffset); for (j = 0; j < assetCollider->numTriangles; trianglePacked++, triangle++, j++) { Vec3f* v1 = triangle->v1 = &collisionData->vertices[(*trianglePacked) & 0x3FF]; Vec3f* v2 = triangle->v2 = &collisionData->vertices[(*trianglePacked >> 10) & 0x3FF]; Vec3f* v3 = triangle->v3 = &collisionData->vertices[(*trianglePacked >> 20) & 0x3FF]; triangle->oneSided = (*trianglePacked >> 30) & 1; triangle->e13.x = v3->x - v1->x; triangle->e13.y = v3->y - v1->y; triangle->e13.z = v3->z - v1->z; triangle->e21.x = v1->x - v2->x; triangle->e21.y = v1->y - v2->y; triangle->e21.z = v1->z - v2->z; triangle->e32.x = v2->x - v3->x; triangle->e32.y = v2->y - v3->y; triangle->e32.z = v2->z - v3->z; e13_x = triangle->e13.x; e13_y = triangle->e13.y; e13_z = triangle->e13.z; e21_x = triangle->e21.x; e21_y = triangle->e21.y; e21_z = triangle->e21.z; // cross product normalX = e13_y * e21_z - e13_z * e21_y; normalY = e13_z * e21_x - e13_x * e21_z; normalZ = e13_x * e21_y - e13_y * e21_x; coeff = SQ(normalX) + SQ(normalY) + SQ(normalZ); if (coeff != 0) { coeff = 1.0f / sqrtf(coeff); } else { coeff = 0.0f; } triangle->normal.x = normalX * coeff; triangle->normal.y = normalY * coeff; triangle->normal.z = normalZ * coeff; } } } } void parent_collider_to_model(s16 colliderID, s16 modelIndex) { Collider* collider; ColliderTriangle* triangle; s32 i; Vec3f** vertexBuffer; Vec3f** vertexPtr; s32 vertexBufferSize; Vec3f* vertexTable; Vec3f* vertex; collider = &gCollisionData.colliderList[colliderID]; collider->parentModelIndex = modelIndex; collider->flags |= COLLIDER_FLAG_HAS_MODEL_PARENT; vertexBuffer = collision_heap_malloc(collider->numTriangles * sizeof(Vec3f)); vertexBufferSize = 0; vertexPtr = vertexBuffer; for (i = 0, triangle = collider->triangleTable; i < collider->numTriangles; i++, triangle++) { _add_hit_vert_to_buffer(vertexBuffer, triangle->v1, &vertexBufferSize); _add_hit_vert_to_buffer(vertexBuffer, triangle->v2, &vertexBufferSize); _add_hit_vert_to_buffer(vertexBuffer, triangle->v3, &vertexBufferSize); } collider->numVertices = vertexBufferSize; collider->vertexTable = collision_heap_malloc(vertexBufferSize * 2 * sizeof(Vec3f)); for (i = 0, vertexTable = collider->vertexTable; i < vertexBufferSize; vertexPtr++, vertexTable += 2, i++) { vertex = *vertexPtr; vertexTable[0].x = vertexTable[1].x = vertex->x; vertexTable[0].y = vertexTable[1].y = vertex->y; vertexTable[0].z = vertexTable[1].z = vertex->z; } vertexTable = collider->vertexTable; for (i = 0, triangle = collider->triangleTable; i < collider->numTriangles; triangle++, i++) { triangle->v1 = &vertexTable[_get_hit_vert_index_from_buffer(vertexBuffer, triangle->v1, &vertexBufferSize) * 2]; triangle->v2 = &vertexTable[_get_hit_vert_index_from_buffer(vertexBuffer, triangle->v2, &vertexBufferSize) * 2]; triangle->v3 = &vertexTable[_get_hit_vert_index_from_buffer(vertexBuffer, triangle->v3, &vertexBufferSize) * 2]; } collision_heap_free(vertexBuffer); } void _add_hit_vert_to_buffer(Vec3f** buf, Vec3f* vert, s32* bufSize) { s32 i; for (i = 0; i < *bufSize; i++) { if (buf[i] == vert) { break; } } if (i == *bufSize) { buf[i] = vert; (*bufSize)++; } } s32 _get_hit_vert_index_from_buffer(Vec3f** buffer, Vec3f* vert, s32* bufferSize) { s32 i; for (i = 0; i < *bufferSize; i++) { if (*buffer == vert) { break; } buffer++; } return i; } void update_collider_transform(s16 colliderID) { Collider* collider; struct Model* model; Matrix4f matrix; s32 i; Vec3f* vertexTable; f32 min_x, min_y, min_z, max_x, max_y, max_z; ColliderTriangle* triangle; f32 e13_y, e21_z, e13_z, e21_y, e21_x, e13_x, normalX, normalY, normalZ, coeff; collider = &gCollisionData.colliderList[colliderID]; model = get_model_from_list_index(collider->parentModelIndex); if (model->bakedMtx == NULL) { copy_matrix(model->userTransformMtx, matrix); } else { guMtxL2F(matrix, (Mtx*)model->bakedMtx); guMtxCatF(model->userTransformMtx, matrix, matrix); } triangle = collider->triangleTable; vertexTable = collider->vertexTable; min_x = min_y = min_z = 999999.9f; max_x = max_y = max_z = -999999.9f; for (i = 0; i < collider->numVertices; vertexTable += 2, i++) { guMtxXFMF(matrix, vertexTable[1].x, vertexTable[1].y, vertexTable[1].z, &vertexTable[0].x, &vertexTable[0].y, &vertexTable[0].z); if (vertexTable[0].x < min_x) min_x = vertexTable[0].x; if (vertexTable[0].x > max_x) max_x = vertexTable[0].x; if (vertexTable[0].y < min_y) min_y = vertexTable[0].y; if (vertexTable[0].y > max_y) max_y = vertexTable[0].y; if (vertexTable[0].z < min_z) min_z = vertexTable[0].z; if (vertexTable[0].z > max_z) max_z = vertexTable[0].z; } collider->aabb->min.x = min_x; collider->aabb->min.y = min_y; collider->aabb->min.z = min_z; collider->aabb->max.x = max_x; collider->aabb->max.y = max_y; collider->aabb->max.z = max_z; for (i = 0; i < collider->numTriangles; triangle++, i++) { Vec3f* v1 = triangle->v1; Vec3f* v2 = triangle->v2; Vec3f* v3 = triangle->v3; triangle->e13.x = v3->x - v1->x; triangle->e13.y = v3->y - v1->y; triangle->e13.z = v3->z - v1->z; triangle->e21.x = v1->x - v2->x; triangle->e21.y = v1->y - v2->y; triangle->e21.z = v1->z - v2->z; triangle->e32.x = v2->x - v3->x; triangle->e32.y = v2->y - v3->y; triangle->e32.z = v2->z - v3->z; e13_x = triangle->e13.x; e13_y = triangle->e13.y; e13_z = triangle->e13.z; e21_x = triangle->e21.x; e21_y = triangle->e21.y; e21_z = triangle->e21.z; // vector product normalX = e13_y * e21_z - e13_z * e21_y; normalY = e13_z * e21_x - e13_x * e21_z; normalZ = e13_x * e21_y - e13_y * e21_x; coeff = SQ(normalX) + SQ(normalY) + SQ(normalZ); if (coeff != 0) { coeff = 1.0f / sqrtf(coeff); } else { coeff = 0.0f; } triangle->normal.x = normalX * coeff; triangle->normal.y = normalY * coeff; triangle->normal.z = normalZ * coeff; } } s32 get_collider_flags(s32 colliderID) { if (colliderID & COLLISION_WITH_ENTITY_BIT) { return 0; } else { return gCollisionData.colliderList[colliderID].flags; } } void get_flat_collider_normal(s32 colliderID, f32* x, f32* y, f32* z) { ColliderTriangle* triangle = &gCollisionData.colliderList[colliderID].triangleTable[0]; *x = triangle->normal.x; *y = triangle->normal.y; *z = triangle->normal.z; } void get_collider_center(s32 colliderID, f32* x, f32* y, f32* z) { ColliderBoundingBox* aabb = gCollisionData.colliderList[colliderID].aabb; *x = (aabb->min.x + aabb->max.x) * 0.5f; *y = (aabb->min.y + aabb->max.y) * 0.5f; *z = (aabb->min.z + aabb->max.z) * 0.5f; } s32 test_ray_triangle_general(ColliderTriangle* triangle, Vec3f* vertices) { f32 distToTrianglePlane; f32 cosAngle; Vec3f* v1; Vec3f* v2; Vec3f* v3; if (triangle->normal.x == 0 && triangle->normal.y == 0 && triangle->normal.z == 0) return FALSE; v1 = triangle->v1; v2 = triangle->v2; v3 = triangle->v3; distToTrianglePlane = triangle->normal.x * (gCollisionRayStartX - v1->x) + triangle->normal.y * (gCollisionRayStartY - v1->y) + triangle->normal.z * (gCollisionRayStartZ - v1->z); if (triangle->oneSided) { if (distToTrianglePlane < 0) { return FALSE; } if (triangle->normal.x * gCollisionRayDirX + triangle->normal.y * gCollisionRayDirY + triangle->normal.z * gCollisionRayDirZ >= 0) { return FALSE; } if ((gCollisionRayStartX - v1->x) * (triangle->e13.z * gCollisionRayDirY - triangle->e13.y * gCollisionRayDirZ) + (gCollisionRayStartY - v1->y) * (triangle->e13.x * gCollisionRayDirZ - triangle->e13.z * gCollisionRayDirX) + (gCollisionRayStartZ - v1->z) * (triangle->e13.y * gCollisionRayDirX - triangle->e13.x * gCollisionRayDirY) < 0) { return FALSE; } if ((gCollisionRayStartX - v2->x) * (triangle->e21.z * gCollisionRayDirY - triangle->e21.y * gCollisionRayDirZ) + (gCollisionRayStartY - v2->y) * (triangle->e21.x * gCollisionRayDirZ - triangle->e21.z * gCollisionRayDirX) + (gCollisionRayStartZ - v2->z) * (triangle->e21.y * gCollisionRayDirX - triangle->e21.x * gCollisionRayDirY) < 0) { return FALSE; } if ((gCollisionRayStartX - v3->x) * (triangle->e32.z * gCollisionRayDirY - triangle->e32.y * gCollisionRayDirZ) + (gCollisionRayStartY - v3->y) * (triangle->e32.x * gCollisionRayDirZ - triangle->e32.z * gCollisionRayDirX) + (gCollisionRayStartZ - v3->z) * (triangle->e32.y * gCollisionRayDirX - triangle->e32.x * gCollisionRayDirY) < 0) { return FALSE; } } else { if ((triangle->normal.x * gCollisionRayDirX + triangle->normal.y * gCollisionRayDirY + triangle->normal.z * gCollisionRayDirZ) * distToTrianglePlane >= 0) { return FALSE; } if (((gCollisionRayStartX - v1->x) * (triangle->e13.z * gCollisionRayDirY - triangle->e13.y * gCollisionRayDirZ) + (gCollisionRayStartY - v1->y) * (triangle->e13.x * gCollisionRayDirZ - triangle->e13.z * gCollisionRayDirX) + (gCollisionRayStartZ - v1->z) * (triangle->e13.y * gCollisionRayDirX - triangle->e13.x * gCollisionRayDirY) ) * distToTrianglePlane < 0) { return FALSE; } if (((gCollisionRayStartX - v2->x) * (triangle->e21.z * gCollisionRayDirY - triangle->e21.y * gCollisionRayDirZ) + (gCollisionRayStartY - v2->y) * (triangle->e21.x * gCollisionRayDirZ - triangle->e21.z * gCollisionRayDirX) + (gCollisionRayStartZ - v2->z) * (triangle->e21.y * gCollisionRayDirX - triangle->e21.x * gCollisionRayDirY) ) * distToTrianglePlane < 0) { return FALSE; } if (((gCollisionRayStartX - v3->x) * (triangle->e32.z * gCollisionRayDirY - triangle->e32.y * gCollisionRayDirZ) + (gCollisionRayStartY - v3->y) * (triangle->e32.x * gCollisionRayDirZ - triangle->e32.z * gCollisionRayDirX) + (gCollisionRayStartZ - v3->z) * (triangle->e32.y * gCollisionRayDirX - triangle->e32.x * gCollisionRayDirY) ) * distToTrianglePlane < 0) { return FALSE; } } cosAngle = triangle->normal.x * gCollisionRayDirX + triangle->normal.y * gCollisionRayDirY + triangle->normal.z * gCollisionRayDirZ; if (gCollisionRayLength >= 0 && gCollisionRayLength <= -distToTrianglePlane / cosAngle) { return FALSE; } gCollisionRayLength = -distToTrianglePlane / cosAngle; gCollisionPointX = gCollisionRayStartX + gCollisionRayDirX * gCollisionRayLength; gCollisionPointY = gCollisionRayStartY + gCollisionRayDirY * gCollisionRayLength; gCollisionPointZ = gCollisionRayStartZ + gCollisionRayDirZ * gCollisionRayLength; gCollisionNormalX = triangle->normal.x; gCollisionNormalY = triangle->normal.y; gCollisionNormalZ = triangle->normal.z; return TRUE; } s32 test_ray_triangle_down(ColliderTriangle* triangle, Vec3f* vertices) { f32 distToTrianglePlane, cosAngle; Vec3f* v1; Vec3f* v2; Vec3f* v3; if (triangle->normal.x == 0 && triangle->normal.y == 0 && triangle->normal.z == 0) { return FALSE; } v1 = triangle->v1; v2 = triangle->v2; v3 = triangle->v3; distToTrianglePlane = triangle->normal.x * (gCollisionRayStartX - v1->x) + triangle->normal.y * (gCollisionRayStartY - v1->y) + triangle->normal.z * (gCollisionRayStartZ - v1->z); if (triangle->oneSided) { if (distToTrianglePlane < 0) { return FALSE; } if (triangle->normal.y <= 0) return FALSE; if ((gCollisionRayStartZ - v1->z) * triangle->e13.x - (gCollisionRayStartX - v1->x) * triangle->e13.z < 0) { return FALSE; } if ((gCollisionRayStartZ - v2->z) * triangle->e21.x - (gCollisionRayStartX - v2->x) * triangle->e21.z < 0) { return FALSE; } if ((gCollisionRayStartZ - v3->z) * triangle->e32.x - (gCollisionRayStartX - v3->x) * triangle->e32.z < 0) { return FALSE; } } else { if (triangle->normal.y * distToTrianglePlane <= 0) { return FALSE; } if (((gCollisionRayStartZ - v1->z) * triangle->e13.x - (gCollisionRayStartX - v1->x) * triangle->e13.z) * distToTrianglePlane < 0) { return FALSE; } if (((gCollisionRayStartZ - v2->z) * triangle->e21.x - (gCollisionRayStartX - v2->x) * triangle->e21.z) * distToTrianglePlane < 0) { return FALSE; } if (((gCollisionRayStartZ - v3->z) * triangle->e32.x - (gCollisionRayStartX - v3->x) * triangle->e32.z) * distToTrianglePlane < 0) { return FALSE; } } cosAngle = -triangle->normal.y; if (gCollisionRayLength >= 0 && gCollisionRayLength <= -distToTrianglePlane / cosAngle) { return FALSE; } gCollisionRayLength = -distToTrianglePlane / cosAngle; gCollisionPointX = gCollisionRayStartX; gCollisionPointY = gCollisionRayStartY - gCollisionRayLength; gCollisionPointZ = gCollisionRayStartZ; gCollisionNormalX = triangle->normal.x; gCollisionNormalY = triangle->normal.y; gCollisionNormalZ = triangle->normal.z; return TRUE; } s32 test_ray_triangle_horizontal(ColliderTriangle* triangle, Vec3f *vertices) { f32 distToTrianglePlane, cosAngle; Vec3f* v1; Vec3f* v2; Vec3f* v3; if (triangle->normal.x == 0 && triangle->normal.y == 0 && triangle->normal.z == 0) { return FALSE; } v1 = triangle->v1; v2 = triangle->v2; v3 = triangle->v3; distToTrianglePlane = triangle->normal.x * (gCollisionRayStartX - v1->x) + triangle->normal.y * (gCollisionRayStartY - v1->y) + triangle->normal.z * (gCollisionRayStartZ - v1->z); if (triangle->oneSided) { if (distToTrianglePlane < 0) { return FALSE; } if (triangle->normal.x * gCollisionRayDirX + triangle->normal.z * gCollisionRayDirZ >= 0) { return FALSE; } if ((gCollisionRayStartX - v1->x) * (-triangle->e13.y * gCollisionRayDirZ) + (gCollisionRayStartY - v1->y) * (triangle->e13.x * gCollisionRayDirZ - triangle->e13.z * gCollisionRayDirX) + (gCollisionRayStartZ - v1->z) * (triangle->e13.y * gCollisionRayDirX) < 0) { return FALSE; } if ((gCollisionRayStartX - v2->x) * (-triangle->e21.y * gCollisionRayDirZ) + (gCollisionRayStartY - v2->y) * (triangle->e21.x * gCollisionRayDirZ - triangle->e21.z * gCollisionRayDirX) + (gCollisionRayStartZ - v2->z) * (triangle->e21.y * gCollisionRayDirX) < 0) { return FALSE; } if ((gCollisionRayStartX - v3->x) * (-triangle->e32.y * gCollisionRayDirZ) + (gCollisionRayStartY - v3->y) * (triangle->e32.x * gCollisionRayDirZ - triangle->e32.z * gCollisionRayDirX) + (gCollisionRayStartZ - v3->z) * (triangle->e32.y * gCollisionRayDirX) < 0) { return FALSE; } } else { if ((triangle->normal.x * gCollisionRayDirX + triangle->normal.z * gCollisionRayDirZ) * distToTrianglePlane >= 0) { return FALSE; } if (((gCollisionRayStartX - v1->x) * (-triangle->e13.y * gCollisionRayDirZ) + (gCollisionRayStartY - v1->y) * (triangle->e13.x * gCollisionRayDirZ - triangle->e13.z * gCollisionRayDirX) + (gCollisionRayStartZ - v1->z) * (triangle->e13.y * gCollisionRayDirX)) * distToTrianglePlane < 0) { return FALSE; } if (((gCollisionRayStartX - v2->x) * (-triangle->e21.y * gCollisionRayDirZ) + (gCollisionRayStartY - v2->y) * (triangle->e21.x * gCollisionRayDirZ - triangle->e21.z * gCollisionRayDirX) + (gCollisionRayStartZ - v2->z) * (triangle->e21.y * gCollisionRayDirX)) * distToTrianglePlane < 0) { return FALSE; } if (((gCollisionRayStartX - v3->x) * (-triangle->e32.y * gCollisionRayDirZ) + (gCollisionRayStartY - v3->y) * (triangle->e32.x * gCollisionRayDirZ - triangle->e32.z * gCollisionRayDirX) + (gCollisionRayStartZ - v3->z) * (triangle->e32.y * gCollisionRayDirX)) * distToTrianglePlane < 0) { return FALSE; } } cosAngle = triangle->normal.x * gCollisionRayDirX + triangle->normal.z * gCollisionRayDirZ; if (gCollisionRayLength >= 0 && gCollisionRayLength <= -distToTrianglePlane / cosAngle) { return FALSE; } gCollisionRayLength = -distToTrianglePlane / cosAngle; gCollisionPointX = gCollisionRayStartX + gCollisionRayDirX * gCollisionRayLength; gCollisionPointY = gCollisionRayStartY; gCollisionPointZ = gCollisionRayStartZ + gCollisionRayDirZ * gCollisionRayLength; gCollisionNormalX = triangle->normal.x; gCollisionNormalY = triangle->normal.y; gCollisionNormalZ = triangle->normal.z; return TRUE; } s32 test_ray_colliders(s32 ignoreFlags, f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f32 dirZ, f32* hitX, f32* hitY, f32* hitZ, f32* hitDepth, f32* hitNx, f32* hitNy, f32* hitNz) { Collider* collider; CollisionData* collisionData; ColliderTriangle* triangle; s32 i, j; s32 colliderID; f32 min_x, min_y, min_z, max_x, max_y, max_z; if (dirX == 0 && dirY == 0 && dirZ == 0) { return 0; } collisionData = &gCollisionData; gCollisionRayDirX = dirX; gCollisionRayDirY = dirY; gCollisionRayDirZ = dirZ; gCollisionRayStartX = startX; gCollisionRayStartY = startY; gCollisionRayStartZ = startZ; gCollisionRayLength = *hitDepth; colliderID = NO_COLLIDER; if (dirX < 0) { min_x = startX + dirX * gCollisionRayLength; max_x = startX; } else { min_x = startX; max_x = startX + dirX * gCollisionRayLength; } if (dirY < 0) { min_y = startY + dirY * gCollisionRayLength; max_y = startY; } else { min_y = startY; max_y = startY + dirY * gCollisionRayLength; } if (dirZ < 0) { min_z = startZ + dirZ * gCollisionRayLength; max_z = startZ; } else { min_z = startZ; max_z = startZ + dirZ * gCollisionRayLength; } for (i = 0; i < collisionData->numColliders; i++) { collider = &collisionData->colliderList[i]; if ((collider->flags & ignoreFlags) || collider->numTriangles == 0 || max_x < collider->aabb->min.x || min_x > collider->aabb->max.x || max_z < collider->aabb->min.z || min_z > collider->aabb->max.z || max_y < collider->aabb->min.y || min_y > collider->aabb->max.y) { continue; } triangle = collider->triangleTable; if (gCollisionRayDirX == 0 && gCollisionRayDirZ == 0 && gCollisionRayDirY == -1.0) { for (j = 0; j < collider->numTriangles; j++) { if (test_ray_triangle_down(triangle++, collisionData->vertices)) { colliderID = i; } } } else if (gCollisionRayDirY == 0) { for (j = 0; j < collider->numTriangles; j++) { if (test_ray_triangle_horizontal(triangle++, collisionData->vertices)) { colliderID = i; } } } else { for (j = 0; j < collider->numTriangles; j++) { if (test_ray_triangle_general(triangle++, collisionData->vertices)) { colliderID = i; } } } } if (colliderID >= 0) { *hitX = gCollisionPointX; *hitY = gCollisionPointY; *hitZ = gCollisionPointZ; *hitDepth = gCollisionRayLength; *hitNx = gCollisionNormalX; *hitNy = gCollisionNormalY; *hitNz = gCollisionNormalZ; return colliderID; } else { return colliderID; } } s32 test_ray_zones(f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f32 dirZ, f32* hitX, f32* hitY, f32* hitZ, f32* hitDepth, f32* hitNx, f32* hitNy, f32* hitNz) { Collider* collider; CollisionData* collisionData; ColliderTriangle* triangle; s32 i, j; s32 colliderID; collisionData = &gZoneCollisionData; gCollisionRayDirX = dirX; gCollisionRayDirY = dirY; gCollisionRayDirZ = dirZ; gCollisionRayStartX = startX; gCollisionRayStartY = startY; gCollisionRayStartZ = startZ; gCollisionRayLength = *hitDepth; colliderID = NO_COLLIDER; for (i = 0; i < collisionData->numColliders; i++) { collider = &collisionData->colliderList[i]; if (collider->flags & COLLIDER_FLAG_IGNORE_PLAYER) continue; if (collider->numTriangles == 0 || collider->aabb == NULL) continue; triangle = collider->triangleTable; for (j = 0; j < collider->numTriangles; j++) { if (test_ray_triangle_down(triangle++, collisionData->vertices)) { colliderID = i; } } } if (colliderID >= 0) { *hitX = gCollisionPointX; *hitY = gCollisionPointY; *hitZ = gCollisionPointZ; *hitDepth = gCollisionRayLength; *hitNx = gCollisionNormalX; *hitNy = gCollisionNormalY; *hitNz = gCollisionNormalZ; return colliderID; } else { return colliderID; } } f32 test_ray_collider_horizontal(s32 ignoreFlags, s32 colliderID, f32 x, f32 y, f32 z, f32 length, f32 yaw) { CollisionData* collisionData = &gCollisionData; f32 cosTheta; f32 sinTheta; Collider* collider; ColliderTriangle* triangleTable; s32 i; f32 ret; sin_cos_rad(DEG_TO_RAD(yaw), &sinTheta, &cosTheta); collider = &collisionData->colliderList[colliderID]; gCollisionRayDirY = 0; gCollisionRayStartX = x; gCollisionRayStartY = y; gCollisionRayStartZ = z; gCollisionRayLength = length; gCollisionRayDirX = sinTheta; gCollisionRayDirZ = -cosTheta; ret = -1.0f; if (!(collider->flags & ignoreFlags) && collider->numTriangles != 0) { triangleTable = collider->triangleTable; for (i = 0; i < collider->numTriangles; i++) if (test_ray_triangle_horizontal(triangleTable++, collisionData->vertices)) ret = gCollisionRayLength; } return ret; } enum { ENTITY_TEST_ANY = 0, ENTITY_TEST_DOWN = 1, ENTITY_TEST_LATERAL = 2, }; s32 test_ray_entities(f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f32 dirZ, f32* hitX, f32* hitY, f32* hitZ, f32* hitDepth, f32* hitNx, f32* hitNy, f32* hitNz) { f32 hitDepthDown, hitDepthHoriz; s32 type; s32 i, j; Entity* entity; Matrix4f tempMatrix1; Matrix4f tempMatrix2; Vec3f boxVertices[8]; ColliderTriangle entityTriangle; s32 entityIndex; f32 h; f32 aabbX, aabbZ; s32 hasCollision; f32 dist, dist2; ColliderTriangle *triangle = &entityTriangle; entityIndex = -1; type = ENTITY_TEST_ANY; hitDepthDown = hitDepthHoriz = *hitDepth; if (dirX == 0 && dirZ == 0 && dirY < 0) { hitDepthHoriz = 0; type = ENTITY_TEST_DOWN; } else if (dirY == 0) { hitDepthDown = 0; type = ENTITY_TEST_LATERAL; } gCollisionRayLength = -1; triangle->oneSided = TRUE; for (i = 0; i < MAX_ENTITIES; i++) { entity = get_entity_by_index(i); if (entity == NULL || (entity->flags & (ENTITY_FLAG_SKIP_UPDATE | ENTITY_FLAG_DISABLE_COLLISION))) { continue; } dist = hitDepthHoriz + entity->effectiveSize; if (startX > entity->pos.x + dist || startX < entity->pos.x - dist) { continue; } if (startZ > entity->pos.z + dist || startZ < entity->pos.z - dist) { continue; } switch (type) { case ENTITY_TEST_ANY: case ENTITY_TEST_DOWN: dist = entity->pos.y; dist2 = hitDepthDown + entity->effectiveSize * 2; if (dist + dist2 < startY || startY < dist - dist2) { continue; } break; case ENTITY_TEST_LATERAL: dist = entity->pos.y; dist2 = entity->effectiveSize * 2; if (dist + dist2 < startY || startY < dist - dist2) { continue; } break; } aabbX = entity->aabb.x / 2; aabbZ = entity->aabb.z / 2; boxVertices[1].x = boxVertices[2].x = boxVertices[5].x = boxVertices[6].x = -aabbX; boxVertices[0].x = boxVertices[3].x = boxVertices[4].x = boxVertices[7].x = aabbX; boxVertices[0].y = boxVertices[1].y = boxVertices[2].y = boxVertices[3].y = 0; boxVertices[4].y = boxVertices[5].y = boxVertices[6].y = boxVertices[7].y = entity->aabb.y; boxVertices[0].z = boxVertices[1].z = boxVertices[4].z = boxVertices[5].z = aabbZ; boxVertices[2].z = boxVertices[3].z = boxVertices[6].z = boxVertices[7].z = -aabbZ; guMtxXFMF(entity->inverseTransformMatrix, dirX, dirY, dirZ, &gCollisionRayDirX, &gCollisionRayDirY, &gCollisionRayDirZ); guMtxXFMF(entity->inverseTransformMatrix, startX - entity->pos.x, startY - entity->pos.y, startZ - entity->pos.z, &gCollisionRayStartX, &gCollisionRayStartY, &gCollisionRayStartZ); for (j = 0; j < 12; j++) { Vec3f* v1 = triangle->v1 = &boxVertices[gEntityColliderFaces[j].x]; Vec3f* v2 = triangle->v2 = &boxVertices[gEntityColliderFaces[j].y]; Vec3f* v3 = triangle->v3 = &boxVertices[gEntityColliderFaces[j].z]; triangle->e13.x = v3->x - v1->x; triangle->e13.y = v3->y - v1->y; triangle->e13.z = v3->z - v1->z; triangle->e21.x = v1->x - v2->x; triangle->e21.y = v1->y - v2->y; triangle->e21.z = v1->z - v2->z; triangle->e32.x = v2->x - v3->x; triangle->e32.y = v2->y - v3->y; triangle->e32.z = v2->z - v3->z; triangle->normal.x = gEntityColliderNormals[j].x; triangle->normal.y = gEntityColliderNormals[j].y; triangle->normal.z = gEntityColliderNormals[j].z; if (hasCollision = test_ray_triangle_general(&entityTriangle, boxVertices)) { break; } } if (hasCollision && gCollisionRayLength < *hitDepth) { entityIndex = i; *hitDepth = gCollisionRayLength; switch (type) { case ENTITY_TEST_ANY: hitDepthDown = gCollisionRayLength; hitDepthHoriz = gCollisionRayLength; break; case ENTITY_TEST_DOWN: hitDepthDown = gCollisionRayLength; break; case ENTITY_TEST_LATERAL: hitDepthHoriz = gCollisionRayLength; break; } guRotateF(tempMatrix1, entity->rot.x, 1.0f, 0.0f, 0.0f); guRotateF(tempMatrix2, entity->rot.z, 0.0f, 0.0f, 1.0f); guMtxCatF(tempMatrix1, tempMatrix2, tempMatrix1); guRotateF(tempMatrix2, entity->rot.y, 0.0f, 1.0f, 0.0f); guMtxCatF(tempMatrix1, tempMatrix2, tempMatrix1); guTranslateF(tempMatrix2, entity->pos.x, entity->pos.y, entity->pos.z); guMtxCatF(tempMatrix1, tempMatrix2, tempMatrix1); guMtxXFMF(tempMatrix1, gCollisionPointX, gCollisionPointY, gCollisionPointZ, hitX, hitY, hitZ); h = 1.0f / sqrtf(SQ(gCollisionNormalX) + SQ(gCollisionNormalY) + SQ(gCollisionNormalZ)); *hitNx = gCollisionNormalX * h; *hitNy = gCollisionNormalY * h; *hitNz = gCollisionNormalZ * h; } } return entityIndex; }
608de46008b89f242f36056680654a25076341c2
fec41f425b51e73842bd37fe0720e9d633288d42
/hapcut2-src/common.h
c911ed9d1b7a53706fdbe8a8a3c8c232733e6c76
[ "BSD-2-Clause" ]
permissive
vibansal/HapCUT2
52434f72af703b4147baf966e00c2476d2c46d4c
0eb7075424afbb40259ced6b5b1cbd95d0cedf55
refs/heads/master
2022-10-21T19:16:58.785156
2022-10-14T21:50:21
2022-10-14T21:50:21
64,779,084
188
46
BSD-2-Clause
2022-10-14T21:56:42
2016-08-02T17:48:30
C
UTF-8
C
false
false
3,289
h
common.h
#ifndef _COMMON_H #define _COMMON_H #include <stdint.h> #include "fragments.h" #include "variant.h" extern int QVoffset; extern int MINQ; #include <assert.h> #include <stdio.h> #include <math.h> ////////////////////////////////////////////////////////////////////////////////////////////////////////// // logsum10 -- a port of Sean Eddy's fast table-driven log sum, converted to log base10 // This code was originally part of HMMER. This version is used with Sean Eddy's permission as public domain code. /* p7_LOGSUM10_SCALE defines the precision of the calculation; the * default of 1000.0 means rounding differences to the nearest 0.001 * nat. p7_LOGSUM10_TBL defines the size of the lookup table; the * default of 16000 means entries are calculated for differences of 0 * to 16.000 nats (when p7_LOGSUM10_SCALE is 1000.0). e^{-p7_LOGSUM10_TBL / * p7_LOGSUM10_SCALE} should be on the order of the machine FLT_EPSILON, * typically 1.2e-7. */ #define p7_LOGSUMTEN_TBL 16000 #define p7_LOGSUMTEN_SCALE 1000.f #define ESL_MAX(a,b) (((a)>(b))?(a):(b)) #define ESL_MIN(a,b) (((a)<(b))?(a):(b)) #define eslINFINITY INFINITY #define TRUE 1 #define FALSE 0 #define eslOK 1 // initialize the lookup table // this must be called before any calls to esl_flogsum10 int esl_flogsum10_init(void); // approximation to log(10^a + 10^b) static inline float esl_flogsum10(float a, float b) { extern float flogsum10_lookup[p7_LOGSUMTEN_TBL]; const float max = ESL_MAX(a, b); const float min = ESL_MIN(a, b); return (min == -eslINFINITY || (max-min) >= 15.7f) ? max : max + flogsum10_lookup[(int)((max-min)*p7_LOGSUMTEN_SCALE)]; } // approximation to log(10^a + 10^b) static inline float esl_flogsub10(float a, float b) { extern float flogsum10_lookup[p7_LOGSUMTEN_TBL]; const float max = ESL_MAX(a, b); const float min = ESL_MIN(a, b); return (min == -eslINFINITY || (max-min) >= 15.7f) ? max : max - flogsum10_lookup[(int)((max-min)*p7_LOGSUMTEN_SCALE)]; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #define MAXBUF 1000000 #define LOG_HALF log10(0.5) // given a=log10(x) and b=log10(y), returns log10(x+y) #define addlogsEXACT(a, b) (((a) > (b)) ? ((a) + log10(1.0 + pow(10.0, (b) - (a)))) : ((b) + log10(1.0 + pow(10.0, (a) - (b))))) #define subtractlogs(a, b) (((a) > (b)) ? ((a) + log10(1.0 - pow(10, (b) - (a)))) : ((b) + log10(1.0 - pow(10.0, (a) - (b))))) #define addlogs(a, b) esl_flogsum10(a, b) //#define subtractlogs(a, b) esl_flogsub10(a, b) // given a=log10(x) and b=log10(y), returns log10(x-y) #define flip(allele) if (allele == '1') allele = '0'; else if (allele == '0') allele = '1' int fprintf_time(FILE *stream, const char *format, ...); float phred(float x); float unphred(float x); void check_input_0_or_1(char* x); char* concatStrings(char** string_list,int n,char sep); // S1:S2:S3 where sep = ':' // split a string using a single separator, '\n' and '\0' are also delimitors at end of string int splitString(char* input,char sep,char** string_list); // return value = no of strings, string_list is output array int splitString_full(char* input,char sep,char** out); // allocates all memory within function #endif
870e2b68ea683d7e80ba5431d63a6e451047f91a
b5b61f3f0d54da1754de6c75ab7be261164cb0bc
/common/inc/sys/stdint.h
51599456d539ec328d34cbdc8f1b80447e2d40d3
[ "BSD-3-Clause", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
apache/incubator-teaclave-sgx-sdk
4b2077a287d338637cee8be624e86709d50cecc5
3c903bdac4e503dd27b9b1f761c4abfc55f2464c
refs/heads/master
2023-08-17T21:47:08.884261
2023-07-25T10:17:46
2023-07-26T01:32:18
89,560,048
459
171
Apache-2.0
2023-07-26T01:32:19
2017-04-27T05:43:24
Rust
UTF-8
C
false
false
7,521
h
stdint.h
/* $OpenBSD: stdint.h,v 1.4 2006/12/10 22:17:55 deraadt Exp $ */ /* * Copyright (c) 1997, 2005 Todd C. Miller <Todd.Miller@courtesan.com> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef _SYS_STDINT_H_ #define _SYS_STDINT_H_ #include <sys/cdefs.h> #include <sys/_types.h> /* 7.18.1.1 Exact-width integer types (also in sys/types.h) */ #ifndef _INT8_T_DEFINED_ #define _INT8_T_DEFINED_ typedef __int8_t int8_t; #endif #ifndef _UINT8_T_DEFINED_ #define _UINT8_T_DEFINED_ typedef __uint8_t uint8_t; #endif #ifndef _INT16_T_DEFINED_ #define _INT16_T_DEFINED_ typedef __int16_t int16_t; #endif #ifndef _UINT16_T_DEFINED_ #define _UINT16_T_DEFINED_ typedef __uint16_t uint16_t; #endif #ifndef _INT32_T_DEFINED_ #define _INT32_T_DEFINED_ typedef __int32_t int32_t; #endif #ifndef _UINT32_T_DEFINED_ #define _UINT32_T_DEFINED_ typedef __uint32_t uint32_t; #endif #ifndef _INT64_T_DEFINED_ #define _INT64_T_DEFINED_ typedef __int64_t int64_t; #endif #ifndef _UINT64_T_DEFINED_ #define _UINT64_T_DEFINED_ typedef __uint64_t uint64_t; #endif /* 7.18.1.2 Minimum-width integer types */ typedef __int_least8_t int_least8_t; typedef __uint_least8_t uint_least8_t; typedef __int_least16_t int_least16_t; typedef __uint_least16_t uint_least16_t; typedef __int_least32_t int_least32_t; typedef __uint_least32_t uint_least32_t; typedef __int_least64_t int_least64_t; typedef __uint_least64_t uint_least64_t; /* 7.18.1.3 Fastest minimum-width integer types */ typedef __int_fast8_t int_fast8_t; typedef __uint_fast8_t uint_fast8_t; typedef __int_fast16_t int_fast16_t; typedef __uint_fast16_t uint_fast16_t; typedef __int_fast32_t int_fast32_t; typedef __uint_fast32_t uint_fast32_t; typedef __int_fast64_t int_fast64_t; typedef __uint_fast64_t uint_fast64_t; /* 7.18.1.4 Integer types capable of holding object pointers */ #ifndef _INTPTR_T_DEFINED_ #define _INTPTR_T_DEFINED_ typedef __intptr_t intptr_t; #endif #ifndef _UINTPTR_T_DEFINED_ #define _UINTPTR_T_DEFINED_ typedef __uintptr_t uintptr_t; #endif /* 7.18.1.5 Greatest-width integer types */ typedef __intmax_t intmax_t; typedef __uintmax_t uintmax_t; //#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) /* * 7.18.2 Limits of specified-width integer types. * * The following object-like macros specify the minimum and maximum limits * of integer types corresponding to the typedef names defined above. */ /* 7.18.2.1 Limits of exact-width integer types */ #define INT8_MIN (-0x7f - 1) #define INT16_MIN (-0x7fff - 1) #define INT32_MIN (-0x7fffffff - 1) #ifdef __x86_64__ #define INT64_MIN (-0x7fffffffffffffffL - 1) #else #define INT64_MIN (-0x7fffffffffffffffLL - 1) #endif #define INT8_MAX 0x7f #define INT16_MAX 0x7fff #define INT32_MAX 0x7fffffff #ifdef __x86_64__ #define INT64_MAX 0x7fffffffffffffffL #else #define INT64_MAX 0x7fffffffffffffffLL #endif #define UINT8_MAX 0xff #define UINT16_MAX 0xffff #define UINT32_MAX 0xffffffffU #ifdef __x86_64__ #define UINT64_MAX 0xffffffffffffffffUL #else #define UINT64_MAX 0xffffffffffffffffULL #endif /* 7.18.2.2 Limits of minimum-width integer types */ #define INT_LEAST8_MIN INT8_MIN #define INT_LEAST16_MIN INT16_MIN #define INT_LEAST32_MIN INT32_MIN #define INT_LEAST64_MIN INT64_MIN #define INT_LEAST8_MAX INT8_MAX #define INT_LEAST16_MAX INT16_MAX #define INT_LEAST32_MAX INT32_MAX #define INT_LEAST64_MAX INT64_MAX #define UINT_LEAST8_MAX UINT8_MAX #define UINT_LEAST16_MAX UINT16_MAX #define UINT_LEAST32_MAX UINT32_MAX #define UINT_LEAST64_MAX UINT64_MAX /* 7.18.2.3 Limits of fastest minimum-width integer types */ #define INT_FAST8_MIN INT8_MIN #define INT_FAST16_MIN INT16_MIN #define INT_FAST32_MIN INT32_MIN #define INT_FAST64_MIN INT64_MIN #define INT_FAST8_MAX INT8_MAX #ifdef __x86_64__ #define INT_FAST16_MAX INT64_MAX #define INT_FAST32_MAX INT64_MAX #else #define INT_FAST16_MAX INT32_MAX #define INT_FAST32_MAX INT32_MAX #endif #define INT_FAST64_MAX INT64_MAX #define UINT_FAST8_MAX UINT8_MAX #ifdef __x86_64__ #define UINT_FAST16_MAX UINT64_MAX #define UINT_FAST32_MAX UINT64_MAX #else #define UINT_FAST16_MAX UINT32_MAX #define UINT_FAST32_MAX UINT32_MAX #endif #define UINT_FAST64_MAX UINT64_MAX /* 7.18.2.4 Limits of integer types capable of holding object pointers */ #ifdef __x86_64__ #define INTPTR_MIN INT64_MIN #define INTPTR_MAX INT64_MAX #define UINTPTR_MAX UINT64_MAX #else #define INTPTR_MIN INT32_MIN #define INTPTR_MAX INT32_MAX #define UINTPTR_MAX UINT32_MAX #endif /* 7.18.2.5 Limits of greatest-width integer types */ #define INTMAX_MIN INT64_MIN #define INTMAX_MAX INT64_MAX #define UINTMAX_MAX UINT64_MAX /* * 7.18.3 Limits of other integer types. * * The following object-like macros specify the minimum and maximum limits * of integer types corresponding to types specified in other standard * header files. */ /* Limits of ptrdiff_t */ #define PTRDIFF_MIN INTPTR_MIN #define PTRDIFF_MAX INTPTR_MAX /* Limits of size_t (also in limits.h) */ #ifndef SIZE_MAX #define SIZE_MAX UINTPTR_MAX #endif /* Limits of wchar_t */ # ifdef __WCHAR_MAX__ # define WCHAR_MAX __WCHAR_MAX__ # else # define WCHAR_MAX (2147483647) # endif # ifdef __WCHAR_MIN__ # define WCHAR_MIN __WCHAR_MIN__ # elif L'\0' - 1 > 0 # define WCHAR_MIN L'\0' # else # define WCHAR_MIN (-WCHAR_MAX - 1) # endif /* Limits of wint_t */ # define WINT_MIN (0u) # define WINT_MAX (4294967295u) //#endif /* __cplusplus || __STDC_LIMIT_MACROS */ //#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) /* * 7.18.4 Macros for integer constants. * * The following function-like macros expand to integer constants * suitable for initializing objects that have integer types corresponding * to types defined in <stdint.h>. The argument in any instance of * these macros shall be a decimal, octal, or hexadecimal constant with * a value that does not exceed the limits for the corresponding type. */ /* 7.18.4.1 Macros for minimum-width integer constants. */ #define INT8_C(_c) (_c) #define INT16_C(_c) (_c) #define INT32_C(_c) (_c) #define INT64_C(_c) __CONCAT(_c, LL) #define UINT8_C(_c) (_c) #define UINT16_C(_c) (_c) #define UINT32_C(_c) __CONCAT(_c, U) #define UINT64_C(_c) __CONCAT(_c, ULL) /* 7.18.4.2 Macros for greatest-width integer constants. */ #define INTMAX_C(_c) __CONCAT(_c, LL) #define UINTMAX_C(_c) __CONCAT(_c, ULL) //#endif /* __cplusplus || __STDC_CONSTANT_MACROS */ #endif /* _SYS_STDINT_H_ */
a3278841081d49b949d2fd6a0326c9502824873e
99bdb3251fecee538e0630f15f6574054dfc1468
/bsp/imx/imx6ull-smart/drivers/usb/device/usb_device_ehci.c
a57d7fe8f738af6f7c163f417d4ff8c56422e6a3
[ "Apache-2.0", "Zlib", "LicenseRef-scancode-proprietary-license", "MIT", "BSD-3-Clause", "X11", "BSD-4-Clause-UC", "LicenseRef-scancode-unknown-license-reference" ]
permissive
RT-Thread/rt-thread
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
3602f891211904a27dcbd51e5ba72fefce7326b2
refs/heads/master
2023-09-01T04:10:20.295801
2023-08-31T16:20:55
2023-08-31T16:20:55
7,408,108
9,599
5,805
Apache-2.0
2023-09-14T13:37:26
2013-01-02T14:49:21
C
UTF-8
C
false
false
72,695
c
usb_device_ehci.c
/* * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc. * Copyright 2016 - 2017 NXP * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * o Redistributions of source code must retain the above copyright notice, this list * of conditions and the following disclaimer. * * o Redistributions in binary form must reproduce the above copyright notice, this * list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * * o Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <usb/include/usb_device_config.h> #include "fsl_device_registers.h" #include <usb/include/usb.h> #include "usb_device.h" #if ((defined(USB_DEVICE_CONFIG_EHCI)) && (USB_DEVICE_CONFIG_EHCI > 0U)) #include "usb_device_dci.h" #include "usb_device_ehci.h" #if (defined(USB_DEVICE_CONFIG_LOW_POWER_MODE) && (USB_DEVICE_CONFIG_LOW_POWER_MODE > 0U)) #include "usb_phy.h" #endif #include "drv_common.h" /******************************************************************************* * Definitions ******************************************************************************/ #if defined(USB_STACK_USE_DEDICATED_RAM) && (USB_STACK_USE_DEDICATED_RAM > 0U) #error The SOC does not suppoort dedicated RAM case. #endif #define virtual_to_physical(v) ((void *)((size_t)v + PV_OFFSET)) #define physical_to_virtual(p) ((void *)((size_t)p - PV_OFFSET)) /******************************************************************************* * Prototypes ******************************************************************************/ static void USB_DeviceEhciSetDefaultState(usb_device_ehci_state_struct_t *ehciState); static usb_status_t USB_DeviceEhciEndpointInit(usb_device_ehci_state_struct_t *ehciState, usb_device_endpoint_init_struct_t *epInit); static usb_status_t USB_DeviceEhciEndpointDeinit(usb_device_ehci_state_struct_t *ehciState, uint8_t ep); static usb_status_t USB_DeviceEhciEndpointStall(usb_device_ehci_state_struct_t *ehciState, uint8_t ep); static usb_status_t USB_DeviceEhciEndpointUnstall(usb_device_ehci_state_struct_t *ehciState, uint8_t ep); static void USB_DeviceEhciFillSetupBuffer(usb_device_ehci_state_struct_t *ehciState, uint8_t ep); static void USB_DeviceEhciCancelControlPipe(usb_device_ehci_state_struct_t *ehciState, uint8_t endpoint, uint8_t direction); static void USB_DeviceEhciInterruptTokenDone(usb_device_ehci_state_struct_t *ehciState); static void USB_DeviceEhciInterruptPortChange(usb_device_ehci_state_struct_t *ehciState); static void USB_DeviceEhciInterruptReset(usb_device_ehci_state_struct_t *ehciState); static void USB_DeviceEhciInterruptSof(usb_device_ehci_state_struct_t *ehciState); #if (defined(USB_DEVICE_CONFIG_LOW_POWER_MODE) && (USB_DEVICE_CONFIG_LOW_POWER_MODE > 0U)) static void USB_DeviceEhciInterruptSuspend(usb_device_ehci_state_struct_t *ehciState); #endif /* USB_DEVICE_CONFIG_LOW_POWER_MODE */ static usb_status_t USB_DeviceEhciTransfer(usb_device_ehci_state_struct_t *ehciState, uint8_t endpointAddress, uint8_t *buffer, uint32_t length); extern usb_status_t USB_DeviceNotificationTrigger(void *handle, void *msg); /******************************************************************************* * Variables ******************************************************************************/ /* Apply for QH buffer, 2048-byte alignment */ void *qh_buffer_vir = NULL; void *qh_buffer_phy = NULL; /* Apply for DTD buffer, 32-byte alignment */ void *dtd_buffer_vir = NULL; void *dtd_buffer_phy = NULL; /* Apply for ehci device state structure */ static usb_device_ehci_state_struct_t g_UsbDeviceEhciSate[USB_DEVICE_CONFIG_EHCI]; #if (defined(USB_DEVICE_CHARGER_DETECT_ENABLE) && (USB_DEVICE_CHARGER_DETECT_ENABLE > 0U)) && \ (defined(FSL_FEATURE_SOC_USBHSDCD_COUNT) && (FSL_FEATURE_SOC_USBHSDCD_COUNT > 0U)) /* Apply for device dcd state structure */ static usb_device_dcd_state_struct_t s_UsbDeviceDcdHSState[USB_DEVICE_CONFIG_EHCI]; #endif /******************************************************************************* * Code ******************************************************************************/ /*! * @brief EHCI NC get USB NC bass address. * * This function is used to get USB NC bass address. * * @param[in] controllerId EHCI controller ID; See the #usb_controller_index_t. * * @retval USB NC bass address. */ #if (defined(USB_DEVICE_CONFIG_LOW_POWER_MODE) && (USB_DEVICE_CONFIG_LOW_POWER_MODE > 0U)) #if (defined(FSL_FEATURE_SOC_USBNC_COUNT) && (FSL_FEATURE_SOC_USBNC_COUNT > 0U)) void *USB_EhciNCGetBase(uint8_t controllerId) { void *usbNCBase = NULL; #if ((defined FSL_FEATURE_SOC_USBNC_COUNT) && (FSL_FEATURE_SOC_USBNC_COUNT > 0U)) uint32_t instance; uint32_t newinstance = 0; uint32_t usbnc_base_temp[] = USBNC_BASE_ADDRS; uint32_t usbnc_base[] = USBNC_BASE_ADDRS; if (controllerId < kUSB_ControllerEhci0) { return NULL; } controllerId = controllerId - kUSB_ControllerEhci0; for (instance = 0; instance < (sizeof(usbnc_base_temp) / sizeof(usbnc_base_temp[0])); instance++) { if (usbnc_base_temp[instance]) { usbnc_base[newinstance++] = usbnc_base_temp[instance]; } } if (controllerId > newinstance) { return NULL; } usbNCBase = (void *)usbnc_base[controllerId]; #endif return usbNCBase; } #endif #endif /*! * @brief Set device controller state to default state. * * The function is used to set device controller state to default state. * The function will be called when USB_DeviceEhciInit called or the control type kUSB_DeviceControlGetEndpointStatus * received in USB_DeviceEhciControl. * * @param ehciState Pointer of the device EHCI state structure. * */ static void USB_DeviceEhciSetDefaultState(usb_device_ehci_state_struct_t *ehciState) { usb_device_ehci_dtd_struct_t *p; /* Initialize the dtd free queue */ ehciState->dtdFree = ehciState->dtd; p = ehciState->dtdFree; for (uint32_t i = 1U; i < USB_DEVICE_CONFIG_EHCI_MAX_DTD; i++) { p->nextDtdPointer = (uint32_t)&ehciState->dtd[i]; p = (usb_device_ehci_dtd_struct_t *)p->nextDtdPointer; } p->nextDtdPointer = 0U; ehciState->dtdCount = USB_DEVICE_CONFIG_EHCI_MAX_DTD; /* Not use interrupt threshold. */ ehciState->registerBase->USBCMD &= ~USBHS_USBCMD_ITC_MASK; ehciState->registerBase->USBCMD |= USBHS_USBCMD_ITC(0U); /* Disable setup lockout, please refer to "Control Endpoint Operation" section in RM. */ ehciState->registerBase->USBMODE |= USBHS_USBMODE_SLOM_MASK; /* Set the endian by using CPU's endian */ //#if (ENDIANNESS == USB_BIG_ENDIAN) #if 0 ehciState->registerBase->USBMODE |= USBHS_USBMODE_ES_MASK; #else ehciState->registerBase->USBMODE &= ~USBHS_USBMODE_ES_MASK; #endif /* Initialize the QHs of endpoint. */ for (uint32_t i = 0U; i < (USB_DEVICE_CONFIG_ENDPOINTS * 2U); i++) { ehciState->qh[i].nextDtdPointer = USB_DEVICE_ECHI_DTD_TERMINATE_MASK; ehciState->qh[i].capabilttiesCharacteristicsUnion.capabilttiesCharacteristicsBitmap.maxPacketSize = USB_CONTROL_MAX_PACKET_SIZE; ehciState->dtdHard[i] = NULL; ehciState->dtdTail[i] = NULL; ehciState->qh[i].endpointStatusUnion.endpointStatusBitmap.isOpened = 0U; } /* Add QH buffer address to USBHS_EPLISTADDR_REG */ //ehciState->registerBase->EPLISTADDR = (uint32_t)ehciState->qh; ehciState->registerBase->EPLISTADDR = (uint32_t)qh_buffer_phy; /* Clear device address */ ehciState->registerBase->DEVICEADDR = 0U; #if defined(USB_DEVICE_CONFIG_DETACH_ENABLE) && (USB_DEVICE_CONFIG_DETACH_ENABLE > 0U) ehciState->registerBase->OTGSC = ehciState->registerBase->OTGSC & 0x0000FFFF; ehciState->registerBase->OTGSC |= USBHS_OTGSC_BSVIE_MASK; #endif /* USB_DEVICE_CONFIG_DETACH_ENABLE */ /* Enable reset, sof, token, stall interrupt */ ehciState->registerBase->USBINTR = (USBHS_USBINTR_UE_MASK | USBHS_USBINTR_UEE_MASK | USBHS_USBINTR_PCE_MASK | USBHS_USBINTR_URE_MASK #if (defined(USB_DEVICE_CONFIG_LOW_POWER_MODE) && (USB_DEVICE_CONFIG_LOW_POWER_MODE > 0U)) | USBHS_USBINTR_SLE_MASK #endif /* USB_DEVICE_CONFIG_LOW_POWER_MODE */ ); /* Clear reset flag */ ehciState->isResetting = 0U; } /*! * @brief Initialize a specified endpoint. * * The function is used to initialize a specified endpoint. * * @param ehciState Pointer of the device EHCI state structure. * @param epInit The endpoint initialization structure pointer. * * @return A USB error code or kStatus_USB_Success. */ static usb_status_t USB_DeviceEhciEndpointInit(usb_device_ehci_state_struct_t *ehciState, usb_device_endpoint_init_struct_t *epInit) { uint32_t primeBit = 1U << ((epInit->endpointAddress & USB_ENDPOINT_NUMBER_MASK) + ((epInit->endpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) >> 0x03U)); uint16_t maxPacketSize = epInit->maxPacketSize & USB_DESCRIPTOR_ENDPOINT_MAXPACKETSIZE_SIZE_MASK; uint8_t endpoint = (epInit->endpointAddress & USB_ENDPOINT_NUMBER_MASK); uint8_t direction = (epInit->endpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) >> USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT; uint8_t index = ((uint8_t)((uint32_t)endpoint << 1U)) | direction; uint8_t transferType = epInit->transferType & USB_DESCRIPTOR_ENDPOINT_ATTRIBUTE_TYPE_MASK; /* Cancel pending transfer of the endpoint */ USB_DeviceEhciCancel(ehciState, epInit->endpointAddress); if ((ehciState->registerBase->EPPRIME & primeBit) || (ehciState->registerBase->EPSR & primeBit)) { return kStatus_USB_Busy; } /* Make the endpoint max packet size align with USB Specification 2.0. */ if (USB_ENDPOINT_ISOCHRONOUS == transferType) { if (maxPacketSize > USB_DEVICE_MAX_HS_ISO_MAX_PACKET_SIZE) { maxPacketSize = USB_DEVICE_MAX_HS_ISO_MAX_PACKET_SIZE; } ehciState->qh[index].capabilttiesCharacteristicsUnion.capabilttiesCharacteristicsBitmap.mult = 1U + ((maxPacketSize & USB_DESCRIPTOR_ENDPOINT_MAXPACKETSIZE_MULT_TRANSACTIONS_MASK) >> USB_DESCRIPTOR_ENDPOINT_MAXPACKETSIZE_MULT_TRANSACTIONS_SHFIT); } else { ehciState->qh[index].capabilttiesCharacteristicsUnion.capabilttiesCharacteristicsBitmap.mult = 0U; } /* Save the max packet size of the endpoint */ ehciState->qh[index].capabilttiesCharacteristicsUnion.capabilttiesCharacteristicsBitmap.maxPacketSize = maxPacketSize; /* Set ZLT bit. */ ehciState->qh[index].capabilttiesCharacteristicsUnion.capabilttiesCharacteristicsBitmap.zlt = !epInit->zlt; /* Enable the endpoint. */ if (USB_ENDPOINT_CONTROL == transferType) { ehciState->qh[index].capabilttiesCharacteristicsUnion.capabilttiesCharacteristicsBitmap.ios = 1U; ehciState->registerBase->EPCR0 |= (direction ? (USBHS_EPCR_TXE_MASK | USBHS_EPCR_TXR_MASK | ((uint32_t)transferType << USBHS_EPCR_TXT_SHIFT)) : (USBHS_EPCR_RXE_MASK | USBHS_EPCR_RXR_MASK | ((uint32_t)transferType << USBHS_EPCR_RXT_SHIFT))); } else { ehciState->qh[index].capabilttiesCharacteristicsUnion.capabilttiesCharacteristicsBitmap.ios = 0U; ehciState->registerBase->EPCR[endpoint - 1U] |= (direction ? (USBHS_EPCR_TXE_MASK | USBHS_EPCR_TXR_MASK | ((uint32_t)transferType << USBHS_EPCR_TXT_SHIFT)) : (USBHS_EPCR_RXE_MASK | USBHS_EPCR_RXR_MASK | ((uint32_t)transferType << USBHS_EPCR_RXT_SHIFT))); } ehciState->qh[index].endpointStatusUnion.endpointStatusBitmap.isOpened = 1U; return kStatus_USB_Success; } /*! * @brief De-initialize a specified endpoint. * * The function is used to de-initialize a specified endpoint. * Current transfer of the endpoint will be cancelled and the specified endpoint will be disabled. * * @param ehciState Pointer of the device EHCI state structure. * @param ep The endpoint address, Bit7, 0U - USB_OUT, 1U - USB_IN. * * @return A USB error code or kStatus_USB_Success. */ static usb_status_t USB_DeviceEhciEndpointDeinit(usb_device_ehci_state_struct_t *ehciState, uint8_t ep) { uint32_t primeBit = 1U << ((ep & USB_ENDPOINT_NUMBER_MASK) + ((ep & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) >> 0x03U)); uint8_t endpoint = (ep & USB_ENDPOINT_NUMBER_MASK); uint8_t direction = (ep & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) >> USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT; uint8_t index = ((uint8_t)((uint32_t)endpoint << 1U)) | direction; ehciState->qh[index].endpointStatusUnion.endpointStatusBitmap.isOpened = 0U; /* Cancel the transfer of the endpoint */ USB_DeviceEhciCancel(ehciState, ep); if ((ehciState->registerBase->EPPRIME & primeBit) || (ehciState->registerBase->EPSR & primeBit)) { return kStatus_USB_Busy; } /* Clear endpoint state */ ehciState->qh[index].capabilttiesCharacteristicsUnion.capabilttiesCharacteristics = 0U; /* Disable the endpoint */ if (!endpoint) { ehciState->registerBase->EPCR0 &= ~(direction ? (USBHS_EPCR_TXE_MASK | USBHS_EPCR_TXT_MASK) : (USBHS_EPCR_RXE_MASK | USBHS_EPCR_RXT_MASK)); } else { ehciState->registerBase->EPCR[endpoint - 1U] &= ~(direction ? (USBHS_EPCR_TXE_MASK | USBHS_EPCR_TXT_MASK) : (USBHS_EPCR_RXE_MASK | USBHS_EPCR_RXT_MASK)); } return kStatus_USB_Success; } /*! * @brief Stall a specified endpoint. * * The function is used to stall a specified endpoint. * Current transfer of the endpoint will be cancelled and the specified endpoint will be stalled. * * @param ehciState Pointer of the device EHCI state structure. * @param ep The endpoint address, Bit7, 0U - USB_OUT, 1U - USB_IN. * * @return A USB error code or kStatus_USB_Success. */ static usb_status_t USB_DeviceEhciEndpointStall(usb_device_ehci_state_struct_t *ehciState, uint8_t ep) { uint8_t endpoint = ep & USB_ENDPOINT_NUMBER_MASK; uint8_t direction = (ep & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) >> USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT; uint8_t index = ((uint8_t)((uint32_t)endpoint << 1U)) | direction; /* Cancel the transfer of the endpoint */ USB_DeviceEhciCancel(ehciState, ep); /* Set endpoint stall flag. */ if (ehciState->qh[index].capabilttiesCharacteristicsUnion.capabilttiesCharacteristicsBitmap.ios) { if (!endpoint) { ehciState->registerBase->EPCR0 |= (USBHS_EPCR_TXS_MASK | USBHS_EPCR_RXS_MASK); } else { ehciState->registerBase->EPCR[endpoint - 1U] |= (USBHS_EPCR_TXS_MASK | USBHS_EPCR_RXS_MASK); } } else { if (!endpoint) { ehciState->registerBase->EPCR0 |= (direction ? USBHS_EPCR_TXS_MASK : USBHS_EPCR_RXS_MASK); } else { ehciState->registerBase->EPCR[endpoint - 1U] |= (direction ? USBHS_EPCR_TXS_MASK : USBHS_EPCR_RXS_MASK); } } return kStatus_USB_Success; } /*! * @brief Un-stall a specified endpoint. * * The function is used to un-stall a specified endpoint. * Current transfer of the endpoint will be cancelled and the specified endpoint will be un-stalled. * * @param ehciState Pointer of the device EHCI state structure. * @param ep The endpoint address, Bit7, 0U - USB_OUT, 1U - USB_IN. * * @return A USB error code or kStatus_USB_Success. */ static usb_status_t USB_DeviceEhciEndpointUnstall(usb_device_ehci_state_struct_t *ehciState, uint8_t ep) { uint8_t endpoint = ep & USB_ENDPOINT_NUMBER_MASK; uint8_t direction = (ep & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) >> USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT; /* Clear the endpoint stall state */ if (!endpoint) { ehciState->registerBase->EPCR0 &= ~(direction ? USBHS_EPCR_TXS_MASK : USBHS_EPCR_RXS_MASK); } else { ehciState->registerBase->EPCR[endpoint - 1U] &= ~(direction ? USBHS_EPCR_TXS_MASK : USBHS_EPCR_RXS_MASK); ehciState->registerBase->EPCR[endpoint - 1U] |= (direction ? USBHS_EPCR_TXR_MASK : USBHS_EPCR_RXR_MASK); } return kStatus_USB_Success; } /*! * @brief Get setup packet data. * * The function is used to get setup packet data and copy to a backup buffer. * * @param ehciState Pointer of the device EHCI state structure. * @param ep The endpoint number. * */ static void USB_DeviceEhciFillSetupBuffer(usb_device_ehci_state_struct_t *ehciState, uint8_t ep) { uint8_t waitingSafelyAccess = 1U; uint8_t index = (ep * 2U) | USB_OUT; /* Write 1U to clear corresponding bit in EPSETUPSR. */ ehciState->registerBase->EPSETUPSR = 1U << ep; while (waitingSafelyAccess) { /* Set the setup tripwire bit. */ ehciState->registerBase->USBCMD |= USBHS_USBCMD_SUTW_MASK; /* Copy setup packet data to backup buffer */ ehciState->qh[index].setupBufferBack[0] = ehciState->qh[index].setupBuffer[0]; ehciState->qh[index].setupBufferBack[1] = ehciState->qh[index].setupBuffer[1]; /* Read the USBCMD[SUTW] bit. If set, jump out from the while loop; if cleared continue */ if (ehciState->registerBase->USBCMD & USBHS_USBCMD_SUTW_MASK) { waitingSafelyAccess = 0U; } } /* Clear the setup tripwire bit */ ehciState->registerBase->USBCMD &= ~USBHS_USBCMD_SUTW_MASK; /* Poll until the EPSETUPSR bit clearred */ while (ehciState->registerBase->EPSETUPSR & (1U << ep)) { } } /*! * @brief Cancel the transfer of the control pipe. * * The function is used to cancel the transfer of the control pipe. * * @param ehciState Pointer of the device EHCI state structure. * @param endpoint The endpoint number. * @param direction The direction of the endpoint. * */ static void USB_DeviceEhciCancelControlPipe(usb_device_ehci_state_struct_t *ehciState, uint8_t endpoint, uint8_t direction) { usb_device_ehci_dtd_struct_t *currentDtd; uint32_t index = ((uint32_t)endpoint << 1U) + (uint32_t)direction; usb_device_callback_message_struct_t message; message.buffer = NULL; message.length = 0U; /* Get the dtd of the control pipe */ currentDtd = (usb_device_ehci_dtd_struct_t *)((uint32_t)ehciState->dtdHard[index] & USB_DEVICE_ECHI_DTD_POINTER_MASK); while (currentDtd) { /* Pass the transfer buffer address */ if (NULL == message.buffer) { uint32_t bufferAddress = currentDtd->bufferPointerPage[0]; message.buffer = (uint8_t *)((bufferAddress & USB_DEVICE_ECHI_DTD_PAGE_MASK) | (currentDtd->reservedUnion.originalBufferInfo.originalBufferOffest)); } /* If the dtd is active, set the message length to USB_UNINITIALIZED_VAL_32. Or set the length by using finished * length. */ if (currentDtd->dtdTokenUnion.dtdTokenBitmap.status & USB_DEVICE_ECHI_DTD_STATUS_ACTIVE) { message.length = USB_UNINITIALIZED_VAL_32; } else { message.length += (currentDtd->reservedUnion.originalBufferInfo.originalBufferLength - currentDtd->dtdTokenUnion.dtdTokenBitmap.totalBytes); } /* Move the dtd head pointer to next. */ /* If the pointer of the head equals to the tail, set the dtd queue to null. */ if (ehciState->dtdHard[index] == ehciState->dtdTail[index]) { ehciState->dtdHard[index] = NULL; ehciState->dtdTail[index] = NULL; ehciState->qh[index].nextDtdPointer = USB_DEVICE_ECHI_DTD_TERMINATE_MASK; ehciState->qh[index].dtdTokenUnion.dtdToken = 0U; } else { ehciState->dtdHard[index] = (usb_device_ehci_dtd_struct_t *)ehciState->dtdHard[index]->nextDtdPointer; } /* When the ioc is set or the dtd queue is empty, the up layer will be notified. */ if ((currentDtd->dtdTokenUnion.dtdTokenBitmap.ioc) || (0 == ((uint32_t)ehciState->dtdHard[index] & USB_DEVICE_ECHI_DTD_POINTER_MASK))) { message.code = endpoint | (uint8_t)((uint32_t)direction << 0x07U); message.isSetup = 0U; USB_DeviceNotificationTrigger(ehciState->deviceHandle, &message); message.buffer = NULL; message.length = 0U; } /* Clear the token field of the dtd. */ currentDtd->dtdTokenUnion.dtdToken = 0U; /* Add the dtd to the free dtd queue. */ currentDtd->nextDtdPointer = (uint32_t)ehciState->dtdFree; ehciState->dtdFree = currentDtd; ehciState->dtdCount++; /* Get the next in-used dtd. */ currentDtd = (usb_device_ehci_dtd_struct_t *)((uint32_t)ehciState->dtdHard[index] & USB_DEVICE_ECHI_DTD_POINTER_MASK); } } /*! * @brief Handle the endpoint token done interrupt. * * The function is used to handle the endpoint token done interrupt. * * @param ehciState Pointer of the device EHCI state structure. * */ static void USB_DeviceEhciInterruptTokenDone(usb_device_ehci_state_struct_t *ehciState) { uint32_t status; uint32_t primeBit; usb_device_ehci_dtd_struct_t *currentDtd; usb_device_callback_message_struct_t message; uint8_t endpoint; uint8_t direction; uint8_t count; uint8_t index; /* Get the EPSETUPSR to check the setup packect received in which one endpoint. */ status = ehciState->registerBase->EPSETUPSR; if (status) { for (endpoint = 0U; endpoint < USB_DEVICE_CONFIG_ENDPOINTS; endpoint++) { /* Check the endpoint receive the setup packet. */ if (status & (1U << endpoint)) { /* Get last setup packet */ usb_setup_struct_t *deviceSetup = (usb_setup_struct_t *)&ehciState->qh[(uint8_t)((uint32_t)endpoint << 1U) + USB_OUT].setupBufferBack; /* Check the direction of the data phase. */ direction = (deviceSetup->bmRequestType & USB_REQUEST_TYPE_DIR_IN) >> USB_REQUEST_TYPE_DIR_SHIFT; /* Cancel the data phase transfer */ USB_DeviceEhciCancelControlPipe(ehciState, endpoint, direction); /* Cancel the status phase transfer */ USB_DeviceEhciCancelControlPipe(ehciState, endpoint, 1U ^ direction); message.code = (endpoint) | (USB_OUT << 0x07U); message.buffer = (uint8_t *)deviceSetup; message.length = USB_SETUP_PACKET_SIZE; message.isSetup = 1U; /* Fill the setup packet to the backup buffer */ USB_DeviceEhciFillSetupBuffer(ehciState, endpoint); /* Notify the up layer the EHCI status changed. */ USB_DeviceNotificationTrigger(ehciState->deviceHandle, &message); } } } /* Read the USBHS_EPCOMPLETE_REG to get the endpoint transfer done status */ status = ehciState->registerBase->EPCOMPLETE; /* Clear the endpoint transfer done status */ ehciState->registerBase->EPCOMPLETE = status; if (status) { for (count = 0U; count < 32U; count++) { /* Check the transfer is done or not in the specified endpoint. */ if (status & ((uint32_t)(1U << count))) { if (count > 15U) { endpoint = count - 16U; direction = USB_IN; } else { endpoint = count; direction = USB_OUT; } if (endpoint >= USB_DEVICE_CONFIG_ENDPOINTS) { continue; } index = (endpoint << 1U) + direction; message.buffer = NULL; message.length = 0U; /* Get the in-used dtd of the specified endpoint. */ currentDtd = (usb_device_ehci_dtd_struct_t *)((uint32_t)ehciState->dtdHard[index] & USB_DEVICE_ECHI_DTD_POINTER_MASK); while (currentDtd) { uint8_t isTokenDone = 0; /* Get the in-used dtd of the specified endpoint. */ currentDtd = (usb_device_ehci_dtd_struct_t *)((uint32_t)ehciState->dtdHard[index] & USB_DEVICE_ECHI_DTD_POINTER_MASK); while (currentDtd) { /* Don't handle the active dtd. */ if ((currentDtd->dtdTokenUnion.dtdTokenBitmap.status & USB_DEVICE_ECHI_DTD_STATUS_ACTIVE) || (currentDtd->dtdTokenUnion.dtdTokenBitmap.ioc)) { if ((!(currentDtd->dtdTokenUnion.dtdTokenBitmap.status & USB_DEVICE_ECHI_DTD_STATUS_ACTIVE)) && (currentDtd->dtdTokenUnion.dtdTokenBitmap.ioc)) { isTokenDone = 1U; } break; } currentDtd = (usb_device_ehci_dtd_struct_t *)(currentDtd->nextDtdPointer & USB_DEVICE_ECHI_DTD_POINTER_MASK); } if ((0 == isTokenDone) && (currentDtd)) { break; } /* Get the in-used dtd of the specified endpoint. */ currentDtd = (usb_device_ehci_dtd_struct_t *)((uint32_t)ehciState->dtdHard[index] & USB_DEVICE_ECHI_DTD_POINTER_MASK); while (currentDtd) { /* Don't handle the active dtd. */ if (currentDtd->dtdTokenUnion.dtdTokenBitmap.status & USB_DEVICE_ECHI_DTD_STATUS_ACTIVE) { break; } /* Save the transfer buffer address */ if (NULL == message.buffer) { message.buffer = (uint8_t *)((currentDtd->bufferPointerPage[0] & USB_DEVICE_ECHI_DTD_PAGE_MASK) | (currentDtd->reservedUnion.originalBufferInfo.originalBufferOffest)); } /* Save the transferred data length */ message.length += (currentDtd->reservedUnion.originalBufferInfo.originalBufferLength - currentDtd->dtdTokenUnion.dtdTokenBitmap.totalBytes); /* Move the dtd queue head pointer to next */ if (ehciState->dtdHard[index] == ehciState->dtdTail[index]) { ehciState->dtdHard[index] = NULL; ehciState->dtdTail[index] = NULL; ehciState->qh[index].nextDtdPointer = USB_DEVICE_ECHI_DTD_TERMINATE_MASK; ehciState->qh[index].dtdTokenUnion.dtdToken = 0U; } else { ehciState->dtdHard[index] = (usb_device_ehci_dtd_struct_t *)ehciState->dtdHard[index]->nextDtdPointer; } /* When the ioc is set or the dtd queue is empty, the up layer will be notified. */ if ((currentDtd->dtdTokenUnion.dtdTokenBitmap.ioc) || (0 == ((uint32_t)ehciState->dtdHard[index] & USB_DEVICE_ECHI_DTD_POINTER_MASK))) { message.code = endpoint | (uint8_t)((uint32_t)direction << 0x07U); message.isSetup = 0U; USB_DeviceNotificationTrigger(ehciState->deviceHandle, &message); message.buffer = NULL; message.length = 0U; } /* Clear the token field of the dtd */ currentDtd->dtdTokenUnion.dtdToken = 0U; currentDtd->nextDtdPointer = (uint32_t)ehciState->dtdFree; ehciState->dtdFree = currentDtd; ehciState->dtdCount++; /* Get the next in-used dtd */ currentDtd = (usb_device_ehci_dtd_struct_t *)((uint32_t)ehciState->dtdHard[index] & USB_DEVICE_ECHI_DTD_POINTER_MASK); if ((NULL != currentDtd) && (currentDtd->dtdTokenUnion.dtdTokenBitmap.status & USB_DEVICE_ECHI_DTD_STATUS_ACTIVE)) { primeBit = 1U << (endpoint + 16U * direction); /* Try to prime the next dtd. */ ehciState->registerBase->EPPRIME = primeBit; /* Whether the endpoint transmit/receive buffer is ready or not. If not, wait for prime bit * cleared and prime the next dtd. */ if (!(ehciState->registerBase->EPSR & primeBit)) { /* Wait for the endpoint prime bit cleared by HW */ while (ehciState->registerBase->EPPRIME & primeBit) { } /* If the endpoint transmit/receive buffer is not ready */ if (!(ehciState->registerBase->EPSR & primeBit)) { /* Prime next dtd and prime the transfer */ ehciState->qh[index].nextDtdPointer = (uint32_t)currentDtd; ehciState->qh[index].dtdTokenUnion.dtdToken = 0U; ehciState->registerBase->EPPRIME = primeBit; } } } } } } } } } /*! * @brief Handle the port status change interrupt. * * The function is used to handle the port status change interrupt. * * @param ehciState Pointer of the device EHCI state structure. * */ static void USB_DeviceEhciInterruptPortChange(usb_device_ehci_state_struct_t *ehciState) { usb_device_callback_message_struct_t message; message.buffer = (uint8_t *)NULL; message.length = 0U; message.isSetup = 0U; /* Whether the port is doing reset. */ if (!(ehciState->registerBase->PORTSC1 & USBHS_PORTSC1_PR_MASK)) { /* If not, update the USB speed. */ if (ehciState->registerBase->PORTSC1 & USBHS_PORTSC1_HSP_MASK) { ehciState->speed = USB_SPEED_HIGH; } else { ehciState->speed = USB_SPEED_FULL; } /* If the device reset flag is non-zero, notify the up layer the device reset finished. */ if (ehciState->isResetting) { message.code = kUSB_DeviceNotifyBusReset; USB_DeviceNotificationTrigger(ehciState->deviceHandle, &message); ehciState->isResetting = 0U; } } #if (defined(USB_DEVICE_CONFIG_LOW_POWER_MODE) && (USB_DEVICE_CONFIG_LOW_POWER_MODE > 0U)) if ((ehciState->isSuspending) && (!(ehciState->registerBase->PORTSC1 & USBHS_PORTSC1_SUSP_MASK))) { /* Set the resume flag */ ehciState->isSuspending = 0U; message.code = kUSB_DeviceNotifyResume; USB_DeviceNotificationTrigger(ehciState->deviceHandle, &message); } #endif /* USB_DEVICE_CONFIG_LOW_POWER_MODE */ } /*! * @brief Handle the reset interrupt. * * The function is used to handle the reset interrupt. * * @param ehciState Pointer of the device EHCI state structure. * */ static void USB_DeviceEhciInterruptReset(usb_device_ehci_state_struct_t *ehciState) { uint32_t status = 0U; /* Clear the setup flag */ status = ehciState->registerBase->EPSETUPSR; ehciState->registerBase->EPSETUPSR = status; /* Clear the endpoint complete flag */ status = ehciState->registerBase->EPCOMPLETE; ehciState->registerBase->EPCOMPLETE = status; do { /* Flush the pending transfers */ ehciState->registerBase->EPFLUSH = USBHS_EPFLUSH_FERB_MASK | USBHS_EPFLUSH_FETB_MASK; } while (ehciState->registerBase->EPPRIME & (USBHS_EPPRIME_PERB_MASK | USBHS_EPPRIME_PETB_MASK)); /* Whether is the port reset. If yes, set the isResetting flag. Or, notify the up layer. */ if (ehciState->registerBase->PORTSC1 & USBHS_PORTSC1_PR_MASK) { ehciState->isResetting = 1U; } else { usb_device_callback_message_struct_t message; message.buffer = (uint8_t *)NULL; message.code = kUSB_DeviceNotifyBusReset; message.length = 0U; message.isSetup = 0U; USB_DeviceNotificationTrigger(ehciState->deviceHandle, &message); } } /*! * @brief Handle the sof interrupt. * * The function is used to handle the sof interrupt. * * @param ehciState Pointer of the device EHCI state structure. * */ static void USB_DeviceEhciInterruptSof(usb_device_ehci_state_struct_t *ehciState) { } #if (defined(USB_DEVICE_CONFIG_LOW_POWER_MODE) && (USB_DEVICE_CONFIG_LOW_POWER_MODE > 0U)) /*! * @brief Handle the suspend interrupt. * * The function is used to handle the suspend interrupt. * * @param ehciState Pointer of the device EHCI state structure. * */ static void USB_DeviceEhciInterruptSuspend(usb_device_ehci_state_struct_t *ehciState) { /* If the port is in suspend state, notify the up layer */ if (ehciState->registerBase->PORTSC1 & USBHS_PORTSC1_SUSP_MASK) { #if (defined(FSL_FEATURE_SOC_USBNC_COUNT) && (FSL_FEATURE_SOC_USBNC_COUNT > 0U)) #else if (ehciState->registerPhyBase->USB1_VBUS_DET_STAT & USBPHY_USB1_VBUS_DET_STAT_VBUS_VALID_3V_MASK) #endif { usb_device_callback_message_struct_t message; message.buffer = (uint8_t *)NULL; message.length = 0U; message.isSetup = 0U; message.code = kUSB_DeviceNotifySuspend; USB_DeviceNotificationTrigger(ehciState->deviceHandle, &message); } } } #endif /* USB_DEVICE_CONFIG_LOW_POWER_MODE */ /*! * @brief Get dtds and link to QH. * * The function is used to get dtds and link to QH. * * @param ehciState Pointer of the device EHCI state structure. * @param endpointAddress The endpoint address, Bit7, 0U - USB_OUT, 1U - USB_IN. * @param buffer The memory address needed to be transferred. * @param length Data length. * * @return A USB error code or kStatus_USB_Success. */ static usb_status_t USB_DeviceEhciTransfer(usb_device_ehci_state_struct_t *ehciState, uint8_t endpointAddress, uint8_t *buffer, uint32_t length) { usb_device_ehci_dtd_struct_t *dtd; usb_device_ehci_dtd_struct_t *dtdHard; uint32_t index = ((endpointAddress & USB_ENDPOINT_NUMBER_MASK) << 1U) | ((endpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) >> USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT); uint32_t primeBit = 1U << ((endpointAddress & USB_ENDPOINT_NUMBER_MASK) + ((endpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) >> 0x03U)); uint8_t epStatus = primeBit; uint32_t sendLength; uint32_t currentIndex = 0U; uint32_t dtdRequestCount = (length + USB_DEVICE_ECHI_DTD_TOTAL_BYTES - 1U) / USB_DEVICE_ECHI_DTD_TOTAL_BYTES; uint8_t qhIdle = 0U; uint8_t waitingSafelyAccess = 1U; USB_OSA_SR_ALLOC(); if (!ehciState) { return kStatus_USB_InvalidHandle; } if (0U == ehciState->qh[index].endpointStatusUnion.endpointStatusBitmap.isOpened) { return kStatus_USB_Error; } /* Return error when ehci is doing reset */ if (ehciState->isResetting) { return kStatus_USB_Error; } if (!dtdRequestCount) { dtdRequestCount = 1U; } USB_OSA_ENTER_CRITICAL(); /* The free dtd count need to not less than the transfer requests. */ if (dtdRequestCount > (uint32_t)ehciState->dtdCount) { USB_OSA_EXIT_CRITICAL(); return kStatus_USB_Busy; } do { /* The transfer length need to not more than USB_DEVICE_ECHI_DTD_TOTAL_BYTES for each dtd. */ if (length > USB_DEVICE_ECHI_DTD_TOTAL_BYTES) { sendLength = USB_DEVICE_ECHI_DTD_TOTAL_BYTES; } else { sendLength = length; } length -= sendLength; /* Get a free dtd */ dtd = ehciState->dtdFree; ehciState->dtdFree = (usb_device_ehci_dtd_struct_t *)dtd->nextDtdPointer; ehciState->dtdCount--; /* Save the dtd head when current active buffer offset is zero. */ if (!currentIndex) { dtdHard = dtd; } /* Set the dtd field */ dtd->nextDtdPointer = USB_DEVICE_ECHI_DTD_TERMINATE_MASK; dtd->dtdTokenUnion.dtdToken = 0U; dtd->bufferPointerPage[0] = (uint32_t)(virtual_to_physical(buffer) + currentIndex); dtd->bufferPointerPage[1] = (dtd->bufferPointerPage[0] + USB_DEVICE_ECHI_DTD_PAGE_BLOCK) & USB_DEVICE_ECHI_DTD_PAGE_MASK; dtd->bufferPointerPage[2] = dtd->bufferPointerPage[1] + USB_DEVICE_ECHI_DTD_PAGE_BLOCK; dtd->bufferPointerPage[3] = dtd->bufferPointerPage[2] + USB_DEVICE_ECHI_DTD_PAGE_BLOCK; dtd->bufferPointerPage[4] = dtd->bufferPointerPage[3] + USB_DEVICE_ECHI_DTD_PAGE_BLOCK; dtd->dtdTokenUnion.dtdTokenBitmap.totalBytes = sendLength; /* Save the data length needed to be transferred. */ dtd->reservedUnion.originalBufferInfo.originalBufferLength = sendLength; /* Save the original buffer address */ dtd->reservedUnion.originalBufferInfo.originalBufferOffest = dtd->bufferPointerPage[0] & USB_DEVICE_ECHI_DTD_PAGE_OFFSET_MASK; dtd->reservedUnion.originalBufferInfo.dtdInvalid = 0U; /* Set the IOC field in last dtd. */ if (!length) { dtd->dtdTokenUnion.dtdTokenBitmap.ioc = 1U; } /* Set dtd active */ dtd->dtdTokenUnion.dtdTokenBitmap.status = USB_DEVICE_ECHI_DTD_STATUS_ACTIVE; /* Move the buffer offset index */ currentIndex += sendLength; /* Add dtd to the in-used dtd queue */ if (ehciState->dtdTail[index]) { ehciState->dtdTail[index]->nextDtdPointer = (uint32_t)dtd; ehciState->dtdTail[index] = dtd; } else { ehciState->dtdHard[index] = dtd; ehciState->dtdTail[index] = dtd; qhIdle = 1U; } } while (length); /* If the QH is not empty */ if (!qhIdle) { /* If the prime bit is set, nothing need to do. */ if (ehciState->registerBase->EPPRIME & primeBit) { USB_OSA_EXIT_CRITICAL(); return kStatus_USB_Success; } /* To safely a dtd */ while (waitingSafelyAccess) { /* set the ATDTW flag to USBHS_USBCMD_REG. */ ehciState->registerBase->USBCMD |= USBHS_USBCMD_ATDTW_MASK; /* Read EPSR */ epStatus = ehciState->registerBase->EPSR; /* Wait the ATDTW bit set */ if (ehciState->registerBase->USBCMD & USBHS_USBCMD_ATDTW_MASK) { waitingSafelyAccess = 0U; } } /* Clear the ATDTW bit */ ehciState->registerBase->USBCMD &= ~USBHS_USBCMD_ATDTW_MASK; } void *dtdhard_phy = NULL; /* If QH is empty or the endpoint is not primed, need to link current dtd head to the QH. */ /* When the endpoint is not primed if qhIdle is zero, it means the QH is empty. */ if ((qhIdle) || (!(epStatus & primeBit))) { //ehciState->qh[index].nextDtdPointer = (uint32_t)dtdHard; dtdhard_phy = imx6ull_get_periph_paddr((uint32_t)dtdHard); ehciState->qh[index].nextDtdPointer = (uint32_t)dtdhard_phy; ehciState->qh[index].dtdTokenUnion.dtdToken = 0U; ehciState->registerBase->EPPRIME = primeBit; while (!(ehciState->registerBase->EPSR & primeBit)) { if (ehciState->registerBase->EPCOMPLETE & primeBit) { break; } else { ehciState->registerBase->EPPRIME = primeBit; } } } USB_OSA_EXIT_CRITICAL(); return kStatus_USB_Success; } /*! * @brief Initialize the USB device EHCI instance. * * This function initializes the USB device EHCI module specified by the controllerId. * * @param controllerId The controller id of the USB IP. Please refer to enumeration type usb_controller_index_t. * @param handle Pointer of the device handle, used to identify the device object is belonged to. * @param ehciHandle It is out parameter, is used to return pointer of the device EHCI handle to the caller. * * @return A USB error code or kStatus_USB_Success. */ usb_status_t USB_DeviceEhciInit(uint8_t controllerId, usb_device_handle handle, usb_device_controller_handle *ehciHandle) { usb_device_ehci_state_struct_t *ehciState; uint32_t ehci_base[] = USBHS_BASE_ADDRS; #if (defined(USB_DEVICE_CHARGER_DETECT_ENABLE) && (USB_DEVICE_CHARGER_DETECT_ENABLE > 0U)) && \ (defined(FSL_FEATURE_SOC_USBHSDCD_COUNT) && (FSL_FEATURE_SOC_USBHSDCD_COUNT > 0U)) usb_device_dcd_state_struct_t *dcdHSState; uint32_t dcd_base[] = USBHSDCD_BASE_ADDRS; usb_device_callback_message_struct_t message; #endif if ((controllerId < kUSB_ControllerEhci0) || ((uint32_t)(controllerId - kUSB_ControllerEhci0) >= USB_DEVICE_CONFIG_EHCI) || ((uint32_t)(controllerId - kUSB_ControllerEhci0) >= (sizeof(ehci_base) / sizeof(uint32_t)))) { return kStatus_USB_ControllerNotFound; } ehciState = &g_UsbDeviceEhciSate[controllerId - kUSB_ControllerEhci0]; int num = 1; int page_size = 4096; qh_buffer_vir = (void *)rt_pages_alloc(num); if(!qh_buffer_vir) { rt_kprintf("ERROR: qh buff page alloc failed\n"); return kStatus_USB_Error; } qh_buffer_phy = virtual_to_physical(qh_buffer_vir); qh_buffer_vir = rt_ioremap_nocache(virtual_to_physical(qh_buffer_vir), (page_size<<num)); dtd_buffer_vir = (void *)rt_pages_alloc(num); if(!dtd_buffer_vir) { rt_kprintf("ERROR: dtd buff page alloc failed\n"); return kStatus_USB_Error; } dtd_buffer_phy = virtual_to_physical(dtd_buffer_vir); dtd_buffer_vir = rt_ioremap_nocache(virtual_to_physical(dtd_buffer_vir), (page_size<<num)); //ehciState->dtd = s_UsbDeviceEhciDtd[controllerId - kUSB_ControllerEhci0]; //ehciState->qh = (usb_device_ehci_qh_struct_t *)&qh_buffer[(controllerId - kUSB_ControllerEhci0) * 2048]; ehciState->dtd = (usb_device_ehci_dtd_struct_t *)dtd_buffer_vir; ehciState->qh = (usb_device_ehci_qh_struct_t *)qh_buffer_vir; ehciState->controllerId = controllerId; ehciState->registerBase = (USBHS_Type *)ehci_base[controllerId - kUSB_ControllerEhci0]; #if (defined(USB_DEVICE_CONFIG_LOW_POWER_MODE) && (USB_DEVICE_CONFIG_LOW_POWER_MODE > 0U)) ehciState->registerPhyBase = (USBPHY_Type *)USB_EhciPhyGetBase(controllerId); #if (defined(FSL_FEATURE_SOC_USBNC_COUNT) && (FSL_FEATURE_SOC_USBNC_COUNT > 0U)) ehciState->registerNcBase = (USBNC_Type *)USB_EhciNCGetBase(controllerId); #endif #endif /* Get the HW's endpoint count */ ehciState->endpointCount = (uint8_t)((ehciState->registerBase->DCCPARAMS & USBHS_DCCPARAMS_DEN_MASK) >> USBHS_DCCPARAMS_DEN_SHIFT); if (ehciState->endpointCount < USB_DEVICE_CONFIG_ENDPOINTS) { return kStatus_USB_Error; } ehciState->deviceHandle = (usb_device_struct_t *)handle; /* Clear the controller mode field and set to device mode. */ ehciState->registerBase->USBMODE &= ~USBHS_USBMODE_CM_MASK; ehciState->registerBase->USBMODE |= USBHS_USBMODE_CM(0x02U); /* Set the EHCI to default status. */ USB_DeviceEhciSetDefaultState(ehciState); *ehciHandle = (usb_device_controller_handle)ehciState; #if (defined(USB_DEVICE_CHARGER_DETECT_ENABLE) && (USB_DEVICE_CHARGER_DETECT_ENABLE > 0U)) && \ (defined(FSL_FEATURE_SOC_USBHSDCD_COUNT) && (FSL_FEATURE_SOC_USBHSDCD_COUNT > 0U)) dcdHSState = &s_UsbDeviceDcdHSState[controllerId - kUSB_ControllerEhci0]; dcdHSState->controllerId = controllerId; dcdHSState->dcdRegisterBase = (USBHSDCD_Type *)dcd_base[controllerId - kUSB_ControllerEhci0]; dcdHSState->deviceHandle = (usb_device_struct_t *)handle; message.buffer = (uint8_t *)NULL; message.length = 0U; message.isSetup = 0U; if (ehciState->registerBase->OTGSC & USBHS_OTGSC_BSV_MASK) { /* Device is connected to a host. */ message.code = kUSB_DeviceNotifyAttach; USB_DeviceNotificationTrigger(ehciState->deviceHandle, &message); } #endif return kStatus_USB_Success; } /*! * @brief De-initialize the USB device EHCI instance. * * This function de-initializes the USB device EHCI module. * * @param ehciHandle Pointer of the device EHCI handle. * * @return A USB error code or kStatus_USB_Success. */ usb_status_t USB_DeviceEhciDeinit(usb_device_controller_handle ehciHandle) { usb_device_ehci_state_struct_t *ehciState = (usb_device_ehci_state_struct_t *)ehciHandle; if (!ehciHandle) { return kStatus_USB_InvalidHandle; } /* Disable all interrupt. */ ehciState->registerBase->USBINTR = 0U; /* Stop the device functionality. */ ehciState->registerBase->USBCMD &= ~USBHS_USBCMD_RS_MASK; /* Reset the controller. */ ehciState->registerBase->USBCMD |= USBHS_USBCMD_RST_MASK; return kStatus_USB_Success; } /*! * @brief Send data through a specified endpoint. * * This function sends data through a specified endpoint. * * @param ehciHandle Pointer of the device EHCI handle. * @param endpointAddress Endpoint index. * @param buffer The memory address to hold the data need to be sent. * @param length The data length need to be sent. * * @return A USB error code or kStatus_USB_Success. * * @note The return value just means if the sending request is successful or not; the transfer done is notified by the * corresponding callback function. * Currently, only one transfer request can be supported for one specific endpoint. * If there is a specific requirement to support multiple transfer requests for one specific endpoint, the application * should implement a queue in the application level. * The subsequent transfer could begin only when the previous transfer is done (get notification through the endpoint * callback). */ usb_status_t USB_DeviceEhciSend(usb_device_controller_handle ehciHandle, uint8_t endpointAddress, uint8_t *buffer, uint32_t length) { /* Add dtd to the QH */ return USB_DeviceEhciTransfer( (usb_device_ehci_state_struct_t *)ehciHandle, (endpointAddress & USB_ENDPOINT_NUMBER_MASK) | (USB_IN << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT), buffer, length); } /*! * @brief Receive data through a specified endpoint. * * This function Receives data through a specified endpoint. * * @param ehciHandle Pointer of the device EHCI handle. * @param endpointAddress Endpoint index. * @param buffer The memory address to save the received data. * @param length The data length want to be received. * * @return A USB error code or kStatus_USB_Success. * * @note The return value just means if the receiving request is successful or not; the transfer done is notified by the * corresponding callback function. * Currently, only one transfer request can be supported for one specific endpoint. * If there is a specific requirement to support multiple transfer requests for one specific endpoint, the application * should implement a queue in the application level. * The subsequent transfer could begin only when the previous transfer is done (get notification through the endpoint * callback). */ usb_status_t USB_DeviceEhciRecv(usb_device_controller_handle ehciHandle, uint8_t endpointAddress, uint8_t *buffer, uint32_t length) { /* Add dtd to the QH */ return USB_DeviceEhciTransfer( (usb_device_ehci_state_struct_t *)ehciHandle, (endpointAddress & USB_ENDPOINT_NUMBER_MASK) | (USB_OUT << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT), buffer, length); } /*! * @brief Cancel the pending transfer in a specified endpoint. * * The function is used to cancel the pending transfer in a specified endpoint. * * @param ehciHandle Pointer of the device EHCI handle. * @param ep Endpoint address, bit7 is the direction of endpoint, 1U - IN, 0U - OUT. * * @return A USB error code or kStatus_USB_Success. */ usb_status_t USB_DeviceEhciCancel(usb_device_controller_handle ehciHandle, uint8_t ep) { usb_device_ehci_state_struct_t *ehciState = (usb_device_ehci_state_struct_t *)ehciHandle; usb_device_callback_message_struct_t message; usb_device_ehci_dtd_struct_t *currentDtd; uint32_t primeBit = 1U << ((ep & USB_ENDPOINT_NUMBER_MASK) + ((ep & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) >> 0x03U)); uint8_t index = ((ep & USB_ENDPOINT_NUMBER_MASK) << 1U) | ((ep & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) >> 0x07U); USB_OSA_SR_ALLOC(); if (!ehciHandle) { return kStatus_USB_InvalidHandle; } USB_OSA_ENTER_CRITICAL(); message.buffer = NULL; message.length = USB_UNINITIALIZED_VAL_32; /* Get the first dtd */ currentDtd = (usb_device_ehci_dtd_struct_t *)((uint32_t)ehciState->dtdHard[index] & USB_DEVICE_ECHI_DTD_POINTER_MASK); while (currentDtd) { currentDtd->reservedUnion.originalBufferInfo.dtdInvalid = 1U; currentDtd = (usb_device_ehci_dtd_struct_t *)(currentDtd->nextDtdPointer & USB_DEVICE_ECHI_DTD_POINTER_MASK); } /* Get the first dtd */ currentDtd = (usb_device_ehci_dtd_struct_t *)((uint32_t)ehciState->dtdHard[index] & USB_DEVICE_ECHI_DTD_POINTER_MASK); while (currentDtd) { if (!currentDtd->reservedUnion.originalBufferInfo.dtdInvalid) { break; } else { if (currentDtd->dtdTokenUnion.dtdTokenBitmap.status & USB_DEVICE_ECHI_DTD_STATUS_ACTIVE) { /* Flush the endpoint to stop a transfer. */ do { /* Set the corresponding bit(s) in the EPFLUSH register */ ehciState->registerBase->EPFLUSH |= primeBit; /* Wait until all bits in the EPFLUSH register are cleared. */ while (ehciState->registerBase->EPFLUSH & primeBit) { } /* * Read the EPSR register to ensure that for all endpoints * commanded to be flushed, that the corresponding bits * are now cleared. */ } while (ehciState->registerBase->EPSR & primeBit); } /* Save the original buffer address. */ if (NULL == message.buffer) { message.buffer = (uint8_t *)((currentDtd->bufferPointerPage[0] & USB_DEVICE_ECHI_DTD_PAGE_MASK) | (currentDtd->reservedUnion.originalBufferInfo.originalBufferOffest)); } /* Remove the dtd from the dtd in-used queue. */ if (ehciState->dtdHard[index] == ehciState->dtdTail[index]) { ehciState->dtdHard[index] = NULL; ehciState->dtdTail[index] = NULL; } else { ehciState->dtdHard[index] = (usb_device_ehci_dtd_struct_t *)ehciState->dtdHard[index]->nextDtdPointer; } /* When the ioc is set or the dtd queue is empty, the up layer will be notified. */ if ((currentDtd->dtdTokenUnion.dtdTokenBitmap.ioc) || (0 == ((uint32_t)ehciState->dtdHard[index] & USB_DEVICE_ECHI_DTD_POINTER_MASK))) { message.code = ep; message.isSetup = 0U; USB_DeviceNotificationTrigger(ehciState->deviceHandle, &message); message.buffer = NULL; } /* Clear the token field. */ currentDtd->dtdTokenUnion.dtdToken = 0U; /* Save the dtd to the free queue. */ currentDtd->nextDtdPointer = (uint32_t)ehciState->dtdFree; ehciState->dtdFree = currentDtd; ehciState->dtdCount++; } /* Get the next dtd. */ currentDtd = (usb_device_ehci_dtd_struct_t *)((uint32_t)ehciState->dtdHard[index] & USB_DEVICE_ECHI_DTD_POINTER_MASK); } if (!currentDtd) { /* Set the QH to empty. */ ehciState->qh[index].nextDtdPointer = USB_DEVICE_ECHI_DTD_TERMINATE_MASK; ehciState->qh[index].dtdTokenUnion.dtdToken = 0U; } USB_OSA_EXIT_CRITICAL(); return kStatus_USB_Success; } /*! * @brief Control the status of the selected item. * * The function is used to control the status of the selected item. * * @param ehciHandle Pointer of the device EHCI handle. * @param type The selected item. Please refer to enumeration type usb_device_control_type_t. * @param param The param type is determined by the selected item. * * @return A USB error code or kStatus_USB_Success. */ usb_status_t USB_DeviceEhciControl(usb_device_controller_handle ehciHandle, usb_device_control_type_t type, void *param) { usb_device_ehci_state_struct_t *ehciState = (usb_device_ehci_state_struct_t *)ehciHandle; usb_status_t error = kStatus_USB_Error; uint16_t *temp16; uint8_t *temp8; #if (defined(USB_DEVICE_CHARGER_DETECT_ENABLE) && (USB_DEVICE_CHARGER_DETECT_ENABLE > 0U)) && \ (defined(FSL_FEATURE_SOC_USBHSDCD_COUNT) && (FSL_FEATURE_SOC_USBHSDCD_COUNT > 0U)) usb_device_dcd_state_struct_t *dcdHSState; dcdHSState = &s_UsbDeviceDcdHSState[ehciState->controllerId - kUSB_ControllerEhci0]; /*The hard code should be replaced*/ usb_device_dcd_charging_time_t *deviceDcdTimingConfig = (usb_device_dcd_charging_time_t *)param; #endif #if ((defined(USB_DEVICE_CONFIG_REMOTE_WAKEUP)) && (USB_DEVICE_CONFIG_REMOTE_WAKEUP > 0U)) usb_device_struct_t *deviceHandle; uint64_t startTick; #endif if (!ehciHandle) { return kStatus_USB_InvalidHandle; } #if ((defined(USB_DEVICE_CONFIG_REMOTE_WAKEUP)) && (USB_DEVICE_CONFIG_REMOTE_WAKEUP > 0U)) deviceHandle = (usb_device_struct_t *)ehciState->deviceHandle; #endif switch (type) { case kUSB_DeviceControlRun: ehciState->registerBase->USBCMD |= USBHS_USBCMD_RS_MASK; error = kStatus_USB_Success; break; case kUSB_DeviceControlStop: ehciState->registerBase->USBCMD &= ~USBHS_USBCMD_RS_MASK; error = kStatus_USB_Success; break; case kUSB_DeviceControlEndpointInit: if (param) { error = USB_DeviceEhciEndpointInit(ehciState, (usb_device_endpoint_init_struct_t *)param); } break; case kUSB_DeviceControlEndpointDeinit: if (param) { temp8 = (uint8_t *)param; error = USB_DeviceEhciEndpointDeinit(ehciState, *temp8); } break; case kUSB_DeviceControlEndpointStall: if (param) { temp8 = (uint8_t *)param; error = USB_DeviceEhciEndpointStall(ehciState, *temp8); } break; case kUSB_DeviceControlEndpointUnstall: if (param) { temp8 = (uint8_t *)param; error = USB_DeviceEhciEndpointUnstall(ehciState, *temp8); } break; case kUSB_DeviceControlGetDeviceStatus: if (param) { temp16 = (uint16_t *)param; *temp16 = (USB_DEVICE_CONFIG_SELF_POWER << (USB_REQUEST_STANDARD_GET_STATUS_DEVICE_SELF_POWERED_SHIFT)) #if ((defined(USB_DEVICE_CONFIG_REMOTE_WAKEUP)) && (USB_DEVICE_CONFIG_REMOTE_WAKEUP > 0U)) | (deviceHandle->remotewakeup << (USB_REQUEST_STANDARD_GET_STATUS_DEVICE_REMOTE_WARKUP_SHIFT)) #endif ; error = kStatus_USB_Success; } break; case kUSB_DeviceControlGetEndpointStatus: if (param) { usb_device_endpoint_status_struct_t *endpointStatus = (usb_device_endpoint_status_struct_t *)param; uint8_t ep = (endpointStatus->endpointAddress) & USB_ENDPOINT_NUMBER_MASK; uint8_t direction = ((endpointStatus->endpointAddress) & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) >> USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT; if (ep < USB_DEVICE_CONFIG_ENDPOINTS) { if (ep) { endpointStatus->endpointStatus = (ehciState->registerBase->EPCR[ep - 1U] & (direction ? USBHS_EPCR_TXS_MASK : USBHS_EPCR_RXS_MASK)) ? kUSB_DeviceEndpointStateStalled : kUSB_DeviceEndpointStateIdle; } else { endpointStatus->endpointStatus = (ehciState->registerBase->EPCR0 & (direction ? USBHS_EPCR_TXS_MASK : USBHS_EPCR_RXS_MASK)) ? kUSB_DeviceEndpointStateStalled : kUSB_DeviceEndpointStateIdle; } error = kStatus_USB_Success; } } break; case kUSB_DeviceControlSetDeviceAddress: if (param) { temp8 = (uint8_t *)param; ehciState->registerBase->DEVICEADDR = (((uint32_t)(*temp8)) << USBHS_DEVICEADDR_USBADR_SHIFT); error = kStatus_USB_Success; } break; case kUSB_DeviceControlGetSynchFrame: break; #if (defined(USB_DEVICE_CONFIG_LOW_POWER_MODE) && (USB_DEVICE_CONFIG_LOW_POWER_MODE > 0U)) #if defined(USB_DEVICE_CONFIG_REMOTE_WAKEUP) && (USB_DEVICE_CONFIG_REMOTE_WAKEUP > 0U) case kUSB_DeviceControlResume: #if (defined(FSL_FEATURE_SOC_USBNC_COUNT) && (FSL_FEATURE_SOC_USBNC_COUNT > 0U)) ehciState->registerNcBase->USB_OTGn_CTRL &= ~USBNC_USB_OTGn_CTRL_WIE_MASK; #else ehciState->registerBase->USBGENCTRL &= ~USBHS_USBGENCTRL_WU_IE_MASK; #endif ehciState->registerBase->PORTSC1 &= ~USBHS_PORTSC1_PHCD_MASK; ehciState->registerBase->PORTSC1 |= USBHS_PORTSC1_FPR_MASK; startTick = deviceHandle->hwTick; while ((deviceHandle->hwTick - startTick) < 10) { __ASM("nop"); } ehciState->registerBase->PORTSC1 &= ~USBHS_PORTSC1_FPR_MASK; error = kStatus_USB_Success; break; #endif /* USB_DEVICE_CONFIG_REMOTE_WAKEUP */ case kUSB_DeviceControlSuspend: ehciState->registerBase->OTGSC |= 0x007F0000U; ehciState->registerPhyBase->PWD = 0xFFFFFFFF; /* ehciState->registerBase->OTGCTL |= ((1U<<10) | (1U<<17) | (1U<<16)); */ while (ehciState->registerPhyBase->CTRL & (USBPHY_CTRL_UTMI_SUSPENDM_MASK)) { __ASM("nop"); } /* ehciState->registerPhyBase->CTRL |= ((1U << 21) | (1U << 22) | (1U << 23)); */ ehciState->registerBase->USBSTS |= USBHS_USBSTS_SRI_MASK; ehciState->registerBase->PORTSC1 |= USBHS_PORTSC1_PHCD_MASK; #if (defined(FSL_FEATURE_SOC_USBNC_COUNT) && (FSL_FEATURE_SOC_USBNC_COUNT > 0U)) ehciState->registerPhyBase->CTRL |= USBPHY_CTRL_ENVBUSCHG_WKUP_MASK | USBPHY_CTRL_ENIDCHG_WKUP_MASK | USBPHY_CTRL_ENDPDMCHG_WKUP_MASK | USBPHY_CTRL_ENIRQRESUMEDETECT_MASK; ehciState->registerNcBase->USB_OTGn_CTRL |= USBNC_USB_OTGn_CTRL_WKUP_ID_EN_MASK | USBNC_USB_OTGn_CTRL_WKUP_VBUS_EN_MASK | USBNC_USB_OTGn_CTRL_WKUP_DPDM_EN_MASK; ehciState->registerNcBase->USB_OTGn_CTRL |= USBNC_USB_OTGn_CTRL_WIE_MASK; #else ehciState->registerBase->USBGENCTRL = USBHS_USBGENCTRL_WU_IE_MASK; #endif ehciState->registerPhyBase->CTRL |= USBPHY_CTRL_CLKGATE_MASK; ehciState->isSuspending = 1U; error = kStatus_USB_Success; break; #endif /* USB_DEVICE_CONFIG_LOW_POWER_MODE */ case kUSB_DeviceControlSetDefaultStatus: for (uint8_t count = 0U; count < USB_DEVICE_CONFIG_ENDPOINTS; count++) { USB_DeviceEhciEndpointDeinit(ehciState, (count | (USB_IN << 0x07U))); USB_DeviceEhciEndpointDeinit(ehciState, (count | (USB_OUT << 0x07U))); } USB_DeviceEhciSetDefaultState(ehciState); error = kStatus_USB_Success; break; case kUSB_DeviceControlGetSpeed: if (param) { temp8 = (uint8_t *)param; *temp8 = ehciState->speed; error = kStatus_USB_Success; } break; case kUSB_DeviceControlGetOtgStatus: break; case kUSB_DeviceControlSetOtgStatus: break; #if (defined(USB_DEVICE_CONFIG_USB20_TEST_MODE) && (USB_DEVICE_CONFIG_USB20_TEST_MODE > 0U)) case kUSB_DeviceControlSetTestMode: if (param) { temp8 = (uint8_t *)param; ehciState->registerBase->PORTSC1 |= ((uint32_t)(*temp8) << 16U); error = kStatus_USB_Success; } break; #endif #if (defined(USB_DEVICE_CHARGER_DETECT_ENABLE) && (USB_DEVICE_CHARGER_DETECT_ENABLE > 0U)) && \ (defined(FSL_FEATURE_SOC_USBHSDCD_COUNT) && (FSL_FEATURE_SOC_USBHSDCD_COUNT > 0U)) case kUSB_DeviceControlDcdInitModule: dcdHSState->dcdRegisterBase->CONTROL |= USBDCD_CONTROL_SR_MASK; dcdHSState->dcdRegisterBase->TIMER0 = USBDCD_TIMER0_TSEQ_INIT(deviceDcdTimingConfig->dcdSeqInitTime); dcdHSState->dcdRegisterBase->TIMER1 = USBDCD_TIMER1_TDCD_DBNC(deviceDcdTimingConfig->dcdDbncTime); dcdHSState->dcdRegisterBase->TIMER1 |= USBDCD_TIMER1_TVDPSRC_ON(deviceDcdTimingConfig->dcdDpSrcOnTime); dcdHSState->dcdRegisterBase->TIMER2_BC12 = USBDCD_TIMER2_BC12_TWAIT_AFTER_PRD(deviceDcdTimingConfig->dcdTimeWaitAfterPrD); dcdHSState->dcdRegisterBase->TIMER2_BC12 |= USBDCD_TIMER2_BC12_TVDMSRC_ON(deviceDcdTimingConfig->dcdTimeDMSrcOn); dcdHSState->dcdRegisterBase->CONTROL |= USBDCD_CONTROL_IE_MASK; dcdHSState->dcdRegisterBase->CONTROL |= USBDCD_CONTROL_BC12_MASK; dcdHSState->dcdRegisterBase->CONTROL |= USBDCD_CONTROL_START_MASK; break; case kUSB_DeviceControlDcdDeinitModule: dcdHSState->dcdRegisterBase->CONTROL |= USBDCD_CONTROL_SR_MASK; break; #endif default: break; } return error; } /*! * @brief Handle the EHCI device interrupt. * * The function is used to handle the EHCI device interrupt. * * @param deviceHandle The device handle got from USB_DeviceInit. * */ void USB_DeviceEhciIsrFunction(void *deviceHandle) { usb_device_struct_t *handle = (usb_device_struct_t *)deviceHandle; usb_device_ehci_state_struct_t *ehciState; uint32_t status; if (NULL == deviceHandle) { return; } ehciState = (usb_device_ehci_state_struct_t *)(handle->controllerHandle); #if ((defined(USB_DEVICE_CONFIG_LOW_POWER_MODE)) && (USB_DEVICE_CONFIG_LOW_POWER_MODE > 0U)) #if (defined(FSL_FEATURE_SOC_USBNC_COUNT) && (FSL_FEATURE_SOC_USBNC_COUNT > 0U)) if (ehciState->registerNcBase->USB_OTGn_CTRL & USBNC_USB_OTGn_CTRL_WIE_MASK) { if (ehciState->registerNcBase->USB_OTGn_CTRL & USBNC_USB_OTGn_CTRL_WIR_MASK) { ehciState->registerBase->PORTSC1 &= ~USBHS_PORTSC1_PHCD_MASK; ehciState->registerNcBase->USB_OTGn_CTRL &= ~USBNC_USB_OTGn_CTRL_WIE_MASK; } } else { } #else if (ehciState->registerBase->USBGENCTRL & USBHS_USBGENCTRL_WU_IE_MASK) { if (ehciState->registerBase->USBGENCTRL & (1U << 8)) { ehciState->registerBase->USBGENCTRL &= ~(1U << 8); ehciState->registerBase->USBGENCTRL |= USBHS_USBGENCTRL_WU_INT_CLR_MASK; ehciState->registerBase->PORTSC1 &= ~USBHS_PORTSC1_PHCD_MASK; ehciState->registerBase->USBGENCTRL &= ~USBHS_USBGENCTRL_WU_IE_MASK; } } else { } #endif #endif #if defined(USB_DEVICE_CONFIG_DETACH_ENABLE) && (USB_DEVICE_CONFIG_DETACH_ENABLE > 0U) if (ehciState->registerBase->OTGSC & USBHS_OTGSC_BSVIS_MASK) { usb_device_callback_message_struct_t message; ehciState->registerBase->OTGSC |= USBHS_OTGSC_BSVIS_MASK; message.buffer = (uint8_t *)NULL; message.length = 0U; message.isSetup = 0U; if (ehciState->registerBase->OTGSC & USBHS_OTGSC_BSV_MASK) { /* Device is connected to a host. */ message.code = kUSB_DeviceNotifyAttach; USB_DeviceNotificationTrigger(ehciState->deviceHandle, &message); } else { /* Device is disconnected from a host. */ message.code = kUSB_DeviceNotifyDetach; USB_DeviceNotificationTrigger(ehciState->deviceHandle, &message); } } #endif /* USB_DEVICE_CONFIG_DETACH_ENABLE */ status = ehciState->registerBase->USBSTS; status &= ehciState->registerBase->USBINTR; ehciState->registerBase->USBSTS = status; #if defined(USB_DEVICE_CONFIG_ERROR_HANDLING) && (USB_DEVICE_CONFIG_ERROR_HANDLING > 0U) if (status & USBHS_USBSTS_UEI_MASK) { /* Error interrupt */ USB_DeviceEhciInterruptError(ehciState); } #endif /* USB_DEVICE_CONFIG_ERROR_HANDLING */ if (status & USBHS_USBSTS_URI_MASK) { /* Reset interrupt */ USB_DeviceEhciInterruptReset(ehciState); } if (status & USBHS_USBSTS_UI_MASK) { /* Token done interrupt */ USB_DeviceEhciInterruptTokenDone(ehciState); } if (status & USBHS_USBSTS_PCI_MASK) { /* Port status change interrupt */ USB_DeviceEhciInterruptPortChange(ehciState); } #if (defined(USB_DEVICE_CONFIG_LOW_POWER_MODE) && (USB_DEVICE_CONFIG_LOW_POWER_MODE > 0U)) if (status & USBHS_USBSTS_SLI_MASK) { /* Suspend interrupt */ USB_DeviceEhciInterruptSuspend(ehciState); } #endif /* USB_DEVICE_CONFIG_LOW_POWER_MODE */ if (status & USBHS_USBSTS_SRI_MASK) { /* Sof interrupt */ USB_DeviceEhciInterruptSof(ehciState); } } #if (defined(USB_DEVICE_CHARGER_DETECT_ENABLE) && (USB_DEVICE_CHARGER_DETECT_ENABLE > 0U)) && \ (defined(FSL_FEATURE_SOC_USBHSDCD_COUNT) && (FSL_FEATURE_SOC_USBHSDCD_COUNT > 0U)) void USB_DeviceDcdHSIsrFunction(void *deviceHandle) { usb_device_struct_t *handle = (usb_device_struct_t *)deviceHandle; usb_device_ehci_state_struct_t *ehciState; usb_device_dcd_state_struct_t *dcdHSState; uint32_t status; uint32_t chargerType; usb_device_callback_message_struct_t message; if (NULL == deviceHandle) { return; } ehciState = (usb_device_ehci_state_struct_t *)(handle->controllerHandle); dcdHSState = &s_UsbDeviceDcdHSState[ehciState->controllerId - kUSB_ControllerEhci0]; status = dcdHSState->dcdRegisterBase->STATUS; dcdHSState->dcdRegisterBase->CONTROL |= USBDCD_CONTROL_IACK_MASK; message.buffer = (uint8_t *)NULL; message.length = 0U; message.isSetup = 0U; if (status & USBDCD_STATUS_ERR_MASK) { if (status & USBDCD_STATUS_TO_MASK) { dcdHSState->dcdRegisterBase->CONTROL |= USBDCD_CONTROL_SR_MASK; message.code = kUSB_DeviceNotifyDcdTimeOut; USB_DeviceNotificationTrigger(dcdHSState->deviceHandle, &message); } else { dcdHSState->dcdRegisterBase->CONTROL |= USBDCD_CONTROL_SR_MASK; message.code = kUSB_DeviceNotifyDcdUnknownPortType; USB_DeviceNotificationTrigger(dcdHSState->deviceHandle, &message); } } else { switch (status & USBDCD_STATUS_SEQ_STAT_MASK) { case USBDCD_STATUS_SEQ_STAT(kUSB_DcdChargingPortDetectionCompleted): chargerType = status & USBDCD_STATUS_SEQ_RES_MASK; if (chargerType == USBDCD_STATUS_SEQ_RES(kUSB_DcdDetectionStandardHost)) { dcdHSState->dcdRegisterBase->CONTROL |= USBDCD_CONTROL_SR_MASK; message.code = kUSB_DeviceNotifySDPDetected; USB_DeviceNotificationTrigger(dcdHSState->deviceHandle, &message); } else if (chargerType == USBDCD_STATUS_SEQ_RES(kUSB_DcdDetectionChargingPort)) { message.code = kUSB_DeviceNotifyChargingPortDetected; USB_DeviceNotificationTrigger(dcdHSState->deviceHandle, &message); } break; case USBDCD_STATUS_SEQ_STAT(kUSB_DcdChargerTypeDetectionCompleted): chargerType = status & USBDCD_STATUS_SEQ_RES_MASK; if (chargerType == USBDCD_STATUS_SEQ_RES(kUSB_DcdDetectionChargingPort)) { dcdHSState->dcdRegisterBase->CONTROL |= USBDCD_CONTROL_SR_MASK; message.code = kUSB_DeviceNotifyChargingHostDetected; USB_DeviceNotificationTrigger(dcdHSState->deviceHandle, &message); } else if (chargerType == USBDCD_STATUS_SEQ_RES(kUSB_DcdDetectionDedicatedCharger)) { dcdHSState->dcdRegisterBase->CONTROL |= USBDCD_CONTROL_SR_MASK; message.code = kUSB_DeviceNotifyDedicatedChargerDetected; USB_DeviceNotificationTrigger(dcdHSState->deviceHandle, &message); } break; default: break; } } } #endif #endif /* USB_DEVICE_CONFIG_EHCI */
15f70fafc647cd2ca32a74918701aa2f3c70dd16
9ceacf33fd96913cac7ef15492c126d96cae6911
/games/hack/makedefs.c
d8d9bc024df7575d1f2ced74b4f00276be50c9aa
[ "BSD-3-Clause" ]
permissive
openbsd/src
ab97ef834fd2d5a7f6729814665e9782b586c130
9e79f3a0ebd11a25b4bff61e900cb6de9e7795e9
refs/heads/master
2023-09-02T18:54:56.624627
2023-09-02T15:16:12
2023-09-02T15:16:12
66,966,208
3,394
1,235
null
2023-08-08T02:42:25
2016-08-30T18:18:25
C
UTF-8
C
false
false
7,752
c
makedefs.c
/* $OpenBSD: makedefs.c,v 1.12 2019/06/28 13:32:52 deraadt Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, * Amsterdam * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * - Neither the name of the Stichting Centrum voor Wiskunde en * Informatica, nor the names of its contributors may be used to endorse or * promote products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Copyright (c) 1982 Jay Fenlason <hack@gnu.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <ctype.h> #include <err.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> /* construct definitions of object constants */ #define LINSZ 1000 #define STRSZ 40 int fd; char string[STRSZ]; void capitalize(char *sp); int getentry(void); int skipuntil(char *s); char nextchar(void); void readline(void); int main(int argc, char **argv) { int index = 0; int propct = 0; char *sp; if (argc != 2) { (void)fprintf(stderr, "usage: makedefs file\n"); return 1; } if ((fd = open(argv[1], O_RDONLY)) == -1) { perror(argv[1]); return 1; } if (pledge("stdio", NULL) == -1) err(1, "pledge"); skipuntil("objects[] = {"); while(getentry()) { if(!*string){ index++; continue; } for(sp = string; *sp; sp++) if(*sp == ' ' || *sp == '\t' || *sp == '-') *sp = '_'; if(!strncmp(string, "RIN_", 4)){ capitalize(string+4); printf("#define %s u.uprops[%d].p_flgs\n", string+4, propct++); } for(sp = string; *sp; sp++) capitalize(sp); /* avoid trouble with stupid C preprocessors */ if(!strncmp(string, "WORTHLESS_PIECE_OF_", 19)) printf("/* #define %s %d */\n", string, index); else printf("#define %s %d\n", string, index); index++; } printf("\n#define CORPSE DEAD_HUMAN\n"); printf("#define LAST_GEM (JADE+1)\n"); printf("#define LAST_RING %d\n", propct); printf("#define NROFOBJECTS %d\n", index-1); return 0; } char line[LINSZ], *lp = line, *lp0 = line, *lpe = line; int eof; void readline(void) { int n = read(fd, lp0, (line+LINSZ)-lp0); if(n == -1){ printf("Input error.\n"); exit(1); } if(n == 0) eof++; lpe = lp0+n; } char nextchar(void) { if(lp == lpe){ readline(); lp = lp0; } return((lp == lpe) ? 0 : *lp++); } int skipuntil(char *s) { char *sp0, *sp1; loop: while(*s != nextchar()) if(eof) { printf("Cannot skipuntil %s\n", s); exit(1); } if(strlen(s) > lpe-lp+1){ char *lp1, *lp2; lp2 = lp; lp1 = lp = lp0; while(lp2 != lpe) *lp1++ = *lp2++; lp2 = lp0; /* save value */ lp0 = lp1; readline(); lp0 = lp2; if(strlen(s) > lpe-lp+1) { printf("error in skipuntil"); exit(1); } } sp0 = s+1; sp1 = lp; while(*sp0 && *sp0 == *sp1) sp0++, sp1++; if(!*sp0){ lp = sp1; return(1); } goto loop; } int getentry(void) { int inbraces = 0, inparens = 0, stringseen = 0, commaseen = 0; int prefix = 0; char ch; #define NSZ 10 char identif[NSZ], *ip; string[0] = string[4] = 0; /* read until {...} or XXX(...) followed by , skip comment and #define lines deliver 0 on failure */ while(1) { ch = nextchar(); swi: if(isalpha((unsigned char)ch)){ ip = identif; do { if(ip < identif+NSZ-1) *ip++ = ch; ch = nextchar(); } while(isalpha((unsigned char)ch) || isdigit((unsigned char)ch)); *ip = 0; while(ch == ' ' || ch == '\t') ch = nextchar(); if(ch == '(' && !inparens && !stringseen) if(!strcmp(identif, "WAND") || !strcmp(identif, "RING") || !strcmp(identif, "POTION") || !strcmp(identif, "SCROLL")) (void) strncpy(string, identif, 3), string[3] = '_', prefix = 4; } switch(ch) { case '/': /* watch for comment */ if((ch = nextchar()) == '*') skipuntil("*/"); goto swi; case '{': inbraces++; continue; case '(': inparens++; continue; case '}': inbraces--; if(inbraces < 0) return(0); continue; case ')': inparens--; if(inparens < 0) { printf("too many ) ?"); exit(1); } continue; case '\n': /* watch for #define at begin of line */ if((ch = nextchar()) == '#'){ char pch; /* skip until '\n' not preceded by '\\' */ do { pch = ch; ch = nextchar(); } while(ch != '\n' || pch == '\\'); continue; } goto swi; case ',': if(!inparens && !inbraces){ if(prefix && !string[prefix]) string[0] = 0; if(stringseen) return(1); printf("unexpected ,\n"); exit(1); } commaseen++; continue; case '\'': if((ch = nextchar()) == '\\') ch = nextchar(); if(nextchar() != '\''){ printf("strange character denotation?\n"); exit(1); } continue; case '"': { char *sp = string + prefix; char pch; int store = (inbraces || inparens) && !stringseen++ && !commaseen; do { pch = ch; ch = nextchar(); if(store && sp < string+STRSZ) *sp++ = ch; } while(ch != '"' || pch == '\\'); if(store) *--sp = 0; continue; } } } } void capitalize(char *sp) { *sp = (char)toupper((unsigned char)*sp); }
e37a2ce272cad756f0e8d6dc48189b6984313541
010279e2ba272d09e9d2c4e903722e5faba2cf7a
/contrib/libs/clapack/ztrevc.c
3e4f836ed21e5b6c9229bbdf57009e9a1981ae9c
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
catboost/catboost
854c1a1f439a96f1ae6b48e16644be20aa04dba2
f5042e35b945aded77b23470ead62d7eacefde92
refs/heads/master
2023-09-01T12:14:14.174108
2023-09-01T10:01:01
2023-09-01T10:22:12
97,556,265
8,012
1,425
Apache-2.0
2023-09-11T03:32:32
2017-07-18T05:29:04
Python
UTF-8
C
false
false
15,863
c
ztrevc.c
/* ztrevc.f -- translated by f2c (version 20061008). You must link the resulting object file with libf2c: on Microsoft Windows system, link with libf2c.lib; on Linux or Unix systems, link with .../path/to/libf2c.a -lm or, if you install libf2c.a in a standard place, with -lf2c -lm -- in that order, at the end of the command line, as in cc *.o -lf2c -lm Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., http://www.netlib.org/f2c/libf2c.zip */ #include "f2c.h" #include "blaswrap.h" /* Table of constant values */ static doublecomplex c_b2 = {1.,0.}; static integer c__1 = 1; /* Subroutine */ int ztrevc_(char *side, char *howmny, logical *select, integer *n, doublecomplex *t, integer *ldt, doublecomplex *vl, integer *ldvl, doublecomplex *vr, integer *ldvr, integer *mm, integer *m, doublecomplex *work, doublereal *rwork, integer *info) { /* System generated locals */ integer t_dim1, t_offset, vl_dim1, vl_offset, vr_dim1, vr_offset, i__1, i__2, i__3, i__4, i__5; doublereal d__1, d__2, d__3; doublecomplex z__1, z__2; /* Builtin functions */ double d_imag(doublecomplex *); void d_cnjg(doublecomplex *, doublecomplex *); /* Local variables */ integer i__, j, k, ii, ki, is; doublereal ulp; logical allv; doublereal unfl, ovfl, smin; logical over; doublereal scale; extern logical lsame_(char *, char *); doublereal remax; logical leftv, bothv; extern /* Subroutine */ int zgemv_(char *, integer *, integer *, doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, doublecomplex *, integer *); logical somev; extern /* Subroutine */ int zcopy_(integer *, doublecomplex *, integer *, doublecomplex *, integer *), dlabad_(doublereal *, doublereal *); extern doublereal dlamch_(char *); extern /* Subroutine */ int xerbla_(char *, integer *), zdscal_( integer *, doublereal *, doublecomplex *, integer *); extern integer izamax_(integer *, doublecomplex *, integer *); logical rightv; extern doublereal dzasum_(integer *, doublecomplex *, integer *); doublereal smlnum; extern /* Subroutine */ int zlatrs_(char *, char *, char *, char *, integer *, doublecomplex *, integer *, doublecomplex *, doublereal *, doublereal *, integer *); /* -- LAPACK routine (version 3.2) -- */ /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ /* November 2006 */ /* .. Scalar Arguments .. */ /* .. */ /* .. Array Arguments .. */ /* .. */ /* Purpose */ /* ======= */ /* ZTREVC computes some or all of the right and/or left eigenvectors of */ /* a complex upper triangular matrix T. */ /* Matrices of this type are produced by the Schur factorization of */ /* a complex general matrix: A = Q*T*Q**H, as computed by ZHSEQR. */ /* The right eigenvector x and the left eigenvector y of T corresponding */ /* to an eigenvalue w are defined by: */ /* T*x = w*x, (y**H)*T = w*(y**H) */ /* where y**H denotes the conjugate transpose of the vector y. */ /* The eigenvalues are not input to this routine, but are read directly */ /* from the diagonal of T. */ /* This routine returns the matrices X and/or Y of right and left */ /* eigenvectors of T, or the products Q*X and/or Q*Y, where Q is an */ /* input matrix. If Q is the unitary factor that reduces a matrix A to */ /* Schur form T, then Q*X and Q*Y are the matrices of right and left */ /* eigenvectors of A. */ /* Arguments */ /* ========= */ /* SIDE (input) CHARACTER*1 */ /* = 'R': compute right eigenvectors only; */ /* = 'L': compute left eigenvectors only; */ /* = 'B': compute both right and left eigenvectors. */ /* HOWMNY (input) CHARACTER*1 */ /* = 'A': compute all right and/or left eigenvectors; */ /* = 'B': compute all right and/or left eigenvectors, */ /* backtransformed using the matrices supplied in */ /* VR and/or VL; */ /* = 'S': compute selected right and/or left eigenvectors, */ /* as indicated by the logical array SELECT. */ /* SELECT (input) LOGICAL array, dimension (N) */ /* If HOWMNY = 'S', SELECT specifies the eigenvectors to be */ /* computed. */ /* The eigenvector corresponding to the j-th eigenvalue is */ /* computed if SELECT(j) = .TRUE.. */ /* Not referenced if HOWMNY = 'A' or 'B'. */ /* N (input) INTEGER */ /* The order of the matrix T. N >= 0. */ /* T (input/output) COMPLEX*16 array, dimension (LDT,N) */ /* The upper triangular matrix T. T is modified, but restored */ /* on exit. */ /* LDT (input) INTEGER */ /* The leading dimension of the array T. LDT >= max(1,N). */ /* VL (input/output) COMPLEX*16 array, dimension (LDVL,MM) */ /* On entry, if SIDE = 'L' or 'B' and HOWMNY = 'B', VL must */ /* contain an N-by-N matrix Q (usually the unitary matrix Q of */ /* Schur vectors returned by ZHSEQR). */ /* On exit, if SIDE = 'L' or 'B', VL contains: */ /* if HOWMNY = 'A', the matrix Y of left eigenvectors of T; */ /* if HOWMNY = 'B', the matrix Q*Y; */ /* if HOWMNY = 'S', the left eigenvectors of T specified by */ /* SELECT, stored consecutively in the columns */ /* of VL, in the same order as their */ /* eigenvalues. */ /* Not referenced if SIDE = 'R'. */ /* LDVL (input) INTEGER */ /* The leading dimension of the array VL. LDVL >= 1, and if */ /* SIDE = 'L' or 'B', LDVL >= N. */ /* VR (input/output) COMPLEX*16 array, dimension (LDVR,MM) */ /* On entry, if SIDE = 'R' or 'B' and HOWMNY = 'B', VR must */ /* contain an N-by-N matrix Q (usually the unitary matrix Q of */ /* Schur vectors returned by ZHSEQR). */ /* On exit, if SIDE = 'R' or 'B', VR contains: */ /* if HOWMNY = 'A', the matrix X of right eigenvectors of T; */ /* if HOWMNY = 'B', the matrix Q*X; */ /* if HOWMNY = 'S', the right eigenvectors of T specified by */ /* SELECT, stored consecutively in the columns */ /* of VR, in the same order as their */ /* eigenvalues. */ /* Not referenced if SIDE = 'L'. */ /* LDVR (input) INTEGER */ /* The leading dimension of the array VR. LDVR >= 1, and if */ /* SIDE = 'R' or 'B'; LDVR >= N. */ /* MM (input) INTEGER */ /* The number of columns in the arrays VL and/or VR. MM >= M. */ /* M (output) INTEGER */ /* The number of columns in the arrays VL and/or VR actually */ /* used to store the eigenvectors. If HOWMNY = 'A' or 'B', M */ /* is set to N. Each selected eigenvector occupies one */ /* column. */ /* WORK (workspace) COMPLEX*16 array, dimension (2*N) */ /* RWORK (workspace) DOUBLE PRECISION array, dimension (N) */ /* INFO (output) INTEGER */ /* = 0: successful exit */ /* < 0: if INFO = -i, the i-th argument had an illegal value */ /* Further Details */ /* =============== */ /* The algorithm used in this program is basically backward (forward) */ /* substitution, with scaling to make the the code robust against */ /* possible overflow. */ /* Each eigenvector is normalized so that the element of largest */ /* magnitude has magnitude 1; here the magnitude of a complex number */ /* (x,y) is taken to be |x| + |y|. */ /* ===================================================================== */ /* .. Parameters .. */ /* .. */ /* .. Local Scalars .. */ /* .. */ /* .. External Functions .. */ /* .. */ /* .. External Subroutines .. */ /* .. */ /* .. Intrinsic Functions .. */ /* .. */ /* .. Statement Functions .. */ /* .. */ /* .. Statement Function definitions .. */ /* .. */ /* .. Executable Statements .. */ /* Decode and test the input parameters */ /* Parameter adjustments */ --select; t_dim1 = *ldt; t_offset = 1 + t_dim1; t -= t_offset; vl_dim1 = *ldvl; vl_offset = 1 + vl_dim1; vl -= vl_offset; vr_dim1 = *ldvr; vr_offset = 1 + vr_dim1; vr -= vr_offset; --work; --rwork; /* Function Body */ bothv = lsame_(side, "B"); rightv = lsame_(side, "R") || bothv; leftv = lsame_(side, "L") || bothv; allv = lsame_(howmny, "A"); over = lsame_(howmny, "B"); somev = lsame_(howmny, "S"); /* Set M to the number of columns required to store the selected */ /* eigenvectors. */ if (somev) { *m = 0; i__1 = *n; for (j = 1; j <= i__1; ++j) { if (select[j]) { ++(*m); } /* L10: */ } } else { *m = *n; } *info = 0; if (! rightv && ! leftv) { *info = -1; } else if (! allv && ! over && ! somev) { *info = -2; } else if (*n < 0) { *info = -4; } else if (*ldt < max(1,*n)) { *info = -6; } else if (*ldvl < 1 || leftv && *ldvl < *n) { *info = -8; } else if (*ldvr < 1 || rightv && *ldvr < *n) { *info = -10; } else if (*mm < *m) { *info = -11; } if (*info != 0) { i__1 = -(*info); xerbla_("ZTREVC", &i__1); return 0; } /* Quick return if possible. */ if (*n == 0) { return 0; } /* Set the constants to control overflow. */ unfl = dlamch_("Safe minimum"); ovfl = 1. / unfl; dlabad_(&unfl, &ovfl); ulp = dlamch_("Precision"); smlnum = unfl * (*n / ulp); /* Store the diagonal elements of T in working array WORK. */ i__1 = *n; for (i__ = 1; i__ <= i__1; ++i__) { i__2 = i__ + *n; i__3 = i__ + i__ * t_dim1; work[i__2].r = t[i__3].r, work[i__2].i = t[i__3].i; /* L20: */ } /* Compute 1-norm of each column of strictly upper triangular */ /* part of T to control overflow in triangular solver. */ rwork[1] = 0.; i__1 = *n; for (j = 2; j <= i__1; ++j) { i__2 = j - 1; rwork[j] = dzasum_(&i__2, &t[j * t_dim1 + 1], &c__1); /* L30: */ } if (rightv) { /* Compute right eigenvectors. */ is = *m; for (ki = *n; ki >= 1; --ki) { if (somev) { if (! select[ki]) { goto L80; } } /* Computing MAX */ i__1 = ki + ki * t_dim1; d__3 = ulp * ((d__1 = t[i__1].r, abs(d__1)) + (d__2 = d_imag(&t[ ki + ki * t_dim1]), abs(d__2))); smin = max(d__3,smlnum); work[1].r = 1., work[1].i = 0.; /* Form right-hand side. */ i__1 = ki - 1; for (k = 1; k <= i__1; ++k) { i__2 = k; i__3 = k + ki * t_dim1; z__1.r = -t[i__3].r, z__1.i = -t[i__3].i; work[i__2].r = z__1.r, work[i__2].i = z__1.i; /* L40: */ } /* Solve the triangular system: */ /* (T(1:KI-1,1:KI-1) - T(KI,KI))*X = SCALE*WORK. */ i__1 = ki - 1; for (k = 1; k <= i__1; ++k) { i__2 = k + k * t_dim1; i__3 = k + k * t_dim1; i__4 = ki + ki * t_dim1; z__1.r = t[i__3].r - t[i__4].r, z__1.i = t[i__3].i - t[i__4] .i; t[i__2].r = z__1.r, t[i__2].i = z__1.i; i__2 = k + k * t_dim1; if ((d__1 = t[i__2].r, abs(d__1)) + (d__2 = d_imag(&t[k + k * t_dim1]), abs(d__2)) < smin) { i__3 = k + k * t_dim1; t[i__3].r = smin, t[i__3].i = 0.; } /* L50: */ } if (ki > 1) { i__1 = ki - 1; zlatrs_("Upper", "No transpose", "Non-unit", "Y", &i__1, &t[ t_offset], ldt, &work[1], &scale, &rwork[1], info); i__1 = ki; work[i__1].r = scale, work[i__1].i = 0.; } /* Copy the vector x or Q*x to VR and normalize. */ if (! over) { zcopy_(&ki, &work[1], &c__1, &vr[is * vr_dim1 + 1], &c__1); ii = izamax_(&ki, &vr[is * vr_dim1 + 1], &c__1); i__1 = ii + is * vr_dim1; remax = 1. / ((d__1 = vr[i__1].r, abs(d__1)) + (d__2 = d_imag( &vr[ii + is * vr_dim1]), abs(d__2))); zdscal_(&ki, &remax, &vr[is * vr_dim1 + 1], &c__1); i__1 = *n; for (k = ki + 1; k <= i__1; ++k) { i__2 = k + is * vr_dim1; vr[i__2].r = 0., vr[i__2].i = 0.; /* L60: */ } } else { if (ki > 1) { i__1 = ki - 1; z__1.r = scale, z__1.i = 0.; zgemv_("N", n, &i__1, &c_b2, &vr[vr_offset], ldvr, &work[ 1], &c__1, &z__1, &vr[ki * vr_dim1 + 1], &c__1); } ii = izamax_(n, &vr[ki * vr_dim1 + 1], &c__1); i__1 = ii + ki * vr_dim1; remax = 1. / ((d__1 = vr[i__1].r, abs(d__1)) + (d__2 = d_imag( &vr[ii + ki * vr_dim1]), abs(d__2))); zdscal_(n, &remax, &vr[ki * vr_dim1 + 1], &c__1); } /* Set back the original diagonal elements of T. */ i__1 = ki - 1; for (k = 1; k <= i__1; ++k) { i__2 = k + k * t_dim1; i__3 = k + *n; t[i__2].r = work[i__3].r, t[i__2].i = work[i__3].i; /* L70: */ } --is; L80: ; } } if (leftv) { /* Compute left eigenvectors. */ is = 1; i__1 = *n; for (ki = 1; ki <= i__1; ++ki) { if (somev) { if (! select[ki]) { goto L130; } } /* Computing MAX */ i__2 = ki + ki * t_dim1; d__3 = ulp * ((d__1 = t[i__2].r, abs(d__1)) + (d__2 = d_imag(&t[ ki + ki * t_dim1]), abs(d__2))); smin = max(d__3,smlnum); i__2 = *n; work[i__2].r = 1., work[i__2].i = 0.; /* Form right-hand side. */ i__2 = *n; for (k = ki + 1; k <= i__2; ++k) { i__3 = k; d_cnjg(&z__2, &t[ki + k * t_dim1]); z__1.r = -z__2.r, z__1.i = -z__2.i; work[i__3].r = z__1.r, work[i__3].i = z__1.i; /* L90: */ } /* Solve the triangular system: */ /* (T(KI+1:N,KI+1:N) - T(KI,KI))'*X = SCALE*WORK. */ i__2 = *n; for (k = ki + 1; k <= i__2; ++k) { i__3 = k + k * t_dim1; i__4 = k + k * t_dim1; i__5 = ki + ki * t_dim1; z__1.r = t[i__4].r - t[i__5].r, z__1.i = t[i__4].i - t[i__5] .i; t[i__3].r = z__1.r, t[i__3].i = z__1.i; i__3 = k + k * t_dim1; if ((d__1 = t[i__3].r, abs(d__1)) + (d__2 = d_imag(&t[k + k * t_dim1]), abs(d__2)) < smin) { i__4 = k + k * t_dim1; t[i__4].r = smin, t[i__4].i = 0.; } /* L100: */ } if (ki < *n) { i__2 = *n - ki; zlatrs_("Upper", "Conjugate transpose", "Non-unit", "Y", & i__2, &t[ki + 1 + (ki + 1) * t_dim1], ldt, &work[ki + 1], &scale, &rwork[1], info); i__2 = ki; work[i__2].r = scale, work[i__2].i = 0.; } /* Copy the vector x or Q*x to VL and normalize. */ if (! over) { i__2 = *n - ki + 1; zcopy_(&i__2, &work[ki], &c__1, &vl[ki + is * vl_dim1], &c__1) ; i__2 = *n - ki + 1; ii = izamax_(&i__2, &vl[ki + is * vl_dim1], &c__1) + ki - 1; i__2 = ii + is * vl_dim1; remax = 1. / ((d__1 = vl[i__2].r, abs(d__1)) + (d__2 = d_imag( &vl[ii + is * vl_dim1]), abs(d__2))); i__2 = *n - ki + 1; zdscal_(&i__2, &remax, &vl[ki + is * vl_dim1], &c__1); i__2 = ki - 1; for (k = 1; k <= i__2; ++k) { i__3 = k + is * vl_dim1; vl[i__3].r = 0., vl[i__3].i = 0.; /* L110: */ } } else { if (ki < *n) { i__2 = *n - ki; z__1.r = scale, z__1.i = 0.; zgemv_("N", n, &i__2, &c_b2, &vl[(ki + 1) * vl_dim1 + 1], ldvl, &work[ki + 1], &c__1, &z__1, &vl[ki * vl_dim1 + 1], &c__1); } ii = izamax_(n, &vl[ki * vl_dim1 + 1], &c__1); i__2 = ii + ki * vl_dim1; remax = 1. / ((d__1 = vl[i__2].r, abs(d__1)) + (d__2 = d_imag( &vl[ii + ki * vl_dim1]), abs(d__2))); zdscal_(n, &remax, &vl[ki * vl_dim1 + 1], &c__1); } /* Set back the original diagonal elements of T. */ i__2 = *n; for (k = ki + 1; k <= i__2; ++k) { i__3 = k + k * t_dim1; i__4 = k + *n; t[i__3].r = work[i__4].r, t[i__3].i = work[i__4].i; /* L120: */ } ++is; L130: ; } } return 0; /* End of ZTREVC */ } /* ztrevc_ */
3c3cc40e75784bf130e215c7ffc6e21774a53e46
bb38c44037a99d0a12a12d92059678f2faebbc80
/src/include/optimizer/plancat.h
9e74112a40e18452a20c4813b818445b58c25afa
[ "LicenseRef-scancode-mulanpsl-2.0-en", "LicenseRef-scancode-unknown-license-reference", "PostgreSQL", "BSD-3-Clause", "LGPL-2.0-or-later", "LicenseRef-scancode-unicode", "LicenseRef-scancode-warranty-disclaimer", "curl", "GPL-1.0-or-later", "LGPL-2.1-or-later", "LGPL-2.1-only", "CC-BY-4.0", "LicenseRef-scancode-protobuf", "OpenSSL", "LicenseRef-scancode-generic-export-compliance", "X11-distribute-modifications-variant", "LicenseRef-scancode-other-permissive", "MIT", "NCSA", "Python-2.0", "LicenseRef-scancode-openssl", "LicenseRef-scancode-ssleay-windows", "CC-BY-3.0", "LicenseRef-scancode-other-copyleft", "GPL-2.0-only", "BSL-1.0", "Apache-2.0", "LGPL-2.0-only", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "Zlib" ]
permissive
opengauss-mirror/openGauss-server
a9c5a62908643492347830826c56da49f0942796
310e84631c68c8bf37b004148b66f94064f701e4
refs/heads/master
2023-07-26T19:29:12.495484
2023-07-17T12:23:32
2023-07-17T12:23:32
276,117,477
591
208
MulanPSL-2.0
2023-04-28T12:30:18
2020-06-30T14:08:59
C++
UTF-8
C
false
false
2,356
h
plancat.h
/* ------------------------------------------------------------------------- * * plancat.h * prototypes for plancat.c. * * * Portions Copyright (c) 2021, openGauss Contributors * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/plancat.h * * ------------------------------------------------------------------------- */ #ifndef PLANCAT_H #define PLANCAT_H #include "nodes/relation.h" #include "utils/relcache.h" /* Hook for plugins to get control in get_relation_info() */ typedef void (*get_relation_info_hook_type) (PlannerInfo *root, Oid relationObjectId, bool inhparent, RelOptInfo *rel); extern THR_LOCAL PGDLLIMPORT get_relation_info_hook_type get_relation_info_hook; extern List* build_index_tlist(PlannerInfo* root, IndexOptInfo* index, Relation heapRelation); extern void get_relation_info(PlannerInfo* root, Oid relationObjectId, bool inhparent, RelOptInfo* rel); extern void estimate_rel_size(Relation rel, int32* attr_widths, RelPageType* pages, double* tuples, double* allvisfrac, List** sampledPartitionIds); extern int32 get_relation_data_width(Oid relid, Oid partitionid, int32* attr_widths, bool vectorized = false); extern int32 getPartitionDataWidth(Relation partRel, int32* attr_widths); extern int32 getIdxDataWidth(Relation rel, IndexInfo* info, bool vectorized); extern bool relation_excluded_by_constraints(PlannerInfo* root, RelOptInfo* rel, RangeTblEntry* rte); extern List* build_physical_tlist(PlannerInfo* root, RelOptInfo* rel); extern bool IsRteForStartWith(PlannerInfo *root, RangeTblEntry *rte); extern bool has_unique_index(RelOptInfo* rel, AttrNumber attno); extern Selectivity restriction_selectivity( PlannerInfo* root, Oid operatorid, List* args, Oid inputcollid, int varRelid); extern Selectivity join_selectivity( PlannerInfo* root, Oid operatorid, List* args, Oid inputcollid, JoinType jointype, SpecialJoinInfo* sjinfo); extern void estimatePartitionSize( Relation relation, Oid partitionid, int32* attr_widths, RelPageType* pages, double* tuples, double* allvisfrac); extern bool HasStoredGeneratedColumns(const PlannerInfo *root, Index rti); extern PlannerInfo *get_cte_root(PlannerInfo *root, int levelsup, char *ctename); #endif /* PLANCAT_H */
40fc61569c38526e2be4200990987eebe975b888
695180c14d136c1af33e50497c7957dc74835680
/tools/driver/drivers/char/tpu_common/tpuv4/tpuv4_userspace_lst_port_indirect_offsets.h
5bee248d26168c16ffc13e0a9202fd3e48dbd856
[ "Apache-2.0" ]
permissive
tensorflow/tpu
4517c43b42c3dd98b8abafbbd9457384dd9639b1
0f7adb97a93ec3e3485c261d030c507eb16b33e4
refs/heads/master
2023-09-02T23:33:31.299394
2023-09-01T00:43:03
2023-09-01T00:43:03
96,946,693
5,627
2,107
Apache-2.0
2023-09-13T17:50:43
2017-07-11T23:54:39
Jupyter Notebook
UTF-8
C
false
false
978
h
tpuv4_userspace_lst_port_indirect_offsets.h
/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (C) 2021 Google LLC. */ #ifndef _DRIVERS_CHAR_TPU_COMMON_TPUV4_TPU_V4_COMMON_USERSPACE_LST_PORT_INDIRECT_OFFSETS_H_ #define _DRIVERS_CHAR_TPU_COMMON_TPUV4_TPU_V4_COMMON_USERSPACE_LST_PORT_INDIRECT_OFFSETS_H_ #include "drivers/char/tpu_common/tpuv4common/tpuv4common_userspace_lst_port_indirect_offsets.h" #include "drivers/gasket/gasket_types.h" struct tpuv4_userspace_lst_port_indirect_offsets { uint64 data_link_layer_request; uint64 data_link_layer_status; uint64 unused_register_one; uint64 unused_register_two; uint64 unused_register_three; uint64 unused_register_four[2]; uint64 unused_register_five[2]; uint64 unused_register_six[2]; uint64 lock; uint64 physical_layer_state; uint64 rates; uint64 to_mirror[12]; }; int tpuv4_userspace_lst_port_indirect_offsets_count(void); const struct tpuv4common_userspace_lst_port_indirect_offsets * tpuv4_userspace_lst_port_indirect_offsets_get(int index); #endif
b666a791456c2a0c522a6426eed77de6308f7e71
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
/SOFTWARE/A64-TERES/linux-a64/include/net/if_inet6.h
100fb8cec17c0157c331fc12366d22f593368295
[ "Linux-syscall-note", "GPL-2.0-only", "GPL-1.0-or-later", "LicenseRef-scancode-free-unknown", "Apache-2.0" ]
permissive
OLIMEX/DIY-LAPTOP
ae82f4ee79c641d9aee444db9a75f3f6709afa92
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
refs/heads/rel3
2023-08-04T01:54:19.483792
2023-04-03T07:18:12
2023-04-03T07:18:12
80,094,055
507
92
Apache-2.0
2023-04-03T07:05:59
2017-01-26T07:25:50
C
UTF-8
C
false
false
5,915
h
if_inet6.h
/* * inet6 interface/address list definitions * Linux INET6 implementation * * Authors: * Pedro Roque <roque@di.fc.ul.pt> * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _NET_IF_INET6_H #define _NET_IF_INET6_H #include <net/snmp.h> #include <linux/ipv6.h> /* inet6_dev.if_flags */ #define IF_RA_OTHERCONF 0x80 #define IF_RA_MANAGED 0x40 #define IF_RA_RCVD 0x20 #define IF_RS_SENT 0x10 #define IF_READY 0x80000000 /* prefix flags */ #define IF_PREFIX_ONLINK 0x01 #define IF_PREFIX_AUTOCONF 0x02 enum { INET6_IFADDR_STATE_DAD, INET6_IFADDR_STATE_POSTDAD, INET6_IFADDR_STATE_UP, INET6_IFADDR_STATE_DEAD, }; struct inet6_ifaddr { struct in6_addr addr; __u32 prefix_len; /* In seconds, relative to tstamp. Expiry is at tstamp + HZ * lft. */ __u32 valid_lft; __u32 prefered_lft; atomic_t refcnt; spinlock_t lock; spinlock_t state_lock; int state; __u8 probes; __u8 flags; __u16 scope; unsigned long cstamp; /* created timestamp */ unsigned long tstamp; /* updated timestamp */ struct timer_list timer; struct inet6_dev *idev; struct rt6_info *rt; struct hlist_node addr_lst; struct list_head if_list; #ifdef CONFIG_IPV6_PRIVACY struct list_head tmp_list; struct inet6_ifaddr *ifpub; int regen_count; #endif bool tokenized; struct rcu_head rcu; }; struct ip6_sf_socklist { unsigned int sl_max; unsigned int sl_count; struct in6_addr sl_addr[0]; }; #define IP6_SFLSIZE(count) (sizeof(struct ip6_sf_socklist) + \ (count) * sizeof(struct in6_addr)) #define IP6_SFBLOCK 10 /* allocate this many at once */ struct ipv6_mc_socklist { struct in6_addr addr; int ifindex; struct ipv6_mc_socklist __rcu *next; rwlock_t sflock; unsigned int sfmode; /* MCAST_{INCLUDE,EXCLUDE} */ struct ip6_sf_socklist *sflist; struct rcu_head rcu; }; struct ip6_sf_list { struct ip6_sf_list *sf_next; struct in6_addr sf_addr; unsigned long sf_count[2]; /* include/exclude counts */ unsigned char sf_gsresp; /* include in g & s response? */ unsigned char sf_oldin; /* change state */ unsigned char sf_crcount; /* retrans. left to send */ }; #define MAF_TIMER_RUNNING 0x01 #define MAF_LAST_REPORTER 0x02 #define MAF_LOADED 0x04 #define MAF_NOREPORT 0x08 #define MAF_GSQUERY 0x10 struct ifmcaddr6 { struct in6_addr mca_addr; struct inet6_dev *idev; struct ifmcaddr6 *next; struct ip6_sf_list *mca_sources; struct ip6_sf_list *mca_tomb; unsigned int mca_sfmode; unsigned char mca_crcount; unsigned long mca_sfcount[2]; struct timer_list mca_timer; unsigned int mca_flags; int mca_users; atomic_t mca_refcnt; spinlock_t mca_lock; unsigned long mca_cstamp; unsigned long mca_tstamp; }; /* Anycast stuff */ struct ipv6_ac_socklist { struct in6_addr acl_addr; int acl_ifindex; struct ipv6_ac_socklist *acl_next; }; struct ifacaddr6 { struct in6_addr aca_addr; struct inet6_dev *aca_idev; struct rt6_info *aca_rt; struct ifacaddr6 *aca_next; int aca_users; atomic_t aca_refcnt; spinlock_t aca_lock; unsigned long aca_cstamp; unsigned long aca_tstamp; }; #define IFA_HOST IPV6_ADDR_LOOPBACK #define IFA_LINK IPV6_ADDR_LINKLOCAL #define IFA_SITE IPV6_ADDR_SITELOCAL struct ipv6_devstat { struct proc_dir_entry *proc_dir_entry; DEFINE_SNMP_STAT(struct ipstats_mib, ipv6); DEFINE_SNMP_STAT_ATOMIC(struct icmpv6_mib_device, icmpv6dev); DEFINE_SNMP_STAT_ATOMIC(struct icmpv6msg_mib_device, icmpv6msgdev); }; struct inet6_dev { struct net_device *dev; struct list_head addr_list; struct ifmcaddr6 *mc_list; struct ifmcaddr6 *mc_tomb; spinlock_t mc_lock; unsigned char mc_qrv; unsigned char mc_gq_running; unsigned char mc_ifc_count; unsigned long mc_v1_seen; unsigned long mc_maxdelay; struct timer_list mc_gq_timer; /* general query timer */ struct timer_list mc_ifc_timer; /* interface change timer */ struct ifacaddr6 *ac_list; rwlock_t lock; atomic_t refcnt; __u32 if_flags; int dead; #ifdef CONFIG_IPV6_PRIVACY u8 rndid[8]; struct timer_list regen_timer; struct list_head tempaddr_list; #endif struct in6_addr token; struct neigh_parms *nd_parms; struct inet6_dev *next; struct ipv6_devconf cnf; struct ipv6_devstat stats; unsigned long tstamp; /* ipv6InterfaceTable update timestamp */ struct rcu_head rcu; }; static inline void ipv6_eth_mc_map(const struct in6_addr *addr, char *buf) { /* * +-------+-------+-------+-------+-------+-------+ * | 33 | 33 | DST13 | DST14 | DST15 | DST16 | * +-------+-------+-------+-------+-------+-------+ */ buf[0]= 0x33; buf[1]= 0x33; memcpy(buf + 2, &addr->s6_addr32[3], sizeof(__u32)); } static inline void ipv6_arcnet_mc_map(const struct in6_addr *addr, char *buf) { buf[0] = 0x00; } static inline void ipv6_ib_mc_map(const struct in6_addr *addr, const unsigned char *broadcast, char *buf) { unsigned char scope = broadcast[5] & 0xF; buf[0] = 0; /* Reserved */ buf[1] = 0xff; /* Multicast QPN */ buf[2] = 0xff; buf[3] = 0xff; buf[4] = 0xff; buf[5] = 0x10 | scope; /* scope from broadcast address */ buf[6] = 0x60; /* IPv6 signature */ buf[7] = 0x1b; buf[8] = broadcast[8]; /* P_Key */ buf[9] = broadcast[9]; memcpy(buf + 10, addr->s6_addr + 6, 10); } static inline int ipv6_ipgre_mc_map(const struct in6_addr *addr, const unsigned char *broadcast, char *buf) { if ((broadcast[0] | broadcast[1] | broadcast[2] | broadcast[3]) != 0) { memcpy(buf, broadcast, 4); } else { /* v4mapped? */ if ((addr->s6_addr32[0] | addr->s6_addr32[1] | (addr->s6_addr32[2] ^ htonl(0x0000ffff))) != 0) return -EINVAL; memcpy(buf, &addr->s6_addr32[3], 4); } return 0; } #endif
7958d6e04d9d696d516d35783b27fc398ca9a3d4
cf35a104dabc3d3647df66aff9db32d18b002e1b
/cmd/wmii/rule.c
710b341ca8505c8fdae9e7a38e1a818d5ecf71fb
[ "MIT" ]
permissive
0intro/wmii
ba2dff4be1a049c7d4475218a914585a3f810ab5
024f29d1058b58aa4ee6b956500a78f69355fb53
refs/heads/main
2023-07-11T18:08:43.660898
2023-06-25T18:57:45
2023-06-25T18:57:45
74,551,919
110
17
null
null
null
null
UTF-8
C
false
false
2,113
c
rule.c
/* Copyright ©2010 Kris Maglione <maglione.k at Gmail> * See LICENSE file for license details. */ #include "dat.h" #include "fns.h" void update_rules(Rule **rule, char *data) { #define putc(m, c) BLOCK(if((m)->pos < (m)->end) *(m)->pos++ = c;) #define getc(m) ((m)->pos < (m)->end ? *(m)->pos++ : 0) #define ungetc(m) BLOCK(if((m)->pos > (m)->data) --(m)->pos) IxpMsg buf, valuebuf, rebuf; Reprog *re; Rule *r; Ruleval **rvp; Ruleval *rv; char *w; char regexp[256]; char c; int len; while((r = *rule)) { *rule = r->next; while((rv = r->values)) { r->values = rv->next; free(rv); } free(r->regex); free(r->value); free(r); } if(!data || !data[0]) return; buf = ixp_message(data, strlen(data), MsgUnpack); begin: msg_eatrunes(&buf, isspacerune, true); if(getc(&buf) == '/') goto regexp; /* Regexp not at begining of the line. Rest of the line is junk. */ while((c = getc(&buf))) if(c == '\n') goto begin; goto done; regexp: rebuf = ixp_message(regexp, sizeof regexp - 1, MsgPack); while((c = getc(&buf))) if(c == '/') goto value; else if(c != '\\') putc(&rebuf, c); else if(buf.pos[1] == '/' || buf.pos[1] == '\\' && buf.pos[2] == '/') putc(&rebuf, getc(&buf)); else { putc(&rebuf, c); putc(&rebuf, getc(&buf)); } goto done; value: valuebuf = ixp_message(buffer, sizeof buffer - 1, MsgPack); while((c = getc(&buf))) { if(c == '\n') { putc(&valuebuf, ' '); msg_eatrunes(&buf, isspacerune, true); if((c = getc(&buf)) == '/') { ungetc(&buf); break; } } putc(&valuebuf, c); } putc(&rebuf, '\0'); re = regcomp(regexp); if(!re) goto begin; r = emallocz(sizeof *r); *rule = r; rule = &r->next; r->regex = re; valuebuf.end = valuebuf.pos; valuebuf.pos = valuebuf.data; rvp = &r->values; while((w = msg_getword(&valuebuf, 0))) { free(r->value); r->value = estrdup(w); if(strchr(w, '=')) { len = strlen(w) + 1; *rvp = rv = emallocz(sizeof *rv + len); rvp = &rv->next; memcpy(&rv[1], w, len); tokenize(&rv->key, 2, (char*)&rv[1], '='); } } goto begin; done: return; }
e760ca31f8bfe453c1748332f3b0517c1510e021
7744859512f027ef0da8b1bde0f8518e631b98eb
/soh/assets/scenes/indoors/kakariko/kakariko_room_0.h
cf8fa3e64ece4adfc901c70898ee18f3d457caaf
[]
no_license
HarbourMasters/Shipwright
7f70b9470e4f9a117f3fe2d6e4deb776b8742182
0e7c6585239c0d7ea2c039b8b8cb7eaedf8928a9
refs/heads/develop
2023-08-31T20:50:56.253521
2023-08-30T17:34:06
2023-08-30T17:34:06
472,575,717
2,104
459
null
2023-09-14T20:29:01
2022-03-22T01:42:52
C
UTF-8
C
false
false
230
h
kakariko_room_0.h
#pragma once #include "align_asset_macro.h" #define dkakariko_room_0DL_005760 "__OTR__scenes/nonmq/kakariko_scene/kakariko_room_0DL_005760" static const ALIGN_ASSET(2) char kakariko_room_0DL_005760[] = dkakariko_room_0DL_005760;
e7612978034cb535665d94235735d63b77e369c3
40571dcc11c41b02e376bdff3ea4b95eda309771
/src_app/scope_check.c
fb10de903d32d77758f17e5b55b78abb157f9fb5
[]
no_license
nimble-code/Cobra
bde1d115b11a9033c8f4a92ef3222c2d1c4fb9ed
cb272a61907c46b9aae6c73337d5a3ac6af47076
refs/heads/master
2023-06-08T03:05:46.607239
2023-06-02T17:40:04
2023-06-02T17:40:04
190,289,481
113
32
null
2023-04-28T21:06:45
2019-06-04T22:43:49
Shell
UTF-8
C
false
false
9,426
c
scope_check.c
#include "c_api.h" #include <sys/times.h> // requires preprocessing char *Rule = "declare data objects at smallest possible level of scope"; typedef struct Fcts Fcts; typedef struct Ident Ident; typedef struct Typenm Typenm; typedef struct MyRange MyRange; struct Fcts { int seq; Prim *p; // fct name Prim *extent; // closing } Fcts *nxt; } *fcts, *lst; // questions: // identifier appears at least once in global scope // is the identifier used in more than one file // is the identifier used in more than one fct struct Ident { Prim *p; // symbol name Fcts *scope; // fct def if any char *fnm; // filename, if unique int global; // saw in global scope int tagged; // saw with a static tag int nrscopes; int nrfiles; Ident *nxt; } *htab[4096]; struct Typenm { int h; char *s; Typenm *nxt; } *typenm; struct MyRange { int seq; int fct_only; int file_only; } **myrange; extern TokRange **tokrange; // for cobra_prep.c extern void set_multi(void); // cwe_util.c FILE *track_fd; int hash_s(char *v) { unsigned int h = 0x88888EEFL; while (*v != '\0') { h ^= ((h << 4) ^ (h >> 28))+ *v++; } return (int) (h ^ (h>>12)); } void record_type(char *s) { Typenm *t; int h = hash_s(s); for (t = typenm; t; t = t->nxt) { if (t->h == h && strcmp(t->s, s) == 0) { return; } } t = (Typenm *) emalloc(sizeof(Typenm)); t->h = h; t->s = s; t->nxt = typenm; typenm = t; } int is_typenm(char *s) { Typenm *t; int h = hash_s(s); for (t = typenm; t; t = t->nxt) { if (t->h == h && strcmp(t->s, s) == 0) { return 1; } } return 0; } int likely_static(Prim *p) { if (!p || !p->prv) { return 0; } p = p->prv; while (p && (strcmp(p->txt, "}") != 0 || p->curly > 0) && (strcmp(p->txt, ";") != 0 || p->curly > 0) && strcmp(p->txt, "static") != 0) { p = p->prv; } if (p && strcmp(p->txt, "static") == 0) { return 1; } return 0; } void new_ident(Fcts *sc, Prim *id, int is_static) { Ident *i; int h = hash_s(id->txt)&4095; assert(h >= 0 && h < 4096); for (i = htab[h]; i; i = i->nxt) { if (strcmp(i->p->txt, id->txt) == 0) { // same name if (i->scope && sc && i->scope != sc) { i->nrscopes++; } if (strcmp(i->fnm, id->fnm) != 0) { i->nrfiles++; } if (!sc) { i->global++; i->p = id; } else if (!i->scope) { i->scope = sc; i->nrscopes = 1; } break; } } if (!i) { i = (Ident *) emalloc(sizeof(Ident)); i->p = id; i->scope = sc; i->fnm = id->fnm; if (sc) { i->nrscopes = 1; } else { i->global = 1; } i->nrfiles = 1; i->tagged = is_static || likely_static(id->prv); i->nxt = htab[h]; htab[h] = i; } } void new_fct(Prim *p) { Fcts *f = (Fcts *) emalloc(sizeof(Fcts)); f->p = p; p = p->nxt; // ( p = p->jmp; // ) while (strcmp(p->nxt->typ, "cmnt") == 0) { p = p->nxt; } p = p->nxt; // { f->extent = p->jmp; // } if (!lst) { f->seq = 0; fcts = lst = f; } else { f->seq = lst->seq + 1; lst->nxt = f; lst = f; } } int in_range(Fcts *f) { // cobra_eval.c <-> cobra_eval.y problem if (!f || !f->extent || (cur->curly == 0 && strcmp(f->p->fnm, cur->fnm) != 0)) { return 0; } return (f && cur->lnr >= f->p->lnr && cur->lnr <= f->extent->lnr); } int bad_pre(char *s) { if (strcmp(s, "goto") == 0 || strcmp(s, "->") == 0 || strcmp(s, ".") == 0) { return 1; } return 0; } int bad_post(char *s) { if (strcmp(s, ":") == 0) { return 1; } return 0; } int static_fct(char *s) { Fcts *f; for (f = fcts; f; f = f->nxt) { if (strcmp(f->p->txt, s) == 0) { return likely_static (f->p->prv); } } return -1; // not a function } void checkit(const int cpu, Ident *i) { int x; if (!i->global // never seen in global scope || i->tagged // static || strcmp(i->p->txt, "stdio") == 0 || strncmp(i->p->txt, "YY_", 3) == 0 || strncmp(i->p->txt, "yy", 2) == 0 || strncmp(i->p->txt, "flex_", 5) == 0) { return; } assert(cpu >= 0 && cpu < Ncore); // seen in global scope // and i->p points to one such use // if i->p->curly > 0, it is a structure or enum field // and we only report on the structure itself if (i->p->curly > 0 // in structure or enum || i->p->round > 0 // in parameter list || is_typenm(i->p->txt)) { return; } if (i->nrscopes == 1) { myrange[cpu]->fct_only++; i->p->mark = 1; i->p->typ = (i->scope && i->scope->p)?i->scope->p->txt:"global"; if (verbose) { fprintf(stderr, "%s\tis only used in scope %s\n", i->p->txt, i->scope->p->txt); } return; } if (i->nrfiles == 1) { x = static_fct(i->p->txt); if (x == 1) { return; } myrange[cpu]->file_only++; i->p->mark = 2; // printf("%s", (x==0)?"fct ":""); if (verbose) { fprintf(stderr, "%s\tis only used in file %s\n", i->p->txt, i->fnm); } } } static void * range_check(void *arg) { Ident *z; int y, from, upto; int *i = (int *) arg; from = (*i) * (4096/Ncore); upto = (*i == Ncore-1) ? 4096 : from + 4096/Ncore; for (y = from; y < upto; y++) for (z = htab[y]; z; z = z->nxt) { checkit(*i, z); } return NULL; } void *(*fct)(void*) = range_check; void cobra_main(void) { Fcts *f, *scope; pthread_t *t_id; Prim *q; int fct_only = 0, file_only = 0; int i, is_static = 0, first_entry = 1; clock_t start_time, stop_time; struct tms start_tm, stop_tm; double delta_time; if (strlen(backend) > 0) { if (strstr(backend, "json") != NULL) { json_format = 1; } else if (strstr(backend, "help") != NULL) { fprintf(stderr, "usage: scope_check [-json] [-runtimes] *.c\n"); exit(1); } else { fprintf(stderr, "scope_check: unrecognized option '%s'\n", backend); exit(1); } } // if (json_format) // can also be set in front-end // { fprintf(stderr, "error: scope_check does not support json-format output\n"); // exit(1); // } if (!prim) { fprintf(stderr, "scope_check: no tokens\n"); return; } if (!cobra_commands) { cobra_commands = "Rule"; } set_multi(); // cwe_util.c, multi-threading in cobra_links.c track_fd = stdout; // cobra_links.c start_time = times(&start_tm); // find functions and user-defined typenames for (cur = prim; cur; NEXT) { if (TYPE("ident")) { if (cur->curly == 0 && cur->nxt && strcmp(cur->nxt->txt, "(") == 0 && cur->nxt->jmp && cur->nxt->jmp->nxt && strcmp(cur->nxt->jmp->nxt->txt, "{") == 0) { // fct definition new_fct(cur); } } if (MATCH("struct") && cur->nxt) { record_type(cur->nxt->txt); } else if (MATCH("typedef")) { for (q = cur->nxt; q; q = q->nxt) { if (strcmp(q->txt, ";") == 0) { record_type(q->prv->txt); break; } } } } // associate identifiers with enclosing scope f = fcts; // points to fct that we could be in for (cur = prim; cur; NEXT) { if (in_range(f)) { scope = f; } else if (f && in_range(f->nxt)) { f = f->nxt; scope = f; } else { scope = (Fcts *) 0; // global } if (strcmp(cur->txt, "static") == 0) { is_static = 1; } if (cur->round > 0 || strcmp(cur->txt, ";") == 0) { is_static = 0; } if (TYPE("ident") && strncmp(cur->fnm, "/usr", 3) != 0) { if (cur->nxt && !bad_post(cur->nxt->txt) && cur->prv && !bad_pre(cur->prv->txt)) { new_ident(scope, cur, is_static); } } } // check each identifier found, multicore t_id = (pthread_t *) malloc(Ncore * sizeof(pthread_t)); myrange = (MyRange **) malloc(Ncore * sizeof(MyRange *)); for (i = 0; i < Ncore; i++) { myrange[i] = (MyRange *) malloc(sizeof(MyRange)); myrange[i]->seq = i; myrange[i]->fct_only = 0; myrange[i]->file_only = 0; (void) pthread_create(&t_id[i], 0, fct, (void *) &(myrange[i]->seq)); } for (i = 0; i < Ncore; i++) { (void) pthread_join(t_id[i], 0); fct_only += myrange[i]->fct_only; file_only += myrange[i]->file_only; } stop_time = times(&stop_tm); if (fct_only + file_only > 0 && !json_format) { printf("=== %s: %s\n", cobra_commands, Rule); } if (!json_format) { printf(" globals used in one scope only: %3d\n", fct_only); } if (!no_display) { for (cur = prim; cur; NEXT) { if (cur->mark == 1) { if (json_format) { sprintf(json_msg,"%s is used in only one %s (%s)", cur->txt, cur->curly==0?"scope":"function", cur->typ); json_match("scope_check", cobra_commands, json_msg, cur, cur, first_entry); first_entry = 0; } else { printf("\t%s\tused in only one %s (%s)\n", cur->txt, cur->curly==0?"scope":"function", cur->typ); } } } } if (!json_format) { printf(" globals used in one file only: %3d\n", file_only); } if (!no_display) { for (cur = prim; cur; NEXT) { if (cur->mark == 2) { if (json_format) { sprintf(json_msg, "%s is used only in file %s", cur->txt, cur->fnm); json_match("scope_check", cobra_commands, json_msg, cur, cur, first_entry); first_entry = 0; } else { printf("\t%s\tused in only file %s\n", cur->txt, cur->fnm); } } } } delta_time = ((double) (start_time -stop_time)) / ((double) sysconf(_SC_CLK_TCK)); if (runtimes && !no_match && !no_display) { fprintf(stderr, " (%.3g sec)\n", delta_time); } json_match("", 0, 0, 0, 0, 1); // force linkage to cobra_json.o // for all Linux 2.4.1 sources (8,301 files, 3.7 Mlines, 2.6 M NCS) // scope_check -n -z -N? `cat c_files` // 35 sec to build the data structure // 9 sec for the sequential part // 9 sec -N16..30 to do the parallel part of the check // 11 sec -N8 // 20 sec -N4 // 38 sec -N2 // 52 sec -N1 }
62d81b6adffa3627f223d145715adbbd5b2cdc7e
99bdb3251fecee538e0630f15f6574054dfc1468
/bsp/synwit/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_pwm.h
9bf678eddb2a077866cef60e317a3713e6cc6dd3
[ "Apache-2.0", "Zlib", "LicenseRef-scancode-proprietary-license", "MIT", "BSD-3-Clause", "X11", "BSD-4-Clause-UC", "LicenseRef-scancode-unknown-license-reference" ]
permissive
RT-Thread/rt-thread
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
3602f891211904a27dcbd51e5ba72fefce7326b2
refs/heads/master
2023-09-01T04:10:20.295801
2023-08-31T16:20:55
2023-08-31T16:20:55
7,408,108
9,599
5,805
Apache-2.0
2023-09-14T13:37:26
2013-01-02T14:49:21
C
UTF-8
C
false
false
3,181
h
SWM320_pwm.h
#ifndef __SWM320_PWM_H__ #define __SWM320_PWM_H__ typedef struct { uint8_t clk_div; //PWM_CLKDIV_1、PWM_CLKDIV_8 uint8_t mode; //PWM_MODE_INDEP、PWM_MODE_COMPL、PWM_MODE_INDEP_CALIGN、PWM_MODE_COMPL_CALIGN uint16_t cycleA; //A路周期 uint16_t hdutyA; //A路占空比 uint16_t deadzoneA; //A路死区时长,取值0--1023 uint8_t initLevelA; //A路初始输出电平,0 低电平 1 高电平 uint16_t cycleB; //B路周期 uint16_t hdutyB; //B路占空比 uint16_t deadzoneB; //B路死区时长,取值0--1023 uint8_t initLevelB; //B路初始输出电平,0 低电平 1 高电平 uint8_t HEndAIEn; //A路高电平结束中断使能 uint8_t NCycleAIEn; //A路新周期开始中断使能 uint8_t HEndBIEn; //B路高电平结束中断使能 uint8_t NCycleBIEn; //B路新周期开始中断使能 } PWM_InitStructure; #define PWM_CLKDIV_1 0 #define PWM_CLKDIV_8 1 #define PWM_MODE_INDEP 0 //A路和B路为两路独立输出 #define PWM_MODE_COMPL 1 //A路和B路为一路互补输出 #define PWM_MODE_INDEP_CALIGN 3 //A路和B路为两路独立输出,中心对齐 #define PWM_MODE_COMPL_CALIGN 4 //A路和B路为一路互补输出,中心对齐 #define PWM_CH_A 0 #define PWM_CH_B 1 void PWM_Init(PWM_TypeDef * PWMx, PWM_InitStructure * initStruct); //PWM初始化 void PWM_Start(PWM_TypeDef * PWMx, uint32_t chA, uint32_t chB); //启动PWM,开始PWM输出 void PWM_Stop(PWM_TypeDef * PWMx, uint32_t chA, uint32_t chB); //关闭PWM,停止PWM输出 void PWM_SetCycle(PWM_TypeDef * PWMx, uint32_t chn, uint16_t cycle); //设置周期 uint16_t PWM_GetCycle(PWM_TypeDef * PWMx, uint32_t chn); //获取周期 void PWM_SetHDuty(PWM_TypeDef * PWMx, uint32_t chn, uint16_t hduty); //设置高电平时长 uint16_t PWM_GetHDuty(PWM_TypeDef * PWMx, uint32_t chn); //获取高电平时长 void PWM_SetDeadzone(PWM_TypeDef * PWMx, uint32_t chn, uint8_t deadzone); //设置死区时长 uint8_t PWM_GetDeadzone(PWM_TypeDef * PWMx, uint32_t chn); //获取死区时长 void PWM_IntNCycleEn(PWM_TypeDef * PWMx, uint32_t chn); //新周期开始中断使能 void PWM_IntNCycleDis(PWM_TypeDef * PWMx, uint32_t chn); //新周期开始中断禁能 void PWM_IntNCycleClr(PWM_TypeDef * PWMx, uint32_t chn); //新周期开始中断标志清除 uint32_t PWM_IntNCycleStat(PWM_TypeDef * PWMx, uint32_t chn); //新周期开始中断是否发生 void PWM_IntHEndEn(PWM_TypeDef * PWMx, uint32_t chn); //高电平结束中断使能 void PWM_IntHEndDis(PWM_TypeDef * PWMx, uint32_t chn); //高电平结束中断禁能 void PWM_IntHEndClr(PWM_TypeDef * PWMx, uint32_t chn); //高电平结束中断标志清除 uint32_t PWM_IntHEndStat(PWM_TypeDef * PWMx, uint32_t chn); //高电平结束中断是否发生 #endif //__SWM320_PWM_H__
80563cfa1203e4578e1b257d9072945111334e1c
ecce427678ecff2a93a47f3b1b664202c7d27617
/levels/ssl/geo.c
217edac8c0cedcf56cde665d12146b5e830efe67
[]
no_license
sm64pc/sm64ex
ecf37f31b3f7426c4874254660d856030d789714
54cd27ccee45a2403b45f07a00d6043c51149969
refs/heads/nightly
2023-08-11T12:14:34.424168
2023-07-01T11:45:50
2023-07-01T11:45:50
262,091,731
795
238
null
2023-07-01T11:45:51
2020-05-07T15:43:27
C
UTF-8
C
false
false
822
c
geo.c
#include <ultra64.h> #include "sm64.h" #include "geo_commands.h" #include "game/level_geo.h" #include "game/geo_misc.h" #include "game/camera.h" #include "game/moving_texture.h" #include "game/screen_transition.h" #include "game/paintings.h" #include "make_const_nonconst.h" #include "levels/ssl/header.h" #include "levels/ssl/areas/1/5/geo.inc.c" #include "levels/ssl/areas/2/4/geo.inc.c" #include "levels/ssl/pyramid_top/geo.inc.c" #include "levels/ssl/tox_box/geo.inc.c" #include "levels/ssl/areas/1/geo.inc.c" #include "levels/ssl/grindel/geo.inc.c" #include "levels/ssl/spindel/geo.inc.c" #include "levels/ssl/moving_pyramid_wall/geo.inc.c" #include "levels/ssl/pyramid_elevator/geo.inc.c" #include "levels/ssl/eyerok_col/geo.inc.c" #include "levels/ssl/areas/2/geo.inc.c" #include "levels/ssl/areas/3/geo.inc.c"
0573ca69de5815ea8a1d784827c46f357360f8a3
431a5c28b8dfcc7d6ca6f4f97bf370cd770547a7
/src/tmx/TmxTools/src/version.h
6133ad0cbb7e7f054af01d7ba2ae7f0c1d8256d7
[ "Apache-2.0" ]
permissive
usdot-fhwa-OPS/V2X-Hub
134061cfb55d8c83e871f7fd4bbfa5d8d3092eb0
aae33e6a16b8a30e1faee31a7ee863d191be06b8
refs/heads/develop
2023-08-26T10:10:59.989176
2023-08-24T14:58:21
2023-08-24T14:58:21
168,020,929
106
63
null
2023-09-11T20:24:45
2019-01-28T19:16:45
C
UTF-8
C
false
false
165
h
version.h
/* * version.h * * Created on: Aug 29, 2014 * Author: ivp */ #ifndef VERSION_H_ #define VERSION_H_ #define CLI_VERSION "3.2.0" #endif /* VERSION_H_ */
38b584b688fa32e9a5b073b26da1f863034aa254
e814383d36a10839104efaa4df277996ab220fa3
/opal/mca/btl/ofi/btl_ofi.h
590e9b34c2b9cc5f91f9e4697efa3e1460e37709
[ "mpich2", "BSD-3-Clause-Open-MPI" ]
permissive
open-mpi/ompi
a1d7483ae1d83dd8fd8ae3ee95e832e0a0ee04e3
1edfdb025c4450f694600083ad871cf06c8d45cd
refs/heads/main
2023-09-01T01:30:02.040705
2023-08-29T17:32:18
2023-08-29T17:32:18
24,107,001
2,008
973
NOASSERTION
2023-09-14T20:59:26
2014-09-16T16:08:30
C
UTF-8
C
false
false
14,181
h
btl_ofi.h
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2015-2018 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. * Copyright (c) 2020 Amazon.com, Inc. or its affiliates. * All Rights reserved. * Copyright (c) 2022 Triad National Security, LLC. All rights * reserved. * $COPYRIGHT$ * * Additional copyrights may follow * * $HEADER$ */ /** * @file */ #ifndef MCA_BTL_OFI_H #define MCA_BTL_OFI_H #include "opal_config.h" #include <string.h> #include <sys/types.h> /* Open MPI includes */ #include "opal/mca/btl/base/base.h" #include "opal/mca/btl/base/btl_base_error.h" #include "opal/mca/btl/btl.h" #include "opal/mca/mpool/mpool.h" #include "opal/mca/pmix/pmix-internal.h" #include "opal/mca/rcache/base/base.h" #include "opal/util/event.h" #include "opal/class/opal_hash_table.h" #include <rdma/fabric.h> #include <rdma/fi_cm.h> #include <rdma/fi_domain.h> #include <rdma/fi_endpoint.h> #include <rdma/fi_errno.h> #include <rdma/fi_rma.h> BEGIN_C_DECLS #define MCA_BTL_OFI_MAX_MODULES 16 #define MCA_BTL_OFI_NUM_CQE_READ 64 #define MCA_BTL_OFI_DEFAULT_RD_NUM 10 #define MCA_BTL_OFI_DEFAULT_MAX_CQE 128 #define MCA_BTL_OFI_DEFAULT_PROGRESS_THRESHOLD 64 #define MCA_BTL_OFI_ABORT(args) mca_btl_ofi_exit(args) #define TWO_SIDED_ENABLED mca_btl_ofi_component.two_sided_enabled enum mca_btl_ofi_mode { MCA_BTL_OFI_MODE_ONE_SIDED = 0, MCA_BTL_OFI_MODE_TWO_SIDED, MCA_BTL_OFI_MODE_FULL_SUPPORT, MCA_BTL_OFI_MODE_TOTAL }; enum mca_btl_ofi_hdr_type { MCA_BTL_OFI_TYPE_PUT = 0, MCA_BTL_OFI_TYPE_GET, MCA_BTL_OFI_TYPE_AOP, MCA_BTL_OFI_TYPE_AFOP, MCA_BTL_OFI_TYPE_CSWAP, MCA_BTL_OFI_TYPE_SEND, MCA_BTL_OFI_TYPE_RECV, MCA_BTL_OFI_TYPE_TOTAL }; struct mca_btl_ofi_context_t { int32_t context_id; /* transmit context */ struct fid_ep *tx_ctx; struct fid_ep *rx_ctx; /* completion queue */ struct fid_cq *cq; /* completion info freelist */ /* We have it per context to reduce the thread contention * on the freelist. Things can get really slow. */ opal_free_list_t rdma_comp_list; opal_free_list_t frag_comp_list; opal_free_list_t frag_list; /* for thread locking */ opal_atomic_int32_t lock; }; typedef struct mca_btl_ofi_context_t mca_btl_ofi_context_t; /** * @brief OFI BTL module */ struct mca_btl_ofi_module_t { /** base BTL interface */ mca_btl_base_module_t super; /* libfabric components */ struct fi_info *fabric_info; struct fid_fabric *fabric; struct fid_domain *domain; struct fid_ep *ofi_endpoint; struct fid_av *av; int num_contexts; mca_btl_ofi_context_t *contexts; char *linux_device_name; /** whether the module has been fully initialized or not */ bool initialized; bool use_virt_addr; bool is_scalable_ep; bool use_fi_mr_bind; opal_atomic_int64_t outstanding_rdma; opal_atomic_int64_t outstanding_send; /** linked list of BTL endpoints. this list is never searched so * there is no need for a complicated structure here at this time*/ opal_list_t endpoints; opal_mutex_t module_lock; opal_hash_table_t id_to_endpoint; /** registration cache */ mca_rcache_base_module_t *rcache; /* If the underlying OFI provider has its own cache, we want to bypass * rcache registration */ bool bypass_cache; }; typedef struct mca_btl_ofi_module_t mca_btl_ofi_module_t; extern mca_btl_ofi_module_t mca_btl_ofi_module_template; /** * @brief OFI BTL component */ struct mca_btl_ofi_component_t { mca_btl_base_component_3_0_0_t super; /**< base BTL component */ /** number of TL modules */ int module_count; int num_contexts_per_module; int num_cqe_read; int progress_threshold; int mode; int rd_num; bool two_sided_enabled; size_t namelen; /** Maximum inject size */ size_t max_inject_size; bool disable_inject; /** All BTL OFI modules (1 per tl) */ mca_btl_ofi_module_t *modules[MCA_BTL_OFI_MAX_MODULES]; }; typedef struct mca_btl_ofi_component_t mca_btl_ofi_component_t; OPAL_DECLSPEC extern mca_btl_ofi_component_t mca_btl_ofi_component; struct mca_btl_base_registration_handle_t { uint64_t rkey; void *desc; void *base_addr; }; struct mca_btl_ofi_reg_t { mca_rcache_base_registration_t base; struct fid_mr *ur_mr; /* remote handle */ mca_btl_base_registration_handle_t handle; }; typedef struct mca_btl_ofi_reg_t mca_btl_ofi_reg_t; OBJ_CLASS_DECLARATION(mca_btl_ofi_reg_t); struct mca_btl_ofi_header_t { mca_btl_base_tag_t tag; size_t len; }; typedef struct mca_btl_ofi_header_t mca_btl_ofi_header_t; struct mca_btl_ofi_base_frag_t { mca_btl_base_descriptor_t base; mca_btl_base_segment_t segments[2]; int context_id; struct mca_btl_ofi_module_t *btl; struct mca_btl_base_endpoint_t *endpoint; opal_free_list_t *free_list; mca_btl_ofi_header_t hdr; }; typedef struct mca_btl_ofi_base_frag_t mca_btl_ofi_base_frag_t; OBJ_CLASS_DECLARATION(mca_btl_ofi_base_frag_t); struct mca_btl_ofi_completion_context_t { struct fi_context2 ctx; void *comp; }; typedef struct mca_btl_ofi_completion_context_t mca_btl_ofi_completion_context_t; /* completion structure store information needed * for RDMA callbacks */ struct mca_btl_ofi_base_completion_t { opal_free_list_item_t comp_list; opal_free_list_t *my_list; struct mca_btl_base_module_t *btl; struct mca_btl_base_endpoint_t *endpoint; struct mca_btl_ofi_context_t *my_context; int type; }; typedef struct mca_btl_ofi_base_completion_t mca_btl_ofi_base_completion_t; struct mca_btl_ofi_rdma_completion_t { mca_btl_ofi_base_completion_t base; mca_btl_ofi_completion_context_t comp_ctx; void *local_address; mca_btl_base_registration_handle_t *local_handle; uint64_t operand; uint64_t compare; mca_btl_base_rdma_completion_fn_t cbfunc; void *cbcontext; void *cbdata; }; typedef struct mca_btl_ofi_rdma_completion_t mca_btl_ofi_rdma_completion_t; struct mca_btl_ofi_frag_completion_t { mca_btl_ofi_base_completion_t base; mca_btl_ofi_completion_context_t comp_ctx; mca_btl_ofi_base_frag_t *frag; }; typedef struct mca_btl_ofi_frag_completion_t mca_btl_ofi_frag_completion_t; OBJ_CLASS_DECLARATION(mca_btl_ofi_rdma_completion_t); OBJ_CLASS_DECLARATION(mca_btl_ofi_frag_completion_t); /** * Initiate an asynchronous put. * Completion Semantics: if this function returns a 1 then the operation * is complete. a return of OPAL_SUCCESS indicates * the put operation has been queued with the * network. the local_handle can not be deregistered * until all outstanding operations on that handle * have been completed. * * @param btl (IN) BTL module * @param endpoint (IN) BTL addressing information * @param local_address (IN) Local address to put from (registered) * @param remote_address (IN) Remote address to put to (registered remotely) * @param local_handle (IN) Registration handle for region containing * (local_address, local_address + size) * @param remote_handle (IN) Remote registration handle for region containing * (remote_address, remote_address + size) * @param size (IN) Number of bytes to put * @param flags (IN) Flags for this put operation * @param order (IN) Ordering * @param cbfunc (IN) Function to call on completion (if queued) * @param cbcontext (IN) Context for the callback * @param cbdata (IN) Data for callback * * @retval OPAL_SUCCESS The descriptor was successfully queued for a put * @retval OPAL_ERROR The descriptor was NOT successfully queued for a put * @retval OPAL_ERR_OUT_OF_RESOURCE Insufficient resources to queue the put * operation. Try again later * @retval OPAL_ERR_NOT_AVAILABLE Put can not be performed due to size or * alignment restrictions. */ int mca_btl_ofi_put(struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, void *local_address, uint64_t remote_address, struct mca_btl_base_registration_handle_t *local_handle, struct mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags, int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata); /** * Initiate an asynchronous get. * Completion Semantics: if this function returns a 1 then the operation * is complete. a return of OPAL_SUCCESS indicates * the get operation has been queued with the * network. the local_handle can not be deregistered * until all outstanding operations on that handle * have been completed. * * @param btl (IN) BTL module * @param endpoint (IN) BTL addressing information * @param local_address (IN) Local address to put from (registered) * @param remote_address (IN) Remote address to put to (registered remotely) * @param local_handle (IN) Registration handle for region containing * (local_address, local_address + size) * @param remote_handle (IN) Remote registration handle for region containing * (remote_address, remote_address + size) * @param size (IN) Number of bytes to put * @param flags (IN) Flags for this put operation * @param order (IN) Ordering * @param cbfunc (IN) Function to call on completion (if queued) * @param cbcontext (IN) Context for the callback * @param cbdata (IN) Data for callback * * @retval OPAL_SUCCESS The descriptor was successfully queued for a put * @retval OPAL_ERROR The descriptor was NOT successfully queued for a put * @retval OPAL_ERR_OUT_OF_RESOURCE Insufficient resources to queue the put * operation. Try again later * @retval OPAL_ERR_NOT_AVAILABLE Put can not be performed due to size or * alignment restrictions. */ int mca_btl_ofi_get(struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, void *local_address, uint64_t remote_address, struct mca_btl_base_registration_handle_t *local_handle, struct mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags, int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata); int mca_btl_ofi_aop(struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, uint64_t remote_address, mca_btl_base_registration_handle_t *remote_handle, mca_btl_base_atomic_op_t op, uint64_t operand, int flags, int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata); int mca_btl_ofi_afop(struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, void *local_address, uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle, mca_btl_base_registration_handle_t *remote_handle, mca_btl_base_atomic_op_t op, uint64_t operand, int flags, int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata); int mca_btl_ofi_acswap(struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, void *local_address, uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle, mca_btl_base_registration_handle_t *remote_handle, uint64_t compare, uint64_t value, int flags, int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata); int mca_btl_ofi_flush(struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint); int mca_btl_ofi_finalize(mca_btl_base_module_t *btl); void mca_btl_ofi_rcache_init(mca_btl_ofi_module_t *module); int mca_btl_ofi_reg_mem(void *reg_data, void *base, size_t size, mca_rcache_base_registration_t *reg); int mca_btl_ofi_dereg_mem(void *reg_data, mca_rcache_base_registration_t *reg); int mca_btl_ofi_context_progress(mca_btl_ofi_context_t *context); mca_btl_ofi_module_t *mca_btl_ofi_module_alloc(int mode); int mca_btl_ofi_post_recvs(mca_btl_base_module_t *module, mca_btl_ofi_context_t *context, int count); void mca_btl_ofi_exit(void); /* thread atomics */ static inline bool mca_btl_ofi_context_trylock(mca_btl_ofi_context_t *context) { return (context->lock || OPAL_ATOMIC_SWAP_32(&context->lock, 1)); } static inline void mca_btl_ofi_context_lock(mca_btl_ofi_context_t *context) { while (mca_btl_ofi_context_trylock(context)) ; } static inline void mca_btl_ofi_context_unlock(mca_btl_ofi_context_t *context) { opal_atomic_mb(); context->lock = 0; } END_C_DECLS #endif
ce04367c126bd975c6525d898edef939c3295eff
aa3befea459382dc5c01c925653d54f435b3fb0f
/arch/arm/src/stm32f7/hardware/stm32f72xx73xx_dma.h
ebcf5ed8fa10568c31d62d1a751fd9036594b8a1
[ "MIT-open-group", "BSD-3-Clause", "HPND-sell-variant", "BSD-4-Clause-UC", "LicenseRef-scancode-warranty-disclaimer", "MIT-0", "LicenseRef-scancode-bsd-atmel", "LicenseRef-scancode-gary-s-brown", "LicenseRef-scancode-proprietary-license", "SunPro", "MIT", "LicenseRef-scancode-public-domain-disclaimer", "LicenseRef-scancode-other-permissive", "HPND", "ISC", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "GPL-1.0-or-later", "CC-BY-2.0", "CC-BY-4.0" ]
permissive
apache/nuttx
14519a7bff4a87935d94fb8fb2b19edb501c7cec
606b6d9310fb25c7d92c6f95bf61737e3c79fa0f
refs/heads/master
2023-08-25T06:55:45.822534
2023-08-23T16:03:31
2023-08-24T21:25:47
228,103,273
407
241
Apache-2.0
2023-09-14T18:26:05
2019-12-14T23:27:55
C
UTF-8
C
false
false
34,544
h
stm32f72xx73xx_dma.h
/**************************************************************************** * arch/arm/src/stm32f7/hardware/stm32f72xx73xx_dma.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The * ASF licenses this file to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance with the * License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. * ****************************************************************************/ #ifndef __ARCH_ARM_SRC_STM32F7_HARDWARE_STM32F72XX73XX_DMA_H #define __ARCH_ARM_SRC_STM32F7_HARDWARE_STM32F72XX73XX_DMA_H /**************************************************************************** * Included Files ****************************************************************************/ #include <nuttx/config.h> #if defined(CONFIG_STM32F7_STM32F72XX) || defined(CONFIG_STM32F7_STM32F73XX) /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ /* 2 DMA controllers */ #define DMA1 (0) #define DMA2 (1) /* 8 DMA streams */ #define DMA_STREAM0 (0) #define DMA_STREAM1 (1) #define DMA_STREAM2 (2) #define DMA_STREAM3 (3) #define DMA_STREAM4 (4) #define DMA_STREAM5 (5) #define DMA_STREAM6 (6) #define DMA_STREAM7 (7) /* 16 DMA channels */ #define DMA_CHAN0 (0) #define DMA_CHAN1 (1) #define DMA_CHAN2 (2) #define DMA_CHAN3 (3) #define DMA_CHAN4 (4) #define DMA_CHAN5 (5) #define DMA_CHAN6 (6) #define DMA_CHAN7 (7) #define DMA_CHAN11 (11) /* Register Offsets *********************************************************/ #define STM32_DMA_LISR_OFFSET 0x0000 /* DMA low interrupt status register */ #define STM32_DMA_HISR_OFFSET 0x0004 /* DMA high interrupt status register */ #define STM32_DMA_LIFCR_OFFSET 0x0008 /* DMA low interrupt flag clear register */ #define STM32_DMA_HIFCR_OFFSET 0x000c /* DMA high interrupt flag clear register */ #define STM32_DMA_OFFSET(n) (0x0010+0x0018*(n)) #define STM32_DMA_SCR_OFFSET 0x0000 /* DMA stream n configuration register */ #define STM32_DMA_SNDTR_OFFSET 0x0004 /* DMA stream n number of data register */ #define STM32_DMA_SPAR_OFFSET 0x0008 /* DMA stream n peripheral address register */ #define STM32_DMA_SM0AR_OFFSET 0x000c /* DMA stream n memory 0 address register */ #define STM32_DMA_SM1AR_OFFSET 0x0010 /* DMA stream n memory 1 address register */ #define STM32_DMA_SFCR_OFFSET 0x0014 /* DMA stream n FIFO control register */ #define STM32_DMA_S0CR_OFFSET 0x0010 /* DMA stream 0 configuration register */ #define STM32_DMA_S1CR_OFFSET 0x0028 /* DMA stream 1 configuration register */ #define STM32_DMA_S2CR_OFFSET 0x0040 /* DMA stream 2 configuration register */ #define STM32_DMA_S3CR_OFFSET 0x0058 /* DMA stream 3 configuration register */ #define STM32_DMA_S4CR_OFFSET 0x0070 /* DMA stream 4 configuration register */ #define STM32_DMA_S5CR_OFFSET 0x0088 /* DMA stream 5 configuration register */ #define STM32_DMA_S6CR_OFFSET 0x00a0 /* DMA stream 6 configuration register */ #define STM32_DMA_S7CR_OFFSET 0x00b8 /* DMA stream 7 configuration register */ #define STM32_DMA_S0NDTR_OFFSET 0x0014 /* DMA stream 0 number of data register */ #define STM32_DMA_S1NDTR_OFFSET 0x002c /* DMA stream 1 number of data register */ #define STM32_DMA_S2NDTR_OFFSET 0x0044 /* DMA stream 2 number of data register */ #define STM32_DMA_S3NDTR_OFFSET 0x005c /* DMA stream 3 number of data register */ #define STM32_DMA_S4NDTR_OFFSET 0x0074 /* DMA stream 4 number of data register */ #define STM32_DMA_S5NDTR_OFFSET 0x008c /* DMA stream 5 number of data register */ #define STM32_DMA_S6NDTR_OFFSET 0x00a4 /* DMA stream 6 number of data register */ #define STM32_DMA_S7NDTR_OFFSET 0x00bc /* DMA stream 7 number of data register */ #define STM32_DMA_S0PAR_OFFSET 0x0018 /* DMA stream 0 peripheral address register */ #define STM32_DMA_S1PAR_OFFSET 0x0030 /* DMA stream 1 peripheral address register */ #define STM32_DMA_S2PAR_OFFSET 0x0048 /* DMA stream 2 peripheral address register */ #define STM32_DMA_S3PAR_OFFSET 0x0060 /* DMA stream 3 peripheral address register */ #define STM32_DMA_S4PAR_OFFSET 0x0078 /* DMA stream 4 peripheral address register */ #define STM32_DMA_S5PAR_OFFSET 0x0090 /* DMA stream 5 peripheral address register */ #define STM32_DMA_S6PAR_OFFSET 0x00a8 /* DMA stream 6 peripheral address register */ #define STM32_DMA_S7PAR_OFFSET 0x00c0 /* DMA stream 7 peripheral address register */ #define STM32_DMA_S0M0AR_OFFSET 0x001c /* DMA stream 0 memory 0 address register */ #define STM32_DMA_S1M0AR_OFFSET 0x0034 /* DMA stream 1 memory 0 address register */ #define STM32_DMA_S2M0AR_OFFSET 0x004c /* DMA stream 2 memory 0 address register */ #define STM32_DMA_S3M0AR_OFFSET 0x0064 /* DMA stream 3 memory 0 address register */ #define STM32_DMA_S4M0AR_OFFSET 0x007c /* DMA stream 4 memory 0 address register */ #define STM32_DMA_S5M0AR_OFFSET 0x0094 /* DMA stream 5 memory 0 address register */ #define STM32_DMA_S6M0AR_OFFSET 0x00ac /* DMA stream 6 memory 0 address register */ #define STM32_DMA_S7M0AR_OFFSET 0x00c4 /* DMA stream 7 memory 0 address register */ #define STM32_DMA_S0M1AR_OFFSET 0x0020 /* DMA stream 0 memory 1 address register */ #define STM32_DMA_S1M1AR_OFFSET 0x0038 /* DMA stream 1 memory 1 address register */ #define STM32_DMA_S2M1AR_OFFSET 0x0050 /* DMA stream 2 memory 1 address register */ #define STM32_DMA_S3M1AR_OFFSET 0x0068 /* DMA stream 3 memory 1 address register */ #define STM32_DMA_S4M1AR_OFFSET 0x0080 /* DMA stream 4 memory 1 address register */ #define STM32_DMA_S5M1AR_OFFSET 0x0098 /* DMA stream 5 memory 1 address register */ #define STM32_DMA_S6M1AR_OFFSET 0x00b0 /* DMA stream 6 memory 1 address register */ #define STM32_DMA_S7M1AR_OFFSET 0x00c8 /* DMA stream 7 memory 1 address register */ #define STM32_DMA_S0FCR_OFFSET 0x0024 /* DMA stream 0 FIFO control register */ #define STM32_DMA_S1FCR_OFFSET 0x003c /* DMA stream 1 FIFO control register */ #define STM32_DMA_S2FCR_OFFSET 0x0054 /* DMA stream 2 FIFO control register */ #define STM32_DMA_S3FCR_OFFSET 0x006c /* DMA stream 3 FIFO control register */ #define STM32_DMA_S4FCR_OFFSET 0x0084 /* DMA stream 4 FIFO control register */ #define STM32_DMA_S5FCR_OFFSET 0x009c /* DMA stream 5 FIFO control register */ #define STM32_DMA_S6FCR_OFFSET 0x00b4 /* DMA stream 6 FIFO control register */ #define STM32_DMA_S7FCR_OFFSET 0x00cc /* DMA stream 7 FIFO control register */ /* Register Addresses *******************************************************/ #define STM32_DMA1_LISRC (STM32_DMA1_BASE+STM32_DMA_LISR_OFFSET) #define STM32_DMA1_HISRC (STM32_DMA1_BASE+STM32_DMA_HISR_OFFSET) #define STM32_DMA1_LIFCR (STM32_DMA1_BASE+STM32_DMA_LIFCR_OFFSET) #define STM32_DMA1_HIFCR (STM32_DMA1_BASE+STM32_DMA_HIFCR_OFFSET) #define STM32_DMA1_SCR(n) (STM32_DMA1_BASE+STM32_DMA_SCR_OFFSET+STM32_DMA_OFFSET(n)) #define STM32_DMA1_S0CR (STM32_DMA1_BASE+STM32_DMA_S0CR_OFFSET) #define STM32_DMA1_S1CR (STM32_DMA1_BASE+STM32_DMA_S1CR_OFFSET) #define STM32_DMA1_S2CR (STM32_DMA1_BASE+STM32_DMA_S2CR_OFFSET) #define STM32_DMA1_S3CR (STM32_DMA1_BASE+STM32_DMA_S3CR_OFFSET) #define STM32_DMA1_S4CR (STM32_DMA1_BASE+STM32_DMA_S4CR_OFFSET) #define STM32_DMA1_S5CR (STM32_DMA1_BASE+STM32_DMA_S5CR_OFFSET) #define STM32_DMA1_S6CR (STM32_DMA1_BASE+STM32_DMA_S6CR_OFFSET) #define STM32_DMA1_S7CR (STM32_DMA1_BASE+STM32_DMA_S7CR_OFFSET) #define STM32_DMA1_SNDTR(n) (STM32_DMA1_BASE+STM32_DMA_SNDTR_OFFSET+STM32_DMA_OFFSET(n)) #define STM32_DMA1_S0NDTR (STM32_DMA1_BASE+STM32_DMA_S0NDTR_OFFSET) #define STM32_DMA1_S1NDTR (STM32_DMA1_BASE+STM32_DMA_S1NDTR_OFFSET) #define STM32_DMA1_S2NDTR (STM32_DMA1_BASE+STM32_DMA_S2NDTR_OFFSET) #define STM32_DMA1_S3NDTR (STM32_DMA1_BASE+STM32_DMA_S3NDTR_OFFSET) #define STM32_DMA1_S4NDTR (STM32_DMA1_BASE+STM32_DMA_S4NDTR_OFFSET) #define STM32_DMA1_S5NDTR (STM32_DMA1_BASE+STM32_DMA_S5NDTR_OFFSET) #define STM32_DMA1_S6NDTR (STM32_DMA1_BASE+STM32_DMA_S6NDTR_OFFSET) #define STM32_DMA1_S7NDTR (STM32_DMA1_BASE+STM32_DMA_S7NDTR_OFFSET) #define STM32_DMA1_SPAR(n) (STM32_DMA1_BASE+STM32_DMA_SPAR_OFFSET+STM32_DMA_OFFSET(n)) #define STM32_DMA1_S0PAR (STM32_DMA1_BASE+STM32_DMA_S0PAR_OFFSET) #define STM32_DMA1_S1PAR (STM32_DMA1_BASE+STM32_DMA_S1PAR_OFFSET) #define STM32_DMA1_S2PAR (STM32_DMA1_BASE+STM32_DMA_S2PAR_OFFSET) #define STM32_DMA1_S3PAR (STM32_DMA1_BASE+STM32_DMA_S3PAR_OFFSET) #define STM32_DMA1_S4PAR (STM32_DMA1_BASE+STM32_DMA_S4PAR_OFFSET) #define STM32_DMA1_S5PAR (STM32_DMA1_BASE+STM32_DMA_S5PAR_OFFSET) #define STM32_DMA1_S6PAR (STM32_DMA1_BASE+STM32_DMA_S6PAR_OFFSET) #define STM32_DMA1_S7PAR (STM32_DMA1_BASE+STM32_DMA_S7PAR_OFFSET) #define STM32_DMA1_SM0AR(n) (STM32_DMA1_BASE+STM32_DMA_SM0AR_OFFSET+STM32_DMA_OFFSET(n)) #define STM32_DMA1_S0M0AR (STM32_DMA1_BASE+STM32_DMA_S0M0AR_OFFSET) #define STM32_DMA1_S1M0AR (STM32_DMA1_BASE+STM32_DMA_S1M0AR_OFFSET) #define STM32_DMA1_S2M0AR (STM32_DMA1_BASE+STM32_DMA_S2M0AR_OFFSET) #define STM32_DMA1_S3M0AR (STM32_DMA1_BASE+STM32_DMA_S3M0AR_OFFSET) #define STM32_DMA1_S4M0AR (STM32_DMA1_BASE+STM32_DMA_S4M0AR_OFFSET) #define STM32_DMA1_S5M0AR (STM32_DMA1_BASE+STM32_DMA_S5M0AR_OFFSET) #define STM32_DMA1_S6M0AR (STM32_DMA1_BASE+STM32_DMA_S6M0AR_OFFSET) #define STM32_DMA1_S7M0AR (STM32_DMA1_BASE+STM32_DMA_S7M0AR_OFFSET) #define STM32_DMA1_SM1AR(n) (STM32_DMA1_BASE+STM32_DMA_SM1AR_OFFSET+STM32_DMA_OFFSET(n)) #define STM32_DMA1_S0M1AR (STM32_DMA1_BASE+STM32_DMA_S0M1AR_OFFSET) #define STM32_DMA1_S1M1AR (STM32_DMA1_BASE+STM32_DMA_S1M1AR_OFFSET) #define STM32_DMA1_S2M1AR (STM32_DMA1_BASE+STM32_DMA_S2M1AR_OFFSET) #define STM32_DMA1_S3M1AR (STM32_DMA1_BASE+STM32_DMA_S3M1AR_OFFSET) #define STM32_DMA1_S4M1AR (STM32_DMA1_BASE+STM32_DMA_S4M1AR_OFFSET) #define STM32_DMA1_S5M1AR (STM32_DMA1_BASE+STM32_DMA_S5M1AR_OFFSET) #define STM32_DMA1_S6M1AR (STM32_DMA1_BASE+STM32_DMA_S6M1AR_OFFSET) #define STM32_DMA1_S7M1AR (STM32_DMA1_BASE+STM32_DMA_S7M1AR_OFFSET) #define STM32_DMA1_SFCR(n) (STM32_DMA1_BASE+STM32_DMA_SFCR_OFFSET+STM32_DMA_OFFSET(n)) #define STM32_DMA1_S0FCR (STM32_DMA1_BASE+STM32_DMA_S0FCR_OFFSET) #define STM32_DMA1_S1FCR (STM32_DMA1_BASE+STM32_DMA_S1FCR_OFFSET) #define STM32_DMA1_S2FCR (STM32_DMA1_BASE+STM32_DMA_S2FCR_OFFSET) #define STM32_DMA1_S3FCR (STM32_DMA1_BASE+STM32_DMA_S3FCR_OFFSET) #define STM32_DMA1_S4FCR (STM32_DMA1_BASE+STM32_DMA_S4FCR_OFFSET) #define STM32_DMA1_S5FCR (STM32_DMA1_BASE+STM32_DMA_S5FCR_OFFSET) #define STM32_DMA1_S6FCR (STM32_DMA1_BASE+STM32_DMA_S6FCR_OFFSET) #define STM32_DMA1_S7FCR (STM32_DMA1_BASE+STM32_DMA_S7FCR_OFFSET) #define STM32_DMA2_LISRC (STM32_DMA2_BASE+STM32_DMA_LISR_OFFSET) #define STM32_DMA2_HISRC (STM32_DMA2_BASE+STM32_DMA_HISR_OFFSET) #define STM32_DMA2_LIFCR (STM32_DMA2_BASE+STM32_DMA_LIFCR_OFFSET) #define STM32_DMA2_HIFCR (STM32_DMA2_BASE+STM32_DMA_HIFCR_OFFSET) #define STM32_DMA2_SCR(n) (STM32_DMA2_BASE+STM32_DMA_SCR_OFFSET+STM32_DMA_OFFSET(n)) #define STM32_DMA2_S0CR (STM32_DMA2_BASE+STM32_DMA_S0CR_OFFSET) #define STM32_DMA2_S1CR (STM32_DMA2_BASE+STM32_DMA_S1CR_OFFSET) #define STM32_DMA2_S2CR (STM32_DMA2_BASE+STM32_DMA_S2CR_OFFSET) #define STM32_DMA2_S3CR (STM32_DMA2_BASE+STM32_DMA_S3CR_OFFSET) #define STM32_DMA2_S4CR (STM32_DMA2_BASE+STM32_DMA_S4CR_OFFSET) #define STM32_DMA2_S5CR (STM32_DMA2_BASE+STM32_DMA_S5CR_OFFSET) #define STM32_DMA2_S6CR (STM32_DMA2_BASE+STM32_DMA_S6CR_OFFSET) #define STM32_DMA2_S7CR (STM32_DMA2_BASE+STM32_DMA_S7CR_OFFSET) #define STM32_DMA2_SNDTR(n) (STM32_DMA2_BASE+STM32_DMA_SNDTR_OFFSET+STM32_DMA_OFFSET(n)) #define STM32_DMA2_S0NDTR (STM32_DMA2_BASE+STM32_DMA_S0NDTR_OFFSET) #define STM32_DMA2_S1NDTR (STM32_DMA2_BASE+STM32_DMA_S1NDTR_OFFSET) #define STM32_DMA2_S2NDTR (STM32_DMA2_BASE+STM32_DMA_S2NDTR_OFFSET) #define STM32_DMA2_S3NDTR (STM32_DMA2_BASE+STM32_DMA_S3NDTR_OFFSET) #define STM32_DMA2_S4NDTR (STM32_DMA2_BASE+STM32_DMA_S4NDTR_OFFSET) #define STM32_DMA2_S5NDTR (STM32_DMA2_BASE+STM32_DMA_S5NDTR_OFFSET) #define STM32_DMA2_S6NDTR (STM32_DMA2_BASE+STM32_DMA_S6NDTR_OFFSET) #define STM32_DMA2_S7NDTR (STM32_DMA2_BASE+STM32_DMA_S7NDTR_OFFSET) #define STM32_DMA2_SPAR(n) (STM32_DMA2_BASE+STM32_DMA_SPAR_OFFSET+STM32_DMA_OFFSET(n)) #define STM32_DMA2_S0PAR (STM32_DMA2_BASE+STM32_DMA_S0PAR_OFFSET) #define STM32_DMA2_S1PAR (STM32_DMA2_BASE+STM32_DMA_S1PAR_OFFSET) #define STM32_DMA2_S2PAR (STM32_DMA2_BASE+STM32_DMA_S2PAR_OFFSET) #define STM32_DMA2_S3PAR (STM32_DMA2_BASE+STM32_DMA_S3PAR_OFFSET) #define STM32_DMA2_S4PAR (STM32_DMA2_BASE+STM32_DMA_S4PAR_OFFSET) #define STM32_DMA2_S5PAR (STM32_DMA2_BASE+STM32_DMA_S5PAR_OFFSET) #define STM32_DMA2_S6PAR (STM32_DMA2_BASE+STM32_DMA_S6PAR_OFFSET) #define STM32_DMA2_S7PAR (STM32_DMA2_BASE+STM32_DMA_S7PAR_OFFSET) #define STM32_DMA2_SM0AR(n) (STM32_DMA2_BASE+STM32_DMA_SM0AR_OFFSET+STM32_DMA_OFFSET(n)) #define STM32_DMA2_S0M0AR (STM32_DMA2_BASE+STM32_DMA_S0M0AR_OFFSET) #define STM32_DMA2_S1M0AR (STM32_DMA2_BASE+STM32_DMA_S1M0AR_OFFSET) #define STM32_DMA2_S2M0AR (STM32_DMA2_BASE+STM32_DMA_S2M0AR_OFFSET) #define STM32_DMA2_S3M0AR (STM32_DMA2_BASE+STM32_DMA_S3M0AR_OFFSET) #define STM32_DMA2_S4M0AR (STM32_DMA2_BASE+STM32_DMA_S4M0AR_OFFSET) #define STM32_DMA2_S5M0AR (STM32_DMA2_BASE+STM32_DMA_S5M0AR_OFFSET) #define STM32_DMA2_S6M0AR (STM32_DMA2_BASE+STM32_DMA_S6M0AR_OFFSET) #define STM32_DMA2_S7M0AR (STM32_DMA2_BASE+STM32_DMA_S7M0AR_OFFSET) #define STM32_DMA2_SM1AR(n) (STM32_DMA2_BASE+STM32_DMA_SM1AR_OFFSET+STM32_DMA_OFFSET(n)) #define STM32_DMA2_S0M1AR (STM32_DMA2_BASE+STM32_DMA_S0M1AR_OFFSET) #define STM32_DMA2_S1M1AR (STM32_DMA2_BASE+STM32_DMA_S1M1AR_OFFSET) #define STM32_DMA2_S2M1AR (STM32_DMA2_BASE+STM32_DMA_S2M1AR_OFFSET) #define STM32_DMA2_S3M1AR (STM32_DMA2_BASE+STM32_DMA_S3M1AR_OFFSET) #define STM32_DMA2_S4M1AR (STM32_DMA2_BASE+STM32_DMA_S4M1AR_OFFSET) #define STM32_DMA2_S5M1AR (STM32_DMA2_BASE+STM32_DMA_S5M1AR_OFFSET) #define STM32_DMA2_S6M1AR (STM32_DMA2_BASE+STM32_DMA_S6M1AR_OFFSET) #define STM32_DMA2_S7M1AR (STM32_DMA2_BASE+STM32_DMA_S7M1AR_OFFSET) #define STM32_DMA2_SFCR(n) (STM32_DMA2_BASE+STM32_DMA_SFCR_OFFSET+STM32_DMA_OFFSET(n)) #define STM32_DMA2_S0FCR (STM32_DMA2_BASE+STM32_DMA_S0FCR_OFFSET) #define STM32_DMA2_S1FCR (STM32_DMA2_BASE+STM32_DMA_S1FCR_OFFSET) #define STM32_DMA2_S2FCR (STM32_DMA2_BASE+STM32_DMA_S2FCR_OFFSET) #define STM32_DMA2_S3FCR (STM32_DMA2_BASE+STM32_DMA_S3FCR_OFFSET) #define STM32_DMA2_S4FCR (STM32_DMA2_BASE+STM32_DMA_S4FCR_OFFSET) #define STM32_DMA2_S5FCR (STM32_DMA2_BASE+STM32_DMA_S5FCR_OFFSET) #define STM32_DMA2_S6FCR (STM32_DMA2_BASE+STM32_DMA_S6FCR_OFFSET) #define STM32_DMA2_S7FCR (STM32_DMA2_BASE+STM32_DMA_S7FCR_OFFSET) /* Register Bitfield Definitions ********************************************/ #define DMA_STREAM_MASK 0x3f #define DMA_STREAM_FEIF_BIT (1 << 0) /* Bit 0: Stream FIFO error interrupt flag */ #define DMA_STREAM_DMEIF_BIT (1 << 2) /* Bit 2: Stream direct mode error interrupt flag */ #define DMA_STREAM_TEIF_BIT (1 << 3) /* Bit 3: Stream Transfer Error flag */ #define DMA_STREAM_HTIF_BIT (1 << 4) /* Bit 4: Stream Half Transfer flag */ #define DMA_STREAM_TCIF_BIT (1 << 5) /* Bit 5: Stream Transfer Complete flag */ /* DMA interrupt status register and interrupt flag clear register field * definitions */ #define DMA_INT_STREAM0_SHIFT (0) /* Bits 0-5: DMA Stream 0 interrupt */ #define DMA_INT_STREAM0_MASK (DMA_STREAM_MASK << DMA_INT_STREAM0_SHIFT) #define DMA_INT_STREAM1_SHIFT (6) /* Bits 6-11: DMA Stream 1 interrupt */ #define DMA_INT_STREAM1_MASK (DMA_STREAM_MASK << DMA_INT_STREAM1_SHIFT) #define DMA_INT_STREAM2_SHIFT (16) /* Bits 16-21: DMA Stream 2 interrupt */ #define DMA_INT_STREAM2_MASK (DMA_STREAM_MASK << DMA_INT_STREAM2_SHIFT) #define DMA_INT_STREAM3_SHIFT (22) /* Bits 22-27: DMA Stream 3 interrupt */ #define DMA_INT_STREAM3_MASK (DMA_STREAM_MASK << DMA_INT_STREAM3_SHIFT) #define DMA_INT_STREAM4_SHIFT (0) /* Bits 0-5: DMA Stream 4 interrupt */ #define DMA_INT_STREAM4_MASK (DMA_STREAM_MASK << DMA_INT_STREAM4_SHIFT) #define DMA_INT_STREAM5_SHIFT (6) /* Bits 6-11: DMA Stream 5 interrupt */ #define DMA_INT_STREAM5_MASK (DMA_STREAM_MASK << DMA_INT_STREAM5_SHIFT) #define DMA_INT_STREAM6_SHIFT (16) /* Bits 16-21: DMA Stream 6 interrupt */ #define DMA_INT_STREAM6_MASK (DMA_STREAM_MASK << DMA_INT_STREAM6_SHIFT) #define DMA_INT_STREAM7_SHIFT (22) /* Bits 22-27: DMA Stream 7 interrupt */ #define DMA_INT_STREAM7_MASK (DMA_STREAM_MASK << DMA_INT_STREAM7_SHIFT) /* DMA stream configuration register */ #define DMA_SCR_EN (1 << 0) /* Bit 0: Stream enable */ #define DMA_SCR_DMEIE (1 << 1) /* Bit 1: Direct mode error interrupt enable */ #define DMA_SCR_TEIE (1 << 2) /* Bit 2: Transfer error interrupt enable */ #define DMA_SCR_HTIE (1 << 3) /* Bit 3: Half Transfer interrupt enable */ #define DMA_SCR_TCIE (1 << 4) /* Bit 4: Transfer complete interrupt enable */ #define DMA_SCR_PFCTRL (1 << 5) /* Bit 5: Peripheral flow controller */ #define DMA_SCR_DIR_SHIFT (6) /* Bits 6-7: Data transfer direction */ #define DMA_SCR_DIR_MASK (3 << DMA_SCR_DIR_SHIFT) # define DMA_SCR_DIR_P2M (0 << DMA_SCR_DIR_SHIFT) /* 00: Peripheral-to-memory */ # define DMA_SCR_DIR_M2P (1 << DMA_SCR_DIR_SHIFT) /* 01: Memory-to-peripheral */ # define DMA_SCR_DIR_M2M (2 << DMA_SCR_DIR_SHIFT) /* 10: Memory-to-memory */ #define DMA_SCR_CIRC (1 << 8) /* Bit 8: Circular mode */ #define DMA_SCR_PINC (1 << 9) /* Bit 9: Peripheral increment mode */ #define DMA_SCR_MINC (1 << 10) /* Bit 10: Memory increment mode */ #define DMA_SCR_PSIZE_SHIFT (11) /* Bits 11-12: Peripheral size */ #define DMA_SCR_PSIZE_MASK (3 << DMA_SCR_PSIZE_SHIFT) # define DMA_SCR_PSIZE_8BITS (0 << DMA_SCR_PSIZE_SHIFT) /* 00: 8-bits */ # define DMA_SCR_PSIZE_16BITS (1 << DMA_SCR_PSIZE_SHIFT) /* 01: 16-bits */ # define DMA_SCR_PSIZE_32BITS (2 << DMA_SCR_PSIZE_SHIFT) /* 10: 32-bits */ #define DMA_SCR_MSIZE_SHIFT (13) /* Bits 13-14: Memory size */ #define DMA_SCR_MSIZE_MASK (3 << DMA_SCR_MSIZE_SHIFT) # define DMA_SCR_MSIZE_8BITS (0 << DMA_SCR_MSIZE_SHIFT) /* 00: 8-bits */ # define DMA_SCR_MSIZE_16BITS (1 << DMA_SCR_MSIZE_SHIFT) /* 01: 16-bits */ # define DMA_SCR_MSIZE_32BITS (2 << DMA_SCR_MSIZE_SHIFT) /* 10: 32-bits */ #define DMA_SCR_PINCOS (1 << 15) /* Bit 15: Peripheral increment offset size */ #define DMA_SCR_PL_SHIFT (16) /* Bits 16-17: Stream Priority level */ #define DMA_SCR_PL_MASK (3 << DMA_SCR_PL_SHIFT) # define DMA_SCR_PRILO (0 << DMA_SCR_PL_SHIFT) /* 00: Low */ # define DMA_SCR_PRIMED (1 << DMA_SCR_PL_SHIFT) /* 01: Medium */ # define DMA_SCR_PRIHI (2 << DMA_SCR_PL_SHIFT) /* 10: High */ # define DMA_SCR_PRIVERYHI (3 << DMA_SCR_PL_SHIFT) /* 11: Very high */ #define DMA_SCR_DBM (1 << 18) /* Bit 15: Double buffer mode */ #define DMA_SCR_CT (1 << 19) /* Bit 19: Current target */ #define DMA_SCR_PBURST_SHIFT (21) /* Bits 21-22: Peripheral burst transfer configuration */ #define DMA_SCR_PBURST_MASK (3 << DMA_SCR_PBURST_SHIFT) # define DMA_SCR_PBURST_SINGLE (0 << DMA_SCR_PBURST_SHIFT) /* 00: Single transfer */ # define DMA_SCR_PBURST_INCR4 (1 << DMA_SCR_PBURST_SHIFT) /* 01: Incremental burst of 4 beats */ # define DMA_SCR_PBURST_INCR8 (2 << DMA_SCR_PBURST_SHIFT) /* 10: Incremental burst of 8 beats */ # define DMA_SCR_PBURST_INCR16 (3 << DMA_SCR_PBURST_SHIFT) /* 11: Incremental burst of 16 beats */ #define DMA_SCR_MBURST_SHIFT (23) /* Bits 23-24: Memory burst transfer configuration */ #define DMA_SCR_MBURST_MASK (3 << DMA_SCR_MBURST_SHIFT) # define DMA_SCR_MBURST_SINGLE (0 << DMA_SCR_MBURST_SHIFT) /* 00: Single transfer */ # define DMA_SCR_MBURST_INCR4 (1 << DMA_SCR_MBURST_SHIFT) /* 01: Incremental burst of 4 beats */ # define DMA_SCR_MBURST_INCR8 (2 << DMA_SCR_MBURST_SHIFT) /* 10: Incremental burst of 8 beats */ # define DMA_SCR_MBURST_INCR16 (3 << DMA_SCR_MBURST_SHIFT) /* 11: Incremental burst of 16 beats */ #define DMA_SCR_CHSEL_SHIFT (25) /* Bits 25-27: Channel selection */ #define DMA_SCR_CHSEL_MASK (7 << DMA_SCR_CHSEL_SHIFT) # define DMA_SCR_CHSEL(n) ((n) << DMA_SCR_CHSEL_SHIFT) #define DMA_SCR_ALLINTS (DMA_SCR_DMEIE|DMA_SCR_TEIE|DMA_SCR_HTIE|DMA_SCR_TCIE) /* DMA stream number of data register */ #define DMA_SNDTR_NDT_SHIFT (0) /* Bits 15-0: Number of data to Transfer */ #define DMA_SNDTR_NDT_MASK (0xffff << DMA_SNDTR_NDT_SHIFT) /* DMA stream n FIFO control register */ #define DMA_SFCR_FTH_SHIFT (0) /* Bits 0-1: FIFO threshold selection */ #define DMA_SFCR_FTH_MASK (3 << DMA_SFCR_FTH_SHIFT) # define DMA_SFCR_FTH_QUARTER (0 << DMA_SFCR_FTH_SHIFT) /* 1/4 full FIFO */ # define DMA_SFCR_FTH_HALF (1 << DMA_SFCR_FTH_SHIFT) /* 1/2 full FIFO */ # define DMA_SFCR_FTH_3QUARTER (2 << DMA_SFCR_FTH_SHIFT) /* 3/4 full FIFO */ # define DMA_SFCR_FTH_FULL (3 << DMA_SFCR_FTH_SHIFT) /* full FIFO */ #define DMA_SFCR_DMDIS (1 << 2) /* Bit 2: Direct mode disable */ #define DMA_SFCR_FS_SHIFT (3) /* Bits 3-5: FIFO status */ #define DMA_SFCR_FS_MASK (7 << DMA_SFCR_FS_SHIFT) # define DMA_SFCR_FS_QUARTER (0 << DMA_SFCR_FS_SHIFT) /* 0 < fifo_level < 1/4 */ # define DMA_SFCR_FS_HALF (1 << DMA_SFCR_FS_SHIFT) /* 1/4 = fifo_level < 1/2 */ # define DMA_SFCR_FS_3QUARTER (2 << DMA_SFCR_FS_SHIFT) /* 1/2 = fifo_level < 3/4 */ # define DMA_SFCR_FS_ALMOSTFULL (3 << DMA_SFCR_FS_SHIFT) /* 3/4 = fifo_level < full */ # define DMA_SFCR_FS_EMPTY (4 << DMA_SFCR_FS_SHIFT) /* FIFO is empty */ # define DMA_SFCR_FS_FULL (5 << DMA_SFCR_FS_SHIFT) /* FIFO is full */ /* Bit 6: Reserved */ #define DMA_SFCR_FEIE (1 << 7) /* Bit 7: FIFO error interrupt enable */ /* Bits 8-31: Reserved */ /* DMA Stream mapping. * Each DMA stream has a mapping to several possible sources/sinks of data. * The requests from peripherals assigned to a stream are simply OR'ed * together before entering the DMA block. This means that only one request * on a given stream can be enabled at once. * * Alternative stream selections are provided with a numeric suffix like _1, * _2, etc. The DMA driver, however, will use the pin selection without the * numeric suffix. Additional definitions are required in the board.h file. * For example, if SPI3_RX connects via DMA STREAM0, then following should * be application-specific mapping should be used: * * #define DMAMAP_SPI3_RX DMAMAP_SPI3_RX_1 */ #define STM32_DMA_MAP(d,s,c) ((d) << 7 | (s) << 4 | (c)) #define STM32_DMA_CONTROLLER(m) (((m) >> 7) & 1) #define STM32_DMA_STREAM(m) (((m) >> 4) & 7) #define STM32_DMA_CHANNEL(m) ((m) & 15) #define DMAMAP_SPI3_RX_1 STM32_DMA_MAP(DMA1,DMA_STREAM0,DMA_CHAN0) #define DMAMAP_SPI3_RX_2 STM32_DMA_MAP(DMA1,DMA_STREAM2,DMA_CHAN0) #define DMAMAP_SPI2_RX STM32_DMA_MAP(DMA1,DMA_STREAM3,DMA_CHAN0) #define DMAMAP_SPI2_TX STM32_DMA_MAP(DMA1,DMA_STREAM4,DMA_CHAN0) #define DMAMAP_SPI3_TX_1 STM32_DMA_MAP(DMA1,DMA_STREAM5,DMA_CHAN0) #define DMAMAP_SPI3_TX_2 STM32_DMA_MAP(DMA1,DMA_STREAM7,DMA_CHAN0) #define DMAMAP_I2C1_RX STM32_DMA_MAP(DMA1,DMA_STREAM0,DMA_CHAN1) #define DMAMAP_I2C3_RX_1 STM32_DMA_MAP(DMA1,DMA_STREAM1,DMA_CHAN1) #define DMAMAP_TIM7_UP_1 STM32_DMA_MAP(DMA1,DMA_STREAM2,DMA_CHAN1) #define DMAMAP_TIM7_UP_2 STM32_DMA_MAP(DMA1,DMA_STREAM4,DMA_CHAN1) #define DMAMAP_I2C1_RX_1 STM32_DMA_MAP(DMA1,DMA_STREAM5,DMA_CHAN1) #define DMAMAP_I2C1_TX_1 STM32_DMA_MAP(DMA1,DMA_STREAM6,DMA_CHAN1) #define DMAMAP_I2C1_TX_2 STM32_DMA_MAP(DMA1,DMA_STREAM7,DMA_CHAN1) #define DMAMAP_TIM4_CH1 STM32_DMA_MAP(DMA1,DMA_STREAM0,DMA_CHAN2) #define DMAMAP_TIM4_CH2 STM32_DMA_MAP(DMA1,DMA_STREAM3,DMA_CHAN2) #define DMAMAP_TIM4_UP STM32_DMA_MAP(DMA1,DMA_STREAM6,DMA_CHAN2) #define DMAMAP_TIM4_CH3 STM32_DMA_MAP(DMA1,DMA_STREAM7,DMA_CHAN2) #define DMAMAP_TIM2_UP_1 STM32_DMA_MAP(DMA1,DMA_STREAM1,DMA_CHAN3) #define DMAMAP_TIM2_CH3 STM32_DMA_MAP(DMA1,DMA_STREAM1,DMA_CHAN3) #define DMAMAP_I2C3_RX_2 STM32_DMA_MAP(DMA1,DMA_STREAM2,DMA_CHAN3) #define DMAMAP_I2C3_TX STM32_DMA_MAP(DMA1,DMA_STREAM4,DMA_CHAN3) #define DMAMAP_TIM2_CH1 STM32_DMA_MAP(DMA1,DMA_STREAM5,DMA_CHAN3) #define DMAMAP_TIM2_CH2 STM32_DMA_MAP(DMA1,DMA_STREAM6,DMA_CHAN3) #define DMAMAP_TIM2_CH4_1 STM32_DMA_MAP(DMA1,DMA_STREAM6,DMA_CHAN3) #define DMAMAP_TIM2_UP_2 STM32_DMA_MAP(DMA1,DMA_STREAM7,DMA_CHAN3) #define DMAMAP_TIM2_CH4_2 STM32_DMA_MAP(DMA1,DMA_STREAM7,DMA_CHAN3) #define DMAMAP_UART5_RX STM32_DMA_MAP(DMA1,DMA_STREAM0,DMA_CHAN4) #define DMAMAP_USART3_RX STM32_DMA_MAP(DMA1,DMA_STREAM1,DMA_CHAN4) #define DMAMAP_UART4_RX STM32_DMA_MAP(DMA1,DMA_STREAM2,DMA_CHAN4) #define DMAMAP_USART3_TX_1 STM32_DMA_MAP(DMA1,DMA_STREAM3,DMA_CHAN4) #define DMAMAP_UART4_TX STM32_DMA_MAP(DMA1,DMA_STREAM4,DMA_CHAN4) #define DMAMAP_USART2_RX STM32_DMA_MAP(DMA1,DMA_STREAM5,DMA_CHAN4) #define DMAMAP_USART2_TX STM32_DMA_MAP(DMA1,DMA_STREAM6,DMA_CHAN4) #define DMAMAP_UART5_TX STM32_DMA_MAP(DMA1,DMA_STREAM7,DMA_CHAN4) #define DMAMAP_UART8_TX STM32_DMA_MAP(DMA1,DMA_STREAM0,DMA_CHAN5) #define DMAMAP_UART7_TX STM32_DMA_MAP(DMA1,DMA_STREAM1,DMA_CHAN5) #define DMAMAP_TIM3_CH4 STM32_DMA_MAP(DMA1,DMA_STREAM2,DMA_CHAN5) #define DMAMAP_TIM3_UP STM32_DMA_MAP(DMA1,DMA_STREAM2,DMA_CHAN5) #define DMAMAP_UART7_RX STM32_DMA_MAP(DMA1,DMA_STREAM3,DMA_CHAN5) #define DMAMAP_TIM3_CH1 STM32_DMA_MAP(DMA1,DMA_STREAM4,DMA_CHAN5) #define DMAMAP_TIM3_TRIG STM32_DMA_MAP(DMA1,DMA_STREAM4,DMA_CHAN5) #define DMAMAP_TIM3_CH2 STM32_DMA_MAP(DMA1,DMA_STREAM5,DMA_CHAN5) #define DMAMAP_UART8_RX STM32_DMA_MAP(DMA1,DMA_STREAM6,DMA_CHAN5) #define DMAMAP_TIM3_CH3 STM32_DMA_MAP(DMA1,DMA_STREAM7,DMA_CHAN5) #define DMAMAP_TIM5_CH3 STM32_DMA_MAP(DMA1,DMA_STREAM0,DMA_CHAN6) #define DMAMAP_TIM5_UP_1 STM32_DMA_MAP(DMA1,DMA_STREAM0,DMA_CHAN6) #define DMAMAP_TIM5_CH4_1 STM32_DMA_MAP(DMA1,DMA_STREAM1,DMA_CHAN6) #define DMAMAP_TIM5_TRIG_1 STM32_DMA_MAP(DMA1,DMA_STREAM1,DMA_CHAN6) #define DMAMAP_TIM5_CH1 STM32_DMA_MAP(DMA1,DMA_STREAM2,DMA_CHAN6) #define DMAMAP_TIM5_CH4_2 STM32_DMA_MAP(DMA1,DMA_STREAM3,DMA_CHAN6) #define DMAMAP_TIM5_TRIG_2 STM32_DMA_MAP(DMA1,DMA_STREAM3,DMA_CHAN6) #define DMAMAP_TIM5_CH2 STM32_DMA_MAP(DMA1,DMA_STREAM4,DMA_CHAN6) #define DMAMAP_TIM5_UP_2 STM32_DMA_MAP(DMA1,DMA_STREAM6,DMA_CHAN6) #define DMAMAP_TIM6_UP STM32_DMA_MAP(DMA1,DMA_STREAM1,DMA_CHAN7) #define DMAMAP_I2C2_RX_1 STM32_DMA_MAP(DMA1,DMA_STREAM2,DMA_CHAN7) #define DMAMAP_I2C2_RX_2 STM32_DMA_MAP(DMA1,DMA_STREAM3,DMA_CHAN7) #define DMAMAP_USART3_TX_2 STM32_DMA_MAP(DMA1,DMA_STREAM4,DMA_CHAN7) #define DMAMAP_DAC1 STM32_DMA_MAP(DMA1,DMA_STREAM5,DMA_CHAN7) #define DMAMAP_DAC2 STM32_DMA_MAP(DMA1,DMA_STREAM6,DMA_CHAN7) #define DMAMAP_I2C2_TX STM32_DMA_MAP(DMA1,DMA_STREAM7,DMA_CHAN7) #define DMAMAP_ADC1_1 STM32_DMA_MAP(DMA2,DMA_STREAM0,DMA_CHAN0) #define DMAMAP_SAI1_A_1 STM32_DMA_MAP(DMA2,DMA_STREAM1,DMA_CHAN0) #define DMAMAP_TIM8_CH1_1 STM32_DMA_MAP(DMA2,DMA_STREAM2,DMA_CHAN0) #define DMAMAP_TIM8_CH2_1 STM32_DMA_MAP(DMA2,DMA_STREAM2,DMA_CHAN0) #define DMAMAP_TIM8_CH3_1 STM32_DMA_MAP(DMA2,DMA_STREAM2,DMA_CHAN0) #define DMAMAP_SAI1_A_2 STM32_DMA_MAP(DMA2,DMA_STREAM3,DMA_CHAN0) #define DMAMAP_ADC1_2 STM32_DMA_MAP(DMA2,DMA_STREAM4,DMA_CHAN0) #define DMAMAP_SAI1_B_1 STM32_DMA_MAP(DMA2,DMA_STREAM5,DMA_CHAN0) #define DMAMAP_TIM1_CH1_1 STM32_DMA_MAP(DMA2,DMA_STREAM6,DMA_CHAN0) #define DMAMAP_TIM1_CH2_1 STM32_DMA_MAP(DMA2,DMA_STREAM6,DMA_CHAN0) #define DMAMAP_TIM1_CH3_1 STM32_DMA_MAP(DMA2,DMA_STREAM6,DMA_CHAN0) #define DMAMAP_SAI1_B_2 STM32_DMA_MAP(DMA2,DMA_STREAM7,DMA_CHAN0) #define DMAMAP_ADC2_1 STM32_DMA_MAP(DMA2,DMA_STREAM2,DMA_CHAN1) #define DMAMAP_ADC2_2 STM32_DMA_MAP(DMA2,DMA_STREAM3,DMA_CHAN1) #define DMAMAP_SAI1_B STM32_DMA_MAP(DMA2,DMA_STREAM4,DMA_CHAN1) #define DMAMAP_ADC3_1 STM32_DMA_MAP(DMA2,DMA_STREAM0,DMA_CHAN2) #define DMAMAP_ADC3_2 STM32_DMA_MAP(DMA2,DMA_STREAM1,DMA_CHAN2) #define DMAMAP_SPI5_RX_1 STM32_DMA_MAP(DMA2,DMA_STREAM3,DMA_CHAN2) #define DMAMAP_SPI5_TX_1 STM32_DMA_MAP(DMA2,DMA_STREAM4,DMA_CHAN2) #define DMAMAP_CRYP_OUT STM32_DMA_MAP(DMA2,DMA_STREAM5,DMA_CHAN2) #define DMAMAP_CRYP_IN STM32_DMA_MAP(DMA2,DMA_STREAM6,DMA_CHAN2) #define DMAMAP_SPI1_RX_1 STM32_DMA_MAP(DMA2,DMA_STREAM0,DMA_CHAN3) #define DMAMAP_SPI1_RX_2 STM32_DMA_MAP(DMA2,DMA_STREAM2,DMA_CHAN3) #define DMAMAP_SPI1_TX_1 STM32_DMA_MAP(DMA2,DMA_STREAM3,DMA_CHAN3) #define DMAMAP_SAI2_A STM32_DMA_MAP(DMA2,DMA_STREAM4,DMA_CHAN3) #define DMAMAP_SPI1_TX_2 STM32_DMA_MAP(DMA2,DMA_STREAM5,DMA_CHAN3) #define DMAMAP_SAI2_B STM32_DMA_MAP(DMA2,DMA_STREAM6,DMA_CHAN3) #define DMAMAP_QUADSPI STM32_DMA_MAP(DMA2,DMA_STREAM7,DMA_CHAN3) #define DMAMAP_SPI4_RX_1 STM32_DMA_MAP(DMA2,DMA_STREAM0,DMA_CHAN4) #define DMAMAP_SPI4_TX_1 STM32_DMA_MAP(DMA2,DMA_STREAM1,DMA_CHAN4) #define DMAMAP_USART1_RX_1 STM32_DMA_MAP(DMA2,DMA_STREAM2,DMA_CHAN4) #define DMAMAP_SDMMC1_1 STM32_DMA_MAP(DMA2,DMA_STREAM3,DMA_CHAN4) #define DMAMAP_USART1_RX_2 STM32_DMA_MAP(DMA2,DMA_STREAM5,DMA_CHAN4) #define DMAMAP_SDMMC1_2 STM32_DMA_MAP(DMA2,DMA_STREAM6,DMA_CHAN4) #define DMAMAP_USART1_TX STM32_DMA_MAP(DMA2,DMA_STREAM7,DMA_CHAN4) #define DMAMAP_USART6_RX_1 STM32_DMA_MAP(DMA2,DMA_STREAM1,DMA_CHAN5) #define DMAMAP_USART6_RX_2 STM32_DMA_MAP(DMA2,DMA_STREAM2,DMA_CHAN5) #define DMAMAP_SPI4_RX_2 STM32_DMA_MAP(DMA2,DMA_STREAM3,DMA_CHAN5) #define DMAMAP_SPI4_TX_2 STM32_DMA_MAP(DMA2,DMA_STREAM4,DMA_CHAN5) #define DMAMAP_USART6_TX_1 STM32_DMA_MAP(DMA2,DMA_STREAM6,DMA_CHAN5) #define DMAMAP_USART6_TX_2 STM32_DMA_MAP(DMA2,DMA_STREAM7,DMA_CHAN5) #define DMAMAP_TIM1_TRIG_1 STM32_DMA_MAP(DMA2,DMA_STREAM0,DMA_CHAN6) #define DMAMAP_TIM1_CH1_2 STM32_DMA_MAP(DMA2,DMA_STREAM1,DMA_CHAN6) #define DMAMAP_TIM1_CH2_2 STM32_DMA_MAP(DMA2,DMA_STREAM2,DMA_CHAN6) #define DMAMAP_TIM1_CH1 STM32_DMA_MAP(DMA2,DMA_STREAM3,DMA_CHAN6) #define DMAMAP_TIM1_CH4 STM32_DMA_MAP(DMA2,DMA_STREAM4,DMA_CHAN6) #define DMAMAP_TIM1_TRIG_2 STM32_DMA_MAP(DMA2,DMA_STREAM4,DMA_CHAN6) #define DMAMAP_TIM1_COM STM32_DMA_MAP(DMA2,DMA_STREAM4,DMA_CHAN6) #define DMAMAP_TIM1_UP STM32_DMA_MAP(DMA2,DMA_STREAM5,DMA_CHAN6) #define DMAMAP_TIM1_CH3_2 STM32_DMA_MAP(DMA2,DMA_STREAM6,DMA_CHAN6) #define DMAMAP_TIM8_UP STM32_DMA_MAP(DMA2,DMA_STREAM1,DMA_CHAN7) #define DMAMAP_TIM8_CH1_2 STM32_DMA_MAP(DMA2,DMA_STREAM2,DMA_CHAN7) #define DMAMAP_TIM8_CH2_2 STM32_DMA_MAP(DMA2,DMA_STREAM3,DMA_CHAN7) #define DMAMAP_TIM8_CH3_2 STM32_DMA_MAP(DMA2,DMA_STREAM4,DMA_CHAN7) #define DMAMAP_SPI5_RX_2 STM32_DMA_MAP(DMA2,DMA_STREAM5,DMA_CHAN7) #define DMAMAP_SPI5_TX_2 STM32_DMA_MAP(DMA2,DMA_STREAM6,DMA_CHAN7) #define DMAMAP_TIM8_CH4 STM32_DMA_MAP(DMA2,DMA_STREAM7,DMA_CHAN7) #define DMAMAP_TIM8_TRIG STM32_DMA_MAP(DMA2,DMA_STREAM7,DMA_CHAN7) #define DMAMAP_TIM8_COM STM32_DMA_MAP(DMA2,DMA_STREAM7,DMA_CHAN7) #define DMAMAP_SDMMC2_1 STM32_DMA_MAP(DMA2,DMA_STREAM0,DMA_CHAN11) #define DMAMAP_SDMMC2_2 STM32_DMA_MAP(DMA2,DMA_STREAM5,DMA_CHAN11) #endif /* CONFIG_STM32F7_STM32F72XX || CONFIG_STM32F7_STM32F73XX */ #endif /* __ARCH_ARM_SRC_STM32F7_HARDWARE_STM32F72XX73XX_DMA_H */
d29b6aee76990f8e98793cf0241a0e920c9a13ad
b452bbb87214f174122f425f6f98f4c3890c3cca
/internal/ccall/xdot.c
2edd961d26ee12561568a8f35d918ad399a58c2a
[ "MIT" ]
permissive
goccy/go-graphviz
bea9bc86b42734aff7ffae283aeae71702ca588a
865af036ddbb745c4424bbd2fdaa9a75668cf0d4
refs/heads/master
2023-07-20T08:05:39.868377
2023-03-21T23:49:44
2023-03-21T23:49:44
236,740,615
511
66
MIT
2023-07-07T13:53:28
2020-01-28T13:24:09
Go
UTF-8
C
false
false
23
c
xdot.c
#include "xdot/xdot.c"
c08fc7eb0ce70c9bc9674dd4be715300d9a33cf8
fdbb74a95924e2677466614f6ab6e2bb13b2a95a
/dsp/scale/magikarp.c
50b65a63d32d93f7e1d0de4605f0206d7b2aa645
[ "ISC" ]
permissive
jart/cosmopolitan
fb11b5658939023977060a7c6c71a74093d9cb44
0d748ad58e1063dd1f8560f18a0c75293b9415b7
refs/heads/master
2023-09-06T09:17:29.303607
2023-09-02T03:49:13
2023-09-02T03:50:18
272,457,606
11,887
435
ISC
2023-09-14T17:47:58
2020-06-15T14:16:13
C
UTF-8
C
false
false
5,450
c
magikarp.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞══════════════════════════════════════════════════════════════════════════════╡ │ Copyright 2020 Justine Alexandra Roberts Tunney │ │ │ │ Permission to use, copy, modify, and/or distribute this software for │ │ any purpose with or without fee is hereby granted, provided that the │ │ above copyright notice and this permission notice appear in all copies. │ │ │ │ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ │ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ │ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ │ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ │ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ │ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "dsp/core/half.h" #include "dsp/core/ks8.h" #include "dsp/core/kss8.h" #include "dsp/scale/cdecimate2xuint8x8.h" #include "libc/macros.internal.h" #include "libc/nexgen32e/x86feature.h" #include "libc/str/str.h" #include "libc/x/x.h" /** * @fileoverview Magikarp resizes graphics in half very fast. * @note H/T John Costella, Facebook, and Photoshop * @note sharpening is good for luma but not chroma * @see Gyarados */ #define CLAMP(X) MIN(255, MAX(0, X)) #define MAGIKARP(...) \ CLAMP(KS8(5, K[0], K[1], K[2], K[3], K[4], K[5], K[6], K[7], __VA_ARGS__)) signed char g_magikarp[8]; const signed char kMagikarp[8][8] = { {-1, -1, 3, 15, 15, 3, -1, -1}, // magic kernel sharp {-1, -3, 6, 28, 6, -3, -1, 0}, // {0, 0, -11, 53, -11, 0, 0, 0}, // {-2, -6, 2, 22, 22, 2, -6, -2}, // {-3, -9, 1, 27, 27, 1, -9, -3}, // }; signed char g_magkern[8]; const signed char kMagkern[8][8] = { {1, 2, 3, 10, 10, 3, 2, 1}, {0, 4, 4, 16, 4, 4, 0, 0}, {0, 1, 2, 6, 14, 6, 2, 1}, {0, 1, 2, 13, 13, 2, 1, 0}, }; void *Magikarp2xX(long ys, long xs, unsigned char p[ys][xs], long yn, long xn) { long y; if (yn && xn > 1) { for (y = 0; y < yn; ++y) { /* gcc/clang both struggle with left-to-right matrix ops */ cDecimate2xUint8x8(xn, p[y], g_magikarp); } } return p; } void *Magikarp2xY(long ys, long xs, unsigned char p[ys][xs], long yn, long xn) { long y, x, h; signed char K[8]; memcpy(K, g_magikarp, sizeof(K)); for (h = HALF(yn), y = 0; y < h; ++y) { for (x = 0; x < xn; ++x) { p[y][x] = /* gcc/clang are good at optimizing top-to-bottom matrix ops */ MAGIKARP(p[MAX(00 + 0, y * 2 - 3)][x], p[MAX(00 + 0, y * 2 - 2)][x], p[MAX(00 + 0, y * 2 - 1)][x], p[MIN(yn - 1, y * 2 + 0)][x], p[MIN(yn - 1, y * 2 + 1)][x], p[MIN(yn - 1, y * 2 + 2)][x], p[MIN(yn - 1, y * 2 + 3)][x], p[MIN(yn - 1, y * 2 + 4)][x]); } } return p; } void *Magkern2xX(long ys, long xs, unsigned char p[ys][xs], long yn, long xn) { long y; if (yn && xn > 1) { for (y = 0; y < yn; ++y) { cDecimate2xUint8x8(xn, p[y], g_magkern); } } return p; } void *Magkern2xY(long ys, long xs, unsigned char p[ys][xs], long yn, long xn) { long y, x, h; signed char K[8]; memcpy(K, g_magkern, sizeof(K)); for (h = HALF(yn), y = 0; y < h; ++y) { for (x = 0; x < xn; ++x) { p[y][x] = MAGIKARP(p[MAX(00 + 0, y * 2 - 3)][x], p[MAX(00 + 0, y * 2 - 2)][x], p[MAX(00 + 0, y * 2 - 1)][x], p[MIN(yn - 1, y * 2 + 0)][x], p[MIN(yn - 1, y * 2 + 1)][x], p[MIN(yn - 1, y * 2 + 2)][x], p[MIN(yn - 1, y * 2 + 3)][x], p[MIN(yn - 1, y * 2 + 4)][x]); } } return p; } void *MagikarpY(long dys, long dxs, unsigned char d[restrict dys][dxs], long sys, long sxs, const unsigned char s[sys][sxs], long yn, long xn, const signed char K[8]) { long y, x; for (y = 0; y < yn; ++y) { for (x = 0; x < xn; ++x) { d[y][x] = MAGIKARP(s[MAX(00 + 0, y - 3)][x], s[MAX(00 + 0, y - 2)][x], s[MAX(00 + 0, y - 1)][x], s[MIN(yn - 1, y + 0)][x], s[MIN(yn - 1, y + 1)][x], s[MIN(yn - 1, y + 2)][x], s[MIN(yn - 1, y + 3)][x], s[MIN(yn - 1, y + 4)][x]); } } return d; } static textstartup void g_magikarp_init() { memcpy(g_magkern, kMagkern[0], sizeof(g_magkern)); memcpy(g_magikarp, kMagikarp[0], sizeof(g_magikarp)); } const void *const g_magikarp_ctor[] initarray = {g_magikarp_init};
36ad20a019bce0099b9d77334065a0627059b37a
1577e1cf4e89584a125cffb855ca50a9654c6d55
/libplatform/src/atomics/x86_64/OSAtomicFifo.c
cc36f6643e4bfcc6e6c8634459270d79f65198d8
[ "Apache-2.0" ]
permissive
apple-open-source/macos
a4188b5c2ef113d90281d03cd1b14e5ee52ebffb
2d2b15f13487673de33297e49f00ef94af743a9a
refs/heads/master
2023-08-01T11:03:26.870408
2023-03-27T00:00:00
2023-03-27T00:00:00
180,595,052
124
24
null
2022-12-27T14:54:09
2019-04-10T14:06:23
null
UTF-8
C
false
false
2,083
c
OSAtomicFifo.c
#include <libkern/OSAtomic.h> #include <System/i386/cpu_capabilities.h> #define OS_UNFAIR_LOCK_INLINE 1 #include "os/lock_private.h" typedef volatile struct { void *first; void *last; os_unfair_lock lock; } __attribute__ ((aligned (16))) UnfairFifoQueueHead; #define set_next(element, offset, new) \ *((void**)(((uintptr_t)element) + offset)) = new; #define get_next(element, offset) \ *((void**)(((uintptr_t)element) + offset)); // This is a naive implementation using unfair locks to support translated // x86_64 apps only. Native x86_64 and arm64 apps will use the // PFZ implementations void OSAtomicFifoEnqueue$VARIANT$UnfairLock(UnfairFifoQueueHead *list, void *new, size_t offset) { set_next(new, offset, NULL); os_unfair_lock_lock_inline((os_unfair_lock_t)&list->lock); if (list->last == NULL) { list->first = new; } else { set_next(list->last, offset, new); } list->last = new; os_unfair_lock_unlock_inline((os_unfair_lock_t)&list->lock); } void* OSAtomicFifoDequeue$VARIANT$UnfairLock(UnfairFifoQueueHead *list, size_t offset) { os_unfair_lock_lock_inline((os_unfair_lock_t)&list->lock); void *element = list->first; if (element != NULL) { void *next = get_next(element, offset); if (next == NULL) { list->last = NULL; } list->first = next; } os_unfair_lock_unlock_inline((os_unfair_lock_t)&list->lock); return element; } #define MakeResolver(name) \ void * name ## Resolver(void) __asm__("_" #name); \ void * name ## Resolver(void) { \ __asm__(".symbol_resolver _" #name); \ uint64_t capabilities = *(uint64_t*)_COMM_PAGE_CPU_CAPABILITIES64; \ if (capabilities & kIsTranslated) { \ return name ## $VARIANT$UnfairLock; \ } else { \ return name ## $VARIANT$PFZ; \ } \ } void OSAtomicFifoEnqueue$VARIANT$PFZ(OSFifoQueueHead *, void *, size_t); void* OSAtomicFifoDequeue$VARIANT$PFZ(OSFifoQueueHead *, size_t); MakeResolver(OSAtomicFifoEnqueue) MakeResolver(OSAtomicFifoDequeue)
55d267402b0a98ac3bf824a8f1b848bfe1c7a055
6f7788d4d4291021c4d01d845984db689c572632
/IDA_files/D300S/D300S_ptp.idc
4e3d1be4b626fccd41a1cbc658731cf74bc12b17
[]
no_license
simeonpilgrim/nikon-firmware-tools
f56de1d4f15b617a818c8c9eda1877d44b816354
2d63d451efb1457baeaa5be2368ff3123a652dd1
refs/heads/master
2023-04-04T12:06:46.828391
2023-03-28T02:26:43
2023-03-28T02:26:43
32,547,047
153
34
null
2022-12-18T03:47:31
2015-03-19T21:25:26
Java
UTF-8
C
false
false
1,604
idc
D300S_ptp.idc
#include <idc.idc> static PtpEntryA(loc) { auto w; auto s1, s2; auto id; auto id_str,get_str,set_str; w = Dword(loc); s1 = Dword(loc+4); s2 = Dword(loc+8); id = Byte(w)+(Byte(w+1)<<8); id_str = sprintf("ptp_%4X", id); get_str = sprintf("ptpGet_%4X", id); set_str = sprintf("ptpSet_%4X", id); OpOff(loc, 0, 0); OpOff(loc+4, 0, 0); OpOff(loc+8, 0, 0); MakeWord(w); MakeNameEx(w,id_str,0); if( s1 != 0 ) { MakeCode(s1); MakeNameEx(s1,set_str,0); } if( s2 != 0 ) { MakeCode(s2); MakeNameEx(s2,get_str,0); } Message("Ptp %x %x %s %s %s\n", loc, id, id_str, get_str, set_str); } static PtpFixA(start, end) { auto ea; ea= start; while( ea != BADADDR && ea < end ) { PtpEntryA(ea); ea = ea +12; } } static PtpEntryB(loc) { auto w; auto s; auto fun_str; w = Word(loc); s = Dword(loc+4); fun_str = sprintf("ptp_0C_%4X", w); MakeDword(loc); OpOff(loc+4, 0, 0); if( s != 0 ) { MakeCode(s); MakeNameEx(s,fun_str,0); } Message("Ptp %x %x %s\n", loc, w, fun_str); } static PtpFixB(start, end, tab) { auto ea; auto str; str = sprintf("ptp_%s_tab", tab); MakeNameEx(start,str,0); ea= start; while( ea != BADADDR && ea < end ) { PtpEntryB(ea); ea = ea +8; } } static main() { // PTP D300S PtpFixA(0x2024C8, 0x2025AC); // 5xxx table PtpFixA(0x2025AC, 0x202EDC); // Dxxx table PtpFixB(0x2014B8, 0x2014D0, "91xx"); PtpFixB(0x2014D0, 0x2014F8, "98xx"); PtpFixB(0x2014F8, 0x2015A8, "92xx"); PtpFixB(0x2015A8, 0x201648, "10xx"); PtpFixB(0x201B28, 0x201D50, "Fxxx"); Message("Lang Fix: Done\n"); }
c4ebe793a470e65e897cb9ceafe7fe96fe17393e
ec6a71b57ebe88538269197fd16bede6bc2062ae
/erts/emulator/beam/emu/float_instrs.tab
500a647d2b75dee30be052d0a8717939ba8af1c9
[ "Apache-2.0" ]
permissive
erlang/otp
7c6e88ca955bd6a3ede1530154c80e8ce449a370
334589af62a8db25a81afba2ecc50f33ff69ddb8
refs/heads/master
2023-08-30T23:37:28.061328
2023-08-30T04:20:48
2023-08-30T04:20:48
374,927
9,920
3,018
Apache-2.0
2023-09-14T10:37:26
2009-11-16T17:17:57
Erlang
UTF-8
C
false
false
1,905
tab
float_instrs.tab
// -*- c -*- // // %CopyrightBegin% // // Copyright Ericsson AB 2017-2023. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // %CopyrightEnd% // LOAD_DOUBLE(Src, Dst) { GET_DOUBLE($Src, *(FloatDef *) &$Dst); } fload(Reg, Dst) { $LOAD_DOUBLE($Reg, $Dst); } fstore(Float, Dst) { PUT_DOUBLE(*((FloatDef *) &$Float), HTOP); $Dst = make_float(HTOP); HTOP += FLOAT_SIZE_OBJECT; } fconv(Src, Dst) { Eterm src = $Src; if (is_small(src)) { $Dst = (double) signed_val(src); } else if (is_big(src)) { if (big_to_double(src, &$Dst) < 0) { $BADARITH0(); } } else if (is_float(src)) { $LOAD_DOUBLE(src, $Dst); } else { $BADARITH0(); } } FLOAT_OP(Src1, OP, Src2, Dst) { $Dst = $Src1 $OP $Src2; if (!erts_isfinite($Dst)) { $BADARITH0(); } } i_fadd(Src1, Src2, Dst) { $FLOAT_OP($Src1, +, $Src2, $Dst); } i_fsub(Src1, Src2, Dst) { $FLOAT_OP($Src1, -, $Src2, $Dst); } i_fmul(Src1, Src2, Dst) { $FLOAT_OP($Src1, *, $Src2, $Dst); } i_fdiv(Src1, Src2, Dst) { $FLOAT_OP($Src1, /, $Src2, $Dst); } i_fnegate(Src, Dst) { /* Note that there is no need to check for errors since flipping the sign * of a finite float is guaranteed to produce a finite float. */ ASSERT(erts_isfinite($Src)); $Dst = -$Src; ASSERT(erts_isfinite($Dst)); }
98d9ec5704e2df52f2adf0a38526c7881a0bd43c
fcc9b5cb92607deaac4b097776ed0490789d8c3e
/tools-for-build/os-provides-wakebyaddr-test.c
7b3da046d8b13ec9e4ee558808ac4f772b1605c2
[ "LicenseRef-scancode-other-permissive", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "LicenseRef-scancode-warranty-disclaimer", "BSD-3-Clause", "LicenseRef-scancode-mit-specification-disclaimer", "MIT" ]
permissive
sbcl/sbcl
ef248b5e8614ba7f0a1132c4f2cfcb000a074400
85003adf60ef659082c244972e816ea62240b9cb
refs/heads/master
2023-09-01T05:14:15.225083
2023-08-31T20:09:49
2023-08-31T20:09:49
1,890,957
1,737
408
NOASSERTION
2023-08-28T13:05:04
2011-06-13T20:33:25
Common Lisp
UTF-8
C
false
false
1,547
c
os-provides-wakebyaddr-test.c
#include <windows.h> int mutex_word = 0; int expect = 9; DWORD waiter(void* arg) { mutex_word = expect = 2; return WaitOnAddress(&mutex_word, &expect, 4, 100); // .1 sec max } DWORD waker(void* arg) { mutex_word = 0; WakeByAddressSingle(&mutex_word); return 0; } int main() { // Verify that WaitOnAddress returns right away if the mutex word has the wrong value. int result = WaitOnAddress(&mutex_word, &expect, 4, 500); // max = .5 sec if (!result) return 0; // what? shouldn't be an error to mismatch // Try really waiting mutex_word = 9; result = WaitOnAddress(&mutex_word, &expect, 4, 20); // wait 20 millisec // expect a timeout if (!(result == 0 && GetLastError()==ERROR_TIMEOUT)) return 0; // Simulate a lisp mutex being woken HANDLE hWaiter, hWaker; hWaiter = CreateThread(NULL, 0, waiter, 0, /* function and argument */ 0, /* flags */ 0); /* id */ hWaker = CreateThread(NULL, 0, waker, 0, /* function and argument */ CREATE_SUSPENDED, /* flags */ 0); /* id */ for (;;) { // wait for the waiter to place itself into a wait state on the mutex if (mutex_word == 2) break; Sleep(10); // 10 millisec } // Give them some time to rendezvous ResumeThread(hWaker); WaitForSingleObject(hWaiter, 200); // .2 sec max if (mutex_word == 0) return 104; return 1; }
e0330ea4c847d3a205e5be5b030a9b98da7787c5
cce217852fee0a222fdca9f8f6ee8897c540c663
/patch/winview.c
f54c20c04c354439aa0c8dbc088877f0b5c131d0
[ "MIT" ]
permissive
bakkeby/dwm-flexipatch
d3e920f13701714d33a5ea75a12bb52df68f54aa
7849eaa08b71d359c939b946598716539b4ba1d7
refs/heads/master
2023-08-31T22:09:22.250888
2023-08-24T16:18:03
2023-08-24T16:18:03
206,426,925
1,094
366
MIT
2023-08-24T16:18:04
2019-09-04T22:35:38
C
UTF-8
C
false
false
464
c
winview.c
/* Selects for the view of the focused window. The list of tags */ /* to be displayed is matched to the focused window tag list. */ void winview(const Arg* arg) { Window win, win_r, win_p, *win_c; unsigned nc; int unused; Client* c; Arg a; if (!XGetInputFocus(dpy, &win, &unused)) return; while (XQueryTree(dpy, win, &win_r, &win_p, &win_c, &nc) && win_p != win_r) win = win_p; if (!(c = wintoclient(win))) return; a.ui = c->tags; view(&a); }
a033e656dceccf383ff4a367f1bb111eee922c22
78dc9f153549b281be709227bc9897931b06260d
/generation/WinSDK/RecompiledIdlHeaders/shared/hidpi.h
9552c752a8e9aa73817cec00c284f179a989bb88
[ "MIT" ]
permissive
microsoft/win32metadata
dff35b4fe904d556162cee5133294c4498f1a79a
5bf233f04d45f7a697e112e9639722551103eb07
refs/heads/main
2023-09-01T19:51:22.972899
2023-08-30T21:39:44
2023-08-30T21:39:44
270,838,404
1,240
107
NOASSERTION
2023-09-14T18:49:44
2020-06-08T21:52:10
C++
UTF-8
C
false
false
91,934
h
hidpi.h
/*++ Copyright (c) Microsoft Corporation. All rights reserved. Module Name: HIDPI.H Abstract: Public Interface to the HID parsing library. Environment: Kernel & user mode --*/ #ifndef __HIDPI_H__ #define __HIDPI_H__ #include <winapifamily.h> #pragma region Desktop Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) #ifdef __cplusplus extern "C" { #endif #if _MSC_VER >= 1200 #pragma warning(push) #endif #pragma warning(disable:4115) // named type definition in parentheses #pragma warning(disable:4201) // nameless struct/union #pragma warning(disable:4214) // bit field types other than int #include <pshpack4.h> // Please include "hidsdi.h" to use the user space (dll / parser) // Please include "hidpddi.h" to use the kernel space parser // // Special Link collection values for using the query functions // // Root collection references the collection at the base of the link // collection tree. // Unspecifies, references all collections in the link collection tree. // #define HIDP_LINK_COLLECTION_ROOT ((USHORT) -1) #define HIDP_LINK_COLLECTION_UNSPECIFIED ((USHORT) 0) typedef enum _HIDP_REPORT_TYPE { HidP_Input, HidP_Output, HidP_Feature } HIDP_REPORT_TYPE; typedef struct _USAGE_AND_PAGE { USAGE Usage; USAGE UsagePage; } USAGE_AND_PAGE, *PUSAGE_AND_PAGE; #define HidP_IsSameUsageAndPage(u1, u2) ((* (PULONG) &u1) == (* (PULONG) &u2)) typedef struct _HIDP_BUTTON_CAPS { USAGE UsagePage; UCHAR ReportID; BOOLEAN IsAlias; USHORT BitField; USHORT LinkCollection; // A unique internal index pointer USAGE LinkUsage; USAGE LinkUsagePage; BOOLEAN IsRange; BOOLEAN IsStringRange; BOOLEAN IsDesignatorRange; BOOLEAN IsAbsolute; USHORT ReportCount; // Available in API version >= 2 only. USHORT Reserved2; ULONG Reserved[9]; union { struct { USAGE UsageMin, UsageMax; USHORT StringMin, StringMax; USHORT DesignatorMin, DesignatorMax; USHORT DataIndexMin, DataIndexMax; } Range; struct { USAGE Usage, Reserved1; USHORT StringIndex, Reserved2; USHORT DesignatorIndex, Reserved3; USHORT DataIndex, Reserved4; } NotRange; }; } HIDP_BUTTON_CAPS, *PHIDP_BUTTON_CAPS; typedef struct _HIDP_VALUE_CAPS { USAGE UsagePage; UCHAR ReportID; BOOLEAN IsAlias; USHORT BitField; USHORT LinkCollection; // A unique internal index pointer USAGE LinkUsage; USAGE LinkUsagePage; BOOLEAN IsRange; BOOLEAN IsStringRange; BOOLEAN IsDesignatorRange; BOOLEAN IsAbsolute; BOOLEAN HasNull; // Does this channel have a null report union UCHAR Reserved; USHORT BitSize; // How many bits are devoted to this value? USHORT ReportCount; // See Note below. Usually set to 1. USHORT Reserved2[5]; ULONG UnitsExp; ULONG Units; LONG LogicalMin, LogicalMax; LONG PhysicalMin, PhysicalMax; union { struct { USAGE UsageMin, UsageMax; USHORT StringMin, StringMax; USHORT DesignatorMin, DesignatorMax; USHORT DataIndexMin, DataIndexMax; } Range; struct { USAGE Usage, Reserved1; USHORT StringIndex, Reserved2; USHORT DesignatorIndex, Reserved3; USHORT DataIndex, Reserved4; } NotRange; }; } HIDP_VALUE_CAPS, *PHIDP_VALUE_CAPS; // // Notes: // // ReportCount: When a report descriptor declares an Input, Output, or // Feature main item with fewer usage declarations than the report count, then // the last usage applies to all remaining unspecified count in that main item. // (As an example you might have data that required many fields to describe, // possibly buffered bytes.) In this case, only one value cap structure is // allocated for these associtated fields, all with the same usage, and Report // Count reflects the number of fields involved. Normally ReportCount is 1. // To access all of the fields in such a value structure would require using // HidP_GetUsageValueArray and HidP_SetUsageValueArray. HidP_GetUsageValue/ // HidP_SetScaledUsageValue will also work, however, these functions will only // work with the first field of the structure. // // // The link collection tree consists of an array of LINK_COLLECTION_NODES // where the index into this array is the same as the collection number. // // Given a collection A which contains a subcollection B, A is defined to be // the parent B, and B is defined to be the child. // // Given collections A, B, and C where B and C are children of A, and B was // encountered before C in the report descriptor, B is defined as a sibling of // C. (This implies, of course, that if B is a sibling of C, then C is NOT a // sibling of B). // // B is defined as the NextSibling of C if and only if there exists NO // child collection of A, call it D, such that B is a sibling of D and D // is a sibling of C. // // E is defined to be the FirstChild of A if and only if for all children of A, // F, that are not equivalent to E, F is a sibling of E. // (This implies, of course, that the does not exist a child of A, call it G, // where E is a sibling of G). In other words the first sibling is the last // link collection found in the list. // // In other words, if a collection B is defined within the definition of another // collection A, B becomes a child of A. All collections with the same parent // are considered siblings. The FirstChild of the parent collection, A, will be // last collection defined that has A as a parent. The order of sibling pointers // is similarly determined. When a collection B is defined, it becomes the // FirstChild of it's parent collection. The previously defined FirstChild of the // parent collection becomes the NextSibling of the new collection. As new // collections with the same parent are discovered, the chain of sibling is built. // // With that in mind, the following describes conclusively a data structure // that provides direct traversal up, down, and accross the link collection // tree. // // typedef struct _HIDP_LINK_COLLECTION_NODE { USAGE LinkUsage; USAGE LinkUsagePage; USHORT Parent; USHORT NumberOfChildren; USHORT NextSibling; USHORT FirstChild; ULONG CollectionType: 8; // As defined in 6.2.2.6 of HID spec ULONG IsAlias : 1; // This link node is an allias of the next link node. ULONG Reserved: 23; PVOID UserContext; // The user can hang his coat here. } HIDP_LINK_COLLECTION_NODE, *PHIDP_LINK_COLLECTION_NODE; // // When a link collection is described by a delimiter, alias link collection // nodes are created. (One for each usage within the delimiter). // The parser assigns each capability description listed above only one // link collection. // // If a control is defined within a collection defined by // delimited usages, then that control is said to be within multiple link // collections, one for each usage within the open and close delimiter tokens. // Such multiple link collecions are said to be aliases. The first N-1 such // collections, listed in the link collection node array, have their IsAlias // bit set. The last such link collection is the link collection index used // in the capabilities described above. // Clients wishing to set a control in an aliased collection, should walk the // collection array once for each time they see the IsAlias flag set, and use // the last link collection as the index for the below accessor functions. // // NB: if IsAlias is set, then NextSibling should be one more than the current // link collection node index. // typedef PUCHAR PHIDP_REPORT_DESCRIPTOR; typedef struct _HIDP_PREPARSED_DATA * PHIDP_PREPARSED_DATA; typedef struct _HIDP_CAPS { USAGE Usage; USAGE UsagePage; USHORT InputReportByteLength; USHORT OutputReportByteLength; USHORT FeatureReportByteLength; USHORT Reserved[17]; USHORT NumberLinkCollectionNodes; USHORT NumberInputButtonCaps; USHORT NumberInputValueCaps; USHORT NumberInputDataIndices; USHORT NumberOutputButtonCaps; USHORT NumberOutputValueCaps; USHORT NumberOutputDataIndices; USHORT NumberFeatureButtonCaps; USHORT NumberFeatureValueCaps; USHORT NumberFeatureDataIndices; } HIDP_CAPS, *PHIDP_CAPS; typedef struct _HIDP_DATA { USHORT DataIndex; USHORT Reserved; union { ULONG RawValue; // for values BOOLEAN On; // for buttons MUST BE TRUE for buttons. }; } HIDP_DATA, *PHIDP_DATA; // // The HIDP_DATA structure is used with HidP_GetData and HidP_SetData // functions. // // The parser contiguously assigns every control (button or value) in a hid // device a unique data index from zero to NumberXXXDataIndices -1 , inclusive. // This value is found in the HIDP_BUTTON_CAPS and HIDP_VALUE_CAPS structures. // // Most clients will find the Get/Set Buttons / Value accessor functions // sufficient to their needs, as they will allow the clients to access the // data known to them while ignoring the other controls. // // More complex clients, which actually read the Button / Value Caps, and which // do a value add service to these routines (EG Direct Input), will need to // access all the data in the device without interest in the individual usage // or link collection location. These are the clients that will find // HidP_Data useful. // typedef struct _HIDP_UNKNOWN_TOKEN { UCHAR Token; UCHAR Reserved[3]; ULONG BitField; } HIDP_UNKNOWN_TOKEN, *PHIDP_UNKNOWN_TOKEN; typedef struct _HIDP_EXTENDED_ATTRIBUTES { UCHAR NumGlobalUnknowns; UCHAR Reserved [3]; PHIDP_UNKNOWN_TOKEN GlobalUnknowns; // ... Additional attributes ULONG Data [1]; // variableLength DO NOT ACCESS THIS FIELD } HIDP_EXTENDED_ATTRIBUTES, *PHIDP_EXTENDED_ATTRIBUTES; _Must_inspect_result_ _IRQL_requires_max_(PASSIVE_LEVEL) NTSTATUS __stdcall HidP_GetCaps ( _In_ PHIDP_PREPARSED_DATA PreparsedData, _Out_ PHIDP_CAPS Capabilities ); /*++ Routine Description: Returns a list of capabilities of a given hid device as described by its preparsed data. Arguments: PreparsedData The preparsed data returned from HIDCLASS. Capabilities a HIDP_CAPS structure Return Value: HIDP_STATUS_SUCCESS HIDP_STATUS_INVALID_PREPARSED_DATA --*/ _Must_inspect_result_ _IRQL_requires_max_(DISPATCH_LEVEL) NTSTATUS __stdcall HidP_GetLinkCollectionNodes ( _Out_writes_to_(*LinkCollectionNodesLength, *LinkCollectionNodesLength) PHIDP_LINK_COLLECTION_NODE LinkCollectionNodes, _Inout_ PULONG LinkCollectionNodesLength, _In_ PHIDP_PREPARSED_DATA PreparsedData ); /*++ Routine Description: Return a list of PHIDP_LINK_COLLECTION_NODEs used to describe the link collection tree of this hid device. See the above description of struct _HIDP_LINK_COLLECTION_NODE. Arguments: LinkCollectionNodes - a caller allocated array into which HidP_GetLinkCollectionNodes will store the information LinKCollectionNodesLength - the caller sets this value to the length of the the array in terms of number of elements. HidP_GetLinkCollectionNodes sets this value to the actual number of elements set. The total number of nodes required to describe this HID device can be found in the NumberLinkCollectionNodes field in the HIDP_CAPS structure. --*/ _Must_inspect_result_ _IRQL_requires_max_(PASSIVE_LEVEL) NTSTATUS __stdcall HidP_GetSpecificButtonCaps ( _In_ HIDP_REPORT_TYPE ReportType, _In_opt_ USAGE UsagePage, // Optional (0 => ignore) _In_opt_ USHORT LinkCollection, // Optional (0 => ignore) _In_opt_ USAGE Usage, // Optional (0 => ignore) _Out_writes_to_(*ButtonCapsLength, *ButtonCapsLength) PHIDP_BUTTON_CAPS ButtonCaps, _Inout_ PUSHORT ButtonCapsLength, _In_ PHIDP_PREPARSED_DATA PreparsedData ); /*++ Description: HidP_GetButtonCaps returns all the buttons (binary values) that are a part of the given report type for the Hid device represented by the given preparsed data. Parameters: ReportType One of HidP_Input, HidP_Output, or HidP_Feature. UsagePage A usage page value used to limit the button caps returned to those on a given usage page. If set to 0, this parameter is ignored. Can be used with LinkCollection and Usage parameters to further limit the number of button caps structures returned. LinkCollection HIDP_LINK_COLLECTION node array index used to limit the button caps returned to those buttons in a given link collection. If set to 0, this parameter is ignored. Can be used with UsagePage and Usage parameters to further limit the number of button caps structures returned. Usage A usage value used to limit the button caps returned to those with the specified usage value. If set to 0, this parameter is ignored. Can be used with LinkCollection and UsagePage parameters to further limit the number of button caps structures returned. ButtonCaps A _HIDP_BUTTON_CAPS array containing information about all the binary values in the given report. This buffer is provided by the caller. ButtonCapsLength As input, this parameter specifies the length of the ButtonCaps parameter (array) in number of array elements. As output, this value is set to indicate how many of those array elements were filled in by the function. The maximum number of button caps that can be returned is found in the HIDP_CAPS structure. If HIDP_STATUS_BUFFER_TOO_SMALL is returned, this value contains the number of array elements needed to successfully complete the request. PreparsedData The preparsed data returned from HIDCLASS. Return Value HidP_GetSpecificButtonCaps returns the following error codes: HIDP_STATUS_SUCCESS. HIDP_STATUS_INVALID_REPORT_TYPE HIDP_STATUS_INVALID_PREPARSED_DATA HIDP_STATUS_BUFFER_TOO_SMALL (all given entries however have been filled in) HIDP_STATUS_USAGE_NOT_FOUND --*/ _Must_inspect_result_ _IRQL_requires_max_(PASSIVE_LEVEL) NTSTATUS __stdcall HidP_GetButtonCaps ( _In_ HIDP_REPORT_TYPE ReportType, _Out_writes_to_(*ButtonCapsLength, *ButtonCapsLength) PHIDP_BUTTON_CAPS ButtonCaps, _Inout_ PUSHORT ButtonCapsLength, _In_ PHIDP_PREPARSED_DATA PreparsedData ); _Must_inspect_result_ _IRQL_requires_max_(DISPATCH_LEVEL) NTSTATUS __stdcall HidP_GetSpecificValueCaps ( _In_ HIDP_REPORT_TYPE ReportType, _In_opt_ USAGE UsagePage, // Optional (0 => ignore) _In_opt_ USHORT LinkCollection, // Optional (0 => ignore) _In_opt_ USAGE Usage, // Optional (0 => ignore) _Out_writes_to_(*ValueCapsLength, *ValueCapsLength) PHIDP_VALUE_CAPS ValueCaps, _Inout_ PUSHORT ValueCapsLength, _In_ PHIDP_PREPARSED_DATA PreparsedData ); /*++ Description: HidP_GetValueCaps returns all the values (non-binary) that are a part of the given report type for the Hid device represented by the given preparsed data. Parameters: ReportType One of HidP_Input, HidP_Output, or HidP_Feature. UsagePage A usage page value used to limit the value caps returned to those on a given usage page. If set to 0, this parameter is ignored. Can be used with LinkCollection and Usage parameters to further limit the number of value caps structures returned. LinkCollection HIDP_LINK_COLLECTION node array index used to limit the value caps returned to those buttons in a given link collection. If set to 0, this parameter is ignored. Can be used with UsagePage and Usage parameters to further limit the number of value caps structures returned. Usage A usage value used to limit the value caps returned to those with the specified usage value. If set to 0, this parameter is ignored. Can be used with LinkCollection and UsagePage parameters to further limit the number of value caps structures returned. ValueCaps A _HIDP_VALUE_CAPS array containing information about all the non-binary values in the given report. This buffer is provided by the caller. ValueLength As input, this parameter specifies the length of the ValueCaps parameter (array) in number of array elements. As output, this value is set to indicate how many of those array elements were filled in by the function. The maximum number of value caps that can be returned is found in the HIDP_CAPS structure. If HIDP_STATUS_BUFFER_TOO_SMALL is returned, this value contains the number of array elements needed to successfully complete the request. PreparsedData The preparsed data returned from HIDCLASS. Return Value HidP_GetValueCaps returns the following error codes: HIDP_STATUS_SUCCESS. HIDP_STATUS_INVALID_REPORT_TYPE HIDP_STATUS_INVALID_PREPARSED_DATA HIDP_STATUS_BUFFER_TOO_SMALL (all given entries however have been filled in) HIDP_STATUS_USAGE_NOT_FOUND --*/ _Must_inspect_result_ _IRQL_requires_max_(DISPATCH_LEVEL) NTSTATUS __stdcall HidP_GetValueCaps ( _In_ HIDP_REPORT_TYPE ReportType, _Out_writes_to_(*ValueCapsLength, *ValueCapsLength) PHIDP_VALUE_CAPS ValueCaps, _Inout_ PUSHORT ValueCapsLength, _In_ PHIDP_PREPARSED_DATA PreparsedData ); _Must_inspect_result_ _IRQL_requires_max_(DISPATCH_LEVEL) NTSTATUS __stdcall HidP_GetExtendedAttributes ( _In_ HIDP_REPORT_TYPE ReportType, _In_ USHORT DataIndex, _In_ PHIDP_PREPARSED_DATA PreparsedData, _Out_writes_to_(*LengthAttributes, *LengthAttributes) PHIDP_EXTENDED_ATTRIBUTES Attributes, _Inout_ PULONG LengthAttributes ); /*++ Description: Given a data index from the value or button capabilities of a given control return any extended attributes for the control if any exist. Parameters: ReportType One of HidP_Input, HidP_Output, or HidP_Feature. DataIndex The data index for the given control, found in the capabilities structure for that control PreparsedData The preparsed data returned from HIDCLASS. Attributes Pointer to a buffer into which the extended attribute data will be copied. LengthAttributes Length of the given buffer in bytes. Return Value HIDP_STATUS_SUCCESS HIDP_STATUS_DATA_INDEX_NOT_FOUND --*/ _Must_inspect_result_ _IRQL_requires_max_(DISPATCH_LEVEL) NTSTATUS __stdcall HidP_InitializeReportForID ( _In_ HIDP_REPORT_TYPE ReportType, _In_ UCHAR ReportID, _In_ PHIDP_PREPARSED_DATA PreparsedData, _Out_writes_bytes_(ReportLength) PCHAR Report, _In_ ULONG ReportLength ); /*++ Routine Description: Initialize a report based on the given report ID. Parameters: ReportType One of HidP_Input, HidP_Output, or HidP_Feature. PreparasedData Preparsed data structure returned by HIDCLASS Report Buffer which to set the data into. ReportLength Length of Report...Report should be at least as long as the value indicated in the HIDP_CAPS structure for the device and the corresponding ReportType Return Value HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal to the length specified in HIDP_CAPS structure for the given ReportType HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device for the given ReportType --*/ _Must_inspect_result_ NTSTATUS __stdcall HidP_SetData ( _In_ HIDP_REPORT_TYPE ReportType, _Inout_updates_to_(*DataLength,*DataLength) PHIDP_DATA DataList, _Inout_ PULONG DataLength, _In_ PHIDP_PREPARSED_DATA PreparsedData, _In_reads_bytes_(ReportLength) PCHAR Report, _In_ ULONG ReportLength ); /*++ Routine Description: Please Note: Since usage value arrays deal with multiple fields for for one usage value, they cannot be used with HidP_SetData and HidP_GetData. In this case, HIDP_STATUS_IS_USAGE_VALUE_ARRAY will be returned. Parameters: ReportType One of HidP_Input, HidP_Output, or HidP_Feature. DataList Array of HIDP_DATA structures that contains the data values that are to be set into the given report DataLength As input, length in array elements of DataList. As output, contains the number of data elements set on successful completion or an index into the DataList array to identify the faulting HIDP_DATA value if an error code is returned. PreparasedData Preparsed data structure returned by HIDCLASS Report Buffer which to set the data into. ReportLength Length of Report...Report should be at least as long as the value indicated in the HIDP_CAPS structure for the device and the corresponding ReportType Return Value HidP_SetData returns the following error codes. The report packet will have all the data set up until the HIDP_DATA structure that caused the error. DataLength, in the error case, will return this problem index. HIDP_STATUS_SUCCESS -- upon successful insertion of all data into the report packet. HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid HIDP_STATUS_DATA_INDEX_NOT_FOUND -- if a HIDP_DATA structure referenced a data index that does not exist for this device's ReportType HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal to the length specified in HIDP_CAPS structure for the given ReportType HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device for the given ReportType HIDP_STATUS_IS_USAGE_VALUE_ARRAY -- if one of the HIDP_DATA structures references a usage value array. DataLength will contain the index into the array that was invalid HIDP_STATUS_BUTTON_NOT_PRESSED -- if a HIDP_DATA structure attempted to unset a button that was not already set in the Report HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- a HIDP_DATA structure was found with a valid index value but is contained in a different report than the one currently being processed HIDP_STATUS_BUFFER_TOO_SMALL -- if there are not enough entries in a given Main Array Item to report all buttons that have been requested to be set --*/ _Must_inspect_result_ _IRQL_requires_max_(DISPATCH_LEVEL) NTSTATUS __stdcall HidP_GetData ( _In_ HIDP_REPORT_TYPE ReportType, _Out_writes_to_(*DataLength,*DataLength) PHIDP_DATA DataList, _Inout_ PULONG DataLength, _In_ PHIDP_PREPARSED_DATA PreparsedData, _Out_writes_bytes_(ReportLength) PCHAR Report, _In_ ULONG ReportLength ); /*++ Routine Description: Please Note: For obvious reasons HidP_SetData and HidP_GetData will not access UsageValueArrays. Parameters: ReportType One of HidP_Input, HidP_Output, or HidP_Feature. DataList Array of HIDP_DATA structures that will receive the data values that are set in the given report DataLength As input, length in array elements of DataList. As output, contains the number of data elements that were successfully set by HidP_GetData. The maximum size necessary for DataList can be determined by calling HidP_MaxDataListLength PreparsedData Preparsed data structure returned by HIDCLASS Report Buffer which to set the data into. ReportLength Length of Report...Report should be at least as long as the value indicated in the HIDP_CAPS structure for the device and the corresponding ReportType Return Value HidP_GetData returns the following error codes. HIDP_STATUS_SUCCESS -- upon successful retrieval of all data from the report packet. HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal to the length specified in HIDP_CAPS structure for the given ReportType HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device for the given ReportType HIDP_STATUS_BUFFER_TOO_SMALL -- if there are not enough array entries in DataList to store all the indice values in the given report. DataLength will contain the number of array entries required to hold all data --*/ _IRQL_requires_max_(DISPATCH_LEVEL) ULONG __stdcall HidP_MaxDataListLength ( _In_ HIDP_REPORT_TYPE ReportType, _In_ PHIDP_PREPARSED_DATA PreparsedData ); /*++ Routine Description: This function returns the maximum length of HIDP_DATA elements that HidP_GetData could return for the given report type. Parameters: ReportType One of HidP_Input, HidP_Output or HidP_Feature. PreparsedData Preparsed data structure returned by HIDCLASS Return Value: The length of the data list array required for the HidP_GetData function call. If an error occurs (either HIDP_STATUS_INVALID_REPORT_TYPE or HIDP_STATUS_INVALID_PREPARSED_DATA), this function returns 0. --*/ #define HidP_SetButtons(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle) \ HidP_SetUsages(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle) _Must_inspect_result_ NTSTATUS __stdcall HidP_SetUsages ( _In_ HIDP_REPORT_TYPE ReportType, _In_ USAGE UsagePage, _In_opt_ USHORT LinkCollection, _Inout_updates_to_(*UsageLength,*UsageLength) PUSAGE UsageList, _Inout_ PULONG UsageLength, _In_ PHIDP_PREPARSED_DATA PreparsedData, _In_reads_bytes_(ReportLength) PCHAR Report, _In_ ULONG ReportLength ); /*++ Routine Description: This function sets binary values (buttons) in a report. Given an initialized packet of correct length, it modifies the report packet so that each element in the given list of usages has been set in the report packet. For example, in an output report with 5 LED's, each with a given usage, an application could turn on any subset of these lights by placing their usages in any order into the usage array (UsageList). HidP_SetUsages would, in turn, set the appropriate bit or add the corresponding byte into the HID Main Array Item. A properly initialized Report packet is one of the correct byte length, and all zeros. NOTE: A packet that has already been set with a call to a HidP_Set routine can also be passed in. This routine then sets processes the UsageList in the same fashion but verifies that the ReportID already set in Report matches the report ID for the given usages. Parameters: ReportType One of HidP_Input, HidP_Output or HidP_Feature. UsagePage All of the usages in the usage array, which HidP_SetUsages will set in the report, refer to this same usage page. If a client wishes to set usages in a report for multiple usage pages then that client needs to make multiple calls to HidP_SetUsages for each of the usage pages. UsageList A usage array containing the usages that HidP_SetUsages will set in the report packet. UsageLength The length of the given usage array in array elements. The parser will set this value to the position in the usage array where it stopped processing. If successful, UsageLength will be unchanged. In any error condition, this parameter reflects how many of the usages in the usage list have actually been set by the parser. This is useful for finding the usage in the list which caused the error. PreparsedData The preparsed data recevied from HIDCLASS Report The report packet. ReportLength Length of the given report packet...Must be equal to the value reported in the HIDP_CAPS structure for the device and corresponding report type. Return Value HidP_SetUsages returns the following error codes. On error, the report packet will be correct up until the usage element that caused the error. HIDP_STATUS_SUCCESS -- upon successful insertion of all usages into the report packet. HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal to the length specified in the HIDP_CAPS structure for the given ReportType HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device for the given ReportType HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if a usage was found that exists in a different report. If the report is zero-initialized on entry the first usage in the list will determine which report ID is used. Otherwise, the parser will verify that usage matches the passed in report's ID HIDP_STATUS_USAGE_NOT_FOUND -- if the usage does not exist for any report (no matter what the report ID) for the given report type. HIDP_STATUS_BUFFER_TOO_SMALL -- if there are not enough entries in a given Main Array Item to list all of the given usages. The caller needs to split his request into more than one call --*/ #define HidP_UnsetButtons(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle) \ HidP_UnsetUsages(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle) _Must_inspect_result_ NTSTATUS __stdcall HidP_UnsetUsages ( _In_ HIDP_REPORT_TYPE ReportType, _In_ USAGE UsagePage, _In_opt_ USHORT LinkCollection, _Inout_updates_to_(*UsageLength,*UsageLength) PUSAGE UsageList, _Inout_ PULONG UsageLength, _In_ PHIDP_PREPARSED_DATA PreparsedData, _In_reads_bytes_(ReportLength) PCHAR Report, _In_ ULONG ReportLength ); /*++ Routine Description: This function unsets (turns off) binary values (buttons) in the report. Given an initialized packet of correct length, it modifies the report packet so that each element in the given list of usages has been unset in the report packet. This function is the "undo" operation for SetUsages. If the given usage is not already set in the Report, it will return an error code of HIDP_STATUS_BUTTON_NOT_PRESSED. If the button is pressed, HidP_UnsetUsages will unset the appropriate bit or remove the corresponding index value from the HID Main Array Item. A properly initialized Report packet is one of the correct byte length, and all zeros.. NOTE: A packet that has already been set with a call to a HidP_Set routine can also be passed in. This routine then processes the UsageList in the same fashion but verifies that the ReportID already set in Report matches the report ID for the given usages. Parameters: ReportType One of HidP_Input, HidP_Output or HidP_Feature. UsagePage All of the usages in the usage array, which HidP_UnsetUsages will unset in the report, refer to this same usage page. If a client wishes to unset usages in a report for multiple usage pages then that client needs to make multiple calls to HidP_UnsetUsages for each of the usage pages. UsageList A usage array containing the usages that HidP_UnsetUsages will unset in the report packet. UsageLength The length of the given usage array in array elements. The parser will set this value to the position in the usage array where it stopped processing. If successful, UsageLength will be unchanged. In any error condition, this parameter reflects how many of the usages in the usage list have actually been unset by the parser. This is useful for finding the usage in the list which caused the error. PreparsedData The preparsed data recevied from HIDCLASS Report The report packet. ReportLength Length of the given report packet...Must be equal to the value reported in the HIDP_CAPS structure for the device and corresponding report type. Return Value HidP_UnsetUsages returns the following error codes. On error, the report packet will be correct up until the usage element that caused the error. HIDP_STATUS_SUCCESS -- upon successful "unsetting" of all usages in the report packet. HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal to the length specified in the HIDP_CAPS structure for the given ReportType HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device for the given ReportType HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if a usage was found that exists in a different report. If the report is zero-initialized on entry the first usage in the list will determine which report ID is used. Otherwise, the parser will verify that usage matches the passed in report's ID HIDP_STATUS_USAGE_NOT_FOUND -- if the usage does not exist for any report (no matter what the report ID) for the given report type. HIDP_STATUS_BUTTON_NOT_PRESSED -- if a usage corresponds to a button that is not already set in the given report --*/ #define HidP_GetButtons(Rty, UPa, LCo, ULi, ULe, Ppd, Rep, RLe) \ HidP_GetUsages(Rty, UPa, LCo, ULi, ULe, Ppd, Rep, RLe) _Must_inspect_result_ NTSTATUS __stdcall HidP_GetUsages ( _In_ HIDP_REPORT_TYPE ReportType, _In_ USAGE UsagePage, _In_opt_ USHORT LinkCollection, _Out_writes_to_(*UsageLength, *UsageLength) PUSAGE UsageList, _Inout_ PULONG UsageLength, _In_ PHIDP_PREPARSED_DATA PreparsedData, _Out_writes_bytes_(ReportLength) PCHAR Report, _In_ ULONG ReportLength ); /*++ Routine Description: This function returns the binary values (buttons) that are set in a HID report. Given a report packet of correct length, it searches the report packet for each usage for the given usage page and returns them in the usage list. Parameters: ReportType One of HidP_Input, HidP_Output or HidP_Feature. UsagePage All of the usages in the usage list, which HidP_GetUsages will retrieve in the report, refer to this same usage page. If the client wishes to get usages in a packet for multiple usage pages then that client needs to make multiple calls to HidP_GetUsages. LinkCollection An optional value which can limit which usages are returned in the UsageList to those usages that exist in a specific LinkCollection. A non-zero value indicates the index into the HIDP_LINK_COLLECITON_NODE list returned by HidP_GetLinkCollectionNodes of the link collection the usage should belong to. A value of 0 indicates this should value be ignored. UsageList The usage array that will contain all the usages found in the report packet. UsageLength The length of the given usage array in array elements. On input, this value describes the length of the usage list. On output, HidP_GetUsages sets this value to the number of usages that was found. Use HidP_MaxUsageListLength to determine the maximum length needed to return all the usages that a given report packet may contain. PreparsedData Preparsed data structure returned by HIDCLASS Report The report packet. ReportLength Length (in bytes) of the given report packet Return Value HidP_GetUsages returns the following error codes: HIDP_STATUS_SUCCESS -- upon successfully retrieving all the usages from the report packet HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal to the length specified in the HIDP_CAPS structure for the given ReportType HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device for the given ReportType HIDP_STATUS_BUFFER_TOO_SMALL -- if the UsageList is not big enough to hold all the usages found in the report packet. If this is returned, the buffer will contain UsageLength number of usages. Use HidP_MaxUsageListLength to find the maximum length needed HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if no usages were found but usages that match the UsagePage and LinkCollection specified could be found in a report with a different report ID HIDP_STATUS_USAGE_NOT_FOUND -- if there are no usages in a reports for the device and ReportType that match the UsagePage and LinkCollection that were specified --*/ #define HidP_GetButtonsEx(Rty, LCo, BLi, ULe, Ppd, Rep, RLe) \ HidP_GetUsagesEx(Rty, LCo, BLi, ULe, Ppd, Rep, RLe) _Must_inspect_result_ _IRQL_requires_max_(DISPATCH_LEVEL) NTSTATUS __stdcall HidP_GetUsagesEx ( _In_ HIDP_REPORT_TYPE ReportType, _In_opt_ USHORT LinkCollection, // Optional _Inout_updates_to_(*UsageLength,*UsageLength) PUSAGE_AND_PAGE ButtonList, _Inout_ ULONG * UsageLength, _In_ PHIDP_PREPARSED_DATA PreparsedData, _In_reads_bytes_(ReportLength) PCHAR Report, _In_ ULONG ReportLength ); /*++ Routine Description: This function returns the binary values (buttons) in a HID report. Given a report packet of correct length, it searches the report packet for all buttons and returns the UsagePage and Usage for each of the buttons it finds. Parameters: ReportType One of HidP_Input, HidP_Output or HidP_Feature. LinkCollection An optional value which can limit which usages are returned in the ButtonList to those usages that exist in a specific LinkCollection. A non-zero value indicates the index into the HIDP_LINK_COLLECITON_NODE list returned by HidP_GetLinkCollectionNodes of the link collection the usage should belong to. A value of 0 indicates this should value be ignored. ButtonList An array of USAGE_AND_PAGE structures describing all the buttons currently ``down'' in the device. UsageLength The length of the given array in terms of elements. On input, this value describes the length of the list. On output, HidP_GetUsagesEx sets this value to the number of usages that were found. Use HidP_MaxUsageListLength to determine the maximum length needed to return all the usages that a given report packet may contain. PreparsedData Preparsed data returned by HIDCLASS Report The report packet. ReportLength Length (in bytes) of the given report packet. Return Value HidP_GetUsagesEx returns the following error codes: HIDP_STATUS_SUCCESS -- upon successfully retrieving all the usages from the report packet HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal to the length specified in the HIDP_CAPS structure for the given ReportType HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device for the given ReportType HIDP_STATUS_BUFFER_TOO_SMALL -- if ButtonList is not big enough to hold all the usages found in the report packet. If this is returned, the buffer will contain UsageLength number of usages. Use HidP_MaxUsageListLength to find the maximum length needed HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if no usages were found but usages that match the specified LinkCollection exist in report with a different report ID. HIDP_STATUS_USAGE_NOT_FOUND -- if there are no usages in any reports that match the LinkCollection parameter --*/ _IRQL_requires_max_(PASSIVE_LEVEL) ULONG __stdcall HidP_MaxUsageListLength ( _In_ HIDP_REPORT_TYPE ReportType, _In_opt_ USAGE UsagePage, // Optional _In_ PHIDP_PREPARSED_DATA PreparsedData ); /*++ Routine Description: This function returns the maximum number of usages that a call to HidP_GetUsages or HidP_GetUsagesEx could return for a given HID report. If calling for number of usages returned by HidP_GetUsagesEx, use 0 as the UsagePage value. Parameters: ReportType One of HidP_Input, HidP_Output or HidP_Feature. UsagePage Specifies the optional UsagePage to query for. If 0, will return all the maximum number of usage values that could be returned for a given ReportType. If non-zero, will return the maximum number of usages that would be returned for the ReportType with the given UsagePage. PreparsedData Preparsed data returned from HIDCLASS Return Value: The length of the usage list array required for the HidP_GetUsages or HidP_GetUsagesEx function call. If an error occurs (such as HIDP_STATUS_INVALID_REPORT_TYPE or HIDP_INVALID_PREPARSED_DATA, this returns 0. --*/ _Must_inspect_result_ NTSTATUS __stdcall HidP_SetUsageValue ( _In_ HIDP_REPORT_TYPE ReportType, _In_ USAGE UsagePage, _In_opt_ USHORT LinkCollection, _In_ USAGE Usage, _In_ ULONG UsageValue, _In_ PHIDP_PREPARSED_DATA PreparsedData, _Inout_updates_bytes_(ReportLength) PCHAR Report, _In_ ULONG ReportLength ); /*++ Description: HidP_SetUsageValue inserts a value into the HID Report Packet in the field corresponding to the given usage page and usage. HidP_SetUsageValue casts this value to the appropriate bit length. If a report packet contains two different fields with the same Usage and UsagePage, they can be distinguished with the optional LinkCollection field value. Using this function sets the raw value into the report packet with no checking done as to whether it actually falls within the logical minimum/logical maximum range. Use HidP_SetScaledUsageValue for this... NOTE: Although the UsageValue parameter is a ULONG, any casting that is done will preserve or sign-extend the value. The value being set should be considered a LONG value and will be treated as such by this function. Parameters: ReportType One of HidP_Output or HidP_Feature. UsagePage The usage page to which the given usage refers. LinkCollection (Optional) This value can be used to differentiate between two fields that may have the same UsagePage and Usage but exist in different collections. If the link collection value is zero, this function will set the first field it finds that matches the usage page and usage. Usage The usage whose value HidP_SetUsageValue will set. UsageValue The raw value to set in the report buffer. This value must be within the logical range or if a NULL value this value should be the most negative value that can be represented by the number of bits for this field. PreparsedData The preparsed data returned for HIDCLASS Report The report packet. ReportLength Length (in bytes) of the given report packet. Return Value: HidP_SetUsageValue returns the following error codes: HIDP_STATUS_SUCCESS -- upon successfully setting the value in the report packet HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal to the length specified in the HIDP_CAPS structure for the given ReportType HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device for the given ReportType HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and link collection exist but exists in a report with a different report ID than the report being passed in. To set this value, call HidP_SetUsageValue again with a zero-initizialed report packet HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link collection combination does not exist in any reports for this ReportType --*/ _Must_inspect_result_ NTSTATUS __stdcall HidP_SetScaledUsageValue ( _In_ HIDP_REPORT_TYPE ReportType, _In_ USAGE UsagePage, _In_opt_ USHORT LinkCollection, _In_ USAGE Usage, _In_ LONG UsageValue, _In_ PHIDP_PREPARSED_DATA PreparsedData, _Inout_updates_bytes_(ReportLength) PCHAR Report, _In_ ULONG ReportLength ); /*++ Description: HidP_SetScaledUsageValue inserts the UsageValue into the HID report packet in the field corresponding to the given usage page and usage. If a report packet contains two different fields with the same Usage and UsagePage, they can be distinguished with the optional LinkCollection field value. If the specified field has a defined physical range, this function converts the physical value specified to the corresponding logical value for the report. If a physical value does not exist, the function will verify that the value specified falls within the logical range and set according. If the range checking fails but the field has NULL values, the function will set the field to the defined NULL value (most negative number possible) and return HIDP_STATUS_NULL. In other words, use this function to set NULL values for a given field by passing in a value that falls outside the physical range if it is defined or the logical range otherwise. If the field does not support NULL values, an out of range error will be returned instead. Parameters: ReportType One of HidP_Output or HidP_Feature. UsagePage The usage page to which the given usage refers. LinkCollection (Optional) This value can be used to differentiate between two fields that may have the same UsagePage and Usage but exist in different collections. If the link collection value is zero, this function will set the first field it finds that matches the usage page and usage. Usage The usage whose value HidP_SetScaledUsageValue will set. UsageValue The value to set in the report buffer. See the routine description above for the different interpretations of this value PreparsedData The preparsed data returned from HIDCLASS Report The report packet. ReportLength Length (in bytes) of the given report packet. Return Value: HidP_SetScaledUsageValue returns the following error codes: HIDP_STATUS_SUCCESS -- upon successfully setting the value in the report packet HIDP_STATUS_NULL -- upon successfully setting the value in the report packet as a NULL value HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal to the length specified in the HIDP_CAPS structure for the given ReportType HIDP_STATUS_VALUE_OUT_OF_RANGE -- if the value specified failed to fall within the physical range if it exists or within the logical range otherwise and the field specified by the usage does not allow NULL values HIDP_STATUS_BAD_LOG_PHY_VALUES -- if the field has a physical range but either the logical range is invalid (max <= min) or the physical range is invalid HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and link collection exist but exists in a report with a different report ID than the report being passed in. To set this value, call HidP_SetScaledUsageValue again with a zero-initialized report packet HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link collection combination does not exist in any reports for this ReportType --*/ _Must_inspect_result_ NTSTATUS __stdcall HidP_SetUsageValueArray ( _In_ HIDP_REPORT_TYPE ReportType, _In_ USAGE UsagePage, _In_opt_ USHORT LinkCollection, _In_ USAGE Usage, _In_reads_bytes_(UsageValueByteLength) PCHAR UsageValue, _In_ USHORT UsageValueByteLength, _In_ PHIDP_PREPARSED_DATA PreparsedData, _Inout_updates_bytes_(ReportLength) PCHAR Report, _In_ ULONG ReportLength ); /*++ Routine Descripton: A usage value array occurs when the last usage in the list of usages describing a main item must be repeated because there are less usages defined than there are report counts declared for the given main item. In this case a single value cap is allocated for that usage and the report count of that value cap is set to reflect the number of fields to which that usage refers. HidP_SetUsageValueArray sets the raw bits for that usage which spans more than one field in a report. NOTE: This function currently does not support value arrays where the ReportSize for each of the fields in the array is not a multiple of 8 bits. The UsageValue buffer should have the values set as they would appear in the report buffer. If this function supported non 8-bit multiples for the ReportSize then caller should format the input buffer so that each new value begins at the bit immediately following the last bit of the previous value Parameters: ReportType One of HidP_Output or HidP_Feature. UsagePage The usage page to which the given usage refers. LinkCollection (Optional) This value can be used to differentiate between two fields that may have the same UsagePage and Usage but exist in different collections. If the link collection value is zero, this function will set the first field it finds that matches the usage page and usage. Usage The usage whose value array HidP_SetUsageValueArray will set. UsageValue The buffer with the values to set into the value array. The number of BITS required is found by multiplying the BitSize and ReportCount fields of the Value Cap for this control. The least significant bit of this control found in the given report will be placed in the least significan bit location of the array given (little-endian format), regardless of whether or not the field is byte alligned or if the BitSize is a multiple of sizeof (CHAR). See the above note for current implementation limitations. UsageValueByteLength Length of the UsageValue buffer (in bytes) PreparsedData The preparsed data returned from HIDCLASS Report The report packet. ReportLength Length (in bytes) of the given report packet. Return Value: HIDP_STATUS_SUCCESS -- upon successfully setting the value array in the report packet HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal to the length specified in the HIDP_CAPS structure for the given ReportType HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device for the given ReportType HIDP_STATUS_NOT_VALUE_ARRAY -- if the control specified is not a value array -- a value array will have a ReportCount field in the HIDP_VALUE_CAPS structure that is > 1 Use HidP_SetUsageValue instead HIDP_STATUS_BUFFER_TOO_SMALL -- if the size of the passed in buffer with the values to set is too small (ie. has fewer values than the number of fields in the array HIDP_STATUS_NOT_IMPLEMENTED -- if the usage value array has field sizes that are not multiples of 8 bits, this error code is returned since the function currently does not handle setting into such arrays. HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and link collection exist but exists in a report with a different report ID than the report being passed in. To set this value, call HidP_SetUsageValueArray again with a zero-initialized report packet HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link collection combination does not exist in any reports for this ReportType --*/ _Must_inspect_result_ NTSTATUS __stdcall HidP_GetUsageValue ( _In_ HIDP_REPORT_TYPE ReportType, _In_ USAGE UsagePage, _In_opt_ USHORT LinkCollection, _In_ USAGE Usage, _Out_ PULONG UsageValue, _In_ PHIDP_PREPARSED_DATA PreparsedData, _In_reads_bytes_(ReportLength) PCHAR Report, _In_ ULONG ReportLength ); /* Description HidP_GetUsageValue retrieves the value from the HID Report for the usage specified by the combination of usage page, usage and link collection. If a report packet contains two different fields with the same Usage and UsagePage, they can be distinguished with the optional LinkCollection field value. Parameters: ReportType One of HidP_Input or HidP_Feature. UsagePage The usage page to which the given usage refers. LinkCollection (Optional) This value can be used to differentiate between two fields that may have the same UsagePage and Usage but exist in different collections. If the link collection value is zero, this function will set the first field it finds that matches the usage page and usage. Usage The usage whose value HidP_GetUsageValue will retrieve UsageValue The raw value that is set for the specified field in the report buffer. This value will either fall within the logical range or if NULL values are allowed, a number outside the range to indicate a NULL PreparsedData The preparsed data returned for HIDCLASS Report The report packet. ReportLength Length (in bytes) of the given report packet. Return Value: HidP_GetUsageValue returns the following error codes: HIDP_STATUS_SUCCESS -- upon successfully retrieving the value from the report packet HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal to the length specified in the HIDP_CAPS structure for the given ReportType HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device for the given ReportType HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and link collection exist but exists in a report with a different report ID than the report being passed in. To set this value, call HidP_GetUsageValue again with a different report packet HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link collection combination does not exist in any reports for this ReportType --*/ _Must_inspect_result_ NTSTATUS __stdcall HidP_GetScaledUsageValue ( _In_ HIDP_REPORT_TYPE ReportType, _In_ USAGE UsagePage, _In_opt_ USHORT LinkCollection, _In_ USAGE Usage, _Out_ PLONG UsageValue, _In_ PHIDP_PREPARSED_DATA PreparsedData, _In_reads_bytes_(ReportLength) PCHAR Report, _In_ ULONG ReportLength ); /*++ Description HidP_GetScaledUsageValue retrieves a UsageValue from the HID report packet in the field corresponding to the given usage page and usage. If a report packet contains two different fields with the same Usage and UsagePage, they can be distinguished with the optional LinkCollection field value. If the specified field has a defined physical range, this function converts the logical value that exists in the report packet to the corresponding physical value. If a physical range does not exist, the function will return the logical value. This function will check to verify that the logical value in the report falls within the declared logical range. When doing the conversion between logical and physical values, this function assumes a linear extrapolation between the physical max/min and the logical max/min. (Where logical is the values reported by the device and physical is the value returned by this function). If the data field size is less than 32 bits, then HidP_GetScaledUsageValue will sign extend the value to 32 bits. If the range checking fails but the field has NULL values, the function will set UsageValue to 0 and return HIDP_STATUS_NULL. Otherwise, it returns a HIDP_STATUS_OUT_OF_RANGE error. Parameters: ReportType One of HidP_Output or HidP_Feature. UsagePage The usage page to which the given usage refers. LinkCollection (Optional) This value can be used to differentiate between two fields that may have the same UsagePage and Usage but exist in different collections. If the link collection value is zero, this function will retrieve the first field it finds that matches the usage page and usage. Usage The usage whose value HidP_GetScaledUsageValue will retrieve UsageValue The value retrieved from the report buffer. See the routine description above for the different interpretations of this value PreparsedData The preparsed data returned from HIDCLASS Report The report packet. ReportLength Length (in bytes) of the given report packet. Return Value: HidP_GetScaledUsageValue returns the following error codes: HIDP_STATUS_SUCCESS -- upon successfully retrieving the value from the report packet HIDP_STATUS_NULL -- if the report packet had a NULL value set HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal to the length specified in the HIDP_CAPS structure for the given ReportType HIDP_STATUS_VALUE_OUT_OF_RANGE -- if the value retrieved from the packet falls outside the logical range and the field does not support NULL values HIDP_STATUS_BAD_LOG_PHY_VALUES -- if the field has a physical range but either the logical range is invalid (max <= min) or the physical range is invalid HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and link collection exist but exists in a report with a different report ID than the report being passed in. To set this value, call HidP_GetScaledUsageValue with a different report packet HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link collection combination does not exist in any reports for this ReportType --*/ _Must_inspect_result_ NTSTATUS __stdcall HidP_GetUsageValueArray ( _In_ HIDP_REPORT_TYPE ReportType, _In_ USAGE UsagePage, _In_opt_ USHORT LinkCollection, _In_ USAGE Usage, _Inout_updates_bytes_(UsageValueByteLength) PCHAR UsageValue, _In_ USHORT UsageValueByteLength, _In_ PHIDP_PREPARSED_DATA PreparsedData, _In_reads_bytes_(ReportLength) PCHAR Report, _In_ ULONG ReportLength ); /*++ Routine Descripton: A usage value array occurs when the last usage in the list of usages describing a main item must be repeated because there are less usages defined than there are report counts declared for the given main item. In this case a single value cap is allocated for that usage and the report count of that value cap is set to reflect the number of fields to which that usage refers. HidP_GetUsageValueArray returns the raw bits for that usage which spans more than one field in a report. NOTE: This function currently does not support value arrays where the ReportSize for each of the fields in the array is not a multiple of 8 bits. The UsageValue buffer will have the raw values as they are set in the report packet. Parameters: ReportType One of HidP_Input, HidP_Output or HidP_Feature. UsagePage The usage page to which the given usage refers. LinkCollection (Optional) This value can be used to differentiate between two fields that may have the same UsagePage and Usage but exist in different collections. If the link collection value is zero, this function will set the first field it finds that matches the usage page and usage. Usage The usage whose value HidP_GetUsageValueArray will retreive. UsageValue A pointer to an array of characters where the value will be placed. The number of BITS required is found by multiplying the BitSize and ReportCount fields of the Value Cap for this control. The least significant bit of this control found in the given report will be placed in the least significant bit location of the buffer (little-endian format), regardless of whether or not the field is byte aligned or if the BitSize is a multiple of sizeof (CHAR). See note above about current implementation limitations UsageValueByteLength the length of the given UsageValue buffer. PreparsedData The preparsed data returned by the HIDCLASS Report The report packet. ReportLength Length of the given report packet. Return Value: HIDP_STATUS_SUCCESS -- upon successfully retrieving the value from the report packet HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal to the length specified in the HIDP_CAPS structure for the given ReportType HIDP_STATUS_NOT_VALUE_ARRAY -- if the control specified is not a value array -- a value array will have a ReportCount field in the HIDP_VALUE_CAPS structure that is > 1 Use HidP_GetUsageValue instead HIDP_STATUS_BUFFER_TOO_SMALL -- if the size of the passed in buffer in which to return the array is too small (ie. has fewer values than the number of fields in the array HIDP_STATUS_NOT_IMPLEMENTED -- if the usage value array has field sizes that are not multiples of 8 bits, this error code is returned since the function currently does not handle getting values from such arrays. HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and link collection exist but exists in a report with a different report ID than the report being passed in. To set this value, call HidP_GetUsageValueArray with a different report packet HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link collection combination does not exist in any reports for this ReportType --*/ _Must_inspect_result_ _IRQL_requires_max_(DISPATCH_LEVEL) NTSTATUS __stdcall HidP_UsageListDifference ( _In_reads_(UsageListLength) PUSAGE PreviousUsageList, _In_reads_(UsageListLength) PUSAGE CurrentUsageList, _Out_writes_(UsageListLength) PUSAGE BreakUsageList, _Out_writes_(UsageListLength) PUSAGE MakeUsageList, _In_ ULONG UsageListLength ); /*++ Routine Description: This function will return the difference between a two lists of usages (as might be returned from HidP_GetUsages), In other words, it will return return a list of usages that are in the current list but not the previous list as well as a list of usages that are in the previous list but not the current list. Parameters: PreviousUsageList The list of usages before. CurrentUsageList The list of usages now. BreakUsageList Previous - Current. MakeUsageList Current - Previous. UsageListLength Represents the length of the usage lists in array elements. If comparing two lists with a differing number of array elements, this value should be the size of the larger of the two lists. Any zero found with a list indicates an early termination of the list and any usages found after the first zero will be ignored. --*/ _Must_inspect_result_ _IRQL_requires_max_(DISPATCH_LEVEL) NTSTATUS __stdcall HidP_UsageAndPageListDifference ( _In_reads_(UsageListLength) PUSAGE_AND_PAGE PreviousUsageList, _In_reads_(UsageListLength) PUSAGE_AND_PAGE CurrentUsageList, _Out_writes_(UsageListLength) PUSAGE_AND_PAGE BreakUsageList, _Out_writes_(UsageListLength) PUSAGE_AND_PAGE MakeUsageList, _In_ ULONG UsageListLength ); // // Used to get/set data for single button in a ButtonArray. // typedef struct _HIDP_BUTTON_ARRAY_DATA { // // The position (zero-based index) of the button within the ButtonArray. // Value will always be < HIDP_BUTTON_CAPS.ReportCount // (Note: This is NOT an index 'of' a ButtonArray within the preparsed data.) // USHORT ArrayIndex; // // TRUE when the button at the ArrayIndex (within the ButtonArray) is 'On'. // This is FALSE when the button is 'Off'. // BOOLEAN On; } HIDP_BUTTON_ARRAY_DATA, *PHIDP_BUTTON_ARRAY_DATA; _Must_inspect_result_ NTSTATUS __stdcall HidP_GetButtonArray ( _In_ HIDP_REPORT_TYPE ReportType, _In_ USAGE UsagePage, _In_opt_ USHORT LinkCollection, _In_ USAGE Usage, _Out_writes_to_(*ButtonDataLength, *ButtonDataLength) PHIDP_BUTTON_ARRAY_DATA ButtonData, _Inout_ PUSHORT ButtonDataLength, _In_ PHIDP_PREPARSED_DATA PreparsedData, _In_reads_bytes_(ReportLength) PCHAR Report, _In_ ULONG ReportLength ); /*++ Routine Descripton: A button array occurs when the last usage in the sequence of usages describing a main item, must be repeated because there are less usages defined than the ReportCount declared for the given main item. In this case, a single HIDP_BUTTON_CAPS is allocated for that usage and the ReportCount of the HIDP_BUTTON_CAPS is set to reflect the number of fields the usage refers. A HIDP_BUTTON_CAPS that describes a button array, will always have ReportCount > 1. If ReportCount == 1, then it is not a button array and cannot be used with HidP_GetButtonArray. (see instead HidP_GetUsages) HidP_GetButtonArray returns (via _Out_ parameter) an array of HIDP_BUTTON_ARRAY_DATAs, one for each button (in the first button array found (and within the specified LinkCollection) with the supplied Usage) that is set to ON, for the supplied Report. Parameters: ReportType One of HidP_Input, HidP_Output or HidP_Feature. UsagePage The usage page to which the given usage refers. LinkCollection (Optional) This value can be used to differentiate between two fields that may have the same UsagePage and Usage but exist in different collections. If the LinkCollection value is HIDP_LINK_COLLECTION_UNSPECIFIED, the first found button array matching the UsagePage and Usage will be returned (regardless of location). If the LinkCollection value is HIDP_LINK_COLLECTION_ROOT, the first found button array (in the root collection) matching the UsagePage and Usage will be returned. Usage The usage whose buttons HidP_GetButtonArray will retrieve. ButtonData A HIDP_BUTTON_ARRAY_DATAs array where the data of buttons set to ON will be placed. The number of elements required is the ReportCount field of the HIDP_BUTTON_CAPS for this control. This buffer is provided by the caller. ButtonDataLength As input, this parameter specifies the length of the ButtonData parameter (array) in number of array elements (NOT number of bytes). As output, if HIDP_STATUS_SUCCESS is returned, this value is set to indicate how many of those array elements were filled in by the function. The maximum number of HIDP_BUTTON_ARRAY_DATA that can be returned is determined by HIDP_BUTTON_CAPS.ReportCount If HIDP_STATUS_BUFFER_TOO_SMALL is returned, this value contains the number of array elements needed to successfully complete the request. PreparsedData The preparsed data returned by the HIDCLASS Report The report packet. (Note: The first byte MUST be the ReportId; this will be correctly set if the report is read from the system) ReportLength Length of the given report packet (in bytes). Return Value: HIDP_STATUS_SUCCESS -- upon successfully retrieving the buttons from the report packet HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal to the length specified in the HIDP_CAPS structure for the given ReportType HIDP_STATUS_NOT_BUTTON_ARRAY -- if the control specified is not a button array -- a button array will have a ReportCount field in the HIDP_BUTTON_CAPS structure that is > 1. If ReportCount == 1, Use HidP_GetUsages instead. HIDP_STATUS_BUFFER_TOO_SMALL -- if the size of the passed in buffer in which to return the array is too small (i.e. has fewer values than the number of fields in the array). ButtonDataLength will be set to the required size. HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and link collection exist but exists in a report with a different report ID than the report being passed in. To set this value, call HidP_GetButtonArray with a different report packet HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link collection combination does not exist in any reports for this ReportType --*/ _Must_inspect_result_ NTSTATUS __stdcall HidP_SetButtonArray ( _In_ HIDP_REPORT_TYPE ReportType, _In_ USAGE UsagePage, _In_opt_ USHORT LinkCollection, _In_ USAGE Usage, _In_reads_(ButtonDataLength) PHIDP_BUTTON_ARRAY_DATA ButtonData, _In_ USHORT ButtonDataLength, _In_ PHIDP_PREPARSED_DATA PreparsedData, _Inout_updates_bytes_(ReportLength) PCHAR Report, _In_ ULONG ReportLength ); /*++ Routine Descripton: A button array occurs when the last usage in the sequence of usages describing a main item, must be repeated because there are less usages defined than the ReportCount declared for the given main item. In this case, a single HIDP_BUTTON_CAPS is allocated for that usage and the ReportCount of the HIDP_BUTTON_CAPS is set to reflect the number of fields the usage refers. A HIDP_BUTTON_CAPS that describes a button array, will always have ReportCount > 1. If ReportCount == 1, then it is not a button array and cannot be used with HidP_SetButtonArray. (see instead HidP_SetUsages) HidP_SetButtonArray sets the state of buttons via an array of HIDP_BUTTON_ARRAY_DATAs. HidP_SetButtonArray sets the state of buttons via an array of HIDP_BUTTON_ARRAY_DATAs (for the first button array found (and within the specified LinkCollection) with the supplied Usage) for the supplied Report. Parameters: ReportType One of HidP_Output or HidP_Feature. UsagePage The usage page to which the given usage refers. LinkCollection (Optional) This value can be used to differentiate between two fields that may have the same UsagePage and Usage but exist in different collections. If the LinkCollection value is HIDP_LINK_COLLECTION_UNSPECIFIED, the first found button array matching the UsagePage and Usage will be returned (regardless of location). If the LinkCollection value is HIDP_LINK_COLLECTION_ROOT, the first found button array (in the root collection) matching the UsagePage and Usage will be returned. Usage The usage whose button array HidP_SetButtonArray will set. ButtonData The buffer with the values to set into the button array. ButtonDataLength Number of elements in the ButtonData buffer. PreparsedData The preparsed data returned from HIDCLASS Report The report packet. (Note: The first byte MUST be the ReportId). ReportLength Length of the given report packet (in bytes). Return Value: HIDP_STATUS_SUCCESS -- upon successfully setting the value array in the report packet HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal to the length specified in the HIDP_CAPS structure for the given ReportType HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device for the given ReportType HIDP_STATUS_NOT_BUTTON_ARRAY -- if the control specified is not a button array -- a button array will have a ReportCount field in the HIDP_BUTTON_CAPS structure that is > 1. If ReportCount == 1, Use HidP_SetUsages instead. HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and link collection exist but exists in a report with a different report ID than the report being passed in. To set this value, call HidP_SetButtonArray again with a zero-initialized report packet HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link collection combination does not exist in any reports for this ReportType HIDP_STATUS_DATA_INDEX_OUT_OF_RANGE -- if the ArrayIndex for one of the supplied HIDP_BUTTON_ARRAY_DATA is outside the valid range for this button array (i.e. >= HIDP_BUTTON_CAPS.ReportCount) --*/ // // Produce Make or Break Codes // typedef enum _HIDP_KEYBOARD_DIRECTION { HidP_Keyboard_Break, HidP_Keyboard_Make } HIDP_KEYBOARD_DIRECTION; // // A bitmap of the current shift state of the keyboard when using the // below keyboard usages to i8042 translation function. // typedef struct _HIDP_KEYBOARD_MODIFIER_STATE { union { struct { ULONG LeftControl: 1; ULONG LeftShift: 1; ULONG LeftAlt: 1; ULONG LeftGUI: 1; ULONG RightControl: 1; ULONG RightShift: 1; ULONG RightAlt: 1; ULONG RigthGUI: 1; ULONG CapsLock: 1; ULONG ScollLock: 1; ULONG NumLock: 1; ULONG Reserved: 21; }; ULONG ul; }; } HIDP_KEYBOARD_MODIFIER_STATE, * PHIDP_KEYBOARD_MODIFIER_STATE; // // A call back function to give the i8042 scan codes to the caller of // the below translation function. // typedef BOOLEAN (* PHIDP_INSERT_SCANCODES) ( _In_opt_ PVOID Context, // Some caller supplied context. _In_reads_bytes_(Length) PCHAR NewScanCodes, // A list of i8042 scan codes. _In_ ULONG Length // the length of the scan codes. ); _Must_inspect_result_ NTSTATUS __stdcall HidP_TranslateUsageAndPagesToI8042ScanCodes ( _In_reads_(UsageListLength) PUSAGE_AND_PAGE ChangedUsageList, _In_ ULONG UsageListLength, _In_ HIDP_KEYBOARD_DIRECTION KeyAction, _Inout_ PHIDP_KEYBOARD_MODIFIER_STATE ModifierState, _In_ PHIDP_INSERT_SCANCODES InsertCodesProcedure, _In_opt_ PVOID InsertCodesContext ); /*++ Routine Description: Parameters: --*/ _Must_inspect_result_ NTSTATUS __stdcall HidP_TranslateUsagesToI8042ScanCodes ( _In_reads_(UsageListLength) PUSAGE ChangedUsageList, _In_ ULONG UsageListLength, _In_ HIDP_KEYBOARD_DIRECTION KeyAction, _Inout_ PHIDP_KEYBOARD_MODIFIER_STATE ModifierState, _In_ PHIDP_INSERT_SCANCODES InsertCodesProcedure, _In_opt_ PVOID InsertCodesContext ); /*++ Routine Description: Parameters: --*/ // // Define NT Status codes with Facility Code of FACILITY_HID_ERROR_CODE // // FACILITY_HID_ERROR_CODE defined in ntstatus.h #ifndef FACILITY_HID_ERROR_CODE #define FACILITY_HID_ERROR_CODE 0x11 #endif #define HIDP_ERROR_CODES(SEV, CODE) \ ((NTSTATUS) (((SEV) << 28) | (FACILITY_HID_ERROR_CODE << 16) | (CODE))) #define HIDP_STATUS_SUCCESS (HIDP_ERROR_CODES(0x0,0)) #define HIDP_STATUS_NULL (HIDP_ERROR_CODES(0x8,1)) #define HIDP_STATUS_INVALID_PREPARSED_DATA (HIDP_ERROR_CODES(0xC,1)) #define HIDP_STATUS_INVALID_REPORT_TYPE (HIDP_ERROR_CODES(0xC,2)) #define HIDP_STATUS_INVALID_REPORT_LENGTH (HIDP_ERROR_CODES(0xC,3)) #define HIDP_STATUS_USAGE_NOT_FOUND (HIDP_ERROR_CODES(0xC,4)) #define HIDP_STATUS_VALUE_OUT_OF_RANGE (HIDP_ERROR_CODES(0xC,5)) #define HIDP_STATUS_BAD_LOG_PHY_VALUES (HIDP_ERROR_CODES(0xC,6)) #define HIDP_STATUS_BUFFER_TOO_SMALL (HIDP_ERROR_CODES(0xC,7)) #define HIDP_STATUS_INTERNAL_ERROR (HIDP_ERROR_CODES(0xC,8)) #define HIDP_STATUS_I8042_TRANS_UNKNOWN (HIDP_ERROR_CODES(0xC,9)) #define HIDP_STATUS_INCOMPATIBLE_REPORT_ID (HIDP_ERROR_CODES(0xC,0xA)) #define HIDP_STATUS_NOT_VALUE_ARRAY (HIDP_ERROR_CODES(0xC,0xB)) #define HIDP_STATUS_IS_VALUE_ARRAY (HIDP_ERROR_CODES(0xC,0xC)) #define HIDP_STATUS_DATA_INDEX_NOT_FOUND (HIDP_ERROR_CODES(0xC,0xD)) #define HIDP_STATUS_DATA_INDEX_OUT_OF_RANGE (HIDP_ERROR_CODES(0xC,0xE)) #define HIDP_STATUS_BUTTON_NOT_PRESSED (HIDP_ERROR_CODES(0xC,0xF)) #define HIDP_STATUS_REPORT_DOES_NOT_EXIST (HIDP_ERROR_CODES(0xC,0x10)) #define HIDP_STATUS_NOT_IMPLEMENTED (HIDP_ERROR_CODES(0xC,0x20)) #define HIDP_STATUS_NOT_BUTTON_ARRAY (HIDP_ERROR_CODES(0xC,0x21)) // // We blundered this status code. // #define HIDP_STATUS_I8242_TRANS_UNKNOWN HIDP_STATUS_I8042_TRANS_UNKNOWN #ifndef _KERNEL_MODE typedef NTSTATUS (*PFN_HidP_GetVersionInternal)( _Out_ ULONG* Version); _Must_inspect_result_ inline NTSTATUS __stdcall HidP_GetVersion ( _Out_ ULONG* Version ) /*++ Routine Description: Header-only implementation of HidP versioning, to separate API versions that support HidP_GetButtonArray && HidP_SetButtonArray APIs and those that don't. --*/ { NTSTATUS status = HIDP_STATUS_SUCCESS; *Version = 1; HMODULE module = LoadLibraryW(L"hid.dll"); if (module == NULL) { // Couldn't Load the hid dll. Something is very wrong. return HIDP_STATUS_INTERNAL_ERROR; } PFN_HidP_GetVersionInternal fnVersionInternal = (PFN_HidP_GetVersionInternal) GetProcAddress(module, "HidP_GetVersionInternal"); if (fnVersionInternal != NULL) { status = fnVersionInternal(Version); } else { // This DLL build doesn't support HidP_GetVersionInternal, so the version is 1. } return status; } #endif #include <poppack.h> #if _MSC_VER >= 1200 #pragma warning(pop) #else #pragma warning(default:4115) #pragma warning(default:4201) #pragma warning(default:4214) #endif #ifdef __cplusplus } #endif #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ #pragma endregion #endif
858b4d72c802023ce13d2921e3be1b0d045893b1
99bdb3251fecee538e0630f15f6574054dfc1468
/components/net/at/at_socket/at_socket.h
97c158fac5eec4d6013b18e6da33134e1bee5cbb
[ "Apache-2.0" ]
permissive
RT-Thread/rt-thread
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
3602f891211904a27dcbd51e5ba72fefce7326b2
refs/heads/master
2023-09-01T04:10:20.295801
2023-08-31T16:20:55
2023-08-31T16:20:55
7,408,108
9,599
5,805
Apache-2.0
2023-09-14T13:37:26
2013-01-02T14:49:21
C
UTF-8
C
false
false
6,460
h
at_socket.h
/* * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2018-06-06 chenYong first version * 2022-06-02 xianxistu add implement about "AT server" */ #ifndef __AT_SOCKET_H__ #define __AT_SOCKET_H__ #include <rtthread.h> #include <rtdevice.h> #include <rthw.h> #include <netdb.h> #include <sys/socket.h> #ifdef __cplusplus extern "C" { #endif #ifndef AT_SOCKET_RECV_BFSZ #define AT_SOCKET_RECV_BFSZ 512 #endif #define AT_DEFAULT_RECVMBOX_SIZE 10 #define AT_DEFAULT_ACCEPTMBOX_SIZE 10 /* sal socket magic word */ #define AT_SOCKET_MAGIC 0xA100 #ifdef AT_USING_SOCKET_SERVER #define AT_SOCKET_INFO_LEN (sizeof("SOCKET:") + 4) #endif /* Current state of the AT socket. */ enum at_socket_state { AT_SOCKET_NONE, AT_SOCKET_OPEN, AT_SOCKET_LISTEN, AT_SOCKET_CONNECT, AT_SOCKET_CLOSED }; enum at_socket_type { AT_SOCKET_INVALID = 0, AT_SOCKET_TCP = 0x10, /* TCP IPv4 */ AT_SOCKET_UDP = 0x20, /* UDP IPv4 */ }; typedef enum { AT_SOCKET_EVT_RECV, AT_SOCKET_EVT_CLOSED, #ifdef AT_USING_SOCKET_SERVER AT_SOCKET_EVT_CONNECTED, #endif } at_socket_evt_t; struct at_socket; struct at_device; typedef void (*at_evt_cb_t)(struct at_socket *socket, at_socket_evt_t event, const char *buff, size_t bfsz); /* A callback prototype to inform about events for AT socket */ typedef void (* at_socket_callback)(struct at_socket *conn, int event, uint16_t len); /* AT socket operations function */ struct at_socket_ops { int (*at_connect)(struct at_socket *socket, char *ip, int32_t port, enum at_socket_type type, rt_bool_t is_client); int (*at_closesocket)(struct at_socket *socket); int (*at_send)(struct at_socket *socket, const char *buff, size_t bfsz, enum at_socket_type type); int (*at_domain_resolve)(const char *name, char ip[16]); void (*at_set_event_cb)(at_socket_evt_t event, at_evt_cb_t cb); int (*at_socket)(struct at_device *device, enum at_socket_type type); #ifdef AT_USING_SOCKET_SERVER int (*at_listen)(struct at_socket *socket, int backlog); #endif }; /* AT receive package list structure */ struct at_recv_pkt { rt_slist_t list; size_t bfsz_totle; size_t bfsz_index; char *buff; }; typedef struct at_recv_pkt *at_recv_pkt_t; #ifdef AT_USING_SOCKET_SERVER struct at_listen_state { uint16_t is_listen; uint16_t port; }; #endif struct at_socket { /* AT socket magic word */ uint32_t magic; int socket; #ifdef AT_USING_SOCKET_SERVER struct at_listen_state listen; #endif /* device releated information for the socket */ void *device; /* type of the AT socket (TCP, UDP or RAW) */ enum at_socket_type type; /* current state of the AT socket */ enum at_socket_state state; /* sockets operations */ const struct at_socket_ops *ops; /* receive semaphore, received data release semaphore */ rt_sem_t recv_notice; rt_mutex_t recv_lock; rt_slist_t recvpkt_list; /* timeout to wait for send or received data in milliseconds */ int32_t recv_timeout; int32_t send_timeout; /* A callback function that is informed about events for this AT socket */ at_socket_callback callback; /* number of times data was received, set by event_callback() */ uint16_t rcvevent; /* number of times data was ACKed (free send buffer), set by event_callback() */ uint16_t sendevent; /* error happened for this socket, set by event_callback() */ uint16_t errevent; #ifdef SAL_USING_POSIX rt_wqueue_t wait_head; #endif rt_slist_t list; /* user-specific data */ void *user_data; }; int at_socket(int domain, int type, int protocol); int at_closesocket(int socket); int at_shutdown(int socket, int how); int at_bind(int socket, const struct sockaddr *name, socklen_t namelen); #ifdef AT_USING_SOCKET_SERVER int at_listen(int socket, int backlog); #endif int at_connect(int socket, const struct sockaddr *name, socklen_t namelen); #ifdef AT_USING_SOCKET_SERVER int at_accept(int socket, struct sockaddr *name, socklen_t *namelen); #endif int at_sendto(int socket, const void *data, size_t size, int flags, const struct sockaddr *to, socklen_t tolen); int at_send(int socket, const void *data, size_t size, int flags); int at_recvfrom(int socket, void *mem, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen); int at_recv(int socket, void *mem, size_t len, int flags); int at_getsockopt(int socket, int level, int optname, void *optval, socklen_t *optlen); int at_setsockopt(int socket, int level, int optname, const void *optval, socklen_t optlen); struct hostent *at_gethostbyname(const char *name); int at_getaddrinfo(const char *nodename, const char *servname, const struct addrinfo *hints, struct addrinfo **res); void at_freeaddrinfo(struct addrinfo *ai); struct at_socket *at_get_socket(int socket); #ifdef AT_USING_SOCKET_SERVER struct at_socket *at_get_base_socket(int base_socket); #endif #ifndef RT_USING_SAL #define socket(domain, type, protocol) at_socket(domain, type, protocol) #define closesocket(socket) at_closesocket(socket) #define shutdown(socket, how) at_shutdown(socket, how) #define bind(socket, name, namelen) at_bind(socket, name, namelen) #define connect(socket, name, namelen) at_connect(socket, name, namelen) #define sendto(socket, data, size, flags, to, tolen) at_sendto(socket, data, size, flags, to, tolen) #define send(socket, data, size, flags) at_send(socket, data, size, flags) #define recvfrom(socket, mem, len, flags, from, fromlen) at_recvfrom(socket, mem, len, flags, from, fromlen) #define getsockopt(socket, level, optname, optval, optlen) at_getsockopt(socket, level, optname, optval, optlen) #define setsockopt(socket, level, optname, optval, optlen) at_setsockopt(socket, level, optname, optval, optlen) #define gethostbyname(name) at_gethostbyname(name) #define getaddrinfo(nodename, servname, hints, res) at_getaddrinfo(nodename, servname, hints, res) #define freeaddrinfo(ai) at_freeaddrinfo(ai) #endif /* RT_USING_SAL */ #ifdef __cplusplus } #endif #endif /* AT_SOCKET_H__ */
5924f5fbda2c294dec90982d2dbbcc6e6faa0ffd
3a2071c34e3c35847b2bcc2a5d3b3a74114daa0f
/subversion/libsvn_wc/translate.c
bc5db887e24dc59168ea15db8e288127ac07bf4c
[ "BSD-3-Clause", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-other-permissive", "X11", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference", "MIT", "HPND-Markus-Kuhn", "LicenseRef-scancode-unicode", "Apache-2.0", "FSFAP" ]
permissive
apache/subversion
18a9142afe63f060ffc0814fe0c758c91ad8bd31
dd957c4991e61bde23cc60d13449ea8b65f80c43
refs/heads/trunk
2023-09-04T15:22:36.755177
2023-08-29T19:55:03
2023-08-29T19:55:03
454,263
520
207
Apache-2.0
2023-08-26T14:17:30
2009-12-31T09:00:10
C
UTF-8
C
false
false
16,053
c
translate.c
/* * translate.c : wc-specific eol/keyword substitution * * ==================================================================== * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * ==================================================================== */ #include <stdlib.h> #include <string.h> #include <apr_pools.h> #include <apr_file_io.h> #include <apr_strings.h> #include "svn_private_config.h" #include "svn_types.h" #include "svn_string.h" #include "svn_dirent_uri.h" #include "svn_hash.h" #include "svn_path.h" #include "svn_error.h" #include "svn_subst.h" #include "svn_io.h" #include "svn_props.h" #include "wc.h" #include "adm_files.h" #include "translate.h" #include "props.h" #include "private/svn_wc_private.h" svn_error_t * svn_wc__internal_translated_stream(svn_stream_t **stream, svn_wc__db_t *db, const char *local_abspath, const char *versioned_abspath, apr_uint32_t flags, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { svn_boolean_t special; svn_boolean_t to_nf = flags & SVN_WC_TRANSLATE_TO_NF; svn_subst_eol_style_t style; const char *eol; apr_hash_t *keywords; svn_boolean_t repair_forced = flags & SVN_WC_TRANSLATE_FORCE_EOL_REPAIR; SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath)); SVN_ERR_ASSERT(svn_dirent_is_absolute(versioned_abspath)); SVN_ERR(svn_wc__get_translate_info(&style, &eol, &keywords, &special, db, versioned_abspath, NULL, FALSE, scratch_pool, scratch_pool)); if (special) { if (to_nf) return svn_subst_read_specialfile(stream, local_abspath, result_pool, scratch_pool); return svn_subst_create_specialfile(stream, local_abspath, result_pool, scratch_pool); } if (to_nf) SVN_ERR(svn_stream_open_readonly(stream, local_abspath, result_pool, scratch_pool)); else { apr_file_t *file; /* We don't want the "open-exclusively" feature of the normal svn_stream_open_writable interface. Do this manually. */ SVN_ERR(svn_io_file_open(&file, local_abspath, APR_CREATE | APR_WRITE | APR_BUFFERED, APR_OS_DEFAULT, result_pool)); *stream = svn_stream_from_aprfile2(file, FALSE, result_pool); } if (svn_subst_translation_required(style, eol, keywords, special, TRUE)) { if (to_nf) { if (style == svn_subst_eol_style_native) eol = SVN_SUBST_NATIVE_EOL_STR; else if (style == svn_subst_eol_style_fixed) repair_forced = TRUE; else if (style != svn_subst_eol_style_none) return svn_error_create(SVN_ERR_IO_UNKNOWN_EOL, NULL, NULL); /* Wrap the stream to translate to normal form */ *stream = svn_subst_stream_translated(*stream, eol, repair_forced, keywords, FALSE /* expand */, result_pool); /* streams enforce our contract that TO_NF streams are read-only * by returning SVN_ERR_STREAM_NOT_SUPPORTED when trying to * write to them. */ } else { *stream = svn_subst_stream_translated(*stream, eol, TRUE, keywords, TRUE, result_pool); /* streams enforce our contract that FROM_NF streams are write-only * by returning SVN_ERR_STREAM_NOT_SUPPORTED when trying to * read them. */ } } return SVN_NO_ERROR; } svn_error_t * svn_wc__internal_translated_file(const char **xlated_abspath, const char *src_abspath, svn_wc__db_t *db, const char *versioned_abspath, apr_uint32_t flags, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { svn_subst_eol_style_t style; const char *eol; apr_hash_t *keywords; svn_boolean_t special; SVN_ERR_ASSERT(svn_dirent_is_absolute(src_abspath)); SVN_ERR_ASSERT(svn_dirent_is_absolute(versioned_abspath)); SVN_ERR(svn_wc__get_translate_info(&style, &eol, &keywords, &special, db, versioned_abspath, NULL, FALSE, scratch_pool, scratch_pool)); if (! svn_subst_translation_required(style, eol, keywords, special, TRUE) && (! (flags & SVN_WC_TRANSLATE_FORCE_COPY))) { /* Translation would be a no-op, so return the original file. */ *xlated_abspath = src_abspath; } else /* some translation (or copying) is necessary */ { const char *tmp_dir; const char *tmp_vfile; svn_boolean_t repair_forced = (flags & SVN_WC_TRANSLATE_FORCE_EOL_REPAIR) != 0; svn_boolean_t expand = (flags & SVN_WC_TRANSLATE_TO_NF) == 0; if (flags & SVN_WC_TRANSLATE_USE_GLOBAL_TMP) tmp_dir = NULL; else SVN_ERR(svn_wc__db_temp_wcroot_tempdir(&tmp_dir, db, versioned_abspath, scratch_pool, scratch_pool)); SVN_ERR(svn_io_open_unique_file3(NULL, &tmp_vfile, tmp_dir, (flags & SVN_WC_TRANSLATE_NO_OUTPUT_CLEANUP) ? svn_io_file_del_none : svn_io_file_del_on_pool_cleanup, result_pool, scratch_pool)); /* ### ugh. the repair behavior does NOT match the docstring. bleah. ### all of these translation functions are crap and should go ### away anyways. we'll just deprecate most of the functions and ### properly document the survivors */ if (expand) { /* from normal form */ repair_forced = TRUE; } else { /* to normal form */ if (style == svn_subst_eol_style_native) eol = SVN_SUBST_NATIVE_EOL_STR; else if (style == svn_subst_eol_style_fixed) repair_forced = TRUE; else if (style != svn_subst_eol_style_none) return svn_error_create(SVN_ERR_IO_UNKNOWN_EOL, NULL, NULL); } SVN_ERR(svn_subst_copy_and_translate4(src_abspath, tmp_vfile, eol, repair_forced, keywords, expand, special, cancel_func, cancel_baton, result_pool)); *xlated_abspath = tmp_vfile; } return SVN_NO_ERROR; } void svn_wc__eol_value_from_string(const char **value, const char *eol) { if (eol == NULL) *value = NULL; else if (! strcmp("\n", eol)) *value = "LF"; else if (! strcmp("\r", eol)) *value = "CR"; else if (! strcmp("\r\n", eol)) *value = "CRLF"; else *value = NULL; } svn_error_t * svn_wc__get_translate_info(svn_subst_eol_style_t *style, const char **eol, apr_hash_t **keywords, svn_boolean_t *special, svn_wc__db_t *db, const char *local_abspath, apr_hash_t *props, svn_boolean_t for_normalization, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { const char *propval; SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath)); if (props == NULL) SVN_ERR(svn_wc__get_actual_props(&props, db, local_abspath, scratch_pool, scratch_pool)); if (eol) { propval = svn_prop_get_value(props, SVN_PROP_EOL_STYLE); svn_subst_eol_style_from_value(style, eol, propval); } if (keywords) { propval = svn_prop_get_value(props, SVN_PROP_KEYWORDS); if (!propval || *propval == '\0') *keywords = NULL; else SVN_ERR(svn_wc__expand_keywords(keywords, db, local_abspath, NULL, propval, for_normalization, result_pool, scratch_pool)); } if (special) { propval = svn_prop_get_value(props, SVN_PROP_SPECIAL); *special = (propval != NULL); } return SVN_NO_ERROR; } svn_error_t * svn_wc__expand_keywords(apr_hash_t **keywords, svn_wc__db_t *db, const char *local_abspath, const char *wri_abspath, const char *keyword_list, svn_boolean_t for_normalization, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { svn_revnum_t changed_rev; apr_time_t changed_date; const char *changed_author; const char *url; const char *repos_root_url; if (! for_normalization) { const char *repos_relpath; SVN_ERR(svn_wc__db_read_info(NULL, NULL, NULL, &repos_relpath, &repos_root_url, NULL, &changed_rev, &changed_date, &changed_author, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, db, local_abspath, scratch_pool, scratch_pool)); /* Handle special statuses (e.g. added) */ if (!repos_relpath) SVN_ERR(svn_wc__db_read_repos_info(NULL, &repos_relpath, &repos_root_url, NULL, db, local_abspath, scratch_pool, scratch_pool)); url = svn_path_url_add_component2(repos_root_url, repos_relpath, scratch_pool); } else { url = ""; changed_rev = SVN_INVALID_REVNUM; changed_date = 0; changed_author = ""; repos_root_url = ""; } SVN_ERR(svn_subst_build_keywords3(keywords, keyword_list, apr_psprintf(scratch_pool, "%ld", changed_rev), url, repos_root_url, changed_date, changed_author, result_pool)); if (apr_hash_count(*keywords) == 0) *keywords = NULL; return SVN_NO_ERROR; } svn_error_t * svn_wc__sync_flags_with_props(svn_boolean_t *did_set, svn_wc__db_t *db, const char *local_abspath, apr_pool_t *scratch_pool) { svn_wc__db_status_t status; svn_node_kind_t kind; svn_wc__db_lock_t *lock; apr_hash_t *props = NULL; svn_boolean_t had_props; svn_boolean_t props_mod; if (did_set) *did_set = FALSE; /* ### We'll consolidate these info gathering statements in a future commit. */ SVN_ERR(svn_wc__db_read_info(&status, &kind, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &lock, NULL, NULL, NULL, NULL, NULL, &had_props, &props_mod, NULL, NULL, NULL, db, local_abspath, scratch_pool, scratch_pool)); /* We actually only care about the following flags on files, so just early-out for all other types. Also bail if there is no in-wc representation of the file. */ if (kind != svn_node_file || (status != svn_wc__db_status_normal && status != svn_wc__db_status_added)) return SVN_NO_ERROR; if (props_mod || had_props) SVN_ERR(svn_wc__db_read_props(&props, db, local_abspath, scratch_pool, scratch_pool)); else props = NULL; /* If we get this far, we're going to change *something*, so just set the flag appropriately. */ if (did_set) *did_set = TRUE; /* Handle the read-write bit. */ if (status != svn_wc__db_status_normal || props == NULL || ! svn_hash_gets(props, SVN_PROP_NEEDS_LOCK) || lock) { SVN_ERR(svn_io_set_file_read_write(local_abspath, FALSE, scratch_pool)); } else { /* Special case: If we have an uncommitted svn:needs-lock, we don't set the file read_only just yet. That happens upon commit. */ apr_hash_t *pristine_props; if (! props_mod) pristine_props = props; else if (had_props) SVN_ERR(svn_wc__db_read_pristine_props(&pristine_props, db, local_abspath, scratch_pool, scratch_pool)); else pristine_props = NULL; if (pristine_props && svn_hash_gets(pristine_props, SVN_PROP_NEEDS_LOCK) ) /*&& props && apr_hash_get(props, SVN_PROP_NEEDS_LOCK, APR_HASH_KEY_STRING) )*/ SVN_ERR(svn_io_set_file_read_only(local_abspath, FALSE, scratch_pool)); } /* Windows doesn't care about the execute bit. */ #ifndef WIN32 if (props == NULL || ! svn_hash_gets(props, SVN_PROP_EXECUTABLE)) { /* Turn off the execute bit */ SVN_ERR(svn_io_set_file_executable(local_abspath, FALSE, FALSE, scratch_pool)); } else SVN_ERR(svn_io_set_file_executable(local_abspath, TRUE, FALSE, scratch_pool)); #endif return SVN_NO_ERROR; } svn_error_t * svn_wc__translated_stream(svn_stream_t **stream, svn_wc_context_t *wc_ctx, const char *local_abspath, const char *versioned_abspath, apr_uint32_t flags, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { return svn_error_trace( svn_wc__internal_translated_stream(stream, wc_ctx->db, local_abspath, versioned_abspath, flags, result_pool, scratch_pool)); }
5a78a56b282455aad013b32309ffed4719213faf
fdbb74a95924e2677466614f6ab6e2bb13b2a95a
/third_party/python/Modules/cjkcodecs/__cp949ext_decmap.c
9736b3a42a310a255130adbb5e046bea1d4ea8f9
[ "Python-2.0", "GPL-1.0-or-later", "LicenseRef-scancode-python-cwi", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-other-copyleft", "ISC" ]
permissive
jart/cosmopolitan
fb11b5658939023977060a7c6c71a74093d9cb44
0d748ad58e1063dd1f8560f18a0c75293b9415b7
refs/heads/master
2023-09-06T09:17:29.303607
2023-09-02T03:49:13
2023-09-02T03:50:18
272,457,606
11,887
435
ISC
2023-09-14T17:47:58
2020-06-15T14:16:13
C
UTF-8
C
false
false
12,546
c
__cp949ext_decmap.c
#include "libc/x/x.h" #include "third_party/python/Modules/cjkcodecs/xloadzd.h" /* clang-format off */ static _Atomic(void *) __cp949ext_decmap_ptr; static const unsigned char __cp949ext_decmap_rodata[1970] = { 0xb5, 0x5a, 0x09, 0x53, 0x14, 0x47, 0x14, 0xce, 0x9b, 0xea, 0x74, 0x4d, 0x6d, 0x51, 0xa9, 0x94, 0xbf, 0x58, 0x0c, 0x06, 0x14, 0x03, 0x09, 0x15, 0x14, 0x2c, 0x51, 0x82, 0x20, 0x97, 0x2c, 0x57, 0xb8, 0xef, 0x43, 0xb9, 0x14, 0x10, 0x95, 0xc3, 0x93, 0x18, 0x62, 0xd0, 0xa0, 0x20, 0x2a, 0x1a, 0x4a, 0x4d, 0x66, 0xe6, 0xbd, 0x9d, 0xe9, 0x9e, 0xe9, 0x37, 0x33, 0xbb, 0xa9, 0x74, 0x6d, 0xb1, 0x5b, 0x3d, 0xdf, 0xbc, 0xf7, 0xba, 0xfb, 0xdd, 0x4d, 0x49, 0xd7, 0xd7, 0x96, 0xb0, 0x32, 0x96, 0x33, 0x4e, 0x14, 0x39, 0xbf, 0xdc, 0x8f, 0x3b, 0xa4, 0x6d, 0x59, 0x3f, 0xaf, 0x58, 0x5f, 0xb9, 0xe3, 0xa7, 0x15, 0x77, 0x42, 0x79, 0xe8, 0x0c, 0x81, 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f, 0x45, 0x9e, 0x6c, 0x40, 0xcc, 0x58, 0x03, 0xd0, 0x7e, 0x98, 0xff, 0x99, 0xc9, 0xc4, 0xe2, 0x5f, }; optimizesize void *__cp949ext_decmap(void) { return xloadzd(&__cp949ext_decmap_ptr, __cp949ext_decmap_rodata, 1970, 10204, 9650, 2, 0xb92a1dffu); /* 10.2073% profit */ }
29fea1ae133142e1aacd5b5f76f397b9e7ac822a
b9dc55919b29da24c24f8ee367c5618c9532f56f
/Code_source/Compiled/signal/sfz~/sfizz/library/external/simde/test/x86/avx512/cmp.c
66cf9679e1602e1f8813025d71b8cf3a7c5b21f5
[ "WTFPL", "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause", "BSD-3-Clause", "MIT-0", "ISC", "BSL-1.0", "Apache-2.0", "LGPL-2.0-or-later", "LicenseRef-scancode-public-domain", "LGPL-2.1-only", "MIT", "LicenseRef-scancode-free-unknown" ]
permissive
porres/pd-else
075e8b7ac7a78f442055fbd30d6602cae49c887e
b30e8c13c88bb9752c08f78514d64c6206d6678b
refs/heads/master
2023-08-18T22:26:31.120893
2023-08-18T00:46:59
2023-08-18T00:46:59
56,870,805
238
42
WTFPL
2023-09-12T15:55:56
2016-04-22T16:45:29
C
UTF-8
C
false
false
195,592
c
cmp.c
/* SPDX-License-Identifier: MIT * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, * modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Copyright: * 2020 Evan Nemerson <evan@nemerson.com> * 2020 Himanshi Mathur <himanshi18037@iiitd.ac.in> */ #define SIMDE_TEST_X86_AVX512_INSN cmp #include <test/x86/avx512/test-avx512.h> #include <simde/x86/avx512/set.h> #include <simde/x86/avx512/cmp.h> #include <simde/x86/avx512/mov.h> #include <simde/x86/avx512/set1.h> #if !defined(SIMDE_FAST_MATH) // TODO: SIMDE_FAST_MATH can be tested, but only for tests cases with no // NAN in the parameters or results static int test_simde_mm512_cmp_epu16_mask (SIMDE_MUNIT_TEST_ARGS) { #if 1 static const struct { const uint16_t a[32]; const uint16_t b[32]; const simde__mmask32 r; } test_vec[] = { { { UINT16_C(19065), UINT16_C( 6990), UINT16_C(18172), UINT16_C(18778), UINT16_C(52035), UINT16_C(15647), UINT16_C(45508), UINT16_C( 2342), UINT16_C(25212), UINT16_C(40188), UINT16_C( 3875), UINT16_C(43536), UINT16_C( 7646), UINT16_C(63920), UINT16_C( 2924), UINT16_C(58829), UINT16_C( 7253), UINT16_C(20736), UINT16_C(23394), UINT16_C(42394), UINT16_C(47398), UINT16_C(60130), UINT16_C( 2154), UINT16_C(59379), UINT16_C(61546), UINT16_C(36227), UINT16_C(38143), UINT16_C(56888), UINT16_C(59569), UINT16_C( 7895), UINT16_C(42227), UINT16_C(18435) }, { UINT16_C( 1216), UINT16_C( 8858), UINT16_C(13407), UINT16_C(34247), UINT16_C(43502), UINT16_C(22639), UINT16_C(25521), UINT16_C( 2342), UINT16_C(50003), UINT16_C(40188), UINT16_C( 3875), UINT16_C( 2096), UINT16_C( 7646), UINT16_C(48166), UINT16_C(10924), UINT16_C(58829), UINT16_C( 7253), UINT16_C(20736), UINT16_C(23394), UINT16_C(42394), UINT16_C(47398), UINT16_C(60130), UINT16_C( 2154), UINT16_C(59379), UINT16_C(61546), UINT16_C(36227), UINT16_C(38143), UINT16_C(56888), UINT16_C(59569), UINT16_C( 7895), UINT16_C(42227), UINT16_C(18435) }, UINT32_C(4294940288) }, { { UINT16_C(21127), UINT16_C(39360), UINT16_C(49171), UINT16_C(11290), UINT16_C(65393), UINT16_C(16005), UINT16_C(41270), UINT16_C(49332), UINT16_C( 2836), UINT16_C(36987), UINT16_C(15659), UINT16_C( 1842), UINT16_C(65195), UINT16_C(34280), UINT16_C(26616), UINT16_C(32751), UINT16_C(44985), UINT16_C(52248), UINT16_C(12911), UINT16_C(57592), UINT16_C(32305), UINT16_C(26655), UINT16_C(54047), UINT16_C(13352), UINT16_C(41951), UINT16_C( 2756), UINT16_C(63200), UINT16_C(35602), UINT16_C(64244), UINT16_C(60433), UINT16_C( 97), UINT16_C( 6763) }, { UINT16_C(21127), UINT16_C(39360), UINT16_C(49171), UINT16_C(11290), UINT16_C(65393), UINT16_C(31823), UINT16_C(30705), UINT16_C(53424), UINT16_C( 2836), UINT16_C(36987), UINT16_C(60522), UINT16_C( 1842), UINT16_C(39142), UINT16_C(34280), UINT16_C(26616), UINT16_C(32751), UINT16_C(44985), UINT16_C(52248), UINT16_C(12911), UINT16_C(57592), UINT16_C(32305), UINT16_C(26655), UINT16_C(54047), UINT16_C(13352), UINT16_C(41951), UINT16_C( 2756), UINT16_C(63200), UINT16_C(35602), UINT16_C(64244), UINT16_C(60433), UINT16_C( 97), UINT16_C( 6763) }, UINT32_C( 1184) }, { { UINT16_C( 1551), UINT16_C(58232), UINT16_C(63880), UINT16_C(34567), UINT16_C(41579), UINT16_C(44341), UINT16_C(22616), UINT16_C( 2505), UINT16_C(53988), UINT16_C(53058), UINT16_C( 4802), UINT16_C(63747), UINT16_C(60795), UINT16_C(10897), UINT16_C(28942), UINT16_C( 7487), UINT16_C(46967), UINT16_C( 1), UINT16_C( 2224), UINT16_C( 7047), UINT16_C(48298), UINT16_C( 712), UINT16_C(37140), UINT16_C(63755), UINT16_C(19812), UINT16_C( 9928), UINT16_C(52064), UINT16_C(56095), UINT16_C(45240), UINT16_C(50949), UINT16_C(17442), UINT16_C(39396) }, { UINT16_C(58875), UINT16_C(43929), UINT16_C(63880), UINT16_C(34567), UINT16_C(41579), UINT16_C(61849), UINT16_C(22616), UINT16_C(34026), UINT16_C(45810), UINT16_C(53058), UINT16_C( 4802), UINT16_C(13869), UINT16_C(13177), UINT16_C(39933), UINT16_C(28942), UINT16_C( 7487), UINT16_C(46967), UINT16_C( 1), UINT16_C( 2224), UINT16_C( 7047), UINT16_C(48298), UINT16_C( 712), UINT16_C(37140), UINT16_C(63755), UINT16_C(19812), UINT16_C( 9928), UINT16_C(52064), UINT16_C(56095), UINT16_C(45240), UINT16_C(50949), UINT16_C(17442), UINT16_C(39396) }, UINT32_C(4294960893) }, { { UINT16_C(37483), UINT16_C(46878), UINT16_C(37470), UINT16_C( 7069), UINT16_C(10277), UINT16_C(15811), UINT16_C( 7846), UINT16_C(30462), UINT16_C(35318), UINT16_C( 1395), UINT16_C(42125), UINT16_C(11282), UINT16_C( 76), UINT16_C(26369), UINT16_C(42166), UINT16_C( 8608), UINT16_C(48950), UINT16_C(38105), UINT16_C(30289), UINT16_C(30383), UINT16_C(29599), UINT16_C(17843), UINT16_C(45713), UINT16_C(34747), UINT16_C(11835), UINT16_C(51341), UINT16_C(40914), UINT16_C( 7924), UINT16_C(62879), UINT16_C(22149), UINT16_C( 9881), UINT16_C(53111) }, { UINT16_C(20709), UINT16_C(46878), UINT16_C(37470), UINT16_C( 7069), UINT16_C(10277), UINT16_C( 6059), UINT16_C( 7846), UINT16_C(19870), UINT16_C(11156), UINT16_C( 1395), UINT16_C( 2506), UINT16_C(11282), UINT16_C( 76), UINT16_C(39104), UINT16_C(14129), UINT16_C( 5736), UINT16_C(52104), UINT16_C(20300), UINT16_C(63710), UINT16_C(25781), UINT16_C(24664), UINT16_C(27259), UINT16_C( 6854), UINT16_C(23223), UINT16_C(52293), UINT16_C( 4289), UINT16_C(18390), UINT16_C(54650), UINT16_C(14930), UINT16_C(33645), UINT16_C(54641), UINT16_C(63897) }, UINT32_C( 0) }, { { UINT16_C(32584), UINT16_C(64989), UINT16_C(14052), UINT16_C(24413), UINT16_C( 9120), UINT16_C(22649), UINT16_C(49022), UINT16_C(16164), UINT16_C(64207), UINT16_C(18822), UINT16_C(55503), UINT16_C(15747), UINT16_C(62555), UINT16_C(62482), UINT16_C(46062), UINT16_C(14041), UINT16_C(46899), UINT16_C( 5940), UINT16_C(37357), UINT16_C(36214), UINT16_C(61621), UINT16_C(13285), UINT16_C( 2735), UINT16_C(32370), UINT16_C(63748), UINT16_C(54471), UINT16_C(19153), UINT16_C(11537), UINT16_C( 9022), UINT16_C(11297), UINT16_C(64471), UINT16_C( 2659) }, { UINT16_C(38834), UINT16_C(40737), UINT16_C(14052), UINT16_C(56620), UINT16_C( 4743), UINT16_C(13840), UINT16_C(49022), UINT16_C( 8372), UINT16_C(64207), UINT16_C(18822), UINT16_C( 1477), UINT16_C( 1146), UINT16_C(62555), UINT16_C( 48), UINT16_C(37783), UINT16_C(14041), UINT16_C(46899), UINT16_C( 5940), UINT16_C(37357), UINT16_C(36214), UINT16_C(61621), UINT16_C(13285), UINT16_C( 2735), UINT16_C(32370), UINT16_C(63748), UINT16_C(54471), UINT16_C(19153), UINT16_C(11537), UINT16_C( 9022), UINT16_C(11297), UINT16_C(64471), UINT16_C( 2659) }, UINT32_C( 27835) }, { { UINT16_C(32187), UINT16_C(60544), UINT16_C(42951), UINT16_C(18477), UINT16_C(61929), UINT16_C(19581), UINT16_C(11569), UINT16_C(48804), UINT16_C( 419), UINT16_C( 7622), UINT16_C(27271), UINT16_C( 3528), UINT16_C( 1701), UINT16_C(10653), UINT16_C(22638), UINT16_C(10901), UINT16_C( 5845), UINT16_C(40214), UINT16_C(17341), UINT16_C(42725), UINT16_C(25140), UINT16_C(26099), UINT16_C(38799), UINT16_C(13091), UINT16_C(60056), UINT16_C( 8016), UINT16_C( 6228), UINT16_C(64044), UINT16_C(51486), UINT16_C(36131), UINT16_C(47393), UINT16_C(63159) }, { UINT16_C(32187), UINT16_C(35987), UINT16_C(30736), UINT16_C(17458), UINT16_C( 9690), UINT16_C(27305), UINT16_C(11569), UINT16_C(48804), UINT16_C( 419), UINT16_C( 7622), UINT16_C(40710), UINT16_C( 9221), UINT16_C(10344), UINT16_C(35249), UINT16_C(22638), UINT16_C(45184), UINT16_C( 4917), UINT16_C(17724), UINT16_C(28556), UINT16_C(26249), UINT16_C(12948), UINT16_C(20944), UINT16_C(28159), UINT16_C(46501), UINT16_C( 6491), UINT16_C(25024), UINT16_C(50616), UINT16_C( 8581), UINT16_C(14318), UINT16_C(53162), UINT16_C(10911), UINT16_C(54656) }, UINT32_C(3648734175) }, { { UINT16_C(51738), UINT16_C(42027), UINT16_C(49200), UINT16_C( 470), UINT16_C(54545), UINT16_C(46702), UINT16_C(51595), UINT16_C(19407), UINT16_C(34858), UINT16_C(45073), UINT16_C(65449), UINT16_C(21479), UINT16_C(34510), UINT16_C(20094), UINT16_C(48219), UINT16_C(30219), UINT16_C(13958), UINT16_C(46618), UINT16_C(61686), UINT16_C( 1975), UINT16_C( 9926), UINT16_C(20926), UINT16_C(36335), UINT16_C( 6812), UINT16_C(44309), UINT16_C(48842), UINT16_C(45484), UINT16_C(31506), UINT16_C(36919), UINT16_C(37833), UINT16_C(54348), UINT16_C(53769) }, { UINT16_C(51738), UINT16_C( 392), UINT16_C(49200), UINT16_C( 470), UINT16_C(51046), UINT16_C(21802), UINT16_C(51028), UINT16_C(19407), UINT16_C(34858), UINT16_C(45073), UINT16_C(15082), UINT16_C( 8860), UINT16_C(26058), UINT16_C(20094), UINT16_C(48219), UINT16_C(30219), UINT16_C(13958), UINT16_C(46618), UINT16_C(61686), UINT16_C( 1975), UINT16_C( 9926), UINT16_C(20926), UINT16_C(36335), UINT16_C( 6812), UINT16_C(44309), UINT16_C(48842), UINT16_C(45484), UINT16_C(31506), UINT16_C(36919), UINT16_C(37833), UINT16_C(54348), UINT16_C(53769) }, UINT32_C( 7282) }, { { UINT16_C( 9066), UINT16_C(14443), UINT16_C(33338), UINT16_C(42801), UINT16_C(61677), UINT16_C(49795), UINT16_C(38948), UINT16_C(31167), UINT16_C(63384), UINT16_C(47722), UINT16_C(49658), UINT16_C( 5009), UINT16_C( 9809), UINT16_C(10004), UINT16_C(34716), UINT16_C( 1859), UINT16_C(44714), UINT16_C(58687), UINT16_C(28720), UINT16_C( 7564), UINT16_C( 3937), UINT16_C(34271), UINT16_C(40871), UINT16_C(16639), UINT16_C(27030), UINT16_C(37114), UINT16_C(35882), UINT16_C(31907), UINT16_C(47282), UINT16_C(20387), UINT16_C(58943), UINT16_C(59734) }, { UINT16_C(38292), UINT16_C(50638), UINT16_C(33338), UINT16_C(26594), UINT16_C(49769), UINT16_C( 4588), UINT16_C(60257), UINT16_C(31167), UINT16_C(19285), UINT16_C(32648), UINT16_C(49658), UINT16_C( 5009), UINT16_C(40675), UINT16_C( 8921), UINT16_C(12164), UINT16_C( 6412), UINT16_C(56004), UINT16_C(51934), UINT16_C(49205), UINT16_C(40497), UINT16_C( 7810), UINT16_C(58287), UINT16_C( 9), UINT16_C(24283), UINT16_C(25420), UINT16_C( 9182), UINT16_C(55694), UINT16_C(29357), UINT16_C(34424), UINT16_C(64660), UINT16_C(41141), UINT16_C(31253) }, UINT32_MAX }, }; simde__m512i a, b; simde__mmask32 r; a = simde_mm512_loadu_si512(test_vec[0].a); b = simde_mm512_loadu_si512(test_vec[0].b); r = simde_mm512_cmp_epu16_mask(a, b, SIMDE_MM_CMPINT_EQ); simde_assert_equal_mmask32(r, test_vec[0].r); a = simde_mm512_loadu_si512(test_vec[1].a); b = simde_mm512_loadu_si512(test_vec[1].b); r = simde_mm512_cmp_epu16_mask(a, b, SIMDE_MM_CMPINT_LT); simde_assert_equal_mmask32(r, test_vec[1].r); a = simde_mm512_loadu_si512(test_vec[2].a); b = simde_mm512_loadu_si512(test_vec[2].b); r = simde_mm512_cmp_epu16_mask(a, b, SIMDE_MM_CMPINT_LE); simde_assert_equal_mmask32(r, test_vec[2].r); a = simde_mm512_loadu_si512(test_vec[3].a); b = simde_mm512_loadu_si512(test_vec[3].b); r = simde_mm512_cmp_epu16_mask(a, b, SIMDE_MM_CMPINT_FALSE); simde_assert_equal_mmask32(r, test_vec[3].r); a = simde_mm512_loadu_si512(test_vec[4].a); b = simde_mm512_loadu_si512(test_vec[4].b); r = simde_mm512_cmp_epu16_mask(a, b, SIMDE_MM_CMPINT_NE); simde_assert_equal_mmask32(r, test_vec[4].r); a = simde_mm512_loadu_si512(test_vec[5].a); b = simde_mm512_loadu_si512(test_vec[5].b); r = simde_mm512_cmp_epu16_mask(a, b, SIMDE_MM_CMPINT_NLT); simde_assert_equal_mmask32(r, test_vec[5].r); a = simde_mm512_loadu_si512(test_vec[6].a); b = simde_mm512_loadu_si512(test_vec[6].b); r = simde_mm512_cmp_epu16_mask(a, b, SIMDE_MM_CMPINT_NLE); simde_assert_equal_mmask32(r, test_vec[6].r); a = simde_mm512_loadu_si512(test_vec[7].a); b = simde_mm512_loadu_si512(test_vec[7].b); r = simde_mm512_cmp_epu16_mask(a, b, SIMDE_MM_CMPINT_TRUE); simde_assert_equal_mmask32(r, test_vec[7].r); return 0; #else fputc('\n', stdout); simde__m512i a, b; simde__mmask32 r; a = simde_test_x86_random_i16x32(); b = simde_test_x86_random_i16x32(); b = simde_mm512_mask_mov_epi16(a, HEDLEY_STATIC_CAST(simde__mmask32, simde_test_codegen_random_i16()), b); r = simde_mm512_cmp_epu16_mask(a, b, SIMDE_MM_CMPINT_EQ); simde_test_x86_write_u16x32(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_u16x32(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask32(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_i16x32(); b = simde_test_x86_random_i16x32(); b = simde_mm512_mask_mov_epi16(a, HEDLEY_STATIC_CAST(simde__mmask32, simde_test_codegen_random_i16()), b); r = simde_mm512_cmp_epu16_mask(a, b, SIMDE_MM_CMPINT_LT); simde_test_x86_write_u16x32(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_u16x32(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask32(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_i16x32(); b = simde_test_x86_random_i16x32(); b = simde_mm512_mask_mov_epi16(a, HEDLEY_STATIC_CAST(simde__mmask32, simde_test_codegen_random_i16()), b); r = simde_mm512_cmp_epu16_mask(a, b, SIMDE_MM_CMPINT_LE); simde_test_x86_write_u16x32(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_u16x32(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask32(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_i16x32(); b = simde_test_x86_random_i16x32(); b = simde_mm512_mask_mov_epi16(a, HEDLEY_STATIC_CAST(simde__mmask32, simde_test_codegen_random_i16()), b); r = simde_mm512_cmp_epu16_mask(a, b, SIMDE_MM_CMPINT_FALSE); simde_test_x86_write_u16x32(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_u16x32(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask32(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_i16x32(); b = simde_test_x86_random_i16x32(); b = simde_mm512_mask_mov_epi16(a, HEDLEY_STATIC_CAST(simde__mmask32, simde_test_codegen_random_i16()), b); r = simde_mm512_cmp_epu16_mask(a, b, SIMDE_MM_CMPINT_NE); simde_test_x86_write_u16x32(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_u16x32(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask32(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_i16x32(); b = simde_test_x86_random_i16x32(); b = simde_mm512_mask_mov_epi16(a, HEDLEY_STATIC_CAST(simde__mmask32, simde_test_codegen_random_i16()), b); r = simde_mm512_cmp_epu16_mask(a, b, SIMDE_MM_CMPINT_NLT); simde_test_x86_write_u16x32(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_u16x32(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask32(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_i16x32(); b = simde_test_x86_random_i16x32(); b = simde_mm512_mask_mov_epi16(a, HEDLEY_STATIC_CAST(simde__mmask32, simde_test_codegen_random_i16()), b); r = simde_mm512_cmp_epu16_mask(a, b, SIMDE_MM_CMPINT_NLE); simde_test_x86_write_u16x32(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_u16x32(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask32(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_i16x32(); b = simde_test_x86_random_i16x32(); b = simde_mm512_mask_mov_epi16(a, HEDLEY_STATIC_CAST(simde__mmask32, simde_test_codegen_random_i16()), b); r = simde_mm512_cmp_epu16_mask(a, b, SIMDE_MM_CMPINT_TRUE); simde_test_x86_write_u16x32(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_u16x32(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask32(2, r, SIMDE_TEST_VEC_POS_LAST); return 1; #endif } static int test_simde_mm512_mask_cmp_epu16_mask (SIMDE_MUNIT_TEST_ARGS) { #if 1 static const struct { const simde__mmask32 k1; const uint16_t a[32]; const uint16_t b[32]; const simde__mmask32 r; } test_vec[] = { { UINT32_C(2942811224), { UINT16_C(57010), UINT16_C(26098), UINT16_C( 9731), UINT16_C(21293), UINT16_C(10159), UINT16_C(22220), UINT16_C(21818), UINT16_C(34232), UINT16_C(16167), UINT16_C(43958), UINT16_C(29019), UINT16_C(18972), UINT16_C(42940), UINT16_C( 5510), UINT16_C(60771), UINT16_C( 5572), UINT16_C(47051), UINT16_C(53114), UINT16_C(43229), UINT16_C(36130), UINT16_C(61135), UINT16_C( 2531), UINT16_C(40004), UINT16_C(27534), UINT16_C(17883), UINT16_C(13846), UINT16_C(12982), UINT16_C(29568), UINT16_C( 1753), UINT16_C(15496), UINT16_C(19699), UINT16_C(48977) }, { UINT16_C(52227), UINT16_C(26098), UINT16_C(45172), UINT16_C(21293), UINT16_C(20895), UINT16_C(58188), UINT16_C(56301), UINT16_C(51278), UINT16_C(16167), UINT16_C(43958), UINT16_C(32663), UINT16_C(28745), UINT16_C(53638), UINT16_C(31149), UINT16_C(65054), UINT16_C( 8504), UINT16_C(50890), UINT16_C(15874), UINT16_C(28791), UINT16_C( 5761), UINT16_C(52930), UINT16_C(45049), UINT16_C(18345), UINT16_C(51576), UINT16_C(30635), UINT16_C(17055), UINT16_C(59894), UINT16_C(31923), UINT16_C(24762), UINT16_C(55542), UINT16_C(11870), UINT16_C(10746) }, UINT32_C( 8) }, { UINT32_C(3916262503), { UINT16_C(12162), UINT16_C(31671), UINT16_C(24798), UINT16_C(22210), UINT16_C(27945), UINT16_C(51405), UINT16_C(50352), UINT16_C(25521), UINT16_C(27712), UINT16_C(14019), UINT16_C( 8516), UINT16_C(15973), UINT16_C(23114), UINT16_C(45627), UINT16_C(43206), UINT16_C(18587), UINT16_C(21207), UINT16_C(46531), UINT16_C(34226), UINT16_C(56076), UINT16_C(55794), UINT16_C(41635), UINT16_C(21917), UINT16_C(56837), UINT16_C(51393), UINT16_C( 1300), UINT16_C(31210), UINT16_C(13380), UINT16_C(32723), UINT16_C(39398), UINT16_C(33063), UINT16_C(65249) }, { UINT16_C(42195), UINT16_C(31671), UINT16_C(48937), UINT16_C(22210), UINT16_C( 1177), UINT16_C(14014), UINT16_C(50265), UINT16_C(25521), UINT16_C(27712), UINT16_C(30239), UINT16_C( 8516), UINT16_C(15973), UINT16_C(23114), UINT16_C(45627), UINT16_C(43206), UINT16_C(18587), UINT16_C(21207), UINT16_C(46531), UINT16_C(34226), UINT16_C(56076), UINT16_C(55794), UINT16_C(41635), UINT16_C(21917), UINT16_C(56837), UINT16_C(51393), UINT16_C( 1300), UINT16_C(31210), UINT16_C(13380), UINT16_C(32723), UINT16_C(39398), UINT16_C(33063), UINT16_C(65249) }, UINT32_C( 5) }, { UINT32_C(3503288309), { UINT16_C(40707), UINT16_C(19817), UINT16_C(51145), UINT16_C( 3243), UINT16_C(13233), UINT16_C( 4463), UINT16_C(13917), UINT16_C(64797), UINT16_C(47839), UINT16_C(37292), UINT16_C(19818), UINT16_C( 75), UINT16_C(49283), UINT16_C(30723), UINT16_C(53936), UINT16_C(45896), UINT16_C(45425), UINT16_C(14848), UINT16_C(43896), UINT16_C(10567), UINT16_C(46814), UINT16_C(15163), UINT16_C(22764), UINT16_C(52024), UINT16_C(58642), UINT16_C(31837), UINT16_C(43058), UINT16_C(46460), UINT16_C(32617), UINT16_C( 6445), UINT16_C(30033), UINT16_C(50124) }, { UINT16_C(40707), UINT16_C(19817), UINT16_C(51145), UINT16_C( 3243), UINT16_C( 1019), UINT16_C(59281), UINT16_C(51803), UINT16_C(28083), UINT16_C(47839), UINT16_C(37292), UINT16_C(19818), UINT16_C( 8598), UINT16_C(50149), UINT16_C(14138), UINT16_C( 1592), UINT16_C(45896), UINT16_C(45425), UINT16_C(14848), UINT16_C(43896), UINT16_C(10567), UINT16_C(46814), UINT16_C(15163), UINT16_C(22764), UINT16_C(52024), UINT16_C(58642), UINT16_C(31837), UINT16_C(43058), UINT16_C(46460), UINT16_C(32617), UINT16_C( 6445), UINT16_C(30033), UINT16_C(50124) }, UINT32_C(3503263589) }, { UINT32_C(3107859481), { UINT16_C( 2147), UINT16_C(33258), UINT16_C(58925), UINT16_C(48979), UINT16_C(13456), UINT16_C( 7227), UINT16_C( 7630), UINT16_C(35389), UINT16_C( 8933), UINT16_C(58240), UINT16_C(31806), UINT16_C(47580), UINT16_C(52299), UINT16_C(25650), UINT16_C(28920), UINT16_C(23325), UINT16_C( 2168), UINT16_C(42460), UINT16_C(12270), UINT16_C(32357), UINT16_C(41060), UINT16_C(12954), UINT16_C(55486), UINT16_C(41916), UINT16_C(15610), UINT16_C(14470), UINT16_C(25273), UINT16_C( 1266), UINT16_C( 9262), UINT16_C( 9833), UINT16_C(34452), UINT16_C( 3457) }, { UINT16_C( 2147), UINT16_C(31922), UINT16_C( 6029), UINT16_C(61947), UINT16_C(13456), UINT16_C( 7227), UINT16_C(57453), UINT16_C(26393), UINT16_C( 8933), UINT16_C(54944), UINT16_C(31806), UINT16_C(47580), UINT16_C(52299), UINT16_C(25650), UINT16_C(55498), UINT16_C(22615), UINT16_C( 2614), UINT16_C(50389), UINT16_C(53281), UINT16_C(55733), UINT16_C(55653), UINT16_C(54095), UINT16_C(26810), UINT16_C(55098), UINT16_C(55816), UINT16_C( 2733), UINT16_C(34668), UINT16_C( 8762), UINT16_C(37323), UINT16_C(38253), UINT16_C(50282), UINT16_C(41197) }, UINT32_C( 0) }, { UINT32_C( 445837412), { UINT16_C(63689), UINT16_C( 6643), UINT16_C(44491), UINT16_C( 1409), UINT16_C(35204), UINT16_C(12768), UINT16_C(19603), UINT16_C(52921), UINT16_C(33903), UINT16_C(56415), UINT16_C(51481), UINT16_C( 1696), UINT16_C(28522), UINT16_C(52937), UINT16_C(23391), UINT16_C(10472), UINT16_C(56403), UINT16_C( 7745), UINT16_C(50057), UINT16_C( 3620), UINT16_C( 1100), UINT16_C(57407), UINT16_C(63568), UINT16_C(49070), UINT16_C( 3452), UINT16_C(38299), UINT16_C(15575), UINT16_C(16796), UINT16_C(26027), UINT16_C( 2575), UINT16_C(63680), UINT16_C( 5170) }, { UINT16_C(29908), UINT16_C(23858), UINT16_C(22071), UINT16_C( 1409), UINT16_C(35204), UINT16_C(12768), UINT16_C( 4515), UINT16_C( 8298), UINT16_C(33903), UINT16_C(56415), UINT16_C(51481), UINT16_C( 1696), UINT16_C(28522), UINT16_C(30711), UINT16_C(23391), UINT16_C(10472), UINT16_C(56403), UINT16_C( 7745), UINT16_C(50057), UINT16_C( 3620), UINT16_C( 1100), UINT16_C(57407), UINT16_C(63568), UINT16_C(49070), UINT16_C( 3452), UINT16_C(38299), UINT16_C(15575), UINT16_C(16796), UINT16_C(26027), UINT16_C( 2575), UINT16_C(63680), UINT16_C( 5170) }, UINT32_C( 8260) }, { UINT32_C(2751257419), { UINT16_C(33353), UINT16_C(25439), UINT16_C(11436), UINT16_C(63207), UINT16_C(28952), UINT16_C(64246), UINT16_C(18237), UINT16_C(62995), UINT16_C(29262), UINT16_C(52646), UINT16_C(32528), UINT16_C(49622), UINT16_C(40438), UINT16_C(17121), UINT16_C(56696), UINT16_C(49893), UINT16_C(17504), UINT16_C( 3109), UINT16_C( 3184), UINT16_C(34819), UINT16_C(63869), UINT16_C(47746), UINT16_C(38208), UINT16_C(36528), UINT16_C(22024), UINT16_C( 6235), UINT16_C(13013), UINT16_C(52441), UINT16_C(48079), UINT16_C(18446), UINT16_C(62360), UINT16_C(63498) }, { UINT16_C(33353), UINT16_C(43013), UINT16_C( 2107), UINT16_C(47153), UINT16_C(45825), UINT16_C(64246), UINT16_C( 8777), UINT16_C(20943), UINT16_C(29262), UINT16_C(52646), UINT16_C(17245), UINT16_C(49622), UINT16_C(40438), UINT16_C(38516), UINT16_C(56696), UINT16_C(21391), UINT16_C(38061), UINT16_C(59643), UINT16_C(11420), UINT16_C(40352), UINT16_C( 4832), UINT16_C(10718), UINT16_C(44340), UINT16_C(44154), UINT16_C(58328), UINT16_C(13818), UINT16_C( 4902), UINT16_C( 9314), UINT16_C(54843), UINT16_C(22203), UINT16_C(19029), UINT16_C( 681) }, UINT32_C(2150685513) }, { UINT32_C(2345761515), { UINT16_C(45335), UINT16_C(62878), UINT16_C(53978), UINT16_C(21666), UINT16_C(31615), UINT16_C(31031), UINT16_C(24240), UINT16_C( 4748), UINT16_C(51074), UINT16_C(15849), UINT16_C(15901), UINT16_C(50823), UINT16_C(25920), UINT16_C(11115), UINT16_C(15583), UINT16_C(63159), UINT16_C(21997), UINT16_C(51179), UINT16_C(36391), UINT16_C(42523), UINT16_C(21001), UINT16_C(47391), UINT16_C(44208), UINT16_C(13260), UINT16_C(46451), UINT16_C(37232), UINT16_C(63731), UINT16_C(13143), UINT16_C(49757), UINT16_C(15711), UINT16_C( 5886), UINT16_C(60211) }, { UINT16_C(45335), UINT16_C(37554), UINT16_C(53978), UINT16_C(21666), UINT16_C(22560), UINT16_C(31031), UINT16_C(24240), UINT16_C( 4748), UINT16_C(51074), UINT16_C(15849), UINT16_C(24684), UINT16_C(50823), UINT16_C(30243), UINT16_C(11115), UINT16_C(14988), UINT16_C(63245), UINT16_C(48985), UINT16_C( 1673), UINT16_C(49805), UINT16_C(44476), UINT16_C(11035), UINT16_C( 8061), UINT16_C(33127), UINT16_C(22423), UINT16_C(41205), UINT16_C(24891), UINT16_C(20993), UINT16_C( 9258), UINT16_C(12744), UINT16_C(21573), UINT16_C(21099), UINT16_C(50251) }, UINT32_C(2337292290) }, { UINT32_C(2258083786), { UINT16_C(45644), UINT16_C(51633), UINT16_C( 6353), UINT16_C(26954), UINT16_C(16240), UINT16_C(43785), UINT16_C( 2720), UINT16_C(52221), UINT16_C(50478), UINT16_C(29948), UINT16_C(26393), UINT16_C(25798), UINT16_C(55339), UINT16_C(62776), UINT16_C(53111), UINT16_C(50043), UINT16_C(11393), UINT16_C(21389), UINT16_C(55109), UINT16_C(46524), UINT16_C(50455), UINT16_C(46944), UINT16_C(24016), UINT16_C(65154), UINT16_C(32290), UINT16_C(15218), UINT16_C(14821), UINT16_C( 4255), UINT16_C(55057), UINT16_C(35077), UINT16_C(32935), UINT16_C(10316) }, { UINT16_C(45644), UINT16_C(51633), UINT16_C(14257), UINT16_C(26954), UINT16_C( 2045), UINT16_C(52607), UINT16_C( 612), UINT16_C(34507), UINT16_C(50478), UINT16_C(29948), UINT16_C(24695), UINT16_C(34934), UINT16_C(55339), UINT16_C(62776), UINT16_C(24316), UINT16_C(50043), UINT16_C(11393), UINT16_C(21389), UINT16_C(55109), UINT16_C(46524), UINT16_C(50455), UINT16_C(46944), UINT16_C(24016), UINT16_C(65154), UINT16_C(32290), UINT16_C(15218), UINT16_C(14821), UINT16_C( 4255), UINT16_C(55057), UINT16_C(35077), UINT16_C(32935), UINT16_C(10316) }, UINT32_C(2258083786) }, }; simde__m512i a, b; simde__mmask32 r; a = simde_mm512_loadu_si512(test_vec[0].a); b = simde_mm512_loadu_si512(test_vec[0].b); r = simde_mm512_mask_cmp_epu16_mask(test_vec[0].k1, a, b, SIMDE_MM_CMPINT_EQ); simde_assert_equal_mmask32(r, test_vec[0].r); a = simde_mm512_loadu_si512(test_vec[1].a); b = simde_mm512_loadu_si512(test_vec[1].b); r = simde_mm512_mask_cmp_epu16_mask(test_vec[1].k1, a, b, SIMDE_MM_CMPINT_LT); simde_assert_equal_mmask32(r, test_vec[1].r); a = simde_mm512_loadu_si512(test_vec[2].a); b = simde_mm512_loadu_si512(test_vec[2].b); r = simde_mm512_mask_cmp_epu16_mask(test_vec[2].k1, a, b, SIMDE_MM_CMPINT_LE); simde_assert_equal_mmask32(r, test_vec[2].r); a = simde_mm512_loadu_si512(test_vec[3].a); b = simde_mm512_loadu_si512(test_vec[3].b); r = simde_mm512_mask_cmp_epu16_mask(test_vec[3].k1, a, b, SIMDE_MM_CMPINT_FALSE); simde_assert_equal_mmask32(r, test_vec[3].r); a = simde_mm512_loadu_si512(test_vec[4].a); b = simde_mm512_loadu_si512(test_vec[4].b); r = simde_mm512_mask_cmp_epu16_mask(test_vec[4].k1, a, b, SIMDE_MM_CMPINT_NE); simde_assert_equal_mmask32(r, test_vec[4].r); a = simde_mm512_loadu_si512(test_vec[5].a); b = simde_mm512_loadu_si512(test_vec[5].b); r = simde_mm512_mask_cmp_epu16_mask(test_vec[5].k1, a, b, SIMDE_MM_CMPINT_NLT); simde_assert_equal_mmask32(r, test_vec[5].r); a = simde_mm512_loadu_si512(test_vec[6].a); b = simde_mm512_loadu_si512(test_vec[6].b); r = simde_mm512_mask_cmp_epu16_mask(test_vec[6].k1, a, b, SIMDE_MM_CMPINT_NLE); simde_assert_equal_mmask32(r, test_vec[6].r); a = simde_mm512_loadu_si512(test_vec[7].a); b = simde_mm512_loadu_si512(test_vec[7].b); r = simde_mm512_mask_cmp_epu16_mask(test_vec[7].k1, a, b, SIMDE_MM_CMPINT_TRUE); simde_assert_equal_mmask32(r, test_vec[7].r); return 0; #else fputc('\n', stdout); simde__m512i a, b; simde__mmask32 r, k1; k1 = simde_test_x86_random_mmask32(); a = simde_test_x86_random_i16x32(); b = simde_test_x86_random_i16x32(); b = simde_mm512_mask_mov_epi16(a, HEDLEY_STATIC_CAST(simde__mmask32, simde_test_codegen_random_i16()), b); r = simde_mm512_mask_cmp_epu16_mask(k1, a, b, SIMDE_MM_CMPINT_EQ); simde_test_x86_write_mmask32(2, k1, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_u16x32(2, a, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_u16x32(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask32(2, r, SIMDE_TEST_VEC_POS_LAST); k1 = simde_test_x86_random_mmask32(); a = simde_test_x86_random_i16x32(); b = simde_test_x86_random_i16x32(); b = simde_mm512_mask_mov_epi16(a, HEDLEY_STATIC_CAST(simde__mmask32, simde_test_codegen_random_i16()), b); r = simde_mm512_mask_cmp_epu16_mask(k1, a, b, SIMDE_MM_CMPINT_LT); simde_test_x86_write_mmask32(2, k1, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_u16x32(2, a, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_u16x32(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask32(2, r, SIMDE_TEST_VEC_POS_LAST); k1 = simde_test_x86_random_mmask32(); a = simde_test_x86_random_i16x32(); b = simde_test_x86_random_i16x32(); b = simde_mm512_mask_mov_epi16(a, HEDLEY_STATIC_CAST(simde__mmask32, simde_test_codegen_random_i16()), b); r = simde_mm512_mask_cmp_epu16_mask(k1, a, b, SIMDE_MM_CMPINT_LE); simde_test_x86_write_mmask32(2, k1, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_u16x32(2, a, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_u16x32(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask32(2, r, SIMDE_TEST_VEC_POS_LAST); k1 = simde_test_x86_random_mmask32(); a = simde_test_x86_random_i16x32(); b = simde_test_x86_random_i16x32(); b = simde_mm512_mask_mov_epi16(a, HEDLEY_STATIC_CAST(simde__mmask32, simde_test_codegen_random_i16()), b); r = simde_mm512_mask_cmp_epu16_mask(k1, a, b, SIMDE_MM_CMPINT_FALSE); simde_test_x86_write_mmask32(2, k1, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_u16x32(2, a, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_u16x32(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask32(2, r, SIMDE_TEST_VEC_POS_LAST); k1 = simde_test_x86_random_mmask32(); a = simde_test_x86_random_i16x32(); b = simde_test_x86_random_i16x32(); b = simde_mm512_mask_mov_epi16(a, HEDLEY_STATIC_CAST(simde__mmask32, simde_test_codegen_random_i16()), b); r = simde_mm512_mask_cmp_epu16_mask(k1, a, b, SIMDE_MM_CMPINT_NE); simde_test_x86_write_mmask32(2, k1, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_u16x32(2, a, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_u16x32(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask32(2, r, SIMDE_TEST_VEC_POS_LAST); k1 = simde_test_x86_random_mmask32(); a = simde_test_x86_random_i16x32(); b = simde_test_x86_random_i16x32(); b = simde_mm512_mask_mov_epi16(a, HEDLEY_STATIC_CAST(simde__mmask32, simde_test_codegen_random_i16()), b); r = simde_mm512_mask_cmp_epu16_mask(k1, a, b, SIMDE_MM_CMPINT_NLT); simde_test_x86_write_mmask32(2, k1, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_u16x32(2, a, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_u16x32(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask32(2, r, SIMDE_TEST_VEC_POS_LAST); k1 = simde_test_x86_random_mmask32(); a = simde_test_x86_random_i16x32(); b = simde_test_x86_random_i16x32(); b = simde_mm512_mask_mov_epi16(a, HEDLEY_STATIC_CAST(simde__mmask32, simde_test_codegen_random_i16()), b); r = simde_mm512_mask_cmp_epu16_mask(k1, a, b, SIMDE_MM_CMPINT_NLE); simde_test_x86_write_mmask32(2, k1, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_u16x32(2, a, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_u16x32(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask32(2, r, SIMDE_TEST_VEC_POS_LAST); k1 = simde_test_x86_random_mmask32(); a = simde_test_x86_random_i16x32(); b = simde_test_x86_random_i16x32(); b = simde_mm512_mask_mov_epi16(a, HEDLEY_STATIC_CAST(simde__mmask32, simde_test_codegen_random_i16()), b); r = simde_mm512_mask_cmp_epu16_mask(k1, a, b, SIMDE_MM_CMPINT_TRUE); simde_test_x86_write_mmask32(2, k1, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_u16x32(2, a, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_u16x32(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask32(2, r, SIMDE_TEST_VEC_POS_LAST); return 1; #endif } #if !defined(SIMDE_NATIVE_ALIASES_TESTING) static int test_simde_mm512_cmp_ps_mask (SIMDE_MUNIT_TEST_ARGS) { #if 1 static const struct { const simde_float32 a[16]; const simde_float32 b[16]; const simde__mmask16 r; } test_vec[] = { { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -492.75), SIMDE_FLOAT32_C( -438.29), SIMDE_FLOAT32_C( -582.04), SIMDE_FLOAT32_C( 854.65), SIMDE_FLOAT32_C( 155.54), SIMDE_FLOAT32_C( 896.11), SIMDE_FLOAT32_C( -984.17), SIMDE_FLOAT32_C( -151.52), SIMDE_FLOAT32_C( -333.42), SIMDE_FLOAT32_C( -650.38), SIMDE_FLOAT32_C( -87.56), SIMDE_FLOAT32_C( -583.12), SIMDE_FLOAT32_C( -508.18), SIMDE_FLOAT32_C( 10.09) }, { SIMDE_FLOAT32_C( -433.49), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 431.70), SIMDE_FLOAT32_C( -582.04), SIMDE_FLOAT32_C( -629.54), SIMDE_FLOAT32_C( -116.35), SIMDE_FLOAT32_C( -824.24), SIMDE_FLOAT32_C( -984.17), SIMDE_FLOAT32_C( -139.40), SIMDE_FLOAT32_C( -333.42), SIMDE_FLOAT32_C( 866.10), SIMDE_FLOAT32_C( -87.56), SIMDE_FLOAT32_C( -583.12), SIMDE_FLOAT32_C( -722.62), SIMDE_FLOAT32_C( 10.09) }, UINT16_C(46352) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -360.72), SIMDE_FLOAT32_C( 883.16), SIMDE_FLOAT32_C( -175.11), SIMDE_FLOAT32_C( -344.89), SIMDE_FLOAT32_C( -268.35), SIMDE_FLOAT32_C( 491.46), SIMDE_FLOAT32_C( 4.73), SIMDE_FLOAT32_C( 644.09), SIMDE_FLOAT32_C( 908.34), SIMDE_FLOAT32_C( 496.55), SIMDE_FLOAT32_C( -345.82), SIMDE_FLOAT32_C( -412.75), SIMDE_FLOAT32_C( 601.72), SIMDE_FLOAT32_C( -536.93) }, { SIMDE_FLOAT32_C( -981.05), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -97.40), SIMDE_FLOAT32_C( -175.11), SIMDE_FLOAT32_C( -920.53), SIMDE_FLOAT32_C( -268.35), SIMDE_FLOAT32_C( 491.46), SIMDE_FLOAT32_C( 4.73), SIMDE_FLOAT32_C( 644.09), SIMDE_FLOAT32_C( 908.34), SIMDE_FLOAT32_C( -777.04), SIMDE_FLOAT32_C( 528.52), SIMDE_FLOAT32_C( 439.99), SIMDE_FLOAT32_C( 601.72), SIMDE_FLOAT32_C( -536.93) }, UINT16_C(12288) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -698.03), SIMDE_FLOAT32_C( -129.05), SIMDE_FLOAT32_C( -314.88), SIMDE_FLOAT32_C( 306.70), SIMDE_FLOAT32_C( -484.96), SIMDE_FLOAT32_C( -406.54), SIMDE_FLOAT32_C( -196.75), SIMDE_FLOAT32_C( 169.22), SIMDE_FLOAT32_C( 180.71), SIMDE_FLOAT32_C( -595.03), SIMDE_FLOAT32_C( 632.29), SIMDE_FLOAT32_C( 199.66), SIMDE_FLOAT32_C( 321.33), SIMDE_FLOAT32_C( -534.18) }, { SIMDE_FLOAT32_C( -860.70), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -129.05), SIMDE_FLOAT32_C( -314.88), SIMDE_FLOAT32_C( 306.70), SIMDE_FLOAT32_C( 228.07), SIMDE_FLOAT32_C( 91.07), SIMDE_FLOAT32_C( -286.18), SIMDE_FLOAT32_C( 169.22), SIMDE_FLOAT32_C( 180.71), SIMDE_FLOAT32_C( -595.03), SIMDE_FLOAT32_C( 12.74), SIMDE_FLOAT32_C( 199.66), SIMDE_FLOAT32_C( 321.33), SIMDE_FLOAT32_C( 152.04) }, UINT16_C(61176) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -23.06), SIMDE_FLOAT32_C( -461.97), SIMDE_FLOAT32_C( 372.08), SIMDE_FLOAT32_C( 780.19), SIMDE_FLOAT32_C( 707.25), SIMDE_FLOAT32_C( -447.21), SIMDE_FLOAT32_C( -814.84), SIMDE_FLOAT32_C( 339.53), SIMDE_FLOAT32_C( 752.45), SIMDE_FLOAT32_C( 506.49), SIMDE_FLOAT32_C( 805.35), SIMDE_FLOAT32_C( 854.71), SIMDE_FLOAT32_C( 919.95), SIMDE_FLOAT32_C( -649.37) }, { SIMDE_FLOAT32_C( -977.01), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -461.97), SIMDE_FLOAT32_C( 372.08), SIMDE_FLOAT32_C( 780.19), SIMDE_FLOAT32_C( 704.84), SIMDE_FLOAT32_C( 703.98), SIMDE_FLOAT32_C( 276.72), SIMDE_FLOAT32_C( 339.53), SIMDE_FLOAT32_C( 752.45), SIMDE_FLOAT32_C( 506.49), SIMDE_FLOAT32_C( 869.62), SIMDE_FLOAT32_C( -302.69), SIMDE_FLOAT32_C( 919.95), SIMDE_FLOAT32_C( 892.61) }, UINT16_C( 7) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 72.37), SIMDE_FLOAT32_C( -862.11), SIMDE_FLOAT32_C( 400.81), SIMDE_FLOAT32_C( 257.54), SIMDE_FLOAT32_C( 477.42), SIMDE_FLOAT32_C( 153.26), SIMDE_FLOAT32_C( -235.97), SIMDE_FLOAT32_C( 282.77), SIMDE_FLOAT32_C( 7.97), SIMDE_FLOAT32_C( -316.02), SIMDE_FLOAT32_C( 633.40), SIMDE_FLOAT32_C( -271.85), SIMDE_FLOAT32_C( -234.18), SIMDE_FLOAT32_C( -525.10) }, { SIMDE_FLOAT32_C( -569.36), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -862.11), SIMDE_FLOAT32_C( 642.71), SIMDE_FLOAT32_C( 257.54), SIMDE_FLOAT32_C( -901.18), SIMDE_FLOAT32_C( -753.48), SIMDE_FLOAT32_C( 951.92), SIMDE_FLOAT32_C( 968.44), SIMDE_FLOAT32_C( -56.17), SIMDE_FLOAT32_C( -316.02), SIMDE_FLOAT32_C( 633.40), SIMDE_FLOAT32_C( -580.24), SIMDE_FLOAT32_C( 559.34), SIMDE_FLOAT32_C( -525.10) }, UINT16_C(26583) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 889.25), SIMDE_FLOAT32_C( 907.00), SIMDE_FLOAT32_C( 821.84), SIMDE_FLOAT32_C( -346.72), SIMDE_FLOAT32_C( 189.77), SIMDE_FLOAT32_C( -170.19), SIMDE_FLOAT32_C( 337.26), SIMDE_FLOAT32_C( -176.83), SIMDE_FLOAT32_C( 557.96), SIMDE_FLOAT32_C( -896.92), SIMDE_FLOAT32_C( 298.07), SIMDE_FLOAT32_C( 234.35), SIMDE_FLOAT32_C( -958.19), SIMDE_FLOAT32_C( 328.27) }, { SIMDE_FLOAT32_C( -570.42), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -285.59), SIMDE_FLOAT32_C( 931.04), SIMDE_FLOAT32_C( -412.88), SIMDE_FLOAT32_C( -317.16), SIMDE_FLOAT32_C( -170.19), SIMDE_FLOAT32_C( 337.26), SIMDE_FLOAT32_C( -456.11), SIMDE_FLOAT32_C( 557.96), SIMDE_FLOAT32_C( -586.38), SIMDE_FLOAT32_C( 298.07), SIMDE_FLOAT32_C( 234.35), SIMDE_FLOAT32_C( -958.19), SIMDE_FLOAT32_C( 328.27) }, UINT16_C(63471) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 587.85), SIMDE_FLOAT32_C( -638.08), SIMDE_FLOAT32_C( 882.64), SIMDE_FLOAT32_C( -74.89), SIMDE_FLOAT32_C( 185.09), SIMDE_FLOAT32_C( 440.60), SIMDE_FLOAT32_C( 28.19), SIMDE_FLOAT32_C( -516.84), SIMDE_FLOAT32_C( -325.05), SIMDE_FLOAT32_C( 69.99), SIMDE_FLOAT32_C( 811.43), SIMDE_FLOAT32_C( 290.54), SIMDE_FLOAT32_C( -245.49), SIMDE_FLOAT32_C( -553.37) }, { SIMDE_FLOAT32_C( 172.16), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -312.22), SIMDE_FLOAT32_C( 882.64), SIMDE_FLOAT32_C( -74.89), SIMDE_FLOAT32_C( 231.67), SIMDE_FLOAT32_C( 440.60), SIMDE_FLOAT32_C( -698.35), SIMDE_FLOAT32_C( -932.75), SIMDE_FLOAT32_C( -325.05), SIMDE_FLOAT32_C( 346.97), SIMDE_FLOAT32_C( 332.41), SIMDE_FLOAT32_C( -351.53), SIMDE_FLOAT32_C( -245.49), SIMDE_FLOAT32_C( -495.43) }, UINT16_C(13063) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -205.49), SIMDE_FLOAT32_C( -948.42), SIMDE_FLOAT32_C( 24.54), SIMDE_FLOAT32_C( 822.70), SIMDE_FLOAT32_C( -465.26), SIMDE_FLOAT32_C( 699.49), SIMDE_FLOAT32_C( -107.31), SIMDE_FLOAT32_C( -653.83), SIMDE_FLOAT32_C( -9.98), SIMDE_FLOAT32_C( 647.21), SIMDE_FLOAT32_C( -207.19), SIMDE_FLOAT32_C( -5.03), SIMDE_FLOAT32_C( -667.24), SIMDE_FLOAT32_C( 826.56) }, { SIMDE_FLOAT32_C( -133.51), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -85.57), SIMDE_FLOAT32_C( 24.54), SIMDE_FLOAT32_C( -983.76), SIMDE_FLOAT32_C( -18.32), SIMDE_FLOAT32_C( 699.49), SIMDE_FLOAT32_C( 363.22), SIMDE_FLOAT32_C( -653.83), SIMDE_FLOAT32_C( -185.79), SIMDE_FLOAT32_C( 647.21), SIMDE_FLOAT32_C( -181.34), SIMDE_FLOAT32_C( -484.49), SIMDE_FLOAT32_C( 514.17), SIMDE_FLOAT32_C( 685.14) }, UINT16_C(65528) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -868.62), SIMDE_FLOAT32_C( -728.54), SIMDE_FLOAT32_C( -176.52), SIMDE_FLOAT32_C( 24.08), SIMDE_FLOAT32_C( -382.37), SIMDE_FLOAT32_C( 813.50), SIMDE_FLOAT32_C( -328.72), SIMDE_FLOAT32_C( 410.44), SIMDE_FLOAT32_C( -191.53), SIMDE_FLOAT32_C( 4.04), SIMDE_FLOAT32_C( 237.00), SIMDE_FLOAT32_C( -508.78), SIMDE_FLOAT32_C( -102.77), SIMDE_FLOAT32_C( -48.41) }, { SIMDE_FLOAT32_C( 736.73), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -612.67), SIMDE_FLOAT32_C( -176.52), SIMDE_FLOAT32_C( -668.95), SIMDE_FLOAT32_C( -382.37), SIMDE_FLOAT32_C( 813.50), SIMDE_FLOAT32_C( 975.82), SIMDE_FLOAT32_C( 410.44), SIMDE_FLOAT32_C( -191.53), SIMDE_FLOAT32_C( 4.04), SIMDE_FLOAT32_C( 237.00), SIMDE_FLOAT32_C( -508.78), SIMDE_FLOAT32_C( -102.77), SIMDE_FLOAT32_C( -48.41) }, UINT16_C(65239) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -45.88), SIMDE_FLOAT32_C( 831.04), SIMDE_FLOAT32_C( 1.37), SIMDE_FLOAT32_C( 625.40), SIMDE_FLOAT32_C( 241.48), SIMDE_FLOAT32_C( 809.84), SIMDE_FLOAT32_C( -370.55), SIMDE_FLOAT32_C( -521.52), SIMDE_FLOAT32_C( -698.94), SIMDE_FLOAT32_C( 526.68), SIMDE_FLOAT32_C( 430.07), SIMDE_FLOAT32_C( 706.71), SIMDE_FLOAT32_C( 172.17), SIMDE_FLOAT32_C( -602.09) }, { SIMDE_FLOAT32_C( 213.41), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -204.55), SIMDE_FLOAT32_C( 1.37), SIMDE_FLOAT32_C( -295.23), SIMDE_FLOAT32_C( 241.48), SIMDE_FLOAT32_C( -250.22), SIMDE_FLOAT32_C( -805.24), SIMDE_FLOAT32_C( 520.74), SIMDE_FLOAT32_C( -698.94), SIMDE_FLOAT32_C( 993.42), SIMDE_FLOAT32_C( -537.32), SIMDE_FLOAT32_C( -645.42), SIMDE_FLOAT32_C( 172.17), SIMDE_FLOAT32_C( -602.09) }, UINT16_C( 2567) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -497.00), SIMDE_FLOAT32_C( -251.40), SIMDE_FLOAT32_C( -646.33), SIMDE_FLOAT32_C( 132.44), SIMDE_FLOAT32_C( 227.08), SIMDE_FLOAT32_C( -345.27), SIMDE_FLOAT32_C( -340.88), SIMDE_FLOAT32_C( -342.84), SIMDE_FLOAT32_C( -638.56), SIMDE_FLOAT32_C( 831.28), SIMDE_FLOAT32_C( 55.07), SIMDE_FLOAT32_C( -544.52), SIMDE_FLOAT32_C( -185.32), SIMDE_FLOAT32_C( 784.02) }, { SIMDE_FLOAT32_C( 250.93), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -251.40), SIMDE_FLOAT32_C( -646.33), SIMDE_FLOAT32_C( -316.44), SIMDE_FLOAT32_C( 87.19), SIMDE_FLOAT32_C( -345.27), SIMDE_FLOAT32_C( -323.02), SIMDE_FLOAT32_C( 549.87), SIMDE_FLOAT32_C( -638.56), SIMDE_FLOAT32_C( 831.28), SIMDE_FLOAT32_C( 55.07), SIMDE_FLOAT32_C( -544.52), SIMDE_FLOAT32_C( -185.32), SIMDE_FLOAT32_C( 784.02) }, UINT16_C(65439) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 113.48), SIMDE_FLOAT32_C( -291.23), SIMDE_FLOAT32_C( -387.26), SIMDE_FLOAT32_C( 772.60), SIMDE_FLOAT32_C( 365.92), SIMDE_FLOAT32_C( -25.82), SIMDE_FLOAT32_C( 603.89), SIMDE_FLOAT32_C( -579.01), SIMDE_FLOAT32_C( 429.66), SIMDE_FLOAT32_C( -581.44), SIMDE_FLOAT32_C( -794.99), SIMDE_FLOAT32_C( -319.41), SIMDE_FLOAT32_C( -157.93), SIMDE_FLOAT32_C( -306.19) }, { SIMDE_FLOAT32_C( 481.68), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -291.23), SIMDE_FLOAT32_C( -387.26), SIMDE_FLOAT32_C( -945.65), SIMDE_FLOAT32_C( -115.91), SIMDE_FLOAT32_C( -25.82), SIMDE_FLOAT32_C( -345.20), SIMDE_FLOAT32_C( -579.01), SIMDE_FLOAT32_C( 757.39), SIMDE_FLOAT32_C( -867.15), SIMDE_FLOAT32_C( -156.87), SIMDE_FLOAT32_C( 361.73), SIMDE_FLOAT32_C( -886.11), SIMDE_FLOAT32_C( -306.19) }, UINT16_C( 0) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -0.03), SIMDE_FLOAT32_C( -600.50), SIMDE_FLOAT32_C( -93.35), SIMDE_FLOAT32_C( -396.14), SIMDE_FLOAT32_C( -179.51), SIMDE_FLOAT32_C( -663.69), SIMDE_FLOAT32_C( 22.42), SIMDE_FLOAT32_C( 25.50), SIMDE_FLOAT32_C( 16.90), SIMDE_FLOAT32_C( 864.49), SIMDE_FLOAT32_C( 719.32), SIMDE_FLOAT32_C( 263.94), SIMDE_FLOAT32_C( 879.85), SIMDE_FLOAT32_C( 96.69) }, { SIMDE_FLOAT32_C( 33.57), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -600.50), SIMDE_FLOAT32_C( 755.57), SIMDE_FLOAT32_C( 805.84), SIMDE_FLOAT32_C( 592.31), SIMDE_FLOAT32_C( -663.69), SIMDE_FLOAT32_C( 938.69), SIMDE_FLOAT32_C( -564.57), SIMDE_FLOAT32_C( 16.90), SIMDE_FLOAT32_C( -947.42), SIMDE_FLOAT32_C( -239.76), SIMDE_FLOAT32_C( 263.94), SIMDE_FLOAT32_C( 279.95), SIMDE_FLOAT32_C( 793.82) }, UINT16_C(56176) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -116.23), SIMDE_FLOAT32_C( 13.81), SIMDE_FLOAT32_C( 369.86), SIMDE_FLOAT32_C( 906.19), SIMDE_FLOAT32_C( -960.69), SIMDE_FLOAT32_C( -613.24), SIMDE_FLOAT32_C( 770.68), SIMDE_FLOAT32_C( 758.63), SIMDE_FLOAT32_C( 650.70), SIMDE_FLOAT32_C( 650.54), SIMDE_FLOAT32_C( -144.69), SIMDE_FLOAT32_C( -751.14), SIMDE_FLOAT32_C( -290.78), SIMDE_FLOAT32_C( -993.65) }, { SIMDE_FLOAT32_C( -806.68), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 323.43), SIMDE_FLOAT32_C( 369.86), SIMDE_FLOAT32_C( 750.88), SIMDE_FLOAT32_C( 758.87), SIMDE_FLOAT32_C( -613.24), SIMDE_FLOAT32_C( 803.46), SIMDE_FLOAT32_C( 758.63), SIMDE_FLOAT32_C( 46.88), SIMDE_FLOAT32_C( 83.41), SIMDE_FLOAT32_C( -687.07), SIMDE_FLOAT32_C( 173.78), SIMDE_FLOAT32_C( 363.33), SIMDE_FLOAT32_C( -493.76) }, UINT16_C( 7856) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -846.71), SIMDE_FLOAT32_C( 559.36), SIMDE_FLOAT32_C( 963.95), SIMDE_FLOAT32_C( 923.98), SIMDE_FLOAT32_C( 317.98), SIMDE_FLOAT32_C( 614.64), SIMDE_FLOAT32_C( 574.51), SIMDE_FLOAT32_C( -826.70), SIMDE_FLOAT32_C( 863.51), SIMDE_FLOAT32_C( -716.26), SIMDE_FLOAT32_C( -820.36), SIMDE_FLOAT32_C( 594.63), SIMDE_FLOAT32_C( -251.47), SIMDE_FLOAT32_C( 991.84) }, { SIMDE_FLOAT32_C( -81.93), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -323.06), SIMDE_FLOAT32_C( 578.75), SIMDE_FLOAT32_C( 923.98), SIMDE_FLOAT32_C( 196.05), SIMDE_FLOAT32_C( -374.36), SIMDE_FLOAT32_C( -370.41), SIMDE_FLOAT32_C( 508.97), SIMDE_FLOAT32_C( 863.51), SIMDE_FLOAT32_C( 992.91), SIMDE_FLOAT32_C( -820.36), SIMDE_FLOAT32_C( 594.63), SIMDE_FLOAT32_C( -251.47), SIMDE_FLOAT32_C( 991.84) }, UINT16_C( 472) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -682.72), SIMDE_FLOAT32_C( -587.39), SIMDE_FLOAT32_C( 162.51), SIMDE_FLOAT32_C( 891.79), SIMDE_FLOAT32_C( -414.09), SIMDE_FLOAT32_C( 26.02), SIMDE_FLOAT32_C( -824.47), SIMDE_FLOAT32_C( -234.45), SIMDE_FLOAT32_C( -379.34), SIMDE_FLOAT32_C( -75.94), SIMDE_FLOAT32_C( -242.61), SIMDE_FLOAT32_C( 538.73), SIMDE_FLOAT32_C( 650.36), SIMDE_FLOAT32_C( -499.89) }, { SIMDE_FLOAT32_C( 94.63), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 411.71), SIMDE_FLOAT32_C( 854.75), SIMDE_FLOAT32_C( -324.13), SIMDE_FLOAT32_C( -414.09), SIMDE_FLOAT32_C( 654.16), SIMDE_FLOAT32_C( -331.22), SIMDE_FLOAT32_C( -64.10), SIMDE_FLOAT32_C( -379.34), SIMDE_FLOAT32_C( -91.21), SIMDE_FLOAT32_C( -528.83), SIMDE_FLOAT32_C( 538.73), SIMDE_FLOAT32_C( 302.10), SIMDE_FLOAT32_C( 565.79) }, UINT16_MAX }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 511.17), SIMDE_FLOAT32_C( -435.69), SIMDE_FLOAT32_C( -18.77), SIMDE_FLOAT32_C( 686.70), SIMDE_FLOAT32_C( 329.86), SIMDE_FLOAT32_C( 601.89), SIMDE_FLOAT32_C( -389.24), SIMDE_FLOAT32_C( -912.75), SIMDE_FLOAT32_C( 140.62), SIMDE_FLOAT32_C( -738.88), SIMDE_FLOAT32_C( -412.65), SIMDE_FLOAT32_C( 356.28), SIMDE_FLOAT32_C( 490.24), SIMDE_FLOAT32_C( -366.36) }, { SIMDE_FLOAT32_C( 978.40), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -435.69), SIMDE_FLOAT32_C( -0.85), SIMDE_FLOAT32_C( 686.70), SIMDE_FLOAT32_C( -375.43), SIMDE_FLOAT32_C( -339.95), SIMDE_FLOAT32_C( -389.24), SIMDE_FLOAT32_C( -912.75), SIMDE_FLOAT32_C( 904.88), SIMDE_FLOAT32_C( -738.88), SIMDE_FLOAT32_C( -338.47), SIMDE_FLOAT32_C( 356.28), SIMDE_FLOAT32_C( 490.24), SIMDE_FLOAT32_C( -366.36) }, UINT16_C(60200) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 6.43), SIMDE_FLOAT32_C( -465.89), SIMDE_FLOAT32_C( 235.91), SIMDE_FLOAT32_C( 617.19), SIMDE_FLOAT32_C( -378.65), SIMDE_FLOAT32_C( -623.48), SIMDE_FLOAT32_C( 878.32), SIMDE_FLOAT32_C( 208.71), SIMDE_FLOAT32_C( 732.80), SIMDE_FLOAT32_C( 368.55), SIMDE_FLOAT32_C( 842.35), SIMDE_FLOAT32_C( -499.21), SIMDE_FLOAT32_C( -286.46), SIMDE_FLOAT32_C( 151.86) }, { SIMDE_FLOAT32_C( -810.55), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -185.98), SIMDE_FLOAT32_C( 235.91), SIMDE_FLOAT32_C( 617.19), SIMDE_FLOAT32_C( 909.76), SIMDE_FLOAT32_C( -623.48), SIMDE_FLOAT32_C( -793.58), SIMDE_FLOAT32_C( 208.71), SIMDE_FLOAT32_C( 732.80), SIMDE_FLOAT32_C( -985.03), SIMDE_FLOAT32_C( 842.35), SIMDE_FLOAT32_C( -499.21), SIMDE_FLOAT32_C( -286.46), SIMDE_FLOAT32_C( -584.53) }, UINT16_C( 72) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 958.32), SIMDE_FLOAT32_C( 570.93), SIMDE_FLOAT32_C( -125.57), SIMDE_FLOAT32_C( 836.63), SIMDE_FLOAT32_C( -220.36), SIMDE_FLOAT32_C( -392.77), SIMDE_FLOAT32_C( 205.19), SIMDE_FLOAT32_C( -378.01), SIMDE_FLOAT32_C( 108.02), SIMDE_FLOAT32_C( 918.73), SIMDE_FLOAT32_C( 773.85), SIMDE_FLOAT32_C( 297.47), SIMDE_FLOAT32_C( 631.42), SIMDE_FLOAT32_C( -96.00) }, { SIMDE_FLOAT32_C( -888.51), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 570.93), SIMDE_FLOAT32_C( -125.57), SIMDE_FLOAT32_C( 127.66), SIMDE_FLOAT32_C( -407.46), SIMDE_FLOAT32_C( -392.77), SIMDE_FLOAT32_C( 205.19), SIMDE_FLOAT32_C( -378.01), SIMDE_FLOAT32_C( -115.05), SIMDE_FLOAT32_C( 918.73), SIMDE_FLOAT32_C( 773.85), SIMDE_FLOAT32_C( 297.47), SIMDE_FLOAT32_C( 631.42), SIMDE_FLOAT32_C( 168.81) }, UINT16_C(64408) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -386.59), SIMDE_FLOAT32_C( 519.38), SIMDE_FLOAT32_C( -873.48), SIMDE_FLOAT32_C( 818.60), SIMDE_FLOAT32_C( -858.63), SIMDE_FLOAT32_C( 234.54), SIMDE_FLOAT32_C( 737.33), SIMDE_FLOAT32_C( 915.22), SIMDE_FLOAT32_C( -467.99), SIMDE_FLOAT32_C( 368.74), SIMDE_FLOAT32_C( -180.78), SIMDE_FLOAT32_C( -356.50), SIMDE_FLOAT32_C( 372.90), SIMDE_FLOAT32_C( 740.45) }, { SIMDE_FLOAT32_C( -335.25), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 257.29), SIMDE_FLOAT32_C( -873.48), SIMDE_FLOAT32_C( 818.60), SIMDE_FLOAT32_C( -858.63), SIMDE_FLOAT32_C( 796.60), SIMDE_FLOAT32_C( -511.93), SIMDE_FLOAT32_C( 280.28), SIMDE_FLOAT32_C( 943.55), SIMDE_FLOAT32_C( 368.74), SIMDE_FLOAT32_C( -180.78), SIMDE_FLOAT32_C( -356.50), SIMDE_FLOAT32_C( 372.90), SIMDE_FLOAT32_C( 188.83) }, UINT16_C( 7) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -484.68), SIMDE_FLOAT32_C( -150.43), SIMDE_FLOAT32_C( 468.75), SIMDE_FLOAT32_C( -747.35), SIMDE_FLOAT32_C( -235.22), SIMDE_FLOAT32_C( -999.25), SIMDE_FLOAT32_C( 621.39), SIMDE_FLOAT32_C( 584.00), SIMDE_FLOAT32_C( -355.74), SIMDE_FLOAT32_C( -5.71), SIMDE_FLOAT32_C( 324.45), SIMDE_FLOAT32_C( 309.01), SIMDE_FLOAT32_C( -351.04), SIMDE_FLOAT32_C( -807.44) }, { SIMDE_FLOAT32_C( -291.80), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -150.43), SIMDE_FLOAT32_C( 357.20), SIMDE_FLOAT32_C( -747.35), SIMDE_FLOAT32_C( -235.22), SIMDE_FLOAT32_C( 300.75), SIMDE_FLOAT32_C( 997.90), SIMDE_FLOAT32_C( 356.72), SIMDE_FLOAT32_C( 889.15), SIMDE_FLOAT32_C( -5.71), SIMDE_FLOAT32_C( 324.45), SIMDE_FLOAT32_C( 996.84), SIMDE_FLOAT32_C( -351.04), SIMDE_FLOAT32_C( -807.44) }, UINT16_C(10135) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 545.90), SIMDE_FLOAT32_C( -131.90), SIMDE_FLOAT32_C( 700.55), SIMDE_FLOAT32_C( 167.29), SIMDE_FLOAT32_C( -547.90), SIMDE_FLOAT32_C( -655.19), SIMDE_FLOAT32_C( -838.42), SIMDE_FLOAT32_C( 776.56), SIMDE_FLOAT32_C( 653.81), SIMDE_FLOAT32_C( -189.46), SIMDE_FLOAT32_C( 969.12), SIMDE_FLOAT32_C( -779.89), SIMDE_FLOAT32_C( -628.85), SIMDE_FLOAT32_C( -827.58) }, { SIMDE_FLOAT32_C( -896.68), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -131.90), SIMDE_FLOAT32_C( 29.10), SIMDE_FLOAT32_C( 167.29), SIMDE_FLOAT32_C( -547.90), SIMDE_FLOAT32_C( -81.75), SIMDE_FLOAT32_C( -838.42), SIMDE_FLOAT32_C( -342.64), SIMDE_FLOAT32_C( -84.91), SIMDE_FLOAT32_C( -189.46), SIMDE_FLOAT32_C( 969.12), SIMDE_FLOAT32_C( 146.14), SIMDE_FLOAT32_C( 14.11), SIMDE_FLOAT32_C( -985.57) }, UINT16_C(40831) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 727.30), SIMDE_FLOAT32_C( 334.64), SIMDE_FLOAT32_C( -108.71), SIMDE_FLOAT32_C( 888.88), SIMDE_FLOAT32_C( 111.20), SIMDE_FLOAT32_C( -454.90), SIMDE_FLOAT32_C( -300.58), SIMDE_FLOAT32_C( 80.32), SIMDE_FLOAT32_C( -234.78), SIMDE_FLOAT32_C( 70.57), SIMDE_FLOAT32_C( 252.74), SIMDE_FLOAT32_C( -387.32), SIMDE_FLOAT32_C( -201.08), SIMDE_FLOAT32_C( -883.47) }, { SIMDE_FLOAT32_C( 367.78), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 479.60), SIMDE_FLOAT32_C( -253.73), SIMDE_FLOAT32_C( 888.88), SIMDE_FLOAT32_C( 111.20), SIMDE_FLOAT32_C( -454.90), SIMDE_FLOAT32_C( -300.58), SIMDE_FLOAT32_C( -951.92), SIMDE_FLOAT32_C( -192.50), SIMDE_FLOAT32_C( -343.90), SIMDE_FLOAT32_C( 252.74), SIMDE_FLOAT32_C( -387.32), SIMDE_FLOAT32_C( -201.08), SIMDE_FLOAT32_C( -883.47) }, UINT16_C( 2583) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -167.70), SIMDE_FLOAT32_C( 390.88), SIMDE_FLOAT32_C( 636.32), SIMDE_FLOAT32_C( 531.72), SIMDE_FLOAT32_C( -528.80), SIMDE_FLOAT32_C( -598.46), SIMDE_FLOAT32_C( -397.71), SIMDE_FLOAT32_C( 723.94), SIMDE_FLOAT32_C( 14.22), SIMDE_FLOAT32_C( 401.21), SIMDE_FLOAT32_C( 840.47), SIMDE_FLOAT32_C( -618.00), SIMDE_FLOAT32_C( 229.23), SIMDE_FLOAT32_C( -181.30) }, { SIMDE_FLOAT32_C( 861.60), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 998.57), SIMDE_FLOAT32_C( 636.86), SIMDE_FLOAT32_C( 531.72), SIMDE_FLOAT32_C( -528.80), SIMDE_FLOAT32_C( -555.63), SIMDE_FLOAT32_C( -397.71), SIMDE_FLOAT32_C( -890.85), SIMDE_FLOAT32_C( -902.19), SIMDE_FLOAT32_C( -745.95), SIMDE_FLOAT32_C( 840.47), SIMDE_FLOAT32_C( -702.27), SIMDE_FLOAT32_C( 229.23), SIMDE_FLOAT32_C( -181.30) }, UINT16_C(65528) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 561.47), SIMDE_FLOAT32_C( 195.97), SIMDE_FLOAT32_C( 426.80), SIMDE_FLOAT32_C( -836.24), SIMDE_FLOAT32_C( -80.09), SIMDE_FLOAT32_C( -558.97), SIMDE_FLOAT32_C( 564.97), SIMDE_FLOAT32_C( -239.62), SIMDE_FLOAT32_C( -176.97), SIMDE_FLOAT32_C( -205.81), SIMDE_FLOAT32_C( 579.08), SIMDE_FLOAT32_C( -315.37), SIMDE_FLOAT32_C( -230.31), SIMDE_FLOAT32_C( -681.08) }, { SIMDE_FLOAT32_C( -316.80), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -270.16), SIMDE_FLOAT32_C( -149.08), SIMDE_FLOAT32_C( -836.24), SIMDE_FLOAT32_C( -161.00), SIMDE_FLOAT32_C( -51.27), SIMDE_FLOAT32_C( 992.75), SIMDE_FLOAT32_C( -239.62), SIMDE_FLOAT32_C( -176.97), SIMDE_FLOAT32_C( -205.81), SIMDE_FLOAT32_C( 579.08), SIMDE_FLOAT32_C( -364.60), SIMDE_FLOAT32_C( -230.31), SIMDE_FLOAT32_C( -681.08) }, UINT16_C(56871) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -54.80), SIMDE_FLOAT32_C( -932.26), SIMDE_FLOAT32_C( 528.50), SIMDE_FLOAT32_C( -489.84), SIMDE_FLOAT32_C( -171.88), SIMDE_FLOAT32_C( -648.48), SIMDE_FLOAT32_C( 304.36), SIMDE_FLOAT32_C( -592.80), SIMDE_FLOAT32_C( 36.16), SIMDE_FLOAT32_C( -925.95), SIMDE_FLOAT32_C( -273.88), SIMDE_FLOAT32_C( 719.36), SIMDE_FLOAT32_C( -519.40), SIMDE_FLOAT32_C( 426.88) }, { SIMDE_FLOAT32_C( -550.80), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -932.26), SIMDE_FLOAT32_C( 528.50), SIMDE_FLOAT32_C( -489.84), SIMDE_FLOAT32_C( 181.40), SIMDE_FLOAT32_C( 526.71), SIMDE_FLOAT32_C( -651.46), SIMDE_FLOAT32_C( -592.80), SIMDE_FLOAT32_C( -837.89), SIMDE_FLOAT32_C( 568.50), SIMDE_FLOAT32_C( -273.88), SIMDE_FLOAT32_C( 822.78), SIMDE_FLOAT32_C( -650.06), SIMDE_FLOAT32_C( 508.17) }, UINT16_C(43207) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 805.30), SIMDE_FLOAT32_C( -595.98), SIMDE_FLOAT32_C( -209.73), SIMDE_FLOAT32_C( 109.66), SIMDE_FLOAT32_C( -188.79), SIMDE_FLOAT32_C( 826.42), SIMDE_FLOAT32_C( 183.71), SIMDE_FLOAT32_C( 537.34), SIMDE_FLOAT32_C( 545.78), SIMDE_FLOAT32_C( 664.31), SIMDE_FLOAT32_C( -35.78), SIMDE_FLOAT32_C( 994.98), SIMDE_FLOAT32_C( -4.17), SIMDE_FLOAT32_C( -870.20) }, { SIMDE_FLOAT32_C( 575.90), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -595.98), SIMDE_FLOAT32_C( -209.73), SIMDE_FLOAT32_C( 109.66), SIMDE_FLOAT32_C( -188.79), SIMDE_FLOAT32_C( 826.42), SIMDE_FLOAT32_C( 183.71), SIMDE_FLOAT32_C( 537.34), SIMDE_FLOAT32_C( 545.78), SIMDE_FLOAT32_C( 555.11), SIMDE_FLOAT32_C( -258.43), SIMDE_FLOAT32_C( 697.92), SIMDE_FLOAT32_C( -4.17), SIMDE_FLOAT32_C( -682.53) }, UINT16_C(51199) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 765.20), SIMDE_FLOAT32_C( 532.70), SIMDE_FLOAT32_C( -246.65), SIMDE_FLOAT32_C( -51.09), SIMDE_FLOAT32_C( 70.04), SIMDE_FLOAT32_C( -700.87), SIMDE_FLOAT32_C( -386.79), SIMDE_FLOAT32_C( -965.74), SIMDE_FLOAT32_C( -705.88), SIMDE_FLOAT32_C( 609.04), SIMDE_FLOAT32_C( -835.94), SIMDE_FLOAT32_C( 577.30), SIMDE_FLOAT32_C( -114.88), SIMDE_FLOAT32_C( 452.19) }, { SIMDE_FLOAT32_C( -958.12), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -85.05), SIMDE_FLOAT32_C( -347.19), SIMDE_FLOAT32_C( -51.09), SIMDE_FLOAT32_C( 70.04), SIMDE_FLOAT32_C( 440.48), SIMDE_FLOAT32_C( -386.79), SIMDE_FLOAT32_C( -110.08), SIMDE_FLOAT32_C( 138.40), SIMDE_FLOAT32_C( -300.61), SIMDE_FLOAT32_C( 207.39), SIMDE_FLOAT32_C( 275.06), SIMDE_FLOAT32_C( -114.88), SIMDE_FLOAT32_C( 452.19) }, UINT16_C( 0) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -930.96), SIMDE_FLOAT32_C( -468.38), SIMDE_FLOAT32_C( 254.48), SIMDE_FLOAT32_C( -317.74), SIMDE_FLOAT32_C( -434.12), SIMDE_FLOAT32_C( 548.60), SIMDE_FLOAT32_C( -708.70), SIMDE_FLOAT32_C( -270.06), SIMDE_FLOAT32_C( 125.90), SIMDE_FLOAT32_C( 176.42), SIMDE_FLOAT32_C( -817.87), SIMDE_FLOAT32_C( 167.78), SIMDE_FLOAT32_C( -135.67), SIMDE_FLOAT32_C( 271.00) }, { SIMDE_FLOAT32_C( 461.58), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -468.38), SIMDE_FLOAT32_C( -42.38), SIMDE_FLOAT32_C( 414.18), SIMDE_FLOAT32_C( 121.01), SIMDE_FLOAT32_C( 548.60), SIMDE_FLOAT32_C( -886.43), SIMDE_FLOAT32_C( -671.60), SIMDE_FLOAT32_C( 371.08), SIMDE_FLOAT32_C( 468.51), SIMDE_FLOAT32_C( -742.72), SIMDE_FLOAT32_C( 573.07), SIMDE_FLOAT32_C( -135.67), SIMDE_FLOAT32_C( 718.86) }, UINT16_C(49008) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 339.94), SIMDE_FLOAT32_C( -183.64), SIMDE_FLOAT32_C( 331.50), SIMDE_FLOAT32_C( 631.24), SIMDE_FLOAT32_C( 546.30), SIMDE_FLOAT32_C( -542.60), SIMDE_FLOAT32_C( -192.33), SIMDE_FLOAT32_C( 728.44), SIMDE_FLOAT32_C( 625.18), SIMDE_FLOAT32_C( 672.00), SIMDE_FLOAT32_C( -0.57), SIMDE_FLOAT32_C( 707.92), SIMDE_FLOAT32_C( 189.14), SIMDE_FLOAT32_C( -435.53) }, { SIMDE_FLOAT32_C( -749.52), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 60.01), SIMDE_FLOAT32_C( 331.50), SIMDE_FLOAT32_C( 631.24), SIMDE_FLOAT32_C( 388.41), SIMDE_FLOAT32_C( -542.60), SIMDE_FLOAT32_C( 560.74), SIMDE_FLOAT32_C( 728.44), SIMDE_FLOAT32_C( 186.93), SIMDE_FLOAT32_C( 672.00), SIMDE_FLOAT32_C( 364.55), SIMDE_FLOAT32_C( 707.92), SIMDE_FLOAT32_C( 189.14), SIMDE_FLOAT32_C( 615.03) }, UINT16_C(28400) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 778.26), SIMDE_FLOAT32_C( 977.70), SIMDE_FLOAT32_C( 287.15), SIMDE_FLOAT32_C( -414.08), SIMDE_FLOAT32_C( 706.14), SIMDE_FLOAT32_C( -87.67), SIMDE_FLOAT32_C( -742.08), SIMDE_FLOAT32_C( -294.43), SIMDE_FLOAT32_C( -379.75), SIMDE_FLOAT32_C( 447.06), SIMDE_FLOAT32_C( 270.04), SIMDE_FLOAT32_C( -440.75), SIMDE_FLOAT32_C( 593.82), SIMDE_FLOAT32_C( 248.70) }, { SIMDE_FLOAT32_C( 619.26), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 977.70), SIMDE_FLOAT32_C( 450.45), SIMDE_FLOAT32_C( -414.08), SIMDE_FLOAT32_C( 706.14), SIMDE_FLOAT32_C( -87.67), SIMDE_FLOAT32_C( -742.08), SIMDE_FLOAT32_C( -294.43), SIMDE_FLOAT32_C( -647.28), SIMDE_FLOAT32_C( 858.12), SIMDE_FLOAT32_C( 270.04), SIMDE_FLOAT32_C( 850.97), SIMDE_FLOAT32_C( 593.82), SIMDE_FLOAT32_C( 248.70) }, UINT16_C( 1024) }, { { SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( -630.69), SIMDE_FLOAT32_C( 748.16), SIMDE_FLOAT32_C( -119.80), SIMDE_FLOAT32_C( -372.76), SIMDE_FLOAT32_C( -546.27), SIMDE_FLOAT32_C( 500.45), SIMDE_FLOAT32_C( -925.71), SIMDE_FLOAT32_C( 723.77), SIMDE_FLOAT32_C( -940.30), SIMDE_FLOAT32_C( 668.11), SIMDE_FLOAT32_C( -27.53), SIMDE_FLOAT32_C( 678.96), SIMDE_FLOAT32_C( 504.70), SIMDE_FLOAT32_C( -686.60) }, { SIMDE_FLOAT32_C( -313.38), SIMDE_MATH_NANF, SIMDE_MATH_NANF, SIMDE_FLOAT32_C( 748.16), SIMDE_FLOAT32_C( -119.80), SIMDE_FLOAT32_C( -733.89), SIMDE_FLOAT32_C( -546.27), SIMDE_FLOAT32_C( 945.25), SIMDE_FLOAT32_C( -875.77), SIMDE_FLOAT32_C( -9.20), SIMDE_FLOAT32_C( 796.22), SIMDE_FLOAT32_C( -870.63), SIMDE_FLOAT32_C( 55.13), SIMDE_FLOAT32_C( 678.96), SIMDE_FLOAT32_C( 912.76), SIMDE_FLOAT32_C( -686.60) }, UINT16_MAX } }; simde__m512 a, b; simde__mmask16 r; a = simde_mm512_loadu_ps(test_vec[0].a); b = simde_mm512_loadu_ps(test_vec[0].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_EQ_OQ); simde_assert_equal_mmask16(r, test_vec[0].r); a = simde_mm512_loadu_ps(test_vec[1].a); b = simde_mm512_loadu_ps(test_vec[1].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_LT_OS); simde_assert_equal_mmask16(r, test_vec[1].r); a = simde_mm512_loadu_ps(test_vec[2].a); b = simde_mm512_loadu_ps(test_vec[2].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_LE_OS); simde_assert_equal_mmask16(r, test_vec[2].r); a = simde_mm512_loadu_ps(test_vec[3].a); b = simde_mm512_loadu_ps(test_vec[3].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_UNORD_Q); simde_assert_equal_mmask16(r, test_vec[3].r); a = simde_mm512_loadu_ps(test_vec[4].a); b = simde_mm512_loadu_ps(test_vec[4].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NEQ_UQ); simde_assert_equal_mmask16(r, test_vec[4].r); a = simde_mm512_loadu_ps(test_vec[5].a); b = simde_mm512_loadu_ps(test_vec[5].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NLT_US); simde_assert_equal_mmask16(r, test_vec[5].r); a = simde_mm512_loadu_ps(test_vec[6].a); b = simde_mm512_loadu_ps(test_vec[6].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NLE_US); simde_assert_equal_mmask16(r, test_vec[6].r); a = simde_mm512_loadu_ps(test_vec[7].a); b = simde_mm512_loadu_ps(test_vec[7].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_ORD_Q); simde_assert_equal_mmask16(r, test_vec[7].r); a = simde_mm512_loadu_ps(test_vec[8].a); b = simde_mm512_loadu_ps(test_vec[8].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_EQ_UQ); simde_assert_equal_mmask16(r, test_vec[8].r); a = simde_mm512_loadu_ps(test_vec[9].a); b = simde_mm512_loadu_ps(test_vec[9].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NGE_US); simde_assert_equal_mmask16(r, test_vec[9].r); a = simde_mm512_loadu_ps(test_vec[10].a); b = simde_mm512_loadu_ps(test_vec[10].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NGT_US); simde_assert_equal_mmask16(r, test_vec[10].r); a = simde_mm512_loadu_ps(test_vec[11].a); b = simde_mm512_loadu_ps(test_vec[11].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_FALSE_OQ); simde_assert_equal_mmask16(r, test_vec[11].r); a = simde_mm512_loadu_ps(test_vec[12].a); b = simde_mm512_loadu_ps(test_vec[12].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NEQ_OQ); simde_assert_equal_mmask16(r, test_vec[12].r); a = simde_mm512_loadu_ps(test_vec[13].a); b = simde_mm512_loadu_ps(test_vec[13].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_GE_OS); simde_assert_equal_mmask16(r, test_vec[13].r); a = simde_mm512_loadu_ps(test_vec[14].a); b = simde_mm512_loadu_ps(test_vec[14].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_GT_OS); simde_assert_equal_mmask16(r, test_vec[14].r); a = simde_mm512_loadu_ps(test_vec[15].a); b = simde_mm512_loadu_ps(test_vec[15].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_TRUE_UQ); simde_assert_equal_mmask16(r, test_vec[15].r); a = simde_mm512_loadu_ps(test_vec[16].a); b = simde_mm512_loadu_ps(test_vec[16].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_EQ_OS); simde_assert_equal_mmask16(r, test_vec[16].r); a = simde_mm512_loadu_ps(test_vec[17].a); b = simde_mm512_loadu_ps(test_vec[17].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_LT_OQ); simde_assert_equal_mmask16(r, test_vec[17].r); a = simde_mm512_loadu_ps(test_vec[18].a); b = simde_mm512_loadu_ps(test_vec[18].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_LE_OQ); simde_assert_equal_mmask16(r, test_vec[18].r); a = simde_mm512_loadu_ps(test_vec[19].a); b = simde_mm512_loadu_ps(test_vec[19].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_UNORD_S); simde_assert_equal_mmask16(r, test_vec[19].r); a = simde_mm512_loadu_ps(test_vec[20].a); b = simde_mm512_loadu_ps(test_vec[20].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NEQ_US); simde_assert_equal_mmask16(r, test_vec[20].r); a = simde_mm512_loadu_ps(test_vec[21].a); b = simde_mm512_loadu_ps(test_vec[21].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NLT_UQ); simde_assert_equal_mmask16(r, test_vec[21].r); a = simde_mm512_loadu_ps(test_vec[22].a); b = simde_mm512_loadu_ps(test_vec[22].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NLE_UQ); simde_assert_equal_mmask16(r, test_vec[22].r); a = simde_mm512_loadu_ps(test_vec[23].a); b = simde_mm512_loadu_ps(test_vec[23].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_ORD_S); simde_assert_equal_mmask16(r, test_vec[23].r); a = simde_mm512_loadu_ps(test_vec[24].a); b = simde_mm512_loadu_ps(test_vec[24].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_EQ_US); simde_assert_equal_mmask16(r, test_vec[24].r); a = simde_mm512_loadu_ps(test_vec[25].a); b = simde_mm512_loadu_ps(test_vec[25].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NGE_UQ); simde_assert_equal_mmask16(r, test_vec[25].r); a = simde_mm512_loadu_ps(test_vec[26].a); b = simde_mm512_loadu_ps(test_vec[26].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NGT_UQ); simde_assert_equal_mmask16(r, test_vec[26].r); a = simde_mm512_loadu_ps(test_vec[27].a); b = simde_mm512_loadu_ps(test_vec[27].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_FALSE_OS); simde_assert_equal_mmask16(r, test_vec[27].r); a = simde_mm512_loadu_ps(test_vec[28].a); b = simde_mm512_loadu_ps(test_vec[28].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NEQ_OS); simde_assert_equal_mmask16(r, test_vec[28].r); a = simde_mm512_loadu_ps(test_vec[29].a); b = simde_mm512_loadu_ps(test_vec[29].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_GE_OQ); simde_assert_equal_mmask16(r, test_vec[29].r); a = simde_mm512_loadu_ps(test_vec[30].a); b = simde_mm512_loadu_ps(test_vec[30].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_GT_OQ); simde_assert_equal_mmask16(r, test_vec[30].r); a = simde_mm512_loadu_ps(test_vec[31].a); b = simde_mm512_loadu_ps(test_vec[31].b); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_TRUE_US); simde_assert_equal_mmask16(r, test_vec[31].r); return 0; #else fputc('\n', stdout); const simde__m512 nanv = simde_mm512_set1_ps(SIMDE_MATH_NANF); simde__m512 a, b; simde__mmask16 r; a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_EQ_OQ); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_LT_OS); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_LE_OS); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_UNORD_Q); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NEQ_UQ); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NLT_US); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NLE_US); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_ORD_Q); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_EQ_UQ); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NGE_US); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NGT_US); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_FALSE_OQ); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NEQ_OQ); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_GE_OS); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_GT_OS); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_TRUE_UQ); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_EQ_OS); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_LT_OQ); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_LE_OQ); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_UNORD_S); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NEQ_US); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NLT_UQ); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NLE_UQ); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_ORD_S); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_EQ_US); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NGE_UQ); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NGT_UQ); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_FALSE_OS); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_NEQ_OS); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_GE_OQ); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_GT_OQ); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_test_x86_random_f32x16(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); b = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, simde_test_codegen_random_i16()), b); a = simde_mm512_mask_mov_ps(a, HEDLEY_STATIC_CAST(simde__mmask16, 3), nanv); b = simde_mm512_mask_mov_ps(b, HEDLEY_STATIC_CAST(simde__mmask16, 6), nanv); r = simde_mm512_cmp_ps_mask(a, b, SIMDE_CMP_TRUE_US); simde_test_x86_write_f32x16(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x16(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask16(2, r, SIMDE_TEST_VEC_POS_LAST); return 1; #endif } static int test_simde_mm256_cmp_ps_mask (SIMDE_MUNIT_TEST_ARGS) { #if 1 simde__m256 a, b; simde__mmask8 e, r; a = simde_mm256_set_ps(SIMDE_FLOAT32_C( -521.70), SIMDE_FLOAT32_C( 208.95), SIMDE_FLOAT32_C( -892.52), SIMDE_FLOAT32_C( 822.05), SIMDE_FLOAT32_C( -914.87), SIMDE_FLOAT32_C( 926.51), SIMDE_FLOAT32_C( -568.65), SIMDE_FLOAT32_C( -377.10)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( 846.31), SIMDE_FLOAT32_C( -287.77), SIMDE_FLOAT32_C( -505.72), SIMDE_FLOAT32_C( -231.66), SIMDE_FLOAT32_C( 589.02), SIMDE_FLOAT32_C( -703.08), SIMDE_FLOAT32_C( -955.43), SIMDE_FLOAT32_C( 989.02)); e = UINT8_C( 0); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_EQ_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( -285.67), SIMDE_FLOAT32_C( -694.44), SIMDE_FLOAT32_C( -819.49), SIMDE_FLOAT32_C( 958.85), SIMDE_FLOAT32_C( -277.57), SIMDE_FLOAT32_C( 148.21), SIMDE_FLOAT32_C( 209.64), SIMDE_FLOAT32_C( -545.40)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( 646.39), SIMDE_FLOAT32_C( 361.60), SIMDE_FLOAT32_C( -15.47), SIMDE_FLOAT32_C( 23.49), SIMDE_FLOAT32_C( 66.16), SIMDE_FLOAT32_C( 788.78), SIMDE_FLOAT32_C( 421.77), SIMDE_FLOAT32_C( -189.56)); e = UINT8_C(239); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_LT_OS); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( 384.60), SIMDE_FLOAT32_C( 716.23), SIMDE_FLOAT32_C( -59.52), SIMDE_FLOAT32_C( 395.59), SIMDE_FLOAT32_C( 237.94), SIMDE_FLOAT32_C( 731.52), SIMDE_FLOAT32_C( 288.10), SIMDE_FLOAT32_C( 415.88)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( -37.96), SIMDE_FLOAT32_C( 599.69), SIMDE_FLOAT32_C( 685.85), SIMDE_FLOAT32_C( -492.56), SIMDE_FLOAT32_C( 753.39), SIMDE_FLOAT32_C( -26.38), SIMDE_FLOAT32_C( -986.84), SIMDE_FLOAT32_C( -14.96)); e = UINT8_C( 40); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_LE_OS); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( 738.86), SIMDE_FLOAT32_C( 568.67), SIMDE_FLOAT32_C( 990.03), SIMDE_FLOAT32_C( -71.58), SIMDE_FLOAT32_C( -145.66), SIMDE_FLOAT32_C( 684.47), SIMDE_FLOAT32_C( -252.09), SIMDE_FLOAT32_C( -104.51)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( 757.87), SIMDE_FLOAT32_C( -918.31), SIMDE_FLOAT32_C( -833.39), SIMDE_FLOAT32_C( -658.02), SIMDE_FLOAT32_C( -564.70), SIMDE_FLOAT32_C( -194.98), SIMDE_FLOAT32_C( 357.45), SIMDE_FLOAT32_C( 411.80)); e = UINT8_C( 0); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_UNORD_Q); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( 738.73), SIMDE_FLOAT32_C( -765.09), SIMDE_FLOAT32_C( -287.96), SIMDE_FLOAT32_C( -246.32), SIMDE_FLOAT32_C( -149.69), SIMDE_FLOAT32_C( -4.20), SIMDE_FLOAT32_C( 813.21), SIMDE_FLOAT32_C( 454.72)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( 789.87), SIMDE_FLOAT32_C( -805.33), SIMDE_FLOAT32_C( 91.81), SIMDE_FLOAT32_C( -105.62), SIMDE_FLOAT32_C( 232.63), SIMDE_FLOAT32_C( 492.12), SIMDE_FLOAT32_C( 208.53), SIMDE_FLOAT32_C( -274.80)); e = UINT8_MAX; r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_NEQ_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( 280.98), SIMDE_FLOAT32_C( -493.00), SIMDE_FLOAT32_C( -787.12), SIMDE_FLOAT32_C( 869.18), SIMDE_FLOAT32_C( -231.86), SIMDE_FLOAT32_C( -355.79), SIMDE_FLOAT32_C( 879.15), SIMDE_FLOAT32_C( 839.72)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( -66.65), SIMDE_FLOAT32_C( 670.17), SIMDE_FLOAT32_C( 797.96), SIMDE_FLOAT32_C( 478.63), SIMDE_FLOAT32_C( 912.31), SIMDE_FLOAT32_C( 716.28), SIMDE_FLOAT32_C( 312.02), SIMDE_FLOAT32_C( 570.33)); e = UINT8_C(147); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_NLT_US); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( -896.79), SIMDE_FLOAT32_C( -896.41), SIMDE_FLOAT32_C( -981.44), SIMDE_FLOAT32_C( 378.01), SIMDE_FLOAT32_C( -635.14), SIMDE_FLOAT32_C( 783.65), SIMDE_FLOAT32_C( -334.02), SIMDE_FLOAT32_C( 611.17)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( -472.77), SIMDE_FLOAT32_C( 911.34), SIMDE_FLOAT32_C( 530.52), SIMDE_FLOAT32_C( -312.49), SIMDE_FLOAT32_C( -878.53), SIMDE_FLOAT32_C( 335.84), SIMDE_FLOAT32_C( 595.70), SIMDE_FLOAT32_C( 227.09)); e = UINT8_C( 29); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_NLE_US); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( -661.25), SIMDE_FLOAT32_C( -440.17), SIMDE_FLOAT32_C( 802.38), SIMDE_FLOAT32_C( -231.58), SIMDE_FLOAT32_C( 278.84), SIMDE_FLOAT32_C( 295.37), SIMDE_FLOAT32_C( -444.45), SIMDE_FLOAT32_C( 409.66)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( 685.24), SIMDE_FLOAT32_C( 526.37), SIMDE_FLOAT32_C( 921.23), SIMDE_FLOAT32_C( -925.93), SIMDE_FLOAT32_C( -406.98), SIMDE_FLOAT32_C( -748.94), SIMDE_FLOAT32_C( -723.90), SIMDE_FLOAT32_C( 114.39)); e = UINT8_MAX; r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_ORD_Q); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( -444.32), SIMDE_FLOAT32_C( -931.57), SIMDE_FLOAT32_C( -846.31), SIMDE_FLOAT32_C( 328.59), SIMDE_FLOAT32_C( 965.22), SIMDE_FLOAT32_C( -949.90), SIMDE_FLOAT32_C( 310.02), SIMDE_FLOAT32_C( -412.80)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( -655.55), SIMDE_FLOAT32_C( -35.87), SIMDE_FLOAT32_C( -411.51), SIMDE_FLOAT32_C( -65.21), SIMDE_FLOAT32_C( -563.10), SIMDE_FLOAT32_C( -322.85), SIMDE_FLOAT32_C( 404.27), SIMDE_FLOAT32_C( 749.39)); e = UINT8_C( 0); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_EQ_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( 176.28), SIMDE_FLOAT32_C( -748.79), SIMDE_FLOAT32_C( -816.88), SIMDE_FLOAT32_C( -938.12), SIMDE_FLOAT32_C( 912.46), SIMDE_FLOAT32_C( 623.29), SIMDE_FLOAT32_C( -740.49), SIMDE_FLOAT32_C( 144.04)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( 10.70), SIMDE_FLOAT32_C( -781.47), SIMDE_FLOAT32_C( 295.67), SIMDE_FLOAT32_C( -576.51), SIMDE_FLOAT32_C( -466.71), SIMDE_FLOAT32_C( 769.30), SIMDE_FLOAT32_C( -497.74), SIMDE_FLOAT32_C( -540.78)); e = UINT8_C( 54); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_NGE_US); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( -828.30), SIMDE_FLOAT32_C( -510.04), SIMDE_FLOAT32_C( 44.34), SIMDE_FLOAT32_C( -577.69), SIMDE_FLOAT32_C( 934.28), SIMDE_FLOAT32_C( -24.09), SIMDE_FLOAT32_C( -731.37), SIMDE_FLOAT32_C( -394.31)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( -100.36), SIMDE_FLOAT32_C( 727.85), SIMDE_FLOAT32_C( 572.74), SIMDE_FLOAT32_C( 755.60), SIMDE_FLOAT32_C( 383.39), SIMDE_FLOAT32_C( -391.40), SIMDE_FLOAT32_C( 167.11), SIMDE_FLOAT32_C( -551.39)); e = UINT8_C(242); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_NGT_US); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( 993.48), SIMDE_FLOAT32_C( 70.41), SIMDE_FLOAT32_C( 63.31), SIMDE_FLOAT32_C( 534.26), SIMDE_FLOAT32_C( 894.13), SIMDE_FLOAT32_C( -187.90), SIMDE_FLOAT32_C( 351.14), SIMDE_FLOAT32_C( 832.25)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( -258.93), SIMDE_FLOAT32_C( -0.24), SIMDE_FLOAT32_C( -254.70), SIMDE_FLOAT32_C( -864.62), SIMDE_FLOAT32_C( 989.07), SIMDE_FLOAT32_C( -473.23), SIMDE_FLOAT32_C( -160.29), SIMDE_FLOAT32_C( 565.58)); e = UINT8_C( 0); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_FALSE_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( 468.62), SIMDE_FLOAT32_C( 607.95), SIMDE_FLOAT32_C( 165.31), SIMDE_FLOAT32_C( 20.01), SIMDE_FLOAT32_C( 436.25), SIMDE_FLOAT32_C( -324.65), SIMDE_FLOAT32_C( 975.68), SIMDE_FLOAT32_C( 13.93)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( 621.54), SIMDE_FLOAT32_C( -12.34), SIMDE_FLOAT32_C( -420.14), SIMDE_FLOAT32_C( 789.29), SIMDE_FLOAT32_C( -911.98), SIMDE_FLOAT32_C( -147.98), SIMDE_FLOAT32_C( -783.45), SIMDE_FLOAT32_C( -667.58)); e = UINT8_MAX; r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_NEQ_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( -571.34), SIMDE_FLOAT32_C( 458.74), SIMDE_FLOAT32_C( -413.92), SIMDE_FLOAT32_C( -136.92), SIMDE_FLOAT32_C( 465.26), SIMDE_FLOAT32_C( 515.67), SIMDE_FLOAT32_C( 799.77), SIMDE_FLOAT32_C( 931.00)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( 744.75), SIMDE_FLOAT32_C( -697.77), SIMDE_FLOAT32_C( 417.49), SIMDE_FLOAT32_C( -269.18), SIMDE_FLOAT32_C( 561.16), SIMDE_FLOAT32_C( -582.28), SIMDE_FLOAT32_C( 985.51), SIMDE_FLOAT32_C( 425.78)); e = UINT8_C( 85); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_GE_OS); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( -524.68), SIMDE_FLOAT32_C( 881.80), SIMDE_FLOAT32_C( -211.06), SIMDE_FLOAT32_C( -857.10), SIMDE_FLOAT32_C( -586.82), SIMDE_FLOAT32_C( 180.99), SIMDE_FLOAT32_C( -22.41), SIMDE_FLOAT32_C( 393.17)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( 244.68), SIMDE_FLOAT32_C( -583.68), SIMDE_FLOAT32_C( 551.01), SIMDE_FLOAT32_C( 313.68), SIMDE_FLOAT32_C( -205.22), SIMDE_FLOAT32_C( -436.66), SIMDE_FLOAT32_C( -266.18), SIMDE_FLOAT32_C( 5.49)); e = UINT8_C( 71); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_GT_OS); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( 943.85), SIMDE_FLOAT32_C( -357.49), SIMDE_FLOAT32_C( -831.32), SIMDE_FLOAT32_C( -481.93), SIMDE_FLOAT32_C( -786.15), SIMDE_FLOAT32_C( -290.06), SIMDE_FLOAT32_C( 931.99), SIMDE_FLOAT32_C( 350.78)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( 870.89), SIMDE_FLOAT32_C( -370.24), SIMDE_FLOAT32_C( 807.25), SIMDE_FLOAT32_C( -522.28), SIMDE_FLOAT32_C( -114.99), SIMDE_FLOAT32_C( 505.02), SIMDE_FLOAT32_C( 60.23), SIMDE_FLOAT32_C( -845.81)); e = UINT8_MAX; r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_TRUE_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( 605.19), SIMDE_FLOAT32_C( 403.06), SIMDE_FLOAT32_C( -834.13), SIMDE_FLOAT32_C( -400.31), SIMDE_FLOAT32_C( -72.27), SIMDE_FLOAT32_C( -715.93), SIMDE_FLOAT32_C( 810.75), SIMDE_FLOAT32_C( -215.16)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( -131.82), SIMDE_FLOAT32_C( 458.04), SIMDE_FLOAT32_C( -183.71), SIMDE_FLOAT32_C( 517.41), SIMDE_FLOAT32_C( -786.64), SIMDE_FLOAT32_C( -600.03), SIMDE_FLOAT32_C( 966.40), SIMDE_FLOAT32_C( -100.31)); e = UINT8_C( 0); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_EQ_OS); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( -509.15), SIMDE_FLOAT32_C( 210.20), SIMDE_FLOAT32_C( 724.55), SIMDE_FLOAT32_C( -663.34), SIMDE_FLOAT32_C( 266.35), SIMDE_FLOAT32_C( 82.04), SIMDE_FLOAT32_C( -832.02), SIMDE_FLOAT32_C( -251.72)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( 307.30), SIMDE_FLOAT32_C( 133.40), SIMDE_FLOAT32_C( -994.38), SIMDE_FLOAT32_C( -477.53), SIMDE_FLOAT32_C( 262.51), SIMDE_FLOAT32_C( 375.86), SIMDE_FLOAT32_C( -284.78), SIMDE_FLOAT32_C( -215.22)); e = UINT8_C(151); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_LT_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( -516.98), SIMDE_FLOAT32_C( -978.75), SIMDE_FLOAT32_C( 638.09), SIMDE_FLOAT32_C( 583.33), SIMDE_FLOAT32_C( -583.93), SIMDE_FLOAT32_C( -764.96), SIMDE_FLOAT32_C( 417.47), SIMDE_FLOAT32_C( 816.37)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( 985.79), SIMDE_FLOAT32_C( 990.09), SIMDE_FLOAT32_C( -845.58), SIMDE_FLOAT32_C( 237.51), SIMDE_FLOAT32_C( 121.90), SIMDE_FLOAT32_C( -303.62), SIMDE_FLOAT32_C( -578.78), SIMDE_FLOAT32_C( 604.49)); e = UINT8_C(204); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_LE_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( 581.46), SIMDE_FLOAT32_C( 149.92), SIMDE_FLOAT32_C( -537.65), SIMDE_FLOAT32_C( -203.32), SIMDE_FLOAT32_C( -340.94), SIMDE_FLOAT32_C( 252.14), SIMDE_FLOAT32_C( 72.13), SIMDE_FLOAT32_C( -677.60)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( -652.22), SIMDE_FLOAT32_C( 7.34), SIMDE_FLOAT32_C( 977.37), SIMDE_FLOAT32_C( -468.59), SIMDE_FLOAT32_C( 700.03), SIMDE_FLOAT32_C( -156.03), SIMDE_FLOAT32_C( -474.22), SIMDE_FLOAT32_C( 177.57)); e = UINT8_C( 0); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_UNORD_S); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( -515.03), SIMDE_FLOAT32_C( 461.19), SIMDE_FLOAT32_C( -214.90), SIMDE_FLOAT32_C( -119.53), SIMDE_FLOAT32_C( -21.83), SIMDE_FLOAT32_C( -236.15), SIMDE_FLOAT32_C( 242.38), SIMDE_FLOAT32_C( 394.83)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( -365.60), SIMDE_FLOAT32_C( -570.38), SIMDE_FLOAT32_C( 596.96), SIMDE_FLOAT32_C( -688.00), SIMDE_FLOAT32_C( -556.17), SIMDE_FLOAT32_C( 606.87), SIMDE_FLOAT32_C( -842.43), SIMDE_FLOAT32_C( 206.32)); e = UINT8_MAX; r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_NEQ_US); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( 321.68), SIMDE_FLOAT32_C( 47.23), SIMDE_FLOAT32_C( -556.61), SIMDE_FLOAT32_C( -855.88), SIMDE_FLOAT32_C( 465.77), SIMDE_FLOAT32_C( 293.47), SIMDE_FLOAT32_C( 681.77), SIMDE_FLOAT32_C( -330.91)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( 263.40), SIMDE_FLOAT32_C( 848.36), SIMDE_FLOAT32_C( -970.94), SIMDE_FLOAT32_C( 868.56), SIMDE_FLOAT32_C( 500.58), SIMDE_FLOAT32_C( 21.72), SIMDE_FLOAT32_C( 891.20), SIMDE_FLOAT32_C( -30.83)); e = UINT8_C(164); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_NLT_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( -396.38), SIMDE_FLOAT32_C( -363.13), SIMDE_FLOAT32_C( 702.76), SIMDE_FLOAT32_C( 397.30), SIMDE_FLOAT32_C( -848.09), SIMDE_FLOAT32_C( -758.43), SIMDE_FLOAT32_C( -387.80), SIMDE_FLOAT32_C( 271.43)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( -490.21), SIMDE_FLOAT32_C( -193.27), SIMDE_FLOAT32_C( 477.07), SIMDE_FLOAT32_C( 840.70), SIMDE_FLOAT32_C( -827.67), SIMDE_FLOAT32_C( 47.45), SIMDE_FLOAT32_C( -756.26), SIMDE_FLOAT32_C( 860.33)); e = UINT8_C(162); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_NLE_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( 512.75), SIMDE_FLOAT32_C( -375.36), SIMDE_FLOAT32_C( 22.78), SIMDE_FLOAT32_C( -456.42), SIMDE_FLOAT32_C( 302.96), SIMDE_FLOAT32_C( 975.56), SIMDE_FLOAT32_C( -899.81), SIMDE_FLOAT32_C( 158.84)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( -53.14), SIMDE_FLOAT32_C( -954.06), SIMDE_FLOAT32_C( -138.32), SIMDE_FLOAT32_C( 675.42), SIMDE_FLOAT32_C( -217.45), SIMDE_FLOAT32_C( 13.33), SIMDE_FLOAT32_C( 646.36), SIMDE_FLOAT32_C( -86.02)); e = UINT8_MAX; r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_ORD_S); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( 850.60), SIMDE_FLOAT32_C( 474.80), SIMDE_FLOAT32_C( 735.64), SIMDE_FLOAT32_C( 990.27), SIMDE_FLOAT32_C( -128.82), SIMDE_FLOAT32_C( 98.76), SIMDE_FLOAT32_C( -712.49), SIMDE_FLOAT32_C( 473.88)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( 158.16), SIMDE_FLOAT32_C( -670.12), SIMDE_FLOAT32_C( -170.35), SIMDE_FLOAT32_C( 999.32), SIMDE_FLOAT32_C( 820.08), SIMDE_FLOAT32_C( -977.08), SIMDE_FLOAT32_C( -477.75), SIMDE_FLOAT32_C( 979.38)); e = UINT8_C( 0); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_EQ_US); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( -757.80), SIMDE_FLOAT32_C( -13.83), SIMDE_FLOAT32_C( 85.77), SIMDE_FLOAT32_C( 328.22), SIMDE_FLOAT32_C( 473.42), SIMDE_FLOAT32_C( -538.88), SIMDE_FLOAT32_C( -694.57), SIMDE_FLOAT32_C( -70.16)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( -664.94), SIMDE_FLOAT32_C( 354.41), SIMDE_FLOAT32_C( 70.69), SIMDE_FLOAT32_C( -138.82), SIMDE_FLOAT32_C( -592.45), SIMDE_FLOAT32_C( 24.74), SIMDE_FLOAT32_C( 999.49), SIMDE_FLOAT32_C( -267.87)); e = UINT8_C(198); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_NGE_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( -831.82), SIMDE_FLOAT32_C( 199.06), SIMDE_FLOAT32_C( -318.95), SIMDE_FLOAT32_C( -811.20), SIMDE_FLOAT32_C( 348.47), SIMDE_FLOAT32_C( 206.24), SIMDE_FLOAT32_C( -546.83), SIMDE_FLOAT32_C( 358.20)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( -18.53), SIMDE_FLOAT32_C( -639.22), SIMDE_FLOAT32_C( -681.86), SIMDE_FLOAT32_C( -948.37), SIMDE_FLOAT32_C( 202.62), SIMDE_FLOAT32_C( 988.27), SIMDE_FLOAT32_C( 221.98), SIMDE_FLOAT32_C( 203.30)); e = UINT8_C(134); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_NGT_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( -360.20), SIMDE_FLOAT32_C( -806.01), SIMDE_FLOAT32_C( 441.06), SIMDE_FLOAT32_C( 907.67), SIMDE_FLOAT32_C( 951.79), SIMDE_FLOAT32_C( -545.11), SIMDE_FLOAT32_C( -178.10), SIMDE_FLOAT32_C( -376.43)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( 647.62), SIMDE_FLOAT32_C( -363.20), SIMDE_FLOAT32_C( -598.24), SIMDE_FLOAT32_C( -710.58), SIMDE_FLOAT32_C( -698.26), SIMDE_FLOAT32_C( 47.35), SIMDE_FLOAT32_C( 218.73), SIMDE_FLOAT32_C( 440.56)); e = UINT8_C( 0); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_FALSE_OS); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( 727.38), SIMDE_FLOAT32_C( 211.91), SIMDE_FLOAT32_C( -804.86), SIMDE_FLOAT32_C( -475.91), SIMDE_FLOAT32_C( 43.73), SIMDE_FLOAT32_C( -3.92), SIMDE_FLOAT32_C( 843.04), SIMDE_FLOAT32_C( -145.07)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( -858.11), SIMDE_FLOAT32_C( -549.77), SIMDE_FLOAT32_C( 290.78), SIMDE_FLOAT32_C( 518.32), SIMDE_FLOAT32_C( 468.76), SIMDE_FLOAT32_C( -70.00), SIMDE_FLOAT32_C( 200.18), SIMDE_FLOAT32_C( 417.13)); e = UINT8_MAX; r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_NEQ_OS); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( 786.75), SIMDE_FLOAT32_C( -339.84), SIMDE_FLOAT32_C( -712.33), SIMDE_FLOAT32_C( -653.81), SIMDE_FLOAT32_C( -979.64), SIMDE_FLOAT32_C( -906.32), SIMDE_FLOAT32_C( -94.88), SIMDE_FLOAT32_C( -887.31)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( -35.80), SIMDE_FLOAT32_C( 443.44), SIMDE_FLOAT32_C( -274.72), SIMDE_FLOAT32_C( -890.73), SIMDE_FLOAT32_C( 795.82), SIMDE_FLOAT32_C( -911.52), SIMDE_FLOAT32_C( 707.51), SIMDE_FLOAT32_C( 506.40)); e = UINT8_C(148); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_GE_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( -948.21), SIMDE_FLOAT32_C( -180.21), SIMDE_FLOAT32_C( 219.84), SIMDE_FLOAT32_C( -365.33), SIMDE_FLOAT32_C( 92.40), SIMDE_FLOAT32_C( -992.07), SIMDE_FLOAT32_C( -560.48), SIMDE_FLOAT32_C( -431.68)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( 153.26), SIMDE_FLOAT32_C( -919.77), SIMDE_FLOAT32_C( 970.78), SIMDE_FLOAT32_C( 40.57), SIMDE_FLOAT32_C( 938.34), SIMDE_FLOAT32_C( 520.55), SIMDE_FLOAT32_C( 749.79), SIMDE_FLOAT32_C( -579.98)); e = UINT8_C( 65); r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_GT_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_ps(SIMDE_FLOAT32_C( 967.99), SIMDE_FLOAT32_C( 8.83), SIMDE_FLOAT32_C( 833.78), SIMDE_FLOAT32_C( -538.41), SIMDE_FLOAT32_C( 222.09), SIMDE_FLOAT32_C( 173.62), SIMDE_FLOAT32_C( -826.08), SIMDE_FLOAT32_C( -124.10)); b = simde_mm256_set_ps(SIMDE_FLOAT32_C( -609.09), SIMDE_FLOAT32_C( -385.23), SIMDE_FLOAT32_C( 207.26), SIMDE_FLOAT32_C( 822.59), SIMDE_FLOAT32_C( 650.57), SIMDE_FLOAT32_C( 763.82), SIMDE_FLOAT32_C( 97.31), SIMDE_FLOAT32_C( 541.30)); e = UINT8_MAX; r = simde_mm256_cmp_ps_mask(a, b, SIMDE_CMP_TRUE_US); simde_assert_equal_mmask8(r, e); return 0; #else fputc('\n', stdout); for (int i = 0 ; i < 32 ; i++) { simde__m256 a = simde_test_x86_random_f32x8(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); simde__m256 b = simde_test_x86_random_f32x8(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); int imm8 = i; simde__mmask8 r; SIMDE_CONSTIFY_32_(simde_mm256_cmp_ps_mask, r, (HEDLEY_UNREACHABLE(), 0), imm8, a, b); simde_test_x86_write_f32x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_codegen_write_i32(2, imm8, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); } return 1; #endif } static int test_simde_mm_cmp_ps_mask (SIMDE_MUNIT_TEST_ARGS) { #if 1 simde__m128 a, b; simde__mmask8 e, r; a = simde_mm_set_ps(SIMDE_FLOAT32_C( 609.48), SIMDE_FLOAT32_C( 744.95), SIMDE_FLOAT32_C( -768.13), SIMDE_FLOAT32_C( -64.79)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( 772.67), SIMDE_FLOAT32_C( 132.73), SIMDE_FLOAT32_C( -998.15), SIMDE_FLOAT32_C( 759.27)); e = UINT8_C( 0); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_EQ_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( 248.79), SIMDE_FLOAT32_C( 147.05), SIMDE_FLOAT32_C( -94.71), SIMDE_FLOAT32_C( -435.42)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( -898.17), SIMDE_FLOAT32_C( -302.87), SIMDE_FLOAT32_C( 621.93), SIMDE_FLOAT32_C( 462.90)); e = UINT8_C( 3); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_LT_OS); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( 805.59), SIMDE_FLOAT32_C( 659.02), SIMDE_FLOAT32_C( 192.48), SIMDE_FLOAT32_C( -313.67)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( -516.88), SIMDE_FLOAT32_C( 851.69), SIMDE_FLOAT32_C( 929.84), SIMDE_FLOAT32_C( 859.03)); e = UINT8_C( 7); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_LE_OS); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( 671.23), SIMDE_FLOAT32_C( 440.78), SIMDE_FLOAT32_C( 396.17), SIMDE_FLOAT32_C( -933.28)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( -73.11), SIMDE_FLOAT32_C( -829.33), SIMDE_FLOAT32_C( -379.83), SIMDE_FLOAT32_C( 991.67)); e = UINT8_C( 0); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_UNORD_Q); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( -388.69), SIMDE_FLOAT32_C( -463.63), SIMDE_FLOAT32_C( 915.63), SIMDE_FLOAT32_C( -147.97)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( -517.95), SIMDE_FLOAT32_C( -616.02), SIMDE_FLOAT32_C( 669.10), SIMDE_FLOAT32_C( 917.47)); e = UINT8_C( 15); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_NEQ_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( -962.71), SIMDE_FLOAT32_C( 730.84), SIMDE_FLOAT32_C( 531.03), SIMDE_FLOAT32_C( -425.61)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( 839.29), SIMDE_FLOAT32_C( -860.88), SIMDE_FLOAT32_C( -572.03), SIMDE_FLOAT32_C( 152.96)); e = UINT8_C( 6); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_NLT_US); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( 479.48), SIMDE_FLOAT32_C( 644.89), SIMDE_FLOAT32_C( 798.14), SIMDE_FLOAT32_C( 620.45)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( 794.70), SIMDE_FLOAT32_C( 962.60), SIMDE_FLOAT32_C( 496.58), SIMDE_FLOAT32_C( 727.97)); e = UINT8_C( 2); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_NLE_US); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( -115.58), SIMDE_FLOAT32_C( 465.93), SIMDE_FLOAT32_C( 403.39), SIMDE_FLOAT32_C( -107.25)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( -124.42), SIMDE_FLOAT32_C( 811.31), SIMDE_FLOAT32_C( 636.61), SIMDE_FLOAT32_C( -976.45)); e = UINT8_C( 15); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_ORD_Q); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( 469.70), SIMDE_FLOAT32_C( 486.89), SIMDE_FLOAT32_C( -652.32), SIMDE_FLOAT32_C( 552.23)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( -408.83), SIMDE_FLOAT32_C( 951.75), SIMDE_FLOAT32_C( 870.87), SIMDE_FLOAT32_C( -983.22)); e = UINT8_C( 0); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_EQ_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( -445.14), SIMDE_FLOAT32_C( -371.55), SIMDE_FLOAT32_C( 682.59), SIMDE_FLOAT32_C( 401.90)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( 731.01), SIMDE_FLOAT32_C( -605.85), SIMDE_FLOAT32_C( -232.43), SIMDE_FLOAT32_C( -889.44)); e = UINT8_C( 8); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_NGE_US); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( -706.31), SIMDE_FLOAT32_C( 210.49), SIMDE_FLOAT32_C( -960.96), SIMDE_FLOAT32_C( -434.29)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( -571.64), SIMDE_FLOAT32_C( -911.62), SIMDE_FLOAT32_C( 173.09), SIMDE_FLOAT32_C( 535.62)); e = UINT8_C( 11); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_NGT_US); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( -399.97), SIMDE_FLOAT32_C( 312.78), SIMDE_FLOAT32_C( 554.32), SIMDE_FLOAT32_C( -423.52)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( -256.85), SIMDE_FLOAT32_C( 475.61), SIMDE_FLOAT32_C( 124.09), SIMDE_FLOAT32_C( 190.92)); e = UINT8_C( 0); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_FALSE_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( 488.55), SIMDE_FLOAT32_C( -787.14), SIMDE_FLOAT32_C( -37.50), SIMDE_FLOAT32_C( 471.77)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( -764.73), SIMDE_FLOAT32_C( -920.29), SIMDE_FLOAT32_C( -835.39), SIMDE_FLOAT32_C( -166.63)); e = UINT8_C( 15); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_NEQ_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( 957.77), SIMDE_FLOAT32_C( -209.87), SIMDE_FLOAT32_C( -291.83), SIMDE_FLOAT32_C( 847.21)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( -958.55), SIMDE_FLOAT32_C( 688.78), SIMDE_FLOAT32_C( 184.29), SIMDE_FLOAT32_C( 475.74)); e = UINT8_C( 9); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_GE_OS); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( -241.05), SIMDE_FLOAT32_C( -664.86), SIMDE_FLOAT32_C( -100.72), SIMDE_FLOAT32_C( 223.33)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( -351.15), SIMDE_FLOAT32_C( 187.31), SIMDE_FLOAT32_C( -576.47), SIMDE_FLOAT32_C( -927.63)); e = UINT8_C( 11); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_GT_OS); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( 168.76), SIMDE_FLOAT32_C( 248.88), SIMDE_FLOAT32_C( -499.91), SIMDE_FLOAT32_C( 977.84)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( 95.95), SIMDE_FLOAT32_C( 911.92), SIMDE_FLOAT32_C( -275.50), SIMDE_FLOAT32_C( 624.18)); e = UINT8_C( 15); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_TRUE_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( -479.63), SIMDE_FLOAT32_C( -415.51), SIMDE_FLOAT32_C( -875.22), SIMDE_FLOAT32_C( 687.00)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( -863.41), SIMDE_FLOAT32_C( -244.36), SIMDE_FLOAT32_C( -335.79), SIMDE_FLOAT32_C( -710.61)); e = UINT8_C( 0); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_EQ_OS); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( -151.88), SIMDE_FLOAT32_C( -905.64), SIMDE_FLOAT32_C( 545.78), SIMDE_FLOAT32_C( 372.38)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( 953.40), SIMDE_FLOAT32_C( -110.43), SIMDE_FLOAT32_C( 783.15), SIMDE_FLOAT32_C( -269.93)); e = UINT8_C( 14); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_LT_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( -245.20), SIMDE_FLOAT32_C( -287.66), SIMDE_FLOAT32_C( 224.71), SIMDE_FLOAT32_C( -317.58)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( 626.08), SIMDE_FLOAT32_C( 403.65), SIMDE_FLOAT32_C( 899.65), SIMDE_FLOAT32_C( 648.24)); e = UINT8_C( 15); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_LE_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( -976.07), SIMDE_FLOAT32_C( -205.16), SIMDE_FLOAT32_C( -347.47), SIMDE_FLOAT32_C( -600.25)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( 64.03), SIMDE_FLOAT32_C( 119.88), SIMDE_FLOAT32_C( -293.24), SIMDE_FLOAT32_C( 377.03)); e = UINT8_C( 0); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_UNORD_S); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( 120.92), SIMDE_FLOAT32_C( 584.40), SIMDE_FLOAT32_C( 704.37), SIMDE_FLOAT32_C( -168.46)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( 740.95), SIMDE_FLOAT32_C( 257.52), SIMDE_FLOAT32_C( -659.95), SIMDE_FLOAT32_C( -631.42)); e = UINT8_C( 15); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_NEQ_US); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( -384.11), SIMDE_FLOAT32_C( -410.93), SIMDE_FLOAT32_C( 351.88), SIMDE_FLOAT32_C( 885.83)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( 817.45), SIMDE_FLOAT32_C( -430.71), SIMDE_FLOAT32_C( 478.64), SIMDE_FLOAT32_C( 135.03)); e = UINT8_C( 5); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_NLT_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( -648.41), SIMDE_FLOAT32_C( -427.75), SIMDE_FLOAT32_C( 281.63), SIMDE_FLOAT32_C( -296.65)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( 581.03), SIMDE_FLOAT32_C( 977.67), SIMDE_FLOAT32_C( 975.90), SIMDE_FLOAT32_C( 181.29)); e = UINT8_C( 0); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_NLE_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( -994.54), SIMDE_FLOAT32_C( 604.96), SIMDE_FLOAT32_C( -227.48), SIMDE_FLOAT32_C( -371.57)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( -689.19), SIMDE_FLOAT32_C( 69.49), SIMDE_FLOAT32_C( -275.17), SIMDE_FLOAT32_C( 479.28)); e = UINT8_C( 15); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_ORD_S); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( -202.22), SIMDE_FLOAT32_C( 431.74), SIMDE_FLOAT32_C( -346.11), SIMDE_FLOAT32_C( -570.80)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( -120.23), SIMDE_FLOAT32_C( -461.27), SIMDE_FLOAT32_C( -310.75), SIMDE_FLOAT32_C( -6.06)); e = UINT8_C( 0); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_EQ_US); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( 176.16), SIMDE_FLOAT32_C( 495.66), SIMDE_FLOAT32_C( 127.80), SIMDE_FLOAT32_C( -958.87)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( 309.80), SIMDE_FLOAT32_C( -6.39), SIMDE_FLOAT32_C( -935.05), SIMDE_FLOAT32_C( -393.55)); e = UINT8_C( 9); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_NGE_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( -472.13), SIMDE_FLOAT32_C( 661.39), SIMDE_FLOAT32_C( 565.86), SIMDE_FLOAT32_C( 346.58)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( -829.81), SIMDE_FLOAT32_C( -891.10), SIMDE_FLOAT32_C( 639.07), SIMDE_FLOAT32_C( 541.76)); e = UINT8_C( 3); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_NGT_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( 890.86), SIMDE_FLOAT32_C( -824.36), SIMDE_FLOAT32_C( 713.86), SIMDE_FLOAT32_C( -588.42)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( -132.11), SIMDE_FLOAT32_C( -798.33), SIMDE_FLOAT32_C( 245.13), SIMDE_FLOAT32_C( -561.31)); e = UINT8_C( 0); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_FALSE_OS); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( -107.03), SIMDE_FLOAT32_C( 665.67), SIMDE_FLOAT32_C( 633.41), SIMDE_FLOAT32_C( 899.03)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( -636.20), SIMDE_FLOAT32_C( 772.74), SIMDE_FLOAT32_C( -795.59), SIMDE_FLOAT32_C( -677.34)); e = UINT8_C( 15); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_NEQ_OS); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( 938.66), SIMDE_FLOAT32_C( 539.96), SIMDE_FLOAT32_C( 268.40), SIMDE_FLOAT32_C( 332.21)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( -320.07), SIMDE_FLOAT32_C( 248.46), SIMDE_FLOAT32_C( -466.43), SIMDE_FLOAT32_C( 333.35)); e = UINT8_C( 14); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_GE_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( 641.18), SIMDE_FLOAT32_C( 207.80), SIMDE_FLOAT32_C( -90.15), SIMDE_FLOAT32_C( -900.57)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( -39.50), SIMDE_FLOAT32_C( 811.37), SIMDE_FLOAT32_C( 316.69), SIMDE_FLOAT32_C( -451.08)); e = UINT8_C( 8); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_GT_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_ps(SIMDE_FLOAT32_C( 469.24), SIMDE_FLOAT32_C( -148.64), SIMDE_FLOAT32_C( 987.01), SIMDE_FLOAT32_C( 30.55)); b = simde_mm_set_ps(SIMDE_FLOAT32_C( 131.18), SIMDE_FLOAT32_C( -662.87), SIMDE_FLOAT32_C( 53.03), SIMDE_FLOAT32_C( 232.15)); e = UINT8_C( 15); r = simde_mm_cmp_ps_mask(a, b, SIMDE_CMP_TRUE_US); simde_assert_equal_mmask8(r, e); return 0; #else fputc('\n', stdout); for (int i = 0 ; i < 32 ; i++) { simde__m128 a = simde_test_x86_random_f32x4(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); simde__m128 b = simde_test_x86_random_f32x4(SIMDE_FLOAT32_C(-1000.0), SIMDE_FLOAT32_C(1000.0)); int imm8 = i; simde__mmask8 r; SIMDE_CONSTIFY_32_(simde_mm_cmp_ps_mask, r, (HEDLEY_UNREACHABLE(), 0), imm8, a, b); simde_test_x86_write_f32x4(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f32x4(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_codegen_write_i32(2, imm8, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); } return 1; #endif } static int test_simde_mm512_cmp_pd_mask (SIMDE_MUNIT_TEST_ARGS) { #if 1 static const struct { const simde_float64 a[8]; const simde_float64 b[8]; const simde__mmask8 r; } test_vec[] = { { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 971.38), SIMDE_FLOAT64_C( 318.70), SIMDE_FLOAT64_C( 169.28), SIMDE_FLOAT64_C( -796.15), SIMDE_FLOAT64_C( 451.06), SIMDE_FLOAT64_C( -435.12) }, { SIMDE_FLOAT64_C( 683.13), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 318.70), SIMDE_FLOAT64_C( -564.36), SIMDE_FLOAT64_C( 733.28), SIMDE_FLOAT64_C( 451.06), SIMDE_FLOAT64_C( -435.12) }, UINT8_C(200) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -305.32), SIMDE_FLOAT64_C( 832.38), SIMDE_FLOAT64_C( 981.02), SIMDE_FLOAT64_C( -160.50), SIMDE_FLOAT64_C( -949.28), SIMDE_FLOAT64_C( -629.24) }, { SIMDE_FLOAT64_C( -115.84), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 832.38), SIMDE_FLOAT64_C( 981.02), SIMDE_FLOAT64_C( -160.50), SIMDE_FLOAT64_C( 494.24), SIMDE_FLOAT64_C( 465.62) }, UINT8_C(192) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 909.54), SIMDE_FLOAT64_C( -736.00), SIMDE_FLOAT64_C( 199.77), SIMDE_FLOAT64_C( 25.69), SIMDE_FLOAT64_C( -918.86), SIMDE_FLOAT64_C( 445.08) }, { SIMDE_FLOAT64_C( 18.15), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -736.00), SIMDE_FLOAT64_C( 199.77), SIMDE_FLOAT64_C( 25.69), SIMDE_FLOAT64_C( 414.09), SIMDE_FLOAT64_C( -168.83) }, UINT8_C(120) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 115.76), SIMDE_FLOAT64_C( 297.19), SIMDE_FLOAT64_C( 182.95), SIMDE_FLOAT64_C( 999.92), SIMDE_FLOAT64_C( -793.92), SIMDE_FLOAT64_C( 244.87) }, { SIMDE_FLOAT64_C( 246.47), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 297.19), SIMDE_FLOAT64_C( 182.95), SIMDE_FLOAT64_C( 999.92), SIMDE_FLOAT64_C( -793.92), SIMDE_FLOAT64_C( 244.87) }, UINT8_C( 7) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 620.11), SIMDE_FLOAT64_C( -536.66), SIMDE_FLOAT64_C( 379.23), SIMDE_FLOAT64_C( -361.74), SIMDE_FLOAT64_C( -19.88), SIMDE_FLOAT64_C( -442.41) }, { SIMDE_FLOAT64_C( -617.80), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 546.32), SIMDE_FLOAT64_C( -710.33), SIMDE_FLOAT64_C( -361.74), SIMDE_FLOAT64_C( -207.21), SIMDE_FLOAT64_C( 101.87) }, UINT8_C(223) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 531.11), SIMDE_FLOAT64_C( -703.94), SIMDE_FLOAT64_C( 529.69), SIMDE_FLOAT64_C( 342.14), SIMDE_FLOAT64_C( -70.08), SIMDE_FLOAT64_C( -491.13) }, { SIMDE_FLOAT64_C( -910.02), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -234.39), SIMDE_FLOAT64_C( 763.77), SIMDE_FLOAT64_C( 342.14), SIMDE_FLOAT64_C( 147.82), SIMDE_FLOAT64_C( 697.92) }, UINT8_C( 39) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -953.47), SIMDE_FLOAT64_C( -408.73), SIMDE_FLOAT64_C( 634.74), SIMDE_FLOAT64_C( -821.24), SIMDE_FLOAT64_C( -950.23), SIMDE_FLOAT64_C( 773.91) }, { SIMDE_FLOAT64_C( 611.16), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -408.73), SIMDE_FLOAT64_C( 634.74), SIMDE_FLOAT64_C( 720.53), SIMDE_FLOAT64_C( -392.15), SIMDE_FLOAT64_C( 726.12) }, UINT8_C(135) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -406.22), SIMDE_FLOAT64_C( 833.83), SIMDE_FLOAT64_C( 764.68), SIMDE_FLOAT64_C( 241.19), SIMDE_FLOAT64_C( -136.78), SIMDE_FLOAT64_C( -41.57) }, { SIMDE_FLOAT64_C( -96.09), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 833.83), SIMDE_FLOAT64_C( 764.68), SIMDE_FLOAT64_C( 241.19), SIMDE_FLOAT64_C( -136.78), SIMDE_FLOAT64_C( -41.57) }, UINT8_C(248) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -619.84), SIMDE_FLOAT64_C( 406.81), SIMDE_FLOAT64_C( -189.28), SIMDE_FLOAT64_C( -894.75), SIMDE_FLOAT64_C( 746.25), SIMDE_FLOAT64_C( 0.07) }, { SIMDE_FLOAT64_C( 357.05), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 230.97), SIMDE_FLOAT64_C( -86.33), SIMDE_FLOAT64_C( -894.75), SIMDE_FLOAT64_C( -865.12), SIMDE_FLOAT64_C( 0.07) }, UINT8_C(167) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 807.21), SIMDE_FLOAT64_C( -168.08), SIMDE_FLOAT64_C( -107.40), SIMDE_FLOAT64_C( 814.01), SIMDE_FLOAT64_C( 458.92), SIMDE_FLOAT64_C( 639.19) }, { SIMDE_FLOAT64_C( 968.70), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -168.08), SIMDE_FLOAT64_C( 185.90), SIMDE_FLOAT64_C( 814.01), SIMDE_FLOAT64_C( 458.92), SIMDE_FLOAT64_C( -777.29) }, UINT8_C( 23) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -519.12), SIMDE_FLOAT64_C( -755.49), SIMDE_FLOAT64_C( -966.51), SIMDE_FLOAT64_C( 103.99), SIMDE_FLOAT64_C( 432.06), SIMDE_FLOAT64_C( -245.91) }, { SIMDE_FLOAT64_C( -501.73), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -530.16), SIMDE_FLOAT64_C( -484.78), SIMDE_FLOAT64_C( 103.99), SIMDE_FLOAT64_C( 432.06), SIMDE_FLOAT64_C( -245.91) }, UINT8_MAX }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -86.42), SIMDE_FLOAT64_C( -270.62), SIMDE_FLOAT64_C( -18.83), SIMDE_FLOAT64_C( 882.21), SIMDE_FLOAT64_C( -486.79), SIMDE_FLOAT64_C( -224.76) }, { SIMDE_FLOAT64_C( 270.46), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -291.93), SIMDE_FLOAT64_C( 921.81), SIMDE_FLOAT64_C( 146.33), SIMDE_FLOAT64_C( 206.33), SIMDE_FLOAT64_C( -44.76) }, UINT8_C( 0) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -268.80), SIMDE_FLOAT64_C( -117.09), SIMDE_FLOAT64_C( 742.83), SIMDE_FLOAT64_C( 66.16), SIMDE_FLOAT64_C( 228.64), SIMDE_FLOAT64_C( -530.84) }, { SIMDE_FLOAT64_C( 450.85), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -117.09), SIMDE_FLOAT64_C( -806.76), SIMDE_FLOAT64_C( 66.16), SIMDE_FLOAT64_C( 228.64), SIMDE_FLOAT64_C( -530.84) }, UINT8_C( 16) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 656.88), SIMDE_FLOAT64_C( -512.41), SIMDE_FLOAT64_C( 291.63), SIMDE_FLOAT64_C( 273.49), SIMDE_FLOAT64_C( -813.30), SIMDE_FLOAT64_C( -937.66) }, { SIMDE_FLOAT64_C( 974.38), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -512.41), SIMDE_FLOAT64_C( 63.76), SIMDE_FLOAT64_C( 273.49), SIMDE_FLOAT64_C( -813.30), SIMDE_FLOAT64_C( -937.66) }, UINT8_C(248) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -366.75), SIMDE_FLOAT64_C( -249.71), SIMDE_FLOAT64_C( -735.51), SIMDE_FLOAT64_C( -830.75), SIMDE_FLOAT64_C( -505.85), SIMDE_FLOAT64_C( -973.99) }, { SIMDE_FLOAT64_C( 521.64), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -249.71), SIMDE_FLOAT64_C( -777.38), SIMDE_FLOAT64_C( -830.75), SIMDE_FLOAT64_C( -505.85), SIMDE_FLOAT64_C( -973.99) }, UINT8_C( 16) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 592.13), SIMDE_FLOAT64_C( -962.54), SIMDE_FLOAT64_C( -907.01), SIMDE_FLOAT64_C( 573.68), SIMDE_FLOAT64_C( -854.03), SIMDE_FLOAT64_C( 301.66) }, { SIMDE_FLOAT64_C( 850.76), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -962.54), SIMDE_FLOAT64_C( -907.01), SIMDE_FLOAT64_C( 704.63), SIMDE_FLOAT64_C( -854.03), SIMDE_FLOAT64_C( 57.54) }, UINT8_MAX }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -492.87), SIMDE_FLOAT64_C( -833.61), SIMDE_FLOAT64_C( 348.03), SIMDE_FLOAT64_C( -349.08), SIMDE_FLOAT64_C( -146.21), SIMDE_FLOAT64_C( -764.87) }, { SIMDE_FLOAT64_C( 672.24), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 402.87), SIMDE_FLOAT64_C( 348.03), SIMDE_FLOAT64_C( -349.08), SIMDE_FLOAT64_C( -146.21), SIMDE_FLOAT64_C( 846.07) }, UINT8_C(112) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -618.67), SIMDE_FLOAT64_C( 437.06), SIMDE_FLOAT64_C( 240.71), SIMDE_FLOAT64_C( 142.91), SIMDE_FLOAT64_C( -353.22), SIMDE_FLOAT64_C( 378.25) }, { SIMDE_FLOAT64_C( -456.78), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 437.06), SIMDE_FLOAT64_C( -33.46), SIMDE_FLOAT64_C( 142.91), SIMDE_FLOAT64_C( -353.22), SIMDE_FLOAT64_C( -711.43) }, UINT8_C( 0) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -421.19), SIMDE_FLOAT64_C( -842.41), SIMDE_FLOAT64_C( 871.73), SIMDE_FLOAT64_C( -381.48), SIMDE_FLOAT64_C( 233.99), SIMDE_FLOAT64_C( -231.39) }, { SIMDE_FLOAT64_C( -978.61), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -842.41), SIMDE_FLOAT64_C( 871.73), SIMDE_FLOAT64_C( -208.21), SIMDE_FLOAT64_C( 233.99), SIMDE_FLOAT64_C( -165.46) }, UINT8_C(248) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -683.97), SIMDE_FLOAT64_C( -350.05), SIMDE_FLOAT64_C( 453.51), SIMDE_FLOAT64_C( -140.76), SIMDE_FLOAT64_C( -441.05), SIMDE_FLOAT64_C( -463.61) }, { SIMDE_FLOAT64_C( -996.84), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -350.05), SIMDE_FLOAT64_C( 453.51), SIMDE_FLOAT64_C( 885.04), SIMDE_FLOAT64_C( -441.05), SIMDE_FLOAT64_C( -463.61) }, UINT8_C( 7) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 82.37), SIMDE_FLOAT64_C( -842.79), SIMDE_FLOAT64_C( -909.01), SIMDE_FLOAT64_C( 103.76), SIMDE_FLOAT64_C( 206.62), SIMDE_FLOAT64_C( -924.87) }, { SIMDE_FLOAT64_C( -76.79), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -842.79), SIMDE_FLOAT64_C( -63.35), SIMDE_FLOAT64_C( -959.96), SIMDE_FLOAT64_C( -51.94), SIMDE_FLOAT64_C( 11.90) }, UINT8_C(247) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 215.31), SIMDE_FLOAT64_C( -843.05), SIMDE_FLOAT64_C( 1.80), SIMDE_FLOAT64_C( 539.72), SIMDE_FLOAT64_C( 682.44), SIMDE_FLOAT64_C( -41.04) }, { SIMDE_FLOAT64_C( 1.54), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -843.05), SIMDE_FLOAT64_C( -52.86), SIMDE_FLOAT64_C( 307.85), SIMDE_FLOAT64_C( -309.63), SIMDE_FLOAT64_C( -41.04) }, UINT8_MAX }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 493.99), SIMDE_FLOAT64_C( -945.81), SIMDE_FLOAT64_C( -564.35), SIMDE_FLOAT64_C( 872.77), SIMDE_FLOAT64_C( -843.70), SIMDE_FLOAT64_C( 302.56) }, { SIMDE_FLOAT64_C( -152.43), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -945.81), SIMDE_FLOAT64_C( -564.35), SIMDE_FLOAT64_C( 698.66), SIMDE_FLOAT64_C( -843.70), SIMDE_FLOAT64_C( -429.75) }, UINT8_C(167) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -546.31), SIMDE_FLOAT64_C( 203.11), SIMDE_FLOAT64_C( -468.99), SIMDE_FLOAT64_C( 455.23), SIMDE_FLOAT64_C( -300.40), SIMDE_FLOAT64_C( 375.01) }, { SIMDE_FLOAT64_C( 520.68), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 203.11), SIMDE_FLOAT64_C( 916.26), SIMDE_FLOAT64_C( 73.09), SIMDE_FLOAT64_C( -300.40), SIMDE_FLOAT64_C( -723.22) }, UINT8_C(248) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -560.14), SIMDE_FLOAT64_C( -29.18), SIMDE_FLOAT64_C( -985.01), SIMDE_FLOAT64_C( 257.53), SIMDE_FLOAT64_C( -936.23), SIMDE_FLOAT64_C( 357.59) }, { SIMDE_FLOAT64_C( -185.48), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -613.02), SIMDE_FLOAT64_C( -985.01), SIMDE_FLOAT64_C( 970.22), SIMDE_FLOAT64_C( 907.65), SIMDE_FLOAT64_C( 357.59) }, UINT8_C(151) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 879.14), SIMDE_FLOAT64_C( 810.37), SIMDE_FLOAT64_C( -783.06), SIMDE_FLOAT64_C( 101.52), SIMDE_FLOAT64_C( 457.11), SIMDE_FLOAT64_C( -100.19) }, { SIMDE_FLOAT64_C( 14.28), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 774.61), SIMDE_FLOAT64_C( 650.15), SIMDE_FLOAT64_C( 101.52), SIMDE_FLOAT64_C( 457.11), SIMDE_FLOAT64_C( -100.19) }, UINT8_C( 23) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -762.63), SIMDE_FLOAT64_C( 623.72), SIMDE_FLOAT64_C( 735.15), SIMDE_FLOAT64_C( 260.62), SIMDE_FLOAT64_C( 792.33), SIMDE_FLOAT64_C( -208.60) }, { SIMDE_FLOAT64_C( 559.95), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 623.72), SIMDE_FLOAT64_C( -157.88), SIMDE_FLOAT64_C( 260.62), SIMDE_FLOAT64_C( 792.33), SIMDE_FLOAT64_C( -208.60) }, UINT8_C(239) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -833.81), SIMDE_FLOAT64_C( 933.49), SIMDE_FLOAT64_C( -199.20), SIMDE_FLOAT64_C( 180.47), SIMDE_FLOAT64_C( 306.86), SIMDE_FLOAT64_C( -226.30) }, { SIMDE_FLOAT64_C( -44.92), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 933.49), SIMDE_FLOAT64_C( 319.59), SIMDE_FLOAT64_C( -706.47), SIMDE_FLOAT64_C( 306.86), SIMDE_FLOAT64_C( 697.16) }, UINT8_C( 0) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 791.52), SIMDE_FLOAT64_C( -479.80), SIMDE_FLOAT64_C( -776.29), SIMDE_FLOAT64_C( 439.12), SIMDE_FLOAT64_C( 51.40), SIMDE_FLOAT64_C( -14.66) }, { SIMDE_FLOAT64_C( -5.64), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 660.38), SIMDE_FLOAT64_C( -776.29), SIMDE_FLOAT64_C( 235.54), SIMDE_FLOAT64_C( -863.24), SIMDE_FLOAT64_C( -14.66) }, UINT8_C(104) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -417.79), SIMDE_FLOAT64_C( 377.11), SIMDE_FLOAT64_C( 53.06), SIMDE_FLOAT64_C( 537.28), SIMDE_FLOAT64_C( -665.88), SIMDE_FLOAT64_C( -633.25) }, { SIMDE_FLOAT64_C( 81.49), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 377.11), SIMDE_FLOAT64_C( 53.06), SIMDE_FLOAT64_C( 537.28), SIMDE_FLOAT64_C( -665.88), SIMDE_FLOAT64_C( -633.25) }, UINT8_C(248) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -578.18), SIMDE_FLOAT64_C( -514.88), SIMDE_FLOAT64_C( 992.23), SIMDE_FLOAT64_C( 416.19), SIMDE_FLOAT64_C( -621.37), SIMDE_FLOAT64_C( -836.90) }, { SIMDE_FLOAT64_C( 433.72), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( 213.32), SIMDE_FLOAT64_C( 434.75), SIMDE_FLOAT64_C( 416.19), SIMDE_FLOAT64_C( -621.37), SIMDE_FLOAT64_C( -836.90) }, UINT8_C( 16) }, { { SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -80.13), SIMDE_FLOAT64_C( -5.20), SIMDE_FLOAT64_C( 133.92), SIMDE_FLOAT64_C( -998.64), SIMDE_FLOAT64_C( -351.49), SIMDE_FLOAT64_C( 794.21) }, { SIMDE_FLOAT64_C( -813.00), SIMDE_MATH_NAN, SIMDE_MATH_NAN, SIMDE_FLOAT64_C( -5.20), SIMDE_FLOAT64_C( -217.42), SIMDE_FLOAT64_C( 968.11), SIMDE_FLOAT64_C( -465.77), SIMDE_FLOAT64_C( 789.48) }, UINT8_MAX } }; simde__m512d a, b; simde__mmask8 r; a = simde_mm512_loadu_pd(test_vec[0].a); b = simde_mm512_loadu_pd(test_vec[0].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_EQ_OQ); simde_assert_equal_mmask8(r, test_vec[0].r); a = simde_mm512_loadu_pd(test_vec[1].a); b = simde_mm512_loadu_pd(test_vec[1].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_LT_OS); simde_assert_equal_mmask8(r, test_vec[1].r); a = simde_mm512_loadu_pd(test_vec[2].a); b = simde_mm512_loadu_pd(test_vec[2].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_LE_OS); simde_assert_equal_mmask8(r, test_vec[2].r); a = simde_mm512_loadu_pd(test_vec[3].a); b = simde_mm512_loadu_pd(test_vec[3].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_UNORD_Q); simde_assert_equal_mmask8(r, test_vec[3].r); a = simde_mm512_loadu_pd(test_vec[4].a); b = simde_mm512_loadu_pd(test_vec[4].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NEQ_UQ); simde_assert_equal_mmask8(r, test_vec[4].r); a = simde_mm512_loadu_pd(test_vec[5].a); b = simde_mm512_loadu_pd(test_vec[5].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NLT_US); simde_assert_equal_mmask8(r, test_vec[5].r); a = simde_mm512_loadu_pd(test_vec[6].a); b = simde_mm512_loadu_pd(test_vec[6].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NLE_US); simde_assert_equal_mmask8(r, test_vec[6].r); a = simde_mm512_loadu_pd(test_vec[7].a); b = simde_mm512_loadu_pd(test_vec[7].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_ORD_Q); simde_assert_equal_mmask8(r, test_vec[7].r); a = simde_mm512_loadu_pd(test_vec[8].a); b = simde_mm512_loadu_pd(test_vec[8].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_EQ_UQ); simde_assert_equal_mmask8(r, test_vec[8].r); a = simde_mm512_loadu_pd(test_vec[9].a); b = simde_mm512_loadu_pd(test_vec[9].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NGE_US); simde_assert_equal_mmask8(r, test_vec[9].r); a = simde_mm512_loadu_pd(test_vec[10].a); b = simde_mm512_loadu_pd(test_vec[10].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NGT_US); simde_assert_equal_mmask8(r, test_vec[10].r); a = simde_mm512_loadu_pd(test_vec[11].a); b = simde_mm512_loadu_pd(test_vec[11].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_FALSE_OQ); simde_assert_equal_mmask8(r, test_vec[11].r); a = simde_mm512_loadu_pd(test_vec[12].a); b = simde_mm512_loadu_pd(test_vec[12].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NEQ_OQ); simde_assert_equal_mmask8(r, test_vec[12].r); a = simde_mm512_loadu_pd(test_vec[13].a); b = simde_mm512_loadu_pd(test_vec[13].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_GE_OS); simde_assert_equal_mmask8(r, test_vec[13].r); a = simde_mm512_loadu_pd(test_vec[14].a); b = simde_mm512_loadu_pd(test_vec[14].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_GT_OS); simde_assert_equal_mmask8(r, test_vec[14].r); a = simde_mm512_loadu_pd(test_vec[15].a); b = simde_mm512_loadu_pd(test_vec[15].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_TRUE_UQ); simde_assert_equal_mmask8(r, test_vec[15].r); a = simde_mm512_loadu_pd(test_vec[16].a); b = simde_mm512_loadu_pd(test_vec[16].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_EQ_OS); simde_assert_equal_mmask8(r, test_vec[16].r); a = simde_mm512_loadu_pd(test_vec[17].a); b = simde_mm512_loadu_pd(test_vec[17].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_LT_OQ); simde_assert_equal_mmask8(r, test_vec[17].r); a = simde_mm512_loadu_pd(test_vec[18].a); b = simde_mm512_loadu_pd(test_vec[18].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_LE_OQ); simde_assert_equal_mmask8(r, test_vec[18].r); a = simde_mm512_loadu_pd(test_vec[19].a); b = simde_mm512_loadu_pd(test_vec[19].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_UNORD_S); simde_assert_equal_mmask8(r, test_vec[19].r); a = simde_mm512_loadu_pd(test_vec[20].a); b = simde_mm512_loadu_pd(test_vec[20].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NEQ_US); simde_assert_equal_mmask8(r, test_vec[20].r); a = simde_mm512_loadu_pd(test_vec[21].a); b = simde_mm512_loadu_pd(test_vec[21].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NLT_UQ); simde_assert_equal_mmask8(r, test_vec[21].r); a = simde_mm512_loadu_pd(test_vec[22].a); b = simde_mm512_loadu_pd(test_vec[22].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NLE_UQ); simde_assert_equal_mmask8(r, test_vec[22].r); a = simde_mm512_loadu_pd(test_vec[23].a); b = simde_mm512_loadu_pd(test_vec[23].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_ORD_S); simde_assert_equal_mmask8(r, test_vec[23].r); a = simde_mm512_loadu_pd(test_vec[24].a); b = simde_mm512_loadu_pd(test_vec[24].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_EQ_US); simde_assert_equal_mmask8(r, test_vec[24].r); a = simde_mm512_loadu_pd(test_vec[25].a); b = simde_mm512_loadu_pd(test_vec[25].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NGE_UQ); simde_assert_equal_mmask8(r, test_vec[25].r); a = simde_mm512_loadu_pd(test_vec[26].a); b = simde_mm512_loadu_pd(test_vec[26].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NGT_UQ); simde_assert_equal_mmask8(r, test_vec[26].r); a = simde_mm512_loadu_pd(test_vec[27].a); b = simde_mm512_loadu_pd(test_vec[27].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_FALSE_OS); simde_assert_equal_mmask8(r, test_vec[27].r); a = simde_mm512_loadu_pd(test_vec[28].a); b = simde_mm512_loadu_pd(test_vec[28].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NEQ_OS); simde_assert_equal_mmask8(r, test_vec[28].r); a = simde_mm512_loadu_pd(test_vec[29].a); b = simde_mm512_loadu_pd(test_vec[29].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_GE_OQ); simde_assert_equal_mmask8(r, test_vec[29].r); a = simde_mm512_loadu_pd(test_vec[30].a); b = simde_mm512_loadu_pd(test_vec[30].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_GT_OQ); simde_assert_equal_mmask8(r, test_vec[30].r); a = simde_mm512_loadu_pd(test_vec[31].a); b = simde_mm512_loadu_pd(test_vec[31].b); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_TRUE_US); simde_assert_equal_mmask8(r, test_vec[31].r); return 0; #else fputc('\n', stdout); const simde__m512d nanv = simde_mm512_set1_pd(SIMDE_MATH_NAN); simde__m512d a, b; simde__mmask8 r; a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_EQ_OQ); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_LT_OS); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_LE_OS); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_UNORD_Q); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NEQ_UQ); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NLT_US); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NLE_US); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_ORD_Q); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_EQ_UQ); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NGE_US); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NGT_US); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_FALSE_OQ); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NEQ_OQ); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_GE_OS); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_GT_OS); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_TRUE_UQ); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_EQ_OS); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_LT_OQ); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_LE_OQ); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_UNORD_S); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NEQ_US); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NLT_UQ); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NLE_UQ); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_ORD_S); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_EQ_US); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NGE_UQ); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NGT_UQ); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_FALSE_OS); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_NEQ_OS); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_GE_OQ); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_GT_OQ); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); a = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_test_x86_random_f64x8(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); b = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, simde_test_codegen_random_i8()), b); a = simde_mm512_mask_mov_pd(a, HEDLEY_STATIC_CAST(simde__mmask8, 3), nanv); b = simde_mm512_mask_mov_pd(b, HEDLEY_STATIC_CAST(simde__mmask8, 6), nanv); r = simde_mm512_cmp_pd_mask(a, b, SIMDE_CMP_TRUE_US); simde_test_x86_write_f64x8(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x8(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); return 1; #endif } static int test_simde_mm256_cmp_pd_mask (SIMDE_MUNIT_TEST_ARGS) { #if 1 simde__m256d a, b; simde__mmask8 e, r; a = simde_mm256_set_pd(SIMDE_FLOAT64_C( -361.78), SIMDE_FLOAT64_C( -782.43), SIMDE_FLOAT64_C( 565.22), SIMDE_FLOAT64_C( -605.46)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( -817.89), SIMDE_FLOAT64_C( 388.46), SIMDE_FLOAT64_C( 192.48), SIMDE_FLOAT64_C( -823.37)); e = UINT8_C( 0); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_EQ_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( 449.02), SIMDE_FLOAT64_C( 932.44), SIMDE_FLOAT64_C( -896.45), SIMDE_FLOAT64_C( -692.22)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( 84.76), SIMDE_FLOAT64_C( 721.33), SIMDE_FLOAT64_C( -362.73), SIMDE_FLOAT64_C( 95.31)); e = UINT8_C( 3); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_LT_OS); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( -934.37), SIMDE_FLOAT64_C( -274.54), SIMDE_FLOAT64_C( -432.69), SIMDE_FLOAT64_C( 16.07)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( 189.77), SIMDE_FLOAT64_C( 111.61), SIMDE_FLOAT64_C( -686.48), SIMDE_FLOAT64_C( -806.43)); e = UINT8_C( 12); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_LE_OS); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( 800.99), SIMDE_FLOAT64_C( -702.50), SIMDE_FLOAT64_C( -566.68), SIMDE_FLOAT64_C( 451.34)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( 871.85), SIMDE_FLOAT64_C( 216.92), SIMDE_FLOAT64_C( -251.00), SIMDE_FLOAT64_C( 477.31)); e = UINT8_C( 0); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_UNORD_Q); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( -509.15), SIMDE_FLOAT64_C( -489.92), SIMDE_FLOAT64_C( 434.49), SIMDE_FLOAT64_C( -685.79)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( -65.25), SIMDE_FLOAT64_C( -327.04), SIMDE_FLOAT64_C( 898.54), SIMDE_FLOAT64_C( -373.03)); e = UINT8_C( 15); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_NEQ_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( 97.40), SIMDE_FLOAT64_C( -616.22), SIMDE_FLOAT64_C( -394.60), SIMDE_FLOAT64_C( -997.91)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( -741.26), SIMDE_FLOAT64_C( -817.83), SIMDE_FLOAT64_C( -894.89), SIMDE_FLOAT64_C( 242.67)); e = UINT8_C( 14); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_NLT_US); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( -134.02), SIMDE_FLOAT64_C( -675.63), SIMDE_FLOAT64_C( -92.37), SIMDE_FLOAT64_C( -327.58)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( -327.52), SIMDE_FLOAT64_C( -944.25), SIMDE_FLOAT64_C( 435.98), SIMDE_FLOAT64_C( 221.14)); e = UINT8_C( 12); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_NLE_US); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( 346.61), SIMDE_FLOAT64_C( -526.53), SIMDE_FLOAT64_C( -646.75), SIMDE_FLOAT64_C( 869.29)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( 416.47), SIMDE_FLOAT64_C( 218.46), SIMDE_FLOAT64_C( 690.39), SIMDE_FLOAT64_C( 102.25)); e = UINT8_C( 15); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_ORD_Q); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( 751.86), SIMDE_FLOAT64_C( 907.32), SIMDE_FLOAT64_C( 728.54), SIMDE_FLOAT64_C( 124.89)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( 629.16), SIMDE_FLOAT64_C( -313.39), SIMDE_FLOAT64_C( -419.73), SIMDE_FLOAT64_C( 627.08)); e = UINT8_C( 0); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_EQ_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( -571.66), SIMDE_FLOAT64_C( -273.43), SIMDE_FLOAT64_C( 70.39), SIMDE_FLOAT64_C( 185.67)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( 847.91), SIMDE_FLOAT64_C( -312.92), SIMDE_FLOAT64_C( -91.27), SIMDE_FLOAT64_C( 175.49)); e = UINT8_C( 8); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_NGE_US); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( 37.50), SIMDE_FLOAT64_C( -286.11), SIMDE_FLOAT64_C( 11.45), SIMDE_FLOAT64_C( 816.36)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( -683.28), SIMDE_FLOAT64_C( 709.98), SIMDE_FLOAT64_C( -230.35), SIMDE_FLOAT64_C( -552.58)); e = UINT8_C( 4); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_NGT_US); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( -774.85), SIMDE_FLOAT64_C( 663.33), SIMDE_FLOAT64_C( -816.55), SIMDE_FLOAT64_C( 122.90)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( -1.27), SIMDE_FLOAT64_C( 641.62), SIMDE_FLOAT64_C( -118.21), SIMDE_FLOAT64_C( 873.85)); e = UINT8_C( 0); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_FALSE_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( -762.59), SIMDE_FLOAT64_C( -249.41), SIMDE_FLOAT64_C( 548.94), SIMDE_FLOAT64_C( -389.67)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( 314.88), SIMDE_FLOAT64_C( 866.57), SIMDE_FLOAT64_C( 437.20), SIMDE_FLOAT64_C( -870.79)); e = UINT8_C( 15); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_NEQ_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( 683.08), SIMDE_FLOAT64_C( 743.22), SIMDE_FLOAT64_C( -406.86), SIMDE_FLOAT64_C( -492.41)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( 318.23), SIMDE_FLOAT64_C( 530.99), SIMDE_FLOAT64_C( -569.70), SIMDE_FLOAT64_C( 501.87)); e = UINT8_C( 14); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_GE_OS); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( 889.17), SIMDE_FLOAT64_C( -644.27), SIMDE_FLOAT64_C( -755.12), SIMDE_FLOAT64_C( 441.75)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( -862.57), SIMDE_FLOAT64_C( -794.11), SIMDE_FLOAT64_C( -934.28), SIMDE_FLOAT64_C( 14.53)); e = UINT8_C( 15); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_GT_OS); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( -876.98), SIMDE_FLOAT64_C( -637.41), SIMDE_FLOAT64_C( 869.21), SIMDE_FLOAT64_C( -750.83)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( 361.33), SIMDE_FLOAT64_C( 121.75), SIMDE_FLOAT64_C( -995.79), SIMDE_FLOAT64_C( -249.00)); e = UINT8_C( 15); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_TRUE_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( 682.35), SIMDE_FLOAT64_C( 598.74), SIMDE_FLOAT64_C( 872.34), SIMDE_FLOAT64_C( 553.14)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( 817.13), SIMDE_FLOAT64_C( -2.77), SIMDE_FLOAT64_C( 465.31), SIMDE_FLOAT64_C( 309.54)); e = UINT8_C( 0); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_EQ_OS); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( 560.32), SIMDE_FLOAT64_C( 500.20), SIMDE_FLOAT64_C( -259.55), SIMDE_FLOAT64_C( -941.55)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( -387.50), SIMDE_FLOAT64_C( -121.45), SIMDE_FLOAT64_C( 31.19), SIMDE_FLOAT64_C( 170.76)); e = UINT8_C( 3); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_LT_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( -709.40), SIMDE_FLOAT64_C( -498.32), SIMDE_FLOAT64_C( 234.28), SIMDE_FLOAT64_C( 276.07)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( 549.17), SIMDE_FLOAT64_C( -571.97), SIMDE_FLOAT64_C( -292.44), SIMDE_FLOAT64_C( 300.00)); e = UINT8_C( 9); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_LE_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( 327.78), SIMDE_FLOAT64_C( 672.18), SIMDE_FLOAT64_C( -209.38), SIMDE_FLOAT64_C( -423.22)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( -652.03), SIMDE_FLOAT64_C( -310.88), SIMDE_FLOAT64_C( -206.06), SIMDE_FLOAT64_C( -205.17)); e = UINT8_C( 0); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_UNORD_S); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( 975.82), SIMDE_FLOAT64_C( -969.67), SIMDE_FLOAT64_C( -712.14), SIMDE_FLOAT64_C( -333.72)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( 811.62), SIMDE_FLOAT64_C( 792.94), SIMDE_FLOAT64_C( 27.56), SIMDE_FLOAT64_C( 753.17)); e = UINT8_C( 15); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_NEQ_US); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( -61.23), SIMDE_FLOAT64_C( 371.94), SIMDE_FLOAT64_C( 293.15), SIMDE_FLOAT64_C( 768.01)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( 600.41), SIMDE_FLOAT64_C( 551.28), SIMDE_FLOAT64_C( -749.51), SIMDE_FLOAT64_C( -675.66)); e = UINT8_C( 3); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_NLT_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( -215.23), SIMDE_FLOAT64_C( 891.02), SIMDE_FLOAT64_C( -947.05), SIMDE_FLOAT64_C( 484.78)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( 337.30), SIMDE_FLOAT64_C( -666.06), SIMDE_FLOAT64_C( -680.95), SIMDE_FLOAT64_C( -239.48)); e = UINT8_C( 5); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_NLE_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( 904.50), SIMDE_FLOAT64_C( -334.92), SIMDE_FLOAT64_C( -993.88), SIMDE_FLOAT64_C( 109.67)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( 466.34), SIMDE_FLOAT64_C( -747.53), SIMDE_FLOAT64_C( 354.20), SIMDE_FLOAT64_C( -199.94)); e = UINT8_C( 15); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_ORD_S); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( 395.23), SIMDE_FLOAT64_C( 442.16), SIMDE_FLOAT64_C( -717.20), SIMDE_FLOAT64_C( 642.06)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( 78.37), SIMDE_FLOAT64_C( 206.85), SIMDE_FLOAT64_C( 235.10), SIMDE_FLOAT64_C( 310.36)); e = UINT8_C( 0); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_EQ_US); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( -147.41), SIMDE_FLOAT64_C( -982.86), SIMDE_FLOAT64_C( -421.21), SIMDE_FLOAT64_C( -471.75)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( -685.94), SIMDE_FLOAT64_C( -547.00), SIMDE_FLOAT64_C( 568.42), SIMDE_FLOAT64_C( -170.72)); e = UINT8_C( 7); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_NGE_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( -618.11), SIMDE_FLOAT64_C( 98.83), SIMDE_FLOAT64_C( -655.98), SIMDE_FLOAT64_C( 621.37)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( 772.73), SIMDE_FLOAT64_C( 719.18), SIMDE_FLOAT64_C( 432.77), SIMDE_FLOAT64_C( -336.93)); e = UINT8_C( 14); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_NGT_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( -761.04), SIMDE_FLOAT64_C( 677.23), SIMDE_FLOAT64_C( -615.74), SIMDE_FLOAT64_C( 438.90)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( 380.52), SIMDE_FLOAT64_C( 705.30), SIMDE_FLOAT64_C( 929.70), SIMDE_FLOAT64_C( 738.46)); e = UINT8_C( 0); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_FALSE_OS); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( 522.86), SIMDE_FLOAT64_C( -224.25), SIMDE_FLOAT64_C( 147.45), SIMDE_FLOAT64_C( -787.50)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( -89.20), SIMDE_FLOAT64_C( -398.77), SIMDE_FLOAT64_C( 982.60), SIMDE_FLOAT64_C( -617.45)); e = UINT8_C( 15); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_NEQ_OS); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( 390.67), SIMDE_FLOAT64_C( 763.39), SIMDE_FLOAT64_C( -381.63), SIMDE_FLOAT64_C( -438.61)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( 808.16), SIMDE_FLOAT64_C( 704.73), SIMDE_FLOAT64_C( -783.61), SIMDE_FLOAT64_C( -813.21)); e = UINT8_C( 7); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_GE_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( 223.47), SIMDE_FLOAT64_C( -809.95), SIMDE_FLOAT64_C( -196.44), SIMDE_FLOAT64_C( -439.59)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( 675.23), SIMDE_FLOAT64_C( -3.79), SIMDE_FLOAT64_C( 909.23), SIMDE_FLOAT64_C( -763.67)); e = UINT8_C( 1); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_GT_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm256_set_pd(SIMDE_FLOAT64_C( 745.29), SIMDE_FLOAT64_C( -67.43), SIMDE_FLOAT64_C( 881.20), SIMDE_FLOAT64_C( -400.21)); b = simde_mm256_set_pd(SIMDE_FLOAT64_C( -531.86), SIMDE_FLOAT64_C( 270.12), SIMDE_FLOAT64_C( -338.86), SIMDE_FLOAT64_C( -396.43)); e = UINT8_C( 15); r = simde_mm256_cmp_pd_mask(a, b, SIMDE_CMP_TRUE_US); simde_assert_equal_mmask8(r, e); return 0; #else fputc('\n', stdout); for (int i = 0 ; i < 32 ; i++) { simde__m256d a = simde_test_x86_random_f64x4(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); simde__m256d b = simde_test_x86_random_f64x4(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); int imm8 = i; simde__mmask8 r; SIMDE_CONSTIFY_32_(simde_mm256_cmp_pd_mask, r, (HEDLEY_UNREACHABLE(), 0), imm8, a, b); simde_test_x86_write_f64x4(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x4(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_codegen_write_i32(2, imm8, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); } return 1; #endif } static int test_simde_mm_cmp_pd_mask (SIMDE_MUNIT_TEST_ARGS) { #if 1 simde__m128d a, b; simde__mmask8 e, r; a = simde_mm_set_pd(SIMDE_FLOAT64_C( -268.92), SIMDE_FLOAT64_C( 479.50)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( 858.92), SIMDE_FLOAT64_C( 796.74)); e = UINT8_C( 0); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_EQ_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( 179.01), SIMDE_FLOAT64_C( 424.90)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( 764.21), SIMDE_FLOAT64_C( 456.52)); e = UINT8_C( 3); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_LT_OS); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( 527.46), SIMDE_FLOAT64_C( 265.30)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( 962.27), SIMDE_FLOAT64_C( 934.34)); e = UINT8_C( 3); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_LE_OS); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( -837.53), SIMDE_FLOAT64_C( 652.18)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( -597.24), SIMDE_FLOAT64_C( -275.58)); e = UINT8_C( 0); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_UNORD_Q); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( -812.88), SIMDE_FLOAT64_C( 580.18)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( -89.82), SIMDE_FLOAT64_C( -178.32)); e = UINT8_C( 3); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_NEQ_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( -714.89), SIMDE_FLOAT64_C( 539.45)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( -165.89), SIMDE_FLOAT64_C( 628.17)); e = UINT8_C( 0); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_NLT_US); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( -58.11), SIMDE_FLOAT64_C( -458.02)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( 947.44), SIMDE_FLOAT64_C( -465.97)); e = UINT8_C( 1); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_NLE_US); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( 343.16), SIMDE_FLOAT64_C( -778.20)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( 701.30), SIMDE_FLOAT64_C( -788.98)); e = UINT8_C( 3); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_ORD_Q); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( -992.25), SIMDE_FLOAT64_C( -925.76)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( 499.14), SIMDE_FLOAT64_C( 560.22)); e = UINT8_C( 0); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_EQ_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( 16.74), SIMDE_FLOAT64_C( 186.76)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( -547.94), SIMDE_FLOAT64_C( 263.35)); e = UINT8_C( 1); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_NGE_US); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( 197.69), SIMDE_FLOAT64_C( -455.80)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( -803.62), SIMDE_FLOAT64_C( -585.67)); e = UINT8_C( 0); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_NGT_US); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( 138.75), SIMDE_FLOAT64_C( 360.16)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( -59.66), SIMDE_FLOAT64_C( -400.86)); e = UINT8_C( 0); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_FALSE_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( 420.82), SIMDE_FLOAT64_C( 325.87)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( -134.67), SIMDE_FLOAT64_C( 850.52)); e = UINT8_C( 3); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_NEQ_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( 478.68), SIMDE_FLOAT64_C( 705.93)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( -752.09), SIMDE_FLOAT64_C( 699.44)); e = UINT8_C( 3); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_GE_OS); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( -766.53), SIMDE_FLOAT64_C( -579.43)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( -357.63), SIMDE_FLOAT64_C( -804.65)); e = UINT8_C( 1); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_GT_OS); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( -593.64), SIMDE_FLOAT64_C( 576.63)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( 650.88), SIMDE_FLOAT64_C( -656.34)); e = UINT8_C( 3); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_TRUE_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( 903.88), SIMDE_FLOAT64_C( -585.88)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( 600.88), SIMDE_FLOAT64_C( 150.01)); e = UINT8_C( 0); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_EQ_OS); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( -586.64), SIMDE_FLOAT64_C( -79.38)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( 464.82), SIMDE_FLOAT64_C( -947.06)); e = UINT8_C( 2); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_LT_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( -532.73), SIMDE_FLOAT64_C( 611.05)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( -28.79), SIMDE_FLOAT64_C( 661.20)); e = UINT8_C( 3); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_LE_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( -739.66), SIMDE_FLOAT64_C( 606.02)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( -68.11), SIMDE_FLOAT64_C( 911.55)); e = UINT8_C( 0); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_UNORD_S); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( 762.06), SIMDE_FLOAT64_C( 681.16)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( 387.09), SIMDE_FLOAT64_C( 797.22)); e = UINT8_C( 3); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_NEQ_US); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( 496.66), SIMDE_FLOAT64_C( 240.75)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( 661.32), SIMDE_FLOAT64_C( 635.00)); e = UINT8_C( 0); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_NLT_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( 830.35), SIMDE_FLOAT64_C( 730.12)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( 306.75), SIMDE_FLOAT64_C( -696.31)); e = UINT8_C( 3); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_NLE_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( -352.65), SIMDE_FLOAT64_C( -763.29)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( -349.17), SIMDE_FLOAT64_C( -42.37)); e = UINT8_C( 3); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_ORD_S); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( -892.36), SIMDE_FLOAT64_C( -448.77)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( 471.85), SIMDE_FLOAT64_C( -748.29)); e = UINT8_C( 0); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_EQ_US); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( -695.35), SIMDE_FLOAT64_C( -478.99)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( -867.94), SIMDE_FLOAT64_C( -63.32)); e = UINT8_C( 1); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_NGE_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( -402.12), SIMDE_FLOAT64_C( -228.09)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( -622.07), SIMDE_FLOAT64_C( 103.27)); e = UINT8_C( 1); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_NGT_UQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( 14.82), SIMDE_FLOAT64_C( -141.78)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( -460.62), SIMDE_FLOAT64_C( 309.83)); e = UINT8_C( 0); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_FALSE_OS); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( 107.05), SIMDE_FLOAT64_C( -223.11)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( -982.36), SIMDE_FLOAT64_C( 926.47)); e = UINT8_C( 3); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_NEQ_OS); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( 561.47), SIMDE_FLOAT64_C( -396.30)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( -666.17), SIMDE_FLOAT64_C( 678.95)); e = UINT8_C( 2); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_GE_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( 982.64), SIMDE_FLOAT64_C( 391.81)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( 628.52), SIMDE_FLOAT64_C( 640.58)); e = UINT8_C( 2); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_GT_OQ); simde_assert_equal_mmask8(r, e); a = simde_mm_set_pd(SIMDE_FLOAT64_C( -401.79), SIMDE_FLOAT64_C( -370.01)); b = simde_mm_set_pd(SIMDE_FLOAT64_C( 181.22), SIMDE_FLOAT64_C( -720.65)); e = UINT8_C( 3); r = simde_mm_cmp_pd_mask(a, b, SIMDE_CMP_TRUE_US); simde_assert_equal_mmask8(r, e); return 0; #else fputc('\n', stdout); for (int i = 0 ; i < 32 ; i++) { simde__m128d a = simde_test_x86_random_f64x2(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); simde__m128d b = simde_test_x86_random_f64x2(SIMDE_FLOAT64_C(-1000.0), SIMDE_FLOAT64_C(1000.0)); int imm8 = i; simde__mmask8 r; SIMDE_CONSTIFY_32_(simde_mm_cmp_pd_mask, r, (HEDLEY_UNREACHABLE(), 0), imm8, a, b); simde_test_x86_write_f64x2(2, a, SIMDE_TEST_VEC_POS_FIRST); simde_test_x86_write_f64x2(2, b, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_codegen_write_i32(2, imm8, SIMDE_TEST_VEC_POS_MIDDLE); simde_test_x86_write_mmask8(2, r, SIMDE_TEST_VEC_POS_LAST); } return 1; #endif } #endif /* !defined(SIMDE_NATIVE_ALIASES_TESTING */ #else /* To avoid a warning about expr < 0 always evaluating to false * (-Wtype-limits) because there are no functions to test. */ static int test_simde_dummy (SIMDE_MUNIT_TEST_ARGS) { return 0; } #endif /* !defined(SIMDE_FAST_MATH) */ SIMDE_TEST_FUNC_LIST_BEGIN #if !defined(SIMDE_FAST_MATH) SIMDE_TEST_FUNC_LIST_ENTRY(mm512_cmp_epu16_mask) SIMDE_TEST_FUNC_LIST_ENTRY(mm512_mask_cmp_epu16_mask) #if !defined(SIMDE_NATIVE_ALIASES_TESTING) SIMDE_TEST_FUNC_LIST_ENTRY(mm512_cmp_ps_mask) SIMDE_TEST_FUNC_LIST_ENTRY(mm256_cmp_ps_mask) SIMDE_TEST_FUNC_LIST_ENTRY(mm_cmp_ps_mask) SIMDE_TEST_FUNC_LIST_ENTRY(mm512_cmp_pd_mask) SIMDE_TEST_FUNC_LIST_ENTRY(mm256_cmp_pd_mask) SIMDE_TEST_FUNC_LIST_ENTRY(mm_cmp_pd_mask) #endif #else SIMDE_TEST_FUNC_LIST_ENTRY(dummy) #endif SIMDE_TEST_FUNC_LIST_END #include <test/x86/avx512/test-avx512-footer.h>