} 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);
*
* 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];
*
* 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 )
{
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 )
{
/**
* 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)
{
/**
* 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)
{
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)
{
/**
* 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)
{
/**
* 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)
{
/**
* Register private command handlers.
- *
- * @param cmd_ctx
*/
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;
* 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++)