/*
 * dna_read.c
 *
 *  Created on: 2023年6月27日
 *      Author: dell
 */
#include "dna_read.h"

#include <unistd.h>
#include "xil_io.h"
#include "xparameters.h"

#define DNA_ADDR  XPAR_MYDNA_READ_V1_0_0_BASEADDR


void dna_port_read(char* read_data)   //addr_change, because the board is 88d_a.
{
	unsigned read_data_mem[2] = {0};
	Xil_Out32(DNA_ADDR,0x01);
	usleep(20);

	read_data_mem[0] = Xil_In32(DNA_ADDR+4);
	read_data_mem[1] = Xil_In32(DNA_ADDR+8);

	for(int i = 0; i < 8; i++)
	{
		*(read_data+i) = (u8)(read_data_mem[i/4]>> (24 - (8*(i%4))));
	}

}
