Skip to content

Commit d646afe

Browse files
committed
Moved chip database to host application
1 parent 0a57d60 commit d646afe

File tree

13 files changed

+188
-214
lines changed

13 files changed

+188
-214
lines changed

firmware/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ USB_SRCS=hw_config.c stm32_it.c usb_prop.c usb_desc.c usb_istr.c usb_pwr.c \
5151
usb_endp.c usb.c
5252

5353

54-
SRCS=main.c system_stm32f10x.c syscalls.c fsmc_nand.c chip_db.c led.c uart.c \
55-
jtag.c cdc.c nand_programmer.c nand_bad_block.c $(USB_SRCS)
54+
SRCS=main.c system_stm32f10x.c syscalls.c fsmc_nand.c led.c uart.c jtag.c \
55+
cdc.c nand_programmer.c nand_bad_block.c $(USB_SRCS)
5656

5757
OBJS=$(addprefix $(OBJ_DIR),$(SRCS:.c=.o)) \
5858
$(addprefix $(OBJ_DIR),$(STARTUP:.s=.o))

firmware/chip_db.c

Lines changed: 0 additions & 42 deletions
This file was deleted.

firmware/chip_db.h

Lines changed: 0 additions & 37 deletions
This file was deleted.

firmware/chip_info.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* Copyright (C) 2017 Bogdan Bogush <[email protected]>
2+
* This program is free software; you can redistribute it and/or modify
3+
* it under the terms of the GNU General Public License version 3.
4+
*/
5+
6+
#ifndef _CHIP_INFO_H_
7+
#define _CHIP_INFO_H_
8+
9+
typedef struct
10+
{
11+
uint32_t page_size; /* without spare area */
12+
uint32_t block_size;
13+
uint32_t size;
14+
uint8_t setup_time;
15+
uint8_t wait_setup_time;
16+
uint8_t hold_setup_time;
17+
uint8_t hi_z_setup_time;
18+
uint8_t clr_setup_time;
19+
uint8_t ar_setup_time;
20+
} chip_info_t;
21+
22+
#endif /* _CHIP_INFO_H_ */

firmware/fsmc_nand.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*/
55

66
#include "fsmc_nand.h"
7-
#include "chip_db.h"
87
#include <stm32f10x.h>
98

109
#define FSMC_Bank_NAND FSMC_Bank2_NAND
@@ -127,14 +126,8 @@ static void nand_fsmc_init(chip_info_t *chip_info)
127126
FSMC_NANDCmd(FSMC_Bank2_NAND, ENABLE);
128127
}
129128

130-
void nand_init(void)
129+
void nand_init(chip_info_t *chip_info)
131130
{
132-
chip_info_t *chip_info;
133-
134-
if (!chip_is_selected())
135-
return;
136-
chip_info = chip_info_selected_get();
137-
138131
nand_gpio_init();
139132
nand_fsmc_init(chip_info);
140133
}

firmware/fsmc_nand.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#ifndef _FSMC_NAND_H_
77
#define _FSMC_NAND_H_
88

9+
#include "chip_info.h"
10+
911
typedef struct
1012
{
1113
uint8_t maker_id;
@@ -66,7 +68,7 @@ typedef struct
6668
#define ADDR_3rd_CYCLE(ADDR) (uint8_t)(((ADDR)& 0xFF0000) >> 16) /* 3rd addressing cycle */
6769
#define ADDR_4th_CYCLE(ADDR) (uint8_t)(((ADDR)& 0xFF000000) >> 24) /* 4th addressing cycle */
6870

69-
void nand_init(void);
71+
void nand_init(chip_info_t *chip_info);
7072
void nand_read_id(nand_id_t *nand_id);
7173
uint32_t nand_write_page(uint8_t *buf, uint32_t page, uint32_t page_size);
7274
void nand_write_page_async(uint8_t *buf, uint32_t page, uint32_t page_size);

0 commit comments

Comments
 (0)