/* Read SPI Flash Chip ID. 
Reads SPI Flash Chip ID  */
uint32_t spi_flash_rdid(void)
/* Read SPI Flash Chip ID. 
Reads SPI Flash Chip ID  */
uint32_t spi_flash_rdid(void)
{
	volatile uint32_t register_value;
	SPI_FLASH0->READ_CTRL.reg = SPI_FLASH_READ_CTRL_RDATA_COUNT(0x04);
	SPI_FLASH0->CMD_BUFFER0.reg = SPI_FLASH_CMD_READ_ID;
	SPI_FLASH0->DIRECTION.reg = SPI_FLASH_DIRECTION_CMD;
	SPI_FLASH0->DMA_START_ADDRESS.reg = (uint32_t)&register_value;
	SPI_FLASH0->TRANSACTION_CTRL.reg = \
			SPI_FLASH_TRANSACTION_CTRL_FLASH_TRANS_START | \
			SPI_FLASH_TRANSACTION_CTRL_CMD_COUNT(0x01);
	while (SPI_FLASH0->IRQ_STATUS.bit.FLASH_TRANS_DONE != \
			SPI_FLASH_IRQ_STATUS_FLASH_TRANS_DONE) {
	}
	return (register_value);
}