avr_cpufunc(3)
π NAME π
avr_cpufunc β bestie, this is the lil header of AVR superpowers that didn't fit anywhere else β¨
π SYNOPSIS π
Macros
#define _NOP()
#define _MemoryBarrier()
Functions
void ccp_write_io (uint8_t *__ioaddr, uint8_t __value)
π¦ DESCRIPTION π¦
okay so first things first, you gotta pull it in like this:
#include <avr/cpufunc.h>
and this header file? it's got macros that poke at the special functions of the AVR CPU β the ones that genuinely do not fit into any of the other header files. they're the ones that were like "not me being homeless in every other header" and got their own lil house. iconic behavior fr fr π
πΈ MACRO DEFINITION DOCUMENTATION πΈ
β¨ #define _MemoryBarrier()
this one implements a read/write memory barrier. what does that even mean, you ask? a memory barrier tells the compiler do not cache any memory data in registers beyond the barrier β like a velvet rope at the club, nothing crosses it π«π§
and lowkey sometimes this is more effective than blocking certain optimizations by declaring some object with a volatile qualifier. so like, you have options, and this one might eat π
π heads up: go read Problems with reordering code for the stuff you need to take into account with respect to compiler optimizations. don't skip it, bestie.
β¨ #define _NOP()
this executes a no operation (NOP) CPU instruction. it literally does nothing and that is its whole job, and honestly? respect π«Ά
π do NOT use this to implement delays. i'm so serious. for delays you want the functions from<util/delay_basic.h>or<util/delay.h>. that's what they're for, use them, i'm begging.
but for debugging purposes, a NOP is genuinely useful β it gives you an instruction that is guaranteed to be not optimized away by the compiler, so it can always become a breakpoint in the debugger. main character energy: cannot be removed from the scene β¨π
π FUNCTION DOCUMENTATION π
β¨ void ccp_write_io (uint8_t * __ioaddr, uint8_t __value)
write __value to the Configuration Change Protected (CCP) IO register at __ioaddr. that's it, that's the whole thing, and it ate. periodt π
π AUTHOR π
Generated automatically by Doxygen for avr-libc from the source code. so like, no human wrote this, it's the robot's baby π€πΌ
and that's a wrap, bestie!! this was Version 2.1.0, dated Sat Jan 29 2022, brought to you by the avr-libc girlies β mwah, go write some firmware, ily πβ¨π
π¦ where this page comes from
- fedora 43: avr-libc 2.2.1-3.fc43 Β· BSD-3-Clause
- fedora 44: avr-libc 2.2.1-5.fc44 Β· BSD-3-Clause
- opensuse-leap 16.0: avr-libc 2.1.0-bp160.1.33 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms