OpenOCD
testee.c
Go to the documentation of this file.
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 
3 /***************************************************************************
4  * Copyright (C) 2009 Zachary T Welch <zw@superlucidity.net> *
5  ***************************************************************************/
6 
7 #ifdef HAVE_CONFIG_H
8 #include "config.h"
9 #endif
10 
11 #include <helper/log.h>
12 
13 #include "smp.h"
14 #include "target.h"
15 #include "target_type.h"
16 #include "hello.h"
17 
18 static const struct command_registration testee_command_handlers[] = {
19  {
20  .name = "testee",
21  .mode = COMMAND_ANY,
22  .help = "testee target commands",
23  .chain = hello_command_handlers,
24  .usage = "",
25  },
26  {
27  .chain = smp_command_handlers,
28  },
30 };
31 
32 static int testee_init(struct command_context *cmd_ctx, struct target *target)
33 {
34  return ERROR_OK;
35 }
36 static int testee_poll(struct target *target)
37 {
40  return ERROR_OK;
41 }
42 static int testee_halt(struct target *target)
43 {
45  return ERROR_OK;
46 }
47 static int testee_reset_assert(struct target *target)
48 {
50  return ERROR_OK;
51 }
52 static int testee_reset_deassert(struct target *target)
53 {
55  return ERROR_OK;
56 }
57 struct target_type testee_target = {
58  .name = "testee",
59  .commands = testee_command_handlers,
60 
61  .init_target = &testee_init,
62  .poll = &testee_poll,
63  .halt = &testee_halt,
64  .assert_reset = &testee_reset_assert,
65  .deassert_reset = &testee_reset_deassert,
66 };
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:256
@ COMMAND_ANY
Definition: command.h:42
const struct command_registration hello_command_handlers[]
Export the registration for the hello command group, so it can be embedded in example drivers.
Definition: hello.c:86
#define ERROR_OK
Definition: log.h:182
const struct command_registration smp_command_handlers[]
Definition: smp.c:150
const char * name
Definition: command.h:239
const char * usage
a string listing the options and arguments, required or optional
Definition: command.h:244
This holds methods shared between all instances of a given target type.
Definition: target_type.h:27
const char * name
Name of this type of target.
Definition: target_type.h:32
Definition: target.h:119
enum target_state state
Definition: target.h:167
@ TARGET_RESET
Definition: target.h:59
@ TARGET_DEBUG_RUNNING
Definition: target.h:60
@ TARGET_HALTED
Definition: target.h:58
@ TARGET_RUNNING
Definition: target.h:57
static int testee_init(struct command_context *cmd_ctx, struct target *target)
Definition: testee.c:32
struct target_type testee_target
Definition: testee.c:57
static int testee_reset_assert(struct target *target)
Definition: testee.c:47
static int testee_poll(struct target *target)
Definition: testee.c:36
static int testee_reset_deassert(struct target *target)
Definition: testee.c:52
static const struct command_registration testee_command_handlers[]
Definition: testee.c:18
static int testee_halt(struct target *target)
Definition: testee.c:42