{"id":21215451,"url":"https://github.com/choueric/regknife","last_synced_at":"2025-03-15T00:25:10.050Z","repository":{"id":75764110,"uuid":"89563691","full_name":"choueric/regKnife","owner":"choueric","description":"Check and edit the value of fields in a register.","archived":false,"fork":false,"pushed_at":"2017-09-15T06:07:46.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-21T16:32:00.874Z","etag":null,"topics":["bit","embedded-systems","register"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/choueric.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-27T06:31:47.000Z","updated_at":"2017-04-28T03:46:12.000Z","dependencies_parsed_at":"2023-03-08T06:15:27.436Z","dependency_job_id":null,"html_url":"https://github.com/choueric/regKnife","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choueric%2FregKnife","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choueric%2FregKnife/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choueric%2FregKnife/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choueric%2FregKnife/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/choueric","download_url":"https://codeload.github.com/choueric/regKnife/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243664638,"owners_count":20327513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bit","embedded-systems","register"],"created_at":"2024-11-20T21:38:56.879Z","updated_at":"2025-03-15T00:25:10.010Z","avatar_url":"https://github.com/choueric.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# regKnife\n\nIt is used to check and manipulate the values of bits in a register. This tools is useful for people who are embedded software engineers, because I am.\n\n# usage\n\nThis is the built-in usage information:\n\n```\nUsage:\n  [h]elp          : print this message.\n  [p]rint         : show current value.\n  [v]alue \u003cv\u003e     : change value to \u003cv\u003e.\n  [s]et \u003cf\u003e       : set \u003cf to 1.\n  [c]lear \u003cf\u003e     : clear \u003cf\u003e to 0.\n  [w]rite \u003cf\u003e \u003cv\u003e : write val \u003cv\u003e into field \u003cf\u003e.\n  [l]ist [0]      : list all offsets of '1's or '0's.\n  \u003cf\u003e             : read the value of field \u003cf\u003e.\n  exit, quit      : exit this program.\n  \nTwo format to represent field:\n  single bit  : like 1, 3, 0\n  field range : like 0:3, 3:1\n```\n\n# example\n\nFor example, there is a register in chip like:\n\n```\nBit 0    : 1 = enable, 0 = disable.\nBIt 1-2  : 0 = A channel, 1 = B channel, 2 = C channel, 3 = D channel.\nBit 3-5  : reserved.\nBit 6-15 : byte count.\n```\n\nIt is a 16-bits register and there are three fields are useful. When we read this\nregister in driver code and get value is `0x05cd`, what does it mean ? It is time \nto check the datasheet. This is usually a bording and even anoying work, especailly\nwhen the length of register is 32-bits.\n\nUsing this tool makes this work much easier:\n\n1. Start this program, `-l 16` set the register length to 16 (default is 32). \n   There is a shell-like UI.\n   ```\n   $ regknife -l 16\n   ```\n\n2. Input the register value by 'value' command, and see the output like:\n   ```\n   \u003e\u003e\u003e value 0x05cd\n   bin: 0000,0101,1100,1101\n   dec: 1485\n   hex: 0x5cd\n   ```\n   \n3. See the value of `enable` field, i.e. [0]:\n   ```\n   \u003e\u003e\u003e 0\n   bin: 1\n   dec: 1\n   hex: 0x1\n   ```\n   \n4. See the `byte_count` field, i.e. [6:15]:\n   ```\n   \u003e\u003e\u003e 6:15\n   bin: 00,0001,0111\n   dec: 23\n   hex: 0x17\n   ```\n   \n5. You can clear the `enable` field:\n   ```\t\n   \u003e\u003e\u003e c 0\n   bin: 0000,0101,1100,1100\n   dec: 1484\n   hex: 0x5cc\n   \n   ```\n   \n6. You can write the `byte_count` field to 77:\n   ```\n   \u003e\u003e\u003e w 6:15 77\n   0001001101\n   bin: 0001,0011,0100,1100\n   dec: 4940\n   hex: 0x134c\n   \n   \u003e\u003e\u003e 6:15\n   bin: 00,0100,1101\n   dec: 77\n   hex: 0x4d\n   ```\n7. After modification, see the current value by:\n   ```\n   \u003e\u003e\u003e p\n   bin: 00,0100,1101\n   dec: 77\n   hex: 0x4d\n   ```\n8. You can show all offsets of '1's in this register:\n   ```\n   \u003e\u003e\u003e l\n   6,3,2,0\n   ```\n   \n   Or show all offsets of '0's:\n   ```\n   \u003e\u003e\u003e l 0\n   15,14,13,12,11,10,9,8,7,5,4,1\n   ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchoueric%2Fregknife","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchoueric%2Fregknife","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchoueric%2Fregknife/lists"}