Skip to content

Commit c131233

Browse files
committed
Removed unused fsmc functions
1 parent 06c931d commit c131233

File tree

2 files changed

+0
-183
lines changed

2 files changed

+0
-183
lines changed

firmware/fsmc_nand.c

Lines changed: 0 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -349,127 +349,6 @@ uint32_t nand_read_spare_data(uint8_t *buf, uint32_t page, uint32_t offset,
349349
return nand_get_status();
350350
}
351351

352-
#if 0
353-
/**
354-
* @brief This routine write the spare area information for the specified
355-
* pages addresses.
356-
* @param buf: pointer on the Buffer containing data to be written
357-
* @param addr: First page address
358-
* @param num_spare_area_to_write: Number of Spare Area to write
359-
* @retval New status of the NAND operation. This parameter can be:
360-
* - NAND_TIMEOUT_ERROR: when the previous operation generate
361-
* a Timeout error
362-
* - NAND_READY: when memory is ready for the next operation
363-
* And the new status of the increment address operation. It can be:
364-
* - NAND_VALID_ADDRESS: When the new address is valid address
365-
* - NAND_INVALID_ADDRESS: When the new address is invalid address
366-
*/
367-
uint32_t nand_write_spare_area(uint8_t *buf, nand_addr_t addr,
368-
uint32_t num_spare_area_to_write)
369-
{
370-
uint32_t index = 0x00, num_spare_area_written = 0x00,
371-
address_status = NAND_VALID_ADDRESS;
372-
uint32_t status = NAND_READY, size = 0x00;
373-
374-
while ((num_spare_area_to_write != 0x00) &&
375-
(address_status == NAND_VALID_ADDRESS) && (status == NAND_READY))
376-
{
377-
/* Page write Spare area command and address */
378-
*(__IO uint8_t *)(Bank_NAND_ADDR | CMD_AREA) = NAND_CMD_AREA_C;
379-
*(__IO uint8_t *)(Bank_NAND_ADDR | CMD_AREA) = NAND_CMD_WRITE0;
380-
381-
*(__IO uint8_t *)(Bank_NAND_ADDR | ADDR_AREA) = 0x00;
382-
*(__IO uint8_t *)(Bank_NAND_ADDR | ADDR_AREA) =
383-
ADDR_1st_CYCLE(ROW_ADDRESS);
384-
*(__IO uint8_t *)(Bank_NAND_ADDR | ADDR_AREA) =
385-
ADDR_2nd_CYCLE(ROW_ADDRESS);
386-
*(__IO uint8_t *)(Bank_NAND_ADDR | ADDR_AREA) =
387-
ADDR_3rd_CYCLE(ROW_ADDRESS);
388-
389-
/* Calculate the size */
390-
size = NAND_SPARE_AREA_SIZE + (NAND_SPARE_AREA_SIZE *
391-
num_spare_area_written);
392-
393-
/* Write the data */
394-
for (; index < size; index++)
395-
*(__IO uint8_t *)(Bank_NAND_ADDR | DATA_AREA) = buf[index];
396-
397-
*(__IO uint8_t *)(Bank_NAND_ADDR | CMD_AREA) = NAND_CMD_WRITE_TRUE1;
398-
399-
/* Check status for successful operation */
400-
status = nand_get_status();
401-
402-
if (status == NAND_READY)
403-
{
404-
num_spare_area_written++;
405-
406-
num_spare_area_to_write--;
407-
408-
/* Calculate Next page Address */
409-
address_status = nand_addr_inc(&addr);
410-
}
411-
}
412-
413-
return status | address_status;
414-
}
415-
416-
/**
417-
* @brief This routine read the spare area information from the specified
418-
* pages addresses.
419-
* @param buf: pointer on the Buffer to fill
420-
* @param addr: First page address
421-
* @param num_spare_area_to_read: Number of Spare Area to read
422-
* @retval New status of the NAND operation. This parameter can be:
423-
* - NAND_TIMEOUT_ERROR: when the previous operation generate
424-
* a Timeout error
425-
* - NAND_READY: when memory is ready for the next operation
426-
* And the new status of the increment address operation. It can be:
427-
* - NAND_VALID_ADDRESS: When the new address is valid address
428-
* - NAND_INVALID_ADDRESS: When the new address is invalid address
429-
*/
430-
uint32_t nand_read_spare_area(uint8_t *buf, nand_addr_t addr,
431-
uint32_t num_spare_area_to_read)
432-
{
433-
uint32_t num_spare_area_read = 0x00, index = 0x00,
434-
address_status = NAND_VALID_ADDRESS;
435-
uint32_t status = NAND_READY, size = 0x00;
436-
437-
while ((num_spare_area_to_read != 0x0) &&
438-
(address_status == NAND_VALID_ADDRESS))
439-
{
440-
/* Page Read command and page address */
441-
*(__IO uint8_t *)(Bank_NAND_ADDR | CMD_AREA) = NAND_CMD_AREA_C;
442-
443-
*(__IO uint8_t *)(Bank_NAND_ADDR | ADDR_AREA) = 0x00;
444-
*(__IO uint8_t *)(Bank_NAND_ADDR | ADDR_AREA) =
445-
ADDR_1st_CYCLE(ROW_ADDRESS);
446-
*(__IO uint8_t *)(Bank_NAND_ADDR | ADDR_AREA) =
447-
ADDR_2nd_CYCLE(ROW_ADDRESS);
448-
*(__IO uint8_t *)(Bank_NAND_ADDR | ADDR_AREA) =
449-
ADDR_3rd_CYCLE(ROW_ADDRESS);
450-
451-
/* Data Read */
452-
size = NAND_SPARE_AREA_SIZE + (NAND_SPARE_AREA_SIZE *
453-
num_spare_area_read);
454-
455-
/* Get Data into Buffer */
456-
for ( ;index < size; index++)
457-
buf[index] = *(__IO uint8_t *)(Bank_NAND_ADDR | DATA_AREA);
458-
459-
num_spare_area_read++;
460-
461-
num_spare_area_to_read--;
462-
463-
/* Calculate page address */
464-
address_status = nand_addr_inc(&addr);
465-
}
466-
467-
status = nand_get_status();
468-
469-
return status | address_status;
470-
}
471-
#endif
472-
473352
uint32_t nand_erase_block(uint32_t page)
474353
{
475354
*(__IO uint8_t *)(Bank_NAND_ADDR | CMD_AREA) = fsmc_cmd.erase1_cmd;
@@ -569,55 +448,3 @@ uint32_t nand_read_status(void)
569448

570449
return status;
571450
}
572-
573-
#if 0
574-
/**
575-
* @brief Increment the NAND memory address.
576-
* @param addr: address to be incremented.
577-
* @retval The new status of the increment address operation. It can be:
578-
* - NAND_VALID_ADDRESS: When the new address is valid address
579-
* - NAND_INVALID_ADDRESS: When the new address is invalid address
580-
*/
581-
uint32_t nand_addr_inc(nand_addr_t *addr)
582-
{
583-
uint32_t status = NAND_VALID_ADDRESS;
584-
585-
addr->page++;
586-
587-
if (addr->page == NAND_BLOCK_SIZE)
588-
{
589-
addr->page = 0;
590-
addr->block++;
591-
592-
if (addr->block == NAND_ZONE_SIZE)
593-
{
594-
addr->block = 0;
595-
addr->zone++;
596-
597-
if (addr->zone == NAND_MAX_ZONE)
598-
status = NAND_INVALID_ADDRESS;
599-
}
600-
}
601-
602-
return status;
603-
}
604-
605-
uint32_t nand_raw_addr_to_nand_addr(uint32_t raw_addr, nand_addr_t *addr)
606-
{
607-
uint32_t blocks_in_zones, block_size;
608-
uint32_t status = NAND_VALID_ADDRESS;
609-
610-
block_size = NAND_BLOCK_SIZE * NAND_PAGE_SIZE;
611-
addr->zone = raw_addr / (NAND_ZONE_SIZE * block_size);
612-
blocks_in_zones = addr->zone * NAND_ZONE_SIZE;
613-
addr->block = raw_addr / block_size - blocks_in_zones;
614-
addr->page = raw_addr / NAND_PAGE_SIZE - (blocks_in_zones +
615-
addr->block) * NAND_BLOCK_SIZE;
616-
617-
if(addr->zone == NAND_MAX_ZONE)
618-
status = NAND_INVALID_ADDRESS;
619-
620-
return status;
621-
}
622-
623-
#endif

firmware/fsmc_nand.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,9 @@ uint32_t nand_read_data(uint8_t *buf, uint32_t page, uint32_t page_offset,
4545
uint32_t nand_read_page(uint8_t *buf, uint32_t page, uint32_t page_size);
4646
uint32_t nand_read_spare_data(uint8_t *buf, uint32_t page, uint32_t offset,
4747
uint32_t data_size);
48-
#if 0
49-
uint32_t nand_write_spare_area(uint8_t *buf, nand_addr_t addr,
50-
uint32_t num_spare_area_to_write);
51-
uint32_t nand_read_spare_area(uint8_t *buf, nand_addr_t addr,
52-
uint32_t num_spare_area_to_read);
53-
#endif
5448
uint32_t nand_erase_block(uint32_t page);
5549
uint32_t nand_reset(void);
5650
uint32_t nand_get_status(void);
5751
uint32_t nand_read_status(void);
58-
#if 0
59-
uint32_t nand_addr_inc(nand_addr_t *addr);
60-
uint32_t nand_raw_addr_to_nand_addr(uint32_t raw_addr, nand_addr_t *addr);
61-
#endif
6252

6353
#endif /* _FSMC_NAND_H_ */

0 commit comments

Comments
 (0)