flash/nor: implement flash bank deallocation in drivers with simple alloc
[openocd.git] / src / flash / nor / em357.c
index 664306ca5f4017be94dbc18c0d49b8902bac2260..b14e0323c7916e272f66c073a07351d3d930d8b9 100644 (file)
@@ -19,9 +19,7 @@
  *   GNU General Public License for more details.                          *
  *                                                                         *
  *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
  ***************************************************************************/
 
 #ifdef HAVE_CONFIG_H
@@ -455,7 +453,7 @@ static int em357_protect(struct flash_bank *bank, int set, int first, int last)
        return em357_write_options(bank);
 }
 
-static int em357_write_block(struct flash_bank *bank, uint8_t *buffer,
+static int em357_write_block(struct flash_bank *bank, const uint8_t *buffer,
        uint32_t offset, uint32_t count)
 {
        struct target *target = bank->target;
@@ -502,10 +500,9 @@ static int em357_write_block(struct flash_bank *bank, uint8_t *buffer,
                LOG_WARNING("no working area available, can't do block memory writes");
                return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
        }
-       ;
 
        retval = target_write_buffer(target, write_algorithm->address,
-                       sizeof(em357_flash_write_code), (uint8_t *)em357_flash_write_code);
+                       sizeof(em357_flash_write_code), em357_flash_write_code);
        if (retval != ERROR_OK)
                return retval;
 
@@ -583,7 +580,7 @@ static int em357_write_block(struct flash_bank *bank, uint8_t *buffer,
        return retval;
 }
 
-static int em357_write(struct flash_bank *bank, uint8_t *buffer,
+static int em357_write(struct flash_bank *bank, const uint8_t *buffer,
        uint32_t offset, uint32_t count)
 {
        struct target *target = bank->target;
@@ -705,6 +702,11 @@ static int em357_probe(struct flash_bank *bank)
                        num_pages = 128;
                        page_size = 2048;
                        break;
+               case 0x80000:
+                       /* 512k -- 256 2k pages */
+                       num_pages = 256;
+                       page_size = 2048;
+                       break;
                default:
                        LOG_WARNING("No size specified for em357 flash driver, assuming 192k!");
                        num_pages = 96;
@@ -751,13 +753,6 @@ static int em357_auto_probe(struct flash_bank *bank)
        return em357_probe(bank);
 }
 
-
-static int get_em357_info(struct flash_bank *bank, char *buf, int buf_size)
-{
-       snprintf(buf, buf_size, "em357\n");
-       return ERROR_OK;
-}
-
 COMMAND_HANDLER(em357_handle_lock_command)
 {
        struct target *target = NULL;
@@ -946,5 +941,5 @@ struct flash_driver em357_flash = {
        .auto_probe = em357_auto_probe,
        .erase_check = default_flash_blank_check,
        .protect_check = em357_protect_check,
-       .info = get_em357_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)