OpenCores
URL https://opencores.org/ocsvn/ao486/ao486/trunk

Subversion Repositories ao486

[/] [ao486/] [trunk/] [syn/] [components/] [sd_card/] [software/] [exe_bsp/] [HAL/] [src/] [alt_log_macro.S] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 alfik
/*  alt_log_macro.S
2
 *
3
 *  Implements the function tx_log_str, called by the assembly macro
4
 *  ALT_LOG_PUTS().  The macro will be empty when logging is turned off,
5
 *  and this function will not be compiled.  When logging is on,
6
 *  this function is used to print out the strings defined in the beginning
7
 *  of alt_log_printf.c, using port information taken from system.h and
8
 *  alt_log_printf.h.
9
 *
10
 *  This routine only handles strings, and sends a character into the defined
11
 *  output device's output buffer when the device is ready. It's intended for
12
 *  debugging purposes, where messages can be set to print out at certain
13
 *  points in the boot code to indicate the progress of the program.
14
 *
15
 */
16
 
17
#ifndef __ALT_LOG_MACROS__
18
#define __ALT_LOG_MACROS__
19
 
20
/* define this flag to skip assembly-incompatible parts
21
 * of various include files. */
22
#define ALT_ASM_SRC
23
 
24
#ifdef ALT_LOG_ENABLE // only compile this function if this flag is defined.
25
 
26
        #include "system.h"
27
        #include "sys/alt_log_printf.h"
28
 
29
        .global tx_log_str
30
tx_log_str:
31
        /* load base uart / jtag uart address into r6 */
32
        movhi r6, %hiadj(ALT_LOG_PORT_BASE)
33
        addi r6, r6, %lo(ALT_LOG_PORT_BASE)
34
tx_next_char:
35
        /* if pointer points to null, return
36
         * r4 is the pointer to the str to be printed, set by ALT_LOG_PUTS */
37
        ldb r7, (r4)
38
        beq r0, r7, end_tx
39
 
40
        /* check device transmit ready  */
41
wait_tx_ready_loop:
42
        ldwio   r5, ALT_LOG_PRINT_REG_OFFSET(r6)
43
        andi    r5, r5, ALT_LOG_PRINT_MSK
44
        beq     r5, r0, wait_tx_ready_loop
45
        /* write char */
46
        stwio   r7, ALT_LOG_PRINT_TXDATA_REG_OFFSET (r6)
47
        /* advance string pointer */
48
        addi r4, r4, 1
49
        br tx_next_char
50
end_tx:
51
        ret
52
 
53
#endif
54
 
55
#endif /* __ALT_LOG_MACROS__ */
56
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.