mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-04 13:14:32 +02:00
fix(ulp): rename putc -> putc_fn in structure to avoid applying "putc" macro
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
#include "ulp_riscv_utils.h"
|
||||
|
||||
typedef struct {
|
||||
putc_fn_t putc; // Putc function of the underlying driver, e.g. UART
|
||||
putc_fn_t putc_fn; // Putc function of the underlying driver, e.g. UART
|
||||
void *putc_ctx; // Context passed to the putc function
|
||||
} ulp_riscv_print_ctx_t;
|
||||
|
||||
@@ -16,12 +16,12 @@ static ulp_riscv_print_ctx_t s_print_ctx;
|
||||
void ulp_riscv_print_install(putc_fn_t putc, void * putc_ctx)
|
||||
{
|
||||
s_print_ctx.putc_ctx = putc_ctx;
|
||||
s_print_ctx.putc = putc;
|
||||
s_print_ctx.putc_fn = putc;
|
||||
}
|
||||
|
||||
void ulp_riscv_print_str(const char *str)
|
||||
{
|
||||
if (!s_print_ctx.putc) {
|
||||
if (!s_print_ctx.putc_fn) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ void ulp_riscv_print_str(const char *str)
|
||||
ULP_RISCV_ENTER_CRITICAL();
|
||||
|
||||
for (int i = 0; str[i] != 0; i++) {
|
||||
s_print_ctx.putc(s_print_ctx.putc_ctx, str[i]);
|
||||
s_print_ctx.putc_fn(s_print_ctx.putc_ctx, str[i]);
|
||||
}
|
||||
|
||||
ULP_RISCV_EXIT_CRITICAL();
|
||||
@@ -40,7 +40,7 @@ void ulp_riscv_print_hex(int h)
|
||||
int x;
|
||||
int c;
|
||||
|
||||
if (!s_print_ctx.putc) {
|
||||
if (!s_print_ctx.putc_fn) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -51,9 +51,9 @@ void ulp_riscv_print_hex(int h)
|
||||
for (x = 0; x < 8; x++) {
|
||||
c = (h >> 28) & 0xf; // extract the leftmost byte
|
||||
if (c < 10) {
|
||||
s_print_ctx.putc(s_print_ctx.putc_ctx, '0' + c);
|
||||
s_print_ctx.putc_fn(s_print_ctx.putc_ctx, '0' + c);
|
||||
} else {
|
||||
s_print_ctx.putc(s_print_ctx.putc_ctx, 'a' + c - 10);
|
||||
s_print_ctx.putc_fn(s_print_ctx.putc_ctx, 'a' + c - 10);
|
||||
}
|
||||
h <<= 4; // move the 2nd leftmost byte to the left, to be extracted next
|
||||
}
|
||||
@@ -66,7 +66,7 @@ void ulp_riscv_print_hex_with_number_of_digits(int h, int number_of_digits)
|
||||
int x;
|
||||
int c;
|
||||
|
||||
if (!s_print_ctx.putc) {
|
||||
if (!s_print_ctx.putc_fn) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -86,9 +86,9 @@ void ulp_riscv_print_hex_with_number_of_digits(int h, int number_of_digits)
|
||||
for (x = 0; x < number_of_digits; x++) {
|
||||
c = (h >> ((number_of_digits - 1) * 4)) & 0xf; // extract the leftmost byte
|
||||
if (c < 10) {
|
||||
s_print_ctx.putc(s_print_ctx.putc_ctx, '0' + c);
|
||||
s_print_ctx.putc_fn(s_print_ctx.putc_ctx, '0' + c);
|
||||
} else {
|
||||
s_print_ctx.putc(s_print_ctx.putc_ctx, 'a' + c - 10);
|
||||
s_print_ctx.putc_fn(s_print_ctx.putc_ctx, 'a' + c - 10);
|
||||
}
|
||||
h <<= 4; // move the 2nd leftmost byte to the left, to be extracted next
|
||||
}
|
||||
|
Reference in New Issue
Block a user