3 This file is part of the AVR-Huffman.
4 Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "avr-asm-macros.S"
22 #define CMDLIST_ENTRY_SIZE 8
24 /******************************************************************************/
25 /* uint16_t max_cmd_length(PGM_VOID_P cmdlist){
29 str = (char*)pgm_read_word(cmdlist);
30 cmdlist = (uint8_t*)cmdlist + CMDLIST_ENTRY_SIZE;
38 * param cmdlist: r24:r25
43 .global max_cmd_length
66 adiw r30, CMDLIST_ENTRY_SIZE-2
73 /******************************************************************************/
80 breq print_echo_status
86 breq print_echo_status
134 .asciz "\r\necho is o"
136 /******************************************************************************/
137 /* int8_t search_and_call(char *cmd, uint16_t maxcmdlength, PGM_VOID_P cmdlist)
139 * param maxcmdlength: r22:r23
140 * param cmdlist: r20:r21
160 .global search_and_call
186 2: rjmp snc_auto_help
196 rcall firstword_length
203 ldi r22, lo8(exit_str)
204 ldi r23, hi8(exit_str)
214 ldi r24, lo8(nocommand_str)
215 ldi r25, hi8(nocommand_str)
224 adiw r28, CMDLIST_ENTRY_SIZE
237 breq 4f ;snc_return_2
257 .asciz "\r\ncommand not found, try 'help'"
259 /******************************************************************************/
260 /* void cli_option_listing(char *buffer, PGM_VOID_P cmdlist)
261 * param buffer: r24:r25
262 * param cmdlist: r22:r23
272 .global cli_option_listing
294 adiw r28, CMDLIST_ENTRY_SIZE
298 ldi r24, lo8(itemprefix_str)
299 ldi r25, hi8(itemprefix_str)
305 ldi r24, lo8(prompt_str)
306 ldi r25, hi8(prompt_str)
319 /******************************************************************************/
320 /* void cli_auto_help(uint16_t maxcmdlength, PGM_VOID_P cmdlist)
321 * param maxcmdlength: r24:r25
322 * param cmdlist: r22:r23
336 ldi r24, lo8(ahelphead_str)
337 ldi r25, hi8(ahelphead_str)
359 4: ldi r24, lo8(sep_str)
360 ldi r25, hi8(sep_str)
362 ldi r22, lo8(none_str)
363 ldi r23, hi8(none_str)
370 ldi r22, lo8(yes_str)
371 ldi r23, hi8(yes_str)
374 ldi r24, lo8(sep2_str)
375 ldi r25, hi8(sep2_str)
380 rcall cli_hexdump_byte
383 rcall cli_hexdump_byte
390 adiw r28, CMDLIST_ENTRY_SIZE-4
398 .asciz "\r\n[auto help] available commands:\r\n <command> - <params> - <address>\r\n"