fnand_common_cmd.h 2.7 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
/*
 * @Copyright : (C) 2022 Phytium Information Technology, Inc.
 * All Rights Reserved.
 *
 * This program is OPEN SOURCE software: you can redistribute it and/or modify it
 * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd,
 * either version 1.0 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the Phytium Public License for more details.
 *
 *
 * FilePath: fnand_common_cmd.h
 * @Date: 2022-07-05 19:01:01
 * @LastEditTime: 2022-07-05 19:01:02
 * @Description:  This file is for
 *
 * @Modify History:
 *  Ver   Who  Date   Changes
 * ----- ------  -------- --------------------------------------
 */

#ifndef DRIVERS_NAND_COMMON_CMD_H
#define DRIVERS_NAND_COMMON_CMD_H

#include "ftypes.h"
#include "fnand.h"

/*
 * Mandatory commands
 */

#define NAND_CMD_READ1 0x00
#define NAND_CMD_READ2 0x30 /* READ PAGE */

#define NAND_CMD_CHANGE_READ_COLUMN1 0x05 /* NAND Random data Read \
                      Column command (1st                         \
                      cycle) */
#define NAND_CMD_CHANGE_READ_COLUMN2 0xE0 /* NAND Random data Read \
                      Column command (2nd                         \
                      cycle) */
#define NAND_CMD_BLOCK_ERASE1 0x60        /* NAND Block Erase \
                          (1st cycle) */
#define NAND_CMD_BLOCK_ERASE2 0xD0        /* NAND Block Erase \
                          (2nd cycle) */

#define NAND_CMD_PAGE_PROG1 0x80          /* NAND Page Program \
                          command (1st cycle)                      \
                          */
#define NAND_CMD_PAGE_PROG2 0x10          /* NAND Page Program \
                          command (2nd cycle)                      \
                          */

#define NAND_CMD_CHANGE_WRITE_COLUMN 0x85 /* NAND Change Write \
                         Column command */
#define NAND_CMD_READ_ID 0x90             /* NAND Read ID \
                              command */
#define NAND_CMD_READ_PARAM_PAGE 0xEC     /* NAND Read \
                          Parameter Page                   \
                          command */
#define NAND_CMD_RESET 0xFF               /* NAND Reset \
                          command */

#define NAND_END_CMD_NONE 0xfff /* No End command */

#define NAND_CMD_READ_STATUS 0x70 /* Read status */

FError FNandFlashReset(FNand *instance_p, u32 chip_addr) ;
FError FNandFlashReadId(FNand *instance_p, u8 address, u8 *id_buffer, u32 buffer_length, u32 chip_addr);
void FNandFlashFuncRegister(FNand *instance_p);

#endif