Skip to content

Commit

Permalink
Merge pull request #73 from YuzukiHD/dev
Browse files Browse the repository at this point in the history
[log] fix up new log macro
  • Loading branch information
SamulKyull authored Apr 17, 2024
2 parents 7a08830 + aae3fe5 commit 72b9424
Show file tree
Hide file tree
Showing 20 changed files with 97 additions and 137 deletions.
6 changes: 2 additions & 4 deletions board/100ask-ros/syter_boot/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ static int fatfs_loadimage(char *filename, BYTE *dest) {

fret = f_open(&file, filename, FA_OPEN_EXISTING | FA_READ);
if (fret != FR_OK) {
printk(LOG_LEVEL_ERROR,
"FATFS: open, filename: [%s]: error %d\n", filename,
fret);
printk_error("FATFS: open, filename: [%s]: error %d\n", filename, fret);
ret = -1;
goto open_fail;
}
Expand All @@ -131,7 +129,7 @@ static int fatfs_loadimage(char *filename, BYTE *dest) {
fret = f_close(&file);

printk_debug("FATFS: read in %ums at %.2fMB/S\n", time,
(f32) (total_read / time) / 1024.0f);
(f32) (total_read / time) / 1024.0f);

open_fail:
return ret;
Expand Down
32 changes: 15 additions & 17 deletions board/100ask-t113i/load_c906/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ static int fatfs_loadimage(char *filename, BYTE *dest) {

fret = f_open(&file, filename, FA_OPEN_EXISTING | FA_READ);
if (fret != FR_OK) {
printk(LOG_LEVEL_ERROR,
"FATFS: open, filename: [%s]: error %d\n", filename,
fret);
printk_error("FATFS: open, filename: [%s]: error %d\n", filename, fret);
ret = -1;
goto open_fail;
}
Expand All @@ -93,7 +91,7 @@ static int fatfs_loadimage(char *filename, BYTE *dest) {
fret = f_close(&file);

printk_debug("FATFS: read in %ums at %.2fMB/S\n", time,
(f32) (total_read / time) / 1024.0f);
(f32) (total_read / time) / 1024.0f);

open_fail:
return ret;
Expand All @@ -111,8 +109,8 @@ static int load_sdcard(image_info_t *image) {
CONFIG_SDMMC_SPEED_TEST_SIZE);
test_time = time_ms() - start;
printk_debug("SDMMC: speedtest %uKB in %ums at %uKB/S\n",
(CONFIG_SDMMC_SPEED_TEST_SIZE * 512) / 1024, test_time,
(CONFIG_SDMMC_SPEED_TEST_SIZE * 512) / test_time);
(CONFIG_SDMMC_SPEED_TEST_SIZE * 512) / 1024, test_time,
(CONFIG_SDMMC_SPEED_TEST_SIZE * 512) / test_time);

start = time_ms();

Expand Down Expand Up @@ -153,17 +151,17 @@ static int load_sdcard(image_info_t *image) {
}

int main(void) {
sunxi_serial_init(&uart_dbg); // Initialize the serial interface for debugging
sunxi_serial_init(&uart_dbg);// Initialize the serial interface for debugging

show_banner(); // Display a banner
show_banner();// Display a banner

sunxi_clk_init(); // Initialize clock configurations
sunxi_clk_init();// Initialize clock configurations

sunxi_dram_init(&dram_para); // Initialize DRAM parameters
sunxi_dram_init(&dram_para);// Initialize DRAM parameters

sunxi_clk_dump(); // Dump clock information
sunxi_clk_dump();// Dump clock information

memset(&image, 0, sizeof(image_info_t)); // Clear the image structure
memset(&image, 0, sizeof(image_info_t));// Clear the image structure

// Set destination addresses for different images
image.dest = (uint8_t *) CONFIG_RISCV_ELF_LOADADDR;
Expand Down Expand Up @@ -195,7 +193,7 @@ int main(void) {
return 0;
}

sunxi_c906_clock_reset(); // Reset C906 clock
sunxi_c906_clock_reset();// Reset C906 clock

// Get entry address of RISC-V ELF
uint32_t elf_run_addr = elf64_get_entry_addr((phys_addr_t) image.dest);
Expand All @@ -208,13 +206,13 @@ int main(void) {

printk_info("RISC-V C906 Core now Running... \n");

mdelay(100); // Delay for 100 milliseconds
mdelay(100);// Delay for 100 milliseconds

sunxi_c906_clock_init(elf_run_addr); // Initialize C906 clock with entry address
sunxi_c906_clock_init(elf_run_addr);// Initialize C906 clock with entry address

abort(); // Abort A7 execution, loop forever
abort();// Abort A7 execution, loop forever

jmp_to_fel(); // Jump to FEL mode
jmp_to_fel();// Jump to FEL mode

return 0;
}
4 changes: 1 addition & 3 deletions board/dongshanpi-aict/load_e907/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ static int fatfs_loadimage(char *filename, BYTE *dest) {

fret = f_open(&file, filename, FA_OPEN_EXISTING | FA_READ);
if (fret != FR_OK) {
printk(LOG_LEVEL_ERROR,
"FATFS: open, filename: [%s]: error %d\n", filename,
fret);
printk_error("FATFS: open, filename: [%s]: error %d\n", filename, fret);
ret = -1;
goto open_fail;
}
Expand Down
27 changes: 11 additions & 16 deletions board/dongshanpi-aict/syter_boot_spi/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

#include <image_loader.h>

#include "sys-dma.h"
#include "sys-dram.h"
#include "sys-rtc.h"
#include "sys-sid.h"
#include "sys-spi.h"
#include "sys-dma.h"
#include "sys-spi-nand.h"
#include "sys-spi.h"

#include "ff.h"
#include "libfdt.h"
Expand Down Expand Up @@ -81,37 +81,32 @@ int load_spi_nand(sunxi_spi_t *spi, image_info_t *image) {
}

size = fdt_totalsize(image->of_dest);
printk(LOG_LEVEL_DEBUG,
"SPI-NAND: dt blob: Copy from 0x%08x to 0x%08lx size:0x%08x\n",
CONFIG_SPINAND_DTB_ADDR, (uint32_t) image->of_dest, size);
printk_debug("SPI-NAND: dt blob: Copy from 0x%08x to 0x%08lx size:0x%08x\n",
CONFIG_SPINAND_DTB_ADDR, (uint32_t) image->of_dest, size);
start = time_us();
spi_nand_read(spi, image->of_dest, CONFIG_SPINAND_DTB_ADDR,
(uint32_t) size);
time = time_us() - start;
printk(LOG_LEVEL_INFO,
"SPI-NAND: read dt blob of size %u at %.2fMB/S\n", size,
(f32) (size / time));
printk_info("SPI-NAND: read dt blob of size %u at %.2fMB/S\n", size,
(f32) (size / time));

/* get kernel size and read */
spi_nand_read(spi, image->dest, CONFIG_SPINAND_KERNEL_ADDR,
(uint32_t) sizeof(linux_zimage_header_t));
hdr = (linux_zimage_header_t *) image->dest;
if (hdr->magic != LINUX_ZIMAGE_MAGIC) {
printk(LOG_LEVEL_DEBUG,
"SPI-NAND: zImage verification failed\n");
printk_debug("SPI-NAND: zImage verification failed\n");
return -1;
}
size = hdr->end - hdr->start;
printk(LOG_LEVEL_DEBUG,
"SPI-NAND: Image: Copy from 0x%08x to 0x%08lx size:0x%08x\n",
CONFIG_SPINAND_KERNEL_ADDR, (uint32_t) image->dest, size);
printk_debug("SPI-NAND: Image: Copy from 0x%08x to 0x%08lx size:0x%08x\n",
CONFIG_SPINAND_KERNEL_ADDR, (uint32_t) image->dest, size);
start = time_us();
spi_nand_read(spi, image->dest, CONFIG_SPINAND_KERNEL_ADDR,
(uint32_t) size);
time = time_us() - start;
printk(LOG_LEVEL_INFO,
"SPI-NAND: read Image of size %u at %.2fMB/S\n", size,
(f32) (size / time));
printk_info("SPI-NAND: read Image of size %u at %.2fMB/S\n", size,
(f32) (size / time));

return 0;
}
Expand Down
12 changes: 5 additions & 7 deletions board/dongshanpi-aict/syter_bootargs/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ static int fatfs_loadimage(char *filename, BYTE *dest) {

fret = f_open(&file, filename, FA_OPEN_EXISTING | FA_READ);
if (fret != FR_OK) {
printk(LOG_LEVEL_ERROR,
"FATFS: open, filename: [%s]: error %d\n", filename,
fret);
printk_error("FATFS: open, filename: [%s]: error %d\n", filename, fret);
ret = -1;
goto open_fail;
}
Expand Down Expand Up @@ -175,14 +173,14 @@ int load_spi_nand(sunxi_spi_t *spi, image_info_t *image) {
}

size = fdt_totalsize(image->of_dest);
printk(LOG_LEVEL_DEBUG,
printk_debug(
"SPI-NAND: dt blob: Copy from 0x%08x to 0x%08lx size:0x%08x\n",
CONFIG_SPINAND_DTB_ADDR, (uint32_t) image->of_dest, size);
start = time_us();
spi_nand_read(spi, image->of_dest, CONFIG_SPINAND_DTB_ADDR,
(uint32_t) size);
time = time_us() - start;
printk(LOG_LEVEL_INFO,
printk_info(
"SPI-NAND: read dt blob of size %u at %.2fMB/S\n", size,
(f32) (size / time));

Expand All @@ -195,14 +193,14 @@ int load_spi_nand(sunxi_spi_t *spi, image_info_t *image) {
return -1;
}
size = hdr->end - hdr->start;
printk(LOG_LEVEL_DEBUG,
printk_debug(
"SPI-NAND: Image: Copy from 0x%08x to 0x%08lx size:0x%08x\n",
CONFIG_SPINAND_KERNEL_ADDR, (uint32_t) image->dest, size);
start = time_us();
spi_nand_read(spi, image->dest, CONFIG_SPINAND_KERNEL_ADDR,
(uint32_t) size);
time = time_us() - start;
printk(LOG_LEVEL_INFO,
printk_info(
"SPI-NAND: read Image of size %u at %.2fMB/S\n", size,
(f32) (size / time));

Expand Down
4 changes: 1 addition & 3 deletions board/longanpi-3h/load_bl31/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ static int fatfs_loadimage(char *filename, BYTE *dest) {

fret = f_open(&file, filename, FA_OPEN_EXISTING | FA_READ);
if (fret != FR_OK) {
printk(LOG_LEVEL_ERROR,
"FATFS: open, filename: [%s]: error %d\n", filename,
fret);
printk_error("FATFS: open, filename: [%s]: error %d\n", filename, fret);
ret = -1;
goto open_fail;
}
Expand Down
4 changes: 1 addition & 3 deletions board/project-yosemite/load_e907/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ static int fatfs_loadimage(char *filename, BYTE *dest) {

fret = f_open(&file, filename, FA_OPEN_EXISTING | FA_READ);
if (fret != FR_OK) {
printk(LOG_LEVEL_ERROR,
"FATFS: open, filename: [%s]: error %d\n", filename,
fret);
printk_error("FATFS: open, filename: [%s]: error %d\n", filename, fret);
ret = -1;
goto open_fail;
}
Expand Down
10 changes: 5 additions & 5 deletions board/project-yosemite/syter_boot_spi/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ int load_spi_nand(sunxi_spi_t *spi, image_info_t *image) {
}

size = fdt_totalsize(image->of_dest);
printk(LOG_LEVEL_DEBUG,
printk_debug(
"SPI-NAND: dt blob: Copy from 0x%08x to 0x%08lx size:0x%08x\n",
CONFIG_SPINAND_DTB_ADDR, (uint32_t) image->of_dest, size);
start = time_us();
spi_nand_read(spi, image->of_dest, CONFIG_SPINAND_DTB_ADDR,
(uint32_t) size);
time = time_us() - start;
printk(LOG_LEVEL_INFO,
printk_info(
"SPI-NAND: read dt blob of size %u at %.2fMB/S\n", size,
(f32) (size / time));

Expand All @@ -97,19 +97,19 @@ int load_spi_nand(sunxi_spi_t *spi, image_info_t *image) {
(uint32_t) sizeof(linux_zimage_header_t));
hdr = (linux_zimage_header_t *) image->dest;
if (hdr->magic != LINUX_ZIMAGE_MAGIC) {
printk(LOG_LEVEL_DEBUG,
printk_debug(
"SPI-NAND: zImage verification failed\n");
return -1;
}
size = hdr->end - hdr->start;
printk(LOG_LEVEL_DEBUG,
printk_debug(
"SPI-NAND: Image: Copy from 0x%08x to 0x%08lx size:0x%08x\n",
CONFIG_SPINAND_KERNEL_ADDR, (uint32_t) image->dest, size);
start = time_us();
spi_nand_read(spi, image->dest, CONFIG_SPINAND_KERNEL_ADDR,
(uint32_t) size);
time = time_us() - start;
printk(LOG_LEVEL_INFO,
printk_info(
"SPI-NAND: read Image of size %u at %.2fMB/S\n", size,
(f32) (size / time));

Expand Down
12 changes: 5 additions & 7 deletions board/project-yosemite/syter_bootargs/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ static int fatfs_loadimage(char *filename, BYTE *dest) {

fret = f_open(&file, filename, FA_OPEN_EXISTING | FA_READ);
if (fret != FR_OK) {
printk(LOG_LEVEL_ERROR,
"FATFS: open, filename: [%s]: error %d\n", filename,
fret);
printk_error("FATFS: open, filename: [%s]: error %d\n", filename, fret);
ret = -1;
goto open_fail;
}
Expand Down Expand Up @@ -175,14 +173,14 @@ int load_spi_nand(sunxi_spi_t *spi, image_info_t *image) {
}

size = fdt_totalsize(image->of_dest);
printk(LOG_LEVEL_DEBUG,
printk_debug(
"SPI-NAND: dt blob: Copy from 0x%08x to 0x%08lx size:0x%08x\n",
CONFIG_SPINAND_DTB_ADDR, (uint32_t) image->of_dest, size);
start = time_us();
spi_nand_read(spi, image->of_dest, CONFIG_SPINAND_DTB_ADDR,
(uint32_t) size);
time = time_us() - start;
printk(LOG_LEVEL_INFO,
printk_info(
"SPI-NAND: read dt blob of size %u at %.2fMB/S\n", size,
(f32) (size / time));

Expand All @@ -195,14 +193,14 @@ int load_spi_nand(sunxi_spi_t *spi, image_info_t *image) {
return -1;
}
size = hdr->end - hdr->start;
printk(LOG_LEVEL_DEBUG,
printk_debug(
"SPI-NAND: Image: Copy from 0x%08x to 0x%08lx size:0x%08x\n",
CONFIG_SPINAND_KERNEL_ADDR, (uint32_t) image->dest, size);
start = time_us();
spi_nand_read(spi, image->dest, CONFIG_SPINAND_KERNEL_ADDR,
(uint32_t) size);
time = time_us() - start;
printk(LOG_LEVEL_INFO,
printk_info(
"SPI-NAND: read Image of size %u at %.2fMB/S\n", size,
(f32) (size / time));

Expand Down
4 changes: 1 addition & 3 deletions board/tinyvision/load_e907/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ static int fatfs_loadimage(char *filename, BYTE *dest) {

fret = f_open(&file, filename, FA_OPEN_EXISTING | FA_READ);
if (fret != FR_OK) {
printk(LOG_LEVEL_ERROR,
"FATFS: open, filename: [%s]: error %d\n", filename,
fret);
printk_error("FATFS: open, filename: [%s]: error %d\n", filename, fret);
ret = -1;
goto open_fail;
}
Expand Down
16 changes: 7 additions & 9 deletions board/tinyvision/syter_boot_spi/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ static int fatfs_loadimage(char *filename, BYTE *dest) {

fret = f_open(&file, filename, FA_OPEN_EXISTING | FA_READ);
if (fret != FR_OK) {
printk(LOG_LEVEL_ERROR,
"FATFS: open, filename: [%s]: error %d\n", filename,
fret);
printk_error("FATFS: open, filename: [%s]: error %d\n", filename, fret);
ret = -1;
goto open_fail;
}
Expand Down Expand Up @@ -173,14 +171,14 @@ int load_spi_nand(sunxi_spi_t *spi, image_info_t *image) {
}

size = fdt_totalsize(image->of_dest);
printk(LOG_LEVEL_DEBUG,
printk_debug(
"SPI-NAND: dt blob: Copy from 0x%08x to 0x%08lx size:0x%08x\n",
CONFIG_SPINAND_DTB_ADDR, (uint32_t) image->of_dest, size);
start = time_us();
spi_nand_read(spi, image->of_dest, CONFIG_SPINAND_DTB_ADDR,
(uint32_t) size);
time = time_us() - start;
printk(LOG_LEVEL_INFO,
printk_info(
"SPI-NAND: read dt blob of size %u at %.2fMB/S\n", size,
(f32) (size / time));

Expand All @@ -189,19 +187,19 @@ int load_spi_nand(sunxi_spi_t *spi, image_info_t *image) {
(uint32_t) sizeof(linux_zimage_header_t));
hdr = (linux_zimage_header_t *) image->dest;
if (hdr->magic != LINUX_ZIMAGE_MAGIC) {
printk(LOG_LEVEL_DEBUG,
printk_debug(
"SPI-NAND: zImage verification failed\n");
return -1;
}
size = hdr->end - hdr->start;
printk(LOG_LEVEL_DEBUG,
printk_debug(
"SPI-NAND: Image: Copy from 0x%08x to 0x%08lx size:0x%08x\n",
CONFIG_SPINAND_KERNEL_ADDR, (uint32_t) image->dest, size);
start = time_us();
spi_nand_read(spi, image->dest, CONFIG_SPINAND_KERNEL_ADDR,
(uint32_t) size);
time = time_us() - start;
printk(LOG_LEVEL_INFO,
printk_info(
"SPI-NAND: read Image of size %u at %.2fMB/S\n", size,
(f32) (size / time));

Expand Down Expand Up @@ -236,7 +234,7 @@ int main(void) {
printk_error("SMHC: %s controller init failed\n",
sdhci0.name);
} else {
printk(LOG_LEVEL_INFO,
printk_info(
"SMHC: %s controller v%x initialized\n", sdhci0.name,
sdhci0.reg->vers);
}
Expand Down
Loading

0 comments on commit 72b9424

Please sign in to comment.