summaryrefslogtreecommitdiffstats
path: root/mig_test/software/monitor.h
blob: 74d647238d9f4c058d276c089821277e7007ab9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/hw_sp605/bsp_zpuahb/software/monitor.h $
 * $Date$
 * $Author$
 * $Revision$
 */


#ifndef MONITOR_H
#define MONITOR_H

#include <types.h>

////////////////////////////////////////////////////////////
//  monitor definitions

#define MAX_COMMANDS       (64)
#define MAX_COMMAND_LENGTH (12)
#define MAX_HELP_LENGTH    (40)
#define BUFFER_LENGTH      (80)

#define CR                 '\r'
#define LF                 '\n'
#define BS                 '\b'
#define DEL                (0x7f)

#define SOH                (0x01)
#define EOT                (0x04)
#define ACK                (0x06)
#define NAK                (0x15)
#define CAN                (0x18)
#define EOF                (0x1a)


////////////////////////////////////////////////////////////
//  monitor variables

typedef uint32_t (*command_ptr_t) (void);

extern char          command_list[MAX_COMMANDS][MAX_COMMAND_LENGTH];
extern char          help_list   [MAX_COMMANDS][MAX_HELP_LENGTH];
extern command_ptr_t command_ptr_list[MAX_COMMANDS];

extern uint8_t       buffer[BUFFER_LENGTH];
extern uint8_t       command_number;
extern uint8_t       buffer_position;
extern command_ptr_t exec_function;


////////////////////////////////////////////////////////////
//  monitor functions

void monitor_init( void);
void monitor_add_command(char* new_command, char* new_help, command_ptr_t new_command_ptr);
void monitor_prompt( void); 
void process_buffer( void);
extern uint8_t monitor_run;

void monitor_mainloop( void);
void monitor_input(uint8_t c);
char* monitor_get_argument_string(uint8_t num);
int      monitor_get_argument_int(uint8_t num);
uint32_t monitor_get_argument_hex(uint8_t num);

uint32_t help_function( void);

#endif // MONITOR_H
OpenPOWER on IntegriCloud