#include <stdio.h>
#include <stdint.h>
#include <string.h>

#define __SFR_OFFSET 0
#define _MMIO_BYTE(mem_addr) (*(volatile uint8_t *)(&buffer[0] + mem_addr))
#define _SFR_IO8(io_addr) _MMIO_BYTE((io_addr) + __SFR_OFFSET)
#define DDRD _SFR_IO8(0x0A) 

uint8_t buffer[256];

int main(void) {
	memset(&buffer[0], 0, 256);
	DDRD = 0x40;
	printf("value: %x\n", (int)DDRD);
	*(volatile uint8_t*)(&buffer[0] + (0x0A + 0)) = 0x41;
	printf("value: %x\n", (int)DDRD);
	
	// now let's do what you are doing in your struct
	unsigned int dataDirectionRegister = DDRD; // value of register is copied into variable
	dataDirectionRegister = 0x80; // variable is changed but not real register
    printf("register: %x, variable: %x\n", (int)DDRD, dataDirectionRegister);
    
    // you must save an address to do what you need
    volatile uint8_t* realDataDirectionRegister = &DDRD;
    *realDataDirectionRegister = 0x80;
    printf("register: %x, variable: %x\n", (int)DDRD, (int)*realDataDirectionRegister);


	return 0;
}
