For embedded systems where you need to access specific memory addresses for I/O, you normally write directly to the address.
You don't need to malloc here, that's used to manage blocks of memory or structures where you don't care where it will be located.
e.g. to write to address c00010
ptr = c00010;
ptr->field = value;
Also, when using structures overlayed onto memory be careful about padding and structure alignment.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…