mmio-and-bit-manipulation

mmio-and-bit-manipulation is a skill for Claude Code, Codex from mohitmishra786/low-level-dev-skills. It costs 65 tokens per session (1,128 once invoked), scanned A, original, MIT.

A guide to reading and writing hardware registers directly in bare-metal firmware, where code controls peripherals without an operating system or hardware library.

In plain words
What is it for?
Use it when writing or reviewing peripheral drivers, handling bit masks and read-modify-write operations, or sharing register access between interrupt code and normal code.
Why use it?
It helps prevent stale reads, overwritten register bits, alignment mistakes, and byte-order bugs when software talks directly to hardware.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when writing or reviewing peripheral drivers, handling bit masks and read-modify-write operations, or sharing register access between interrupt code and normal code.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mohitmishra786/low-level-dev-skills/mmio-and-bit-manipulation
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add mohitmishra786/low-level-dev-skills --skill mmio-and-bit-manipulation
Clone the repo
git clone --depth 1 https://github.com/mohitmishra786/low-level-dev-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for mmio-and-bit-manipulation

README.md
[![agentmods](https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/mmio-and-bit-manipulation/github.svg)](https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/mmio-and-bit-manipulation)
Your own site
<a href="https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/mmio-and-bit-manipulation"><img src="https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/mmio-and-bit-manipulation/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for mmio-and-bit-manipulation

Your own site · 80×15
<a href="https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/mmio-and-bit-manipulation"><img src="https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/mmio-and-bit-manipulation.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 65 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,128 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00065 $0.01128
Opus 5 $0.00032 $0.00564
Sonnet 5 $0.00013 $0.00226
Haiku 4.5 $0.00006 $0.00113

Measured 12d ago against content hash 0feb9c805c80, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

mmio-and-bit-manipulation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/baremetal/mmio-and-bit-manipulation/SKILL.md · 135 lines

How it starts

The opening of the file, as written. The whole thing — 135 lines — stays where its author put it; the contents beside it link to each section on GitHub.

MMIO and Bit Manipulation

Purpose

Guide agents through safe memory-mapped I/O: volatile semantics, read-modify-write patterns, bitfield pitfalls, alignment and endianness, and portable register access macros for bare-metal drivers.

When to Use

  • Writing peripheral register drivers without HAL
  • Fixing intermittent register corruption or stale reads
  • Replacing C bitfields with explicit masks
  • Porting drivers between little-endian MCUs
  • Auditing ISR vs main-line register access

Workflow

1. MMIO fundamentals

Peripheral registers live at fixed addresses in the CPU memory map. The compiler must not cache reads/writes.

#include <stdint.h>

#define PERIPH_BASE   0x40000000U
#define GPIOA_MODER   (*(volatile uint32_t *)(PERIPH_BASE + 0x20000U))
Qualifier Effect
volatile Forces load/store each access — required for hardware
const volatile Read-only hardware (rare)
Plain uint32_t * Wrong — compiler may optimize away

2. Read-modify-write macros

#define REG32(addr)        (*(volatile uint32_t *)(addr))
#define REG_SET(addr, mask)   (REG32(addr) |= (mask))
#define REG_CLR(addr, mask)   (REG32(addr) &= ~(mask))
#define REG_TOGGLE(addr, mask) (REG32(addr) ^= (mask))
#define REG_WRITE(addr, val)  (REG32(addr) = (val))
#define REG_READ(addr)        (REG32(addr))

Good — atomic intent for single-bit updates when register supports it:

#define GPIOA_BSRR  REG32(0x40020018U)
GPIOA_BSRR = (1U << 5);        /* set PA5 */
GPIOA_BSRR = (1U << (5+16));   /* reset PA5 — STM32 BSRR pattern */

Bad — non-atomic RMW on interrupt-shared registers:

uint32_t v = REG_READ(GPIOA_MODER);
v |= (1U << 10);
REG_WRITE(GPIOA_MODER, v);  /* ISR may interleave — lost update */

Fix: disable IRQ briefly, use hardware set/clear registers, or LL atomic bitband if available.

3. Bitfield pitfalls

/* Bad — layout is implementation-defined, not portable */
typedef struct {
    uint32_t mode  : 2;
    uint32_t type  : 1;
    uint32_t speed : 2;
} gpio_moder_bits_t;

Read the full file on GitHub · 135 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 135 lines · 65 tokens per session scan A 0feb9c805c80

Subscribe to this mod's changes

mmio-and-bit-manipulation is a skill published in the GitHub repository mohitmishra786/low-level-dev-skills (203 stars, last pushed 2mo ago), licensed MIT. It adds 65 tokens to every session and 1,128 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.