| Nico Huber | 10337f7 | 2026-03-04 19:57:27 +0100 | [diff] [blame^] | 1 | /* |
| 2 | * This file is part of the flashrom project. |
| 3 | * |
| 4 | * Copyright (C) 2009 Carl-Daniel Hailfinger |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | */ |
| 15 | |
| 16 | #ifndef __CHIPDRIVERS_MEMORY_BUS_H__ |
| 17 | #define __CHIPDRIVERS_MEMORY_BUS_H__ 1 |
| 18 | |
| 19 | #include <stdint.h> |
| 20 | |
| 21 | struct flashprog_flashctx; |
| 22 | |
| 23 | /* 82802ab.c */ |
| 24 | uint8_t wait_82802ab(struct flashprog_flashctx *); |
| 25 | int probe_82802ab(struct flashprog_flashctx *); |
| 26 | int erase_block_82802ab(struct flashprog_flashctx *, unsigned int page, unsigned int pagesize); |
| 27 | int write_82802ab(struct flashprog_flashctx *, const uint8_t *buf, unsigned int start, unsigned int len); |
| 28 | void print_status_82802ab(uint8_t status); |
| 29 | int unlock_28f004s5(struct flashprog_flashctx *); |
| 30 | int unlock_lh28f008bjt(struct flashprog_flashctx *); |
| 31 | |
| 32 | /* jedec.c */ |
| 33 | uint8_t oddparity(uint8_t val); |
| 34 | void toggle_ready_jedec(const struct flashprog_flashctx *, chipaddr dst); |
| 35 | void data_polling_jedec(const struct flashprog_flashctx *, chipaddr dst, uint8_t data); |
| 36 | int probe_jedec(struct flashprog_flashctx *); |
| 37 | int probe_jedec_29gl(struct flashprog_flashctx *); |
| 38 | int write_jedec(struct flashprog_flashctx *, const uint8_t *buf, unsigned int start, unsigned int len); |
| 39 | int write_jedec_1(struct flashprog_flashctx *, const uint8_t *buf, unsigned int start, unsigned int len); |
| 40 | int erase_sector_jedec(struct flashprog_flashctx *, unsigned int page, unsigned int pagesize); |
| 41 | int erase_block_jedec(struct flashprog_flashctx *, unsigned int page, unsigned int blocksize); |
| 42 | int erase_chip_block_jedec(struct flashprog_flashctx *, unsigned int page, unsigned int blocksize); |
| 43 | |
| 44 | int unlock_regspace2_uniform_32k(struct flashprog_flashctx *); |
| 45 | int unlock_regspace2_uniform_64k(struct flashprog_flashctx *); |
| 46 | int unlock_regspace2_block_eraser_0(struct flashprog_flashctx *); |
| 47 | int unlock_regspace2_block_eraser_1(struct flashprog_flashctx *); |
| 48 | int printlock_regspace2_uniform_64k(struct flashprog_flashctx *); |
| 49 | int printlock_regspace2_block_eraser_0(struct flashprog_flashctx *); |
| 50 | int printlock_regspace2_block_eraser_1(struct flashprog_flashctx *); |
| 51 | |
| 52 | /* sst28sf040.c */ |
| 53 | int erase_chip_28sf040(struct flashprog_flashctx *, unsigned int addr, unsigned int blocklen); |
| 54 | int erase_sector_28sf040(struct flashprog_flashctx *, unsigned int address, unsigned int sector_size); |
| 55 | int write_28sf040(struct flashprog_flashctx *, const uint8_t *buf, unsigned int start, unsigned int len); |
| 56 | int unprotect_28sf040(struct flashprog_flashctx *); |
| 57 | int protect_28sf040(struct flashprog_flashctx *); |
| 58 | |
| 59 | /* sst49lfxxxc.c */ |
| 60 | int erase_sector_49lfxxxc(struct flashprog_flashctx *, unsigned int address, unsigned int sector_size); |
| 61 | |
| 62 | /* sst_fwhub.c */ |
| 63 | int printlock_sst_fwhub(struct flashprog_flashctx *); |
| 64 | int unlock_sst_fwhub(struct flashprog_flashctx *); |
| 65 | |
| 66 | /* w39.c */ |
| 67 | int printlock_w39f010(struct flashprog_flashctx *); |
| 68 | int printlock_w39l010(struct flashprog_flashctx *); |
| 69 | int printlock_w39l020(struct flashprog_flashctx *); |
| 70 | int printlock_w39l040(struct flashprog_flashctx *); |
| 71 | int printlock_w39v040a(struct flashprog_flashctx *); |
| 72 | int printlock_w39v040b(struct flashprog_flashctx *); |
| 73 | int printlock_w39v040c(struct flashprog_flashctx *); |
| 74 | int printlock_w39v040fa(struct flashprog_flashctx *); |
| 75 | int printlock_w39v040fb(struct flashprog_flashctx *); |
| 76 | int printlock_w39v040fc(struct flashprog_flashctx *); |
| 77 | int printlock_w39v080a(struct flashprog_flashctx *); |
| 78 | int printlock_w39v080fa(struct flashprog_flashctx *); |
| 79 | int printlock_w39v080fa_dual(struct flashprog_flashctx *); |
| 80 | int printlock_at49f(struct flashprog_flashctx *); |
| 81 | |
| 82 | /* w29ee011.c */ |
| 83 | int probe_w29ee011(struct flashprog_flashctx *); |
| 84 | |
| 85 | /* stm50.c */ |
| 86 | int erase_sector_stm50(struct flashprog_flashctx *, unsigned int block, unsigned int blocksize); |
| 87 | |
| 88 | /* en29lv640b.c */ |
| 89 | int probe_en29lv640b(struct flashprog_flashctx *); |
| 90 | int write_en29lv640b(struct flashprog_flashctx *, const uint8_t *buf, unsigned int start, unsigned int len); |
| 91 | |
| 92 | /* memory_bus.c */ |
| 93 | enum preparation_steps; |
| 94 | int prepare_memory_access(struct flashprog_flashctx *, enum preparation_steps); |
| 95 | int prepare_memory_register_access(struct flashprog_flashctx *, enum preparation_steps); |
| 96 | void finish_memory_access(struct flashprog_flashctx *); |
| 97 | |
| 98 | #endif /* !__CHIPDRIVERS_MEMORY_BUS_H__ */ |