Skip to content

Commit c1bb94e

Browse files
committed
fsmc code cleanup
1 parent c131233 commit c1bb94e

File tree

1 file changed

+7
-31
lines changed

1 file changed

+7
-31
lines changed

firmware/fsmc_nand.c

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ void nand_read_id(nand_id_t *nand_id)
117117
{
118118
uint32_t data = 0;
119119

120-
/* Send Command to the command area */
121120
*(__IO uint8_t *)(Bank_NAND_ADDR | CMD_AREA) = fsmc_cmd.read_id_cmd;
122121
*(__IO uint8_t *)(Bank_NAND_ADDR | ADDR_AREA) = 0x00;
123122

@@ -266,7 +265,7 @@ uint32_t nand_read_data(uint8_t *buf, uint32_t page, uint32_t page_offset,
266265
*(__IO uint8_t *)(Bank_NAND_ADDR | CMD_AREA) = fsmc_cmd.read2_cmd;
267266

268267
for (i = 0; i < data_size; i++)
269-
buf[i]= *(__IO uint8_t *)(Bank_NAND_ADDR | DATA_AREA);
268+
buf[i] = *(__IO uint8_t *)(Bank_NAND_ADDR | DATA_AREA);
270269

271270
return nand_get_status();
272271
}
@@ -383,29 +382,16 @@ uint32_t nand_erase_block(uint32_t page)
383382
return nand_get_status();
384383
}
385384

386-
/**
387-
* @brief This routine reset the NAND FLASH.
388-
* @param None
389-
* @retval NAND_READY
390-
*/
391385
uint32_t nand_reset()
392386
{
393387
*(__IO uint8_t *)(Bank_NAND_ADDR | CMD_AREA) = fsmc_cmd.reset_cmd;
394388

395389
return (NAND_READY);
396390
}
397391

398-
/**
399-
* @brief Get the NAND operation status.
400-
* @param None
401-
* @retval New status of the NAND operation. This parameter can be:
402-
* - NAND_TIMEOUT_ERROR: when the previous operation generate
403-
* a Timeout error
404-
* - NAND_READY: when memory is ready for the next operation
405-
*/
406-
uint32_t nand_get_status(void)
392+
uint32_t nand_get_status()
407393
{
408-
uint32_t timeout = 0x1000000, status = NAND_READY;
394+
uint32_t status, timeout = 0x1000000;
409395

410396
status = nand_read_status();
411397

@@ -419,29 +405,19 @@ uint32_t nand_get_status(void)
419405
if (!timeout)
420406
status = NAND_TIMEOUT_ERROR;
421407

422-
/* Return the operation status */
423-
return (status);
408+
return status;
424409
}
425410

426-
/**
427-
* @brief Reads the NAND memory status using the Read status command.
428-
* @param None
429-
* @retval The status of the NAND memory. This parameter can be:
430-
* - NAND_BUSY: when memory is busy
431-
* - NAND_READY: when memory is ready for the next operation
432-
* - NAND_ERROR: when the previous operation gererates error
433-
*/
434-
uint32_t nand_read_status(void)
411+
uint32_t nand_read_status()
435412
{
436-
uint32_t data = 0x00, status = NAND_BUSY;
413+
uint32_t data, status;
437414

438-
/* Read status operation */
439415
*(__IO uint8_t *)(Bank_NAND_ADDR | CMD_AREA) = fsmc_cmd.status_cmd;
440416
data = *(__IO uint8_t *)(Bank_NAND_ADDR);
441417

442418
if ((data & NAND_ERROR) == NAND_ERROR)
443419
status = NAND_ERROR;
444-
else if((data & NAND_READY) == NAND_READY)
420+
else if ((data & NAND_READY) == NAND_READY)
445421
status = NAND_READY;
446422
else
447423
status = NAND_BUSY;

0 commit comments

Comments
 (0)