deprecated_items(3)

πŸ“¦ version 2.2.1, in fedora 43, fedora 44, opensuse-leap 16.0

πŸ’… deprecated_items(3) β€” the avr-libc manual page bestie πŸ’…

okay so welcome to deprecated_items, a page straight out of the avr-libc manual, section 3. it's giving "vintage but make it a warning label" ✨


🌸 NAME 🌸

deprecated_items β€” the whole vibe is "this used to be a thing, please stop using it" 🫢


✨ SYNOPSIS ✨

πŸŽ€ Allowing specific system-wide interrupts

okay so here's the tea: globally enabling interrupts is only half the job. every single device's particular interrupt needs to be enabled separately if you actually want interrupts from that device. some devices keep their interrupt enable bit chillin' inside the device's own register set, but external and timer interrupts live in system-wide configuration registers. so yeah, two-step process, no shortcuts πŸ’…

Example, and I'm keeping this exact:

// Enable timer 1 overflow interrupts.
timer_enable_int(_BV(TOIE1));

// Do some work...

// Disable all timer interrupts.
timer_enable_int(0);
⚠️ Note, and pls read this one: be careful when you use these functions. if you already have a different interrupt enabled, you could inadvertently disable it by enabling another interrupt. yeah. that's the trap. it's giving "whoops, sorry bestie" 😭
static __inline__ void timer_enable_int (unsigned char ints)
#define enable_external_int(mask)   (__EICR = mask)
#define INTERRUPT(signame)
#define __INTR_ATTRS   used

🌈 Obsolete IO macros

so back in the day β€” like, back back β€” when AVR-GCC and avr-libc could not handle IO port access in the direct assignment form the way they handle it now, all IO port access had to go through specific macros that eventually turned into inline assembly instructions doing the actual work. very extra. very ✨era✨.

these macros are obsolete now, because reading and writing IO ports can just be done by using the IO port name in an expression. and all bit manipulation (including on IO ports) can be done with generic C bit manipulation operators. we've evolved, periodt πŸ‘‘

the macros in this group simulate the historical behaviour. and here's the lil twist: while they're supposed to be applied to IO ports, the emulation actually uses standard C methods, so they could be applied to arbitrary memory locations as well. chaos, honestly.

#define inp(port)   (port)
#define outp(val,  port)   (port) = (val)
#define inb(port)   (port)
#define outb(port,  val)   (port) = (val)
#define sbi(port,  bit)   (port) |= (1 << (bit))
#define cbi(port,  bit)   (port) &= ~(1 << (bit))

πŸ¦‹ Detailed Description πŸ¦‹

this header file contains several items that used to be available in previous versions of this library, but have eventually been deprecated over time. it's a whole museum exhibit, lowkey πŸ›οΈ

#include <compat/deprecated.h>

these items are supplied within that header file for backward compatibility reasons only, so old source code that has been written for previous library versions could easily be maintained until its end-of-life. that's the only reason they're here. use of any of these items in new code is strongly discouraged. like, don't. fr fr πŸ™ˆ


πŸ‘‘ Macro Definition Documentation πŸ‘‘

#define cbi(port, bit) (port) &= ~(1 << (bit))

Deprecated πŸ’€

clear bit in IO port port.


#define enable_external_int(mask) (__EICR = mask)

Deprecated πŸ’€

this macro gives you access to the GIMSK register (or EIMSK register if you're using an AVR Mega device, or GICR register for others). and like, yeah, it's essentially the same as just assigning to the register, but it does adapt slightly to the type of device being used. cute of it, honestly. this macro is unavailable if none of the registers listed above are defined. so vibe check your device first 🫢


#define inb(port) (port)

Deprecated πŸ’€

read a value from an IO port port.


#define inp(port) (port)

Deprecated πŸ’€

read a value from an IO port port.


#define INTERRUPT(signame)

Value:

void signame (void) __attribute__ ((interrupt,__INTR_ATTRS));  void signame (void)

Deprecated πŸ’€

introduces an interrupt handler function that runs with global interrupts initially enabled. this allows interrupt handlers to be interrupted. yes bestie, that is exactly as spicy as it sounds 😭

and here's why it's deprecated: this macro has been used by too many unsuspecting people in the past, so it's been deprecated, and it will be removed in a future version of the library. users who want to legitimately re-enable interrupts in their interrupt handlers as quickly as possible are encouraged to explicitly declare their handlers as described above. that's the move. that's the whole assignment πŸ’…


#define outb(port, val) (port) = (val)

Deprecated πŸ’€

write val to IO port port.


#define outp(val, port) (port) = (val)

Deprecated πŸ’€

write val to IO port port.


#define sbi(port, bit) (port) |= (1 << (bit))

Deprecated πŸ’€

set bit in IO port port.


πŸ“ Function Documentation πŸ“

static __inline__ void timer_enable_int (unsigned char ints) [static]

Deprecated πŸ’€

this function modifies the timsk register. the value you pass via ints is device specific. so like, know your device, bestie 🧚


⭐ Author ⭐

Generated automatically by Doxygen for avr-libc from the source code. not a human, just a lil robot doing its thing πŸ€–βœ¨


Version 2.1.0 Β· Sat Jan 29 2022 β€” that's the source and the date, mwah, and that's the page! hope u learned something and never used any of it in new code πŸ’–πŸŒΈπŸ¦‹πŸ‘‘

πŸ“¦ where this page comes from