This can't be answered without additional information.
The structure name
adc_t
indicates that it refers to some kind of ADC (Analogue to Digital Converter) registers. These are usually specified in the datasheet of the embedded system.
Assigning a pointer to this structure requires to know the address. Depending on the system it might be sufficient to just assign the address using casting:
adc_t* adc_regs = (adc_t *)adc_regs_base_address;
where
adc_regs_base_address
is the hard coded address defined as constant (e.g. by a
define
statement or as hex address).
If this is not possible there might be a system function to map the address (e.g.
mmap(2): map/unmap files/devices into memory - Linux man page[
^] with Linux).
The third step requires knowing the ADC registers. With a typical system, use the above mapped memory to read the corresponding register(s), create the 12-bit value if necessary (if the registers are 8-bit wide), and divide by four.
A typical code example might be:
uint16_t pot_read()
{
uint16_t adc_value = adc_regs->value_lo |
((adc_regs->value_hi & 0x0f) << 8);
return adc_value / 4;
}