flash_sector_t -> struct flash_sector
[openocd.git] / src / flash / lpc2900.c
index e15d93b25f13dfc9db04f709a1774705bd3fbb0b..fd265bd7ddeb85fc41aa9a6127a22ab044dc4f77 100644 (file)
@@ -171,21 +171,6 @@ typedef struct lpc2900_flash_bank_s
 } lpc2900_flash_bank_t;
 
 
-
-
-static int lpc2900_register_commands(struct command_context_s *cmd_ctx);
-static int lpc2900_flash_bank_command(struct command_context_s *cmd_ctx,
-                                      char *cmd, char **args, int argc,
-                                      struct flash_bank_s *bank);
-static int lpc2900_erase(struct flash_bank_s *bank, int first, int last);
-static int lpc2900_protect(struct flash_bank_s *bank, int set, int first, int last);
-static int lpc2900_write(struct flash_bank_s *bank,
-                         uint8_t *buffer, uint32_t offset, uint32_t count);
-static int lpc2900_probe(struct flash_bank_s *bank);
-static int lpc2900_erase_check(struct flash_bank_s *bank);
-static int lpc2900_protect_check(struct flash_bank_s *bank);
-static int lpc2900_info(struct flash_bank_s *bank, char *buf, int buf_size);
-
 static uint32_t lpc2900_wait_status(flash_bank_t *bank, uint32_t mask, int timeout);
 static void lpc2900_setup(struct flash_bank_s *bank);
 static uint32_t lpc2900_is_ready(struct flash_bank_s *bank);
@@ -545,14 +530,8 @@ static uint32_t lpc2900_calc_tr( uint32_t clock, uint32_t time )
  *
  * Uses the Built-In-Self-Test (BIST) to generate a 128-bit hash value
  * of the flash content.
- *
- * @param cmd_ctx
- * @param cmd
- * @param args
- * @param argc
  */
-static int lpc2900_handle_signature_command( struct command_context_s *cmd_ctx,
-                                             char *cmd, char **args, int argc )
+COMMAND_HANDLER(lpc2900_handle_signature_command)
 {
        uint32_t status;
        uint32_t signature[4];
@@ -601,14 +580,8 @@ static int lpc2900_handle_signature_command( struct command_context_s *cmd_ctx,
  *
  * Read customer info from index sector, and store that block of data into
  * a disk file. The format is binary.
- *
- * @param cmd_ctx
- * @param cmd
- * @param args
- * @param argc
  */
-static int lpc2900_handle_read_custom_command( struct command_context_s *cmd_ctx,
-                                               char *cmd, char **args, int argc )
+COMMAND_HANDLER(lpc2900_handle_read_custom_command)
 {
        if( argc < 2 )
        {
@@ -649,8 +622,8 @@ static int lpc2900_handle_read_custom_command( struct command_context_s *cmd_ctx
        target_write_u32( target, FCTR, FCTR_FS_CS | FCTR_FS_WEB );
 
        /* Try and open the file */
-       fileio_t fileio;
-       char *filename = args[1];
+       struct fileio fileio;
+       const char *filename = args[1];
        int ret = fileio_open( &fileio, filename, FILEIO_WRITE, FILEIO_BINARY );
        if( ret != ERROR_OK )
        {
@@ -678,14 +651,8 @@ static int lpc2900_handle_read_custom_command( struct command_context_s *cmd_ctx
 
 /**
  * Enter password to enable potentially dangerous options.
- *
- * @param cmd_ctx
- * @param cmd
- * @param args
- * @param argc
  */
-static int lpc2900_handle_password_command(struct command_context_s *cmd_ctx,
-                                           char *cmd, char **args, int argc)
+COMMAND_HANDLER(lpc2900_handle_password_command)
 {
        if (argc < 2)
        {
@@ -719,14 +686,8 @@ static int lpc2900_handle_password_command(struct command_context_s *cmd_ctx,
 
 /**
  * Write customer info from file to the index sector.
- *
- * @param cmd_ctx
- * @param cmd
- * @param args
- * @param argc
  */
-static int lpc2900_handle_write_custom_command( struct command_context_s *cmd_ctx,
-                                                char *cmd, char **args, int argc )
+COMMAND_HANDLER(lpc2900_handle_write_custom_command)
 {
        if (argc < 2)
        {
@@ -762,8 +723,8 @@ static int lpc2900_handle_write_custom_command( struct command_context_s *cmd_ct
        image.base_address = 0;
        image.start_address_set = 0;
 
-       char *filename = args[1];
-       char *type = (argc >= 3) ? args[2] : NULL;
+       const char *filename = args[1];
+       const char *type = (argc >= 3) ? args[2] : NULL;
        retval = image_open(&image, filename, type);
        if (retval != ERROR_OK)
        {
@@ -835,14 +796,8 @@ static int lpc2900_handle_write_custom_command( struct command_context_s *cmd_ct
 
 /**
  * Activate 'sector security' for a range of sectors.
- *
- * @param cmd_ctx
- * @param cmd
- * @param args
- * @param argc
  */
-static int lpc2900_handle_secure_sector_command(struct command_context_s *cmd_ctx,
-                                                char *cmd, char **args, int argc)
+COMMAND_HANDLER(lpc2900_handle_secure_sector_command)
 {
        if (argc < 3)
        {
@@ -940,14 +895,8 @@ static int lpc2900_handle_secure_sector_command(struct command_context_s *cmd_ct
 
 /**
  * Activate JTAG protection.
- *
- * @param cmd_ctx
- * @param cmd
- * @param args
- * @param argc
  */
-static int lpc2900_handle_secure_jtag_command(struct command_context_s *cmd_ctx,
-                                              char *cmd, char **args, int argc)
+COMMAND_HANDLER(lpc2900_handle_secure_jtag_command)
 {
        if (argc < 1)
        {
@@ -1002,8 +951,6 @@ static int lpc2900_handle_secure_jtag_command(struct command_context_s *cmd_ctx,
 
 /**
  * Register private command handlers.
- *
- * @param cmd_ctx
  */
 static int lpc2900_register_commands(struct command_context_s *cmd_ctx)
 {
@@ -1068,20 +1015,8 @@ static int lpc2900_register_commands(struct command_context_s *cmd_ctx)
 }
 
 
-/**
- * Evaluate flash bank command.
- *
- * Syntax: flash bank lpc2900 0 0 0 0 target# system_base_clock
- *
- * @param cmd_ctx
- * @param cmd
- * @param args
- * @param argc
- * @param bank Pointer to the flash bank descriptor
- */
-static int lpc2900_flash_bank_command(struct command_context_s *cmd_ctx,
-                                      char *cmd, char **args, int argc,
-                                      struct flash_bank_s *bank)
+/// Evaluate flash bank command.
+FLASH_BANK_COMMAND_HANDLER(lpc2900_flash_bank_command)
 {
        lpc2900_flash_bank_t *lpc2900_info;
 
@@ -1767,7 +1702,7 @@ static int lpc2900_probe(struct flash_bank_s *bank)
         * the logical flash number are translated into the physical flash numbers
         * of the device.
         */
-       bank->sectors = malloc(sizeof(flash_sector_t) * bank->num_sectors);
+       bank->sectors = malloc(sizeof(struct flash_sector) * bank->num_sectors);
 
        offset = 0;
        for (i = 0; i < bank->num_sectors; i++)

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)