I am writing a code where in I have used nested structure. All these structures are defined to be a 64 bit register. Trying to assign a value to these structures as a whole but it is not happening properly. The problem is whole value is not getting assigned. Only a part of it is getting assigned. I have pasted the code here. Please let me know how can I fix it. Thank you in advance.
unsigned long SAR;
struct SARx sar;
struct CHNL_reg ch_reg;
struct dma_reg rst_val;
unsigned long *ptr;
ptr = (unsigned long) &(rst_val.ch_reg.sar);
printf(" %x \n", (rst_val.ch_reg.sar));