@@ -45,92 +45,57 @@ Level Control
4545-------------
4646Three log levels for SPM log system are defined:
4747
48- - TFM_SPM_LOG_LEVEL_DEBUG
49- - TFM_SPM_LOG_LEVEL_INFO
50- - TFM_SPM_LOG_LEVEL_ERROR
51- - TFM_SPM_LOG_LEVEL_SILENCE
48+ - LOG_LEVEL_NONE
49+ - LOG_LEVEL_ERROR
50+ - LOG_LEVEL_NOTICE
51+ - LOG_LEVEL_WARNING
52+ - LOG_LEVEL_INFO
53+ - LOG_LEVEL_VERBOSE
5254
5355Then a macro ``TFM_SPM_LOG_LEVEL `` is defined as an indicator, it should
54- be equal to one of the four log levels.
56+ be equal to one of the six log levels.
5557
5658API Definition
5759--------------
58- The following three APIs LOG APIs output the given 'msg' with hexadecimal
59- formatted 'val' together. These APIs provide constrained ability to output
60- numbers inside SPM. The 'msg' can be skipped with giving an empty string like
61- "". And these APIs supports constant 'msg' string only, giving a runtime string
62- as parameter 'msg' would potentially cause a runtime error.
60+ The following APIs output the string with optional format specifiers.
61+ The _RAW forms of the macros, output the string directly, without
62+ adding a prefix identifying the log level of the print:
6363
64- SPMLOG_DBGMSGVAL(msg, val);
64+ VERBOSE_RAW(...);
65+ VERBOSE(...);
6566
66- SPMLOG_INFMSGVAL(msg, val);
67+ INFO_RAW(...);
68+ INFO(...);
6769
68- SPMLOG_ERRMSGVAL(msg, val);
70+ WARN(...);
71+ WARN_RAW(...);
6972
70- A C-function needs to work as an underlayer for these APIs as string formatting
71- is required. Check 'spm_log_msgval' for details.
72-
73- .. code-block :: c
73+ NOTICE(...);
74+ NOTICE_RAW(...);
7475
75- /**
76- * brief Output the given message plus one value as hexadecimal. The message
77- * can be skipped if the 'msg' is 'NULL' or 'len' equals 0. The
78- * formatted hexadecimal string for 'value' has a '0x' prefix and
79- * leading zeros are not stripped. This function rely on HAL API
80- * 'tfm_hal_output_spm_log' to output the formatted string.
81- *
82- * \param[in] msg A string message
83- * \param[in] len The length of the message
84- * \param[in] value A value need to be output
85- *
86- * \retval >=0 Number of chars output.
87- * \retval <0 TFM HAL error code.
88- */
89- int32_t spm_log_msgval(const char *msg, size_t len, uint32_t value)
90-
91- The following three APIs output a message in string.
92-
93- SPMLOG_DBGMSG(msg);
94-
95- SPMLOG_INFMSG(msg);
96-
97- SPMLOG_ERRMSG(msg);
76+ ERROR(...);
77+ ERROR_RAW(...);
9878
9979Here is a table about the effective APIs with different SPM log level.
10080
101- +------------------+-------------------------+---------------------------+---------------------------+-----------------------------+
102- | | TFM_SPM_LOG_LEVEL_DEBUG | TFM_SPM_LOG_LEVEL_INFO | TFM_SPM_LOG_LEVEL_ERROR | TFM_SPM_LOG_LEVEL_SILENCE |
103- +==================+=========================+===========================+===========================+=============================+
104- | SPMLOG_DBGMSGVAL | Yes | No | No | No |
105- +------------------+-------------------------+---------------------------+---------------------------+-----------------------------+
106- | SPMLOG_INFMSGVAL | Yes | Yes | No | No |
107- +------------------+-------------------------+---------------------------+---------------------------+-----------------------------+
108- | SPMLOG_ERRMSGVAL | Yes | Yes | Yes | No |
109- +------------------+-------------------------+---------------------------+---------------------------+-----------------------------+
110- | SPMLOG_DBGMSG | Yes | No | No | No |
111- +------------------+-------------------------+---------------------------+---------------------------+-----------------------------+
112- | SPMLOG_INFMSG | Yes | Yes | No | No |
113- +------------------+-------------------------+---------------------------+---------------------------+-----------------------------+
114- | SPMLOG_ERRMSG | Yes | Yes | Yes | No |
115- +------------------+-------------------------+---------------------------+---------------------------+-----------------------------+
116-
117- HAL API
118- -------
119- Define HAL API for SPM log system:
120-
121- .. code-block :: c
122-
123- /* SPM log HAL API */
124- int32_t tfm_hal_output_spm_log(const char *str, uint32_t len);
125-
126- Take debug message as an example:
127-
128- .. code-block :: c
129-
130- /* For debug message */
131- #define SPMLOG_DBGMSG(msg) tfm_hal_output_spm_log(msg, sizeof(msg))
132- /* For debug message with a value */
133- #define SPMLOG_DBGMSGVAL(msg, val) spm_log_msgval(msg, sizeof(msg), val)
81+ +--------------------+--------+------+-------+------+
82+ | | DEBUG | INFO | ERROR | NONE |
83+ +====================+========+======+=======+======+
84+ | VERBOSE_RAW | Yes | No | No | No |
85+ | VERBOSE | | | | |
86+ +--------------------+--------+------+-------+------+
87+ | INFO_RAW | Yes | Yes | No | No |
88+ | INFO | | | | |
89+ +--------------------+--------+------+-------+------+
90+ | NOTICE_RAW | Yes | Yes | No | No |
91+ | NOTICE | | | | |
92+ +--------------------+--------+------+-------+------+
93+ | WARN_RAW | Yes | Yes | No | No |
94+ | WARN | | | | |
95+ +--------------------+--------+------+-------+------+
96+ | ERROR_RAW | Yes | Yes | Yes | No |
97+ | ERROR | | | | |
98+ +--------------------+--------+------+-------+------+
13499
135100Partition Log System
136101====================
0 commit comments