/* Write data to nvmem. writes data to file referred by the ulFileId parameter. Writes data to file ulOffset till ulLength.The file id will be marked invalid till the write is done. The file entry doesn't need to be valid - only allocated. 
nvmem_write */
INT32 nvmem_write(UINT32 ulFileId, UINT32 ulLength, UINT32 ulEntryOffset, UINT8 *buff)
/* Write data to nvmem. writes data to file referred by the ulFileId parameter. Writes data to file ulOffset till ulLength.The file id will be marked invalid till the write is done. The file entry doesn't need to be valid - only allocated. 
nvmem_write */
INT32 nvmem_write(UINT32 ulFileId, UINT32 ulLength, UINT32 ulEntryOffset, UINT8 *buff)
{
	INT32 iRes;
	UINT8 *ptr;
	UINT8 *args;
	iRes = EFAIL;
	ptr = tSLInformation.pucTxCommandBuffer;
	args = (ptr + SPI_HEADER_SIZE + HCI_DATA_CMD_HEADER_SIZE);
	args = UINT32_TO_STREAM(args, ulFileId);
	args = UINT32_TO_STREAM(args, 12);
	args = UINT32_TO_STREAM(args, ulLength);
	args = UINT32_TO_STREAM(args, ulEntryOffset);
	memcpy((ptr + SPI_HEADER_SIZE + HCI_DATA_CMD_HEADER_SIZE + 
		NVMEM_WRITE_PARAMS_LEN),buff,ulLength);
	hci_data_command_send(HCI_CMND_NVMEM_WRITE, ptr, NVMEM_WRITE_PARAMS_LEN,
		ulLength);
	SimpleLinkWaitEvent(HCI_EVNT_NVMEM_WRITE, &iRes);
	return(iRes);
}