Skip to content

Commit

Permalink
[board] fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
SamulKyull authored and SamulKyull committed Dec 13, 2024
1 parent 267f402 commit 2377326
Show file tree
Hide file tree
Showing 11 changed files with 100 additions and 103 deletions.
6 changes: 3 additions & 3 deletions include/ctype.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#define __CTYPE_H__

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
extern "C" {
#endif// __cplusplus

/**
* Check if the given character is alphanumeric.
Expand Down Expand Up @@ -137,6 +137,6 @@ int toupper(int c);

#ifdef __cplusplus
}
#endif // __cplusplus
#endif// __cplusplus

#endif /* __CTYPE_H__ */
6 changes: 3 additions & 3 deletions include/smalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include <types.h>

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
extern "C" {
#endif// __cplusplus

struct alloc_struct_t {
phys_addr_t address;
Expand Down Expand Up @@ -54,6 +54,6 @@ void sfree(void *p);

#ifdef __cplusplus
}
#endif // __cplusplus
#endif// __cplusplus

#endif// __SMALLOC_H__
6 changes: 3 additions & 3 deletions include/sstdlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <types.h>

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
extern "C" {
#endif// __cplusplus

/**
* Convert a string to an unsigned long integer, with optional base detection.
Expand Down Expand Up @@ -159,6 +159,6 @@ int simple_abs(int n);

#ifdef __cplusplus
}
#endif // __cplusplus
#endif// __cplusplus

#endif// __STDLIB_H__
2 changes: 1 addition & 1 deletion include/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ int snprintf(char *buf, size_t n, const char *fmt, ...);
*/
int vsnprintf(char *buf, size_t n, const char *fmt, va_list ap);

#endif // CONFIG_SPRINTF
#endif// CONFIG_SPRINTF

#ifdef __cplusplus
}
Expand Down
6 changes: 3 additions & 3 deletions include/uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#define __CLI_UART_H__

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
extern "C" {
#endif// __cplusplus

/**
* Writes a single character 'c' to the UART output.
Expand Down Expand Up @@ -62,6 +62,6 @@ extern int puts(const char *s);

#ifdef __cplusplus
}
#endif // __cplusplus
#endif// __cplusplus

#endif//__CLI_UART_H__
6 changes: 3 additions & 3 deletions include/xformat.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#include <string.h>

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
extern "C" {
#endif// __cplusplus

/**
* Define internal parameters as volatile for 8 bit cpu define
Expand Down Expand Up @@ -68,6 +68,6 @@ unsigned xformat(void (*outchar)(void *arg, char), void *arg, const char *fmt, .

#ifdef __cplusplus
}
#endif // __cplusplus
#endif// __cplusplus

#endif
8 changes: 4 additions & 4 deletions src/smalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <types.h>
#include <string.h>
#include <types.h>

#include "smalloc.h"

Expand Down Expand Up @@ -111,16 +111,16 @@ void sfree(void *p) {
ptr = &boot_heap_head;
while (ptr && ptr->next) {
if (ptr->next->address == (phys_addr_t) p)
break;
break;
ptr = ptr->next;
}

prev = ptr;
ptr = ptr->next;

if (!ptr) return;
if (!ptr) return;

prev->next = ptr->next;
prev->next = ptr->next;

return;
}
9 changes: 4 additions & 5 deletions src/sstdlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,11 @@ long long simple_atoll(const char *nptr) {
return (long long) simple_strtoll(nptr, NULL, 10);
}

long simple_strtol(const char *cp, char **endp, unsigned int base)
{
if (*cp == '-')
return -simple_strtoul(cp + 1, endp, base);
long simple_strtol(const char *cp, char **endp, unsigned int base) {
if (*cp == '-')
return -simple_strtoul(cp + 1, endp, base);

return simple_strtoul(cp, endp, base);
return simple_strtoul(cp, endp, base);
}

unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base) {
Expand Down
2 changes: 1 addition & 1 deletion src/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -981,4 +981,4 @@ int vsnprintf(char *buf, size_t n, const char *fmt, va_list ap) {
return o;
}

#endif // CONFIG_SPRINTF
#endif// CONFIG_SPRINTF
2 changes: 1 addition & 1 deletion tools/bin2array.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ int main(int argc, char *argv[]) {
FILE *inputFile, *outputFile;
char *inputFileName = argv[1]; // Name of the input binary file
char *outputFileName = argv[2];// Name of the output C array file
char *funcName = argv[3];// Name of the output C array
char *funcName = argv[3]; // Name of the output C array
int fileSize;

// Open the input binary file
Expand Down
150 changes: 74 additions & 76 deletions tools/sys-dram.asm.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,82 +4,80 @@
void mctl_phy_ca_bit_delay_compensation(__dram_para_t *para)

{
uint uVar1;
uint chip_id;
uint type;
uint reg_val;
uint i;

if ((para->dram_tpr10 & 0x10000) != 0) {
if ((REG32(0x03006200) & 0xffff) == 0x800) {
switch(para->dram_type) {
case 3:
uVar1 = para->dram_tpr10;
for (i = 0; i < 0x20; i = i + 1) {
*(uint *)((i + 0x120c1e0) * 4) = (uVar1 >> 4 & 0xf) << 1;
}
REG32(0x048307dc) = (para->dram_tpr10 & 0xf) << 1;
REG32(0x048307e4) = (para->dram_tpr10 >> 8 & 0xf) << 1;
REG32(0x048307e0) = REG32(0x048307dc);
if ((para->dram_para2 & 0x1000) != 0) {
REG32(0x04832388) = (para->dram_tpr10 >> 0xc & 0xf) << 1;
}
break;
case 4:
case 7:
break;
case 8:
uVar1 = para->dram_tpr10;
for (i = 0; i < 0x20; i = i + 1) {
*(uint *)((i + 0x120c1e0) * 4) = (uVar1 >> 4 & 0xf) << 1;
}
REG32(0x048307dc) = (para->dram_tpr10 & 0xf) << 1;
REG32(0x048307e4) = (para->dram_tpr10 >> 8 & 0xf) << 1;
REG32(0x048307e0) = REG32(0x048307dc);
if ((para->dram_para2 & 0x1000) != 0) {
REG32(0x04830790) = (para->dram_tpr10 >> 0xc & 0xf) << 1;
}
}
}
else {
switch(para->dram_type) {
case 3:
uVar1 = para->dram_tpr10;
for (i = 0; i < 0x20; i = i + 1) {
*(uint *)((i + 0x120c1e0) * 4) = (uVar1 >> 4 & 0xf) << 1;
}
REG32(0x048307dc) = (para->dram_tpr10 & 0xf) << 1;
REG32(0x048307b8) = (para->dram_tpr10 >> 8 & 0xf) << 1;
REG32(0x048307e0) = REG32(0x048307dc);
if ((para->dram_para2 & 0x1000) != 0) {
REG32(0x04830784) = (para->dram_tpr10 >> 0xc & 0xf) << 1;
}
break;
case 4:
uVar1 = para->dram_tpr10;
for (i = 0; i < 0x20; i = i + 1) {
*(uint *)((i + 0x120c1e0) * 4) = (uVar1 >> 4 & 0xf) << 1;
}
REG32(0x048307dc) = (para->dram_tpr10 & 0xf) << 1;
REG32(0x04830784) = (para->dram_tpr10 >> 8 & 0xf) << 1;
REG32(0x048307e0) = REG32(0x048307dc);
break;
case 7:
uVar1 = para->dram_tpr10;
for (i = 0; i < 0x20; i = i + 1) {
*(uint *)((i + 0x120c1e0) * 4) = (uVar1 >> 4 & 0xf) << 1;
}
REG32(0x048307dc) = (para->dram_tpr10 & 0xf) << 1;
REG32(0x04830788) = (para->dram_tpr10 >> 8 & 0xf) << 1;
REG32(0x048307e0) = REG32(0x048307dc);
if ((para->dram_para2 & 0x1000) != 0) {
REG32(0x04830790) = (para->dram_tpr10 >> 0xc & 0xf) << 1;
uint uVar1;
uint chip_id;
uint type;
uint reg_val;
uint i;

if ((para->dram_tpr10 & 0x10000) != 0) {
if ((REG32(0x03006200) & 0xffff) == 0x800) {
switch (para->dram_type) {
case 3:
uVar1 = para->dram_tpr10;
for (i = 0; i < 0x20; i = i + 1) {
*(uint *) ((i + 0x120c1e0) * 4) = (uVar1 >> 4 & 0xf) << 1;
}
REG32(0x048307dc) = (para->dram_tpr10 & 0xf) << 1;
REG32(0x048307e4) = (para->dram_tpr10 >> 8 & 0xf) << 1;
REG32(0x048307e0) = REG32(0x048307dc);
if ((para->dram_para2 & 0x1000) != 0) {
REG32(0x04832388) = (para->dram_tpr10 >> 0xc & 0xf) << 1;
}
break;
case 4:
case 7:
break;
case 8:
uVar1 = para->dram_tpr10;
for (i = 0; i < 0x20; i = i + 1) {
*(uint *) ((i + 0x120c1e0) * 4) = (uVar1 >> 4 & 0xf) << 1;
}
REG32(0x048307dc) = (para->dram_tpr10 & 0xf) << 1;
REG32(0x048307e4) = (para->dram_tpr10 >> 8 & 0xf) << 1;
REG32(0x048307e0) = REG32(0x048307dc);
if ((para->dram_para2 & 0x1000) != 0) {
REG32(0x04830790) = (para->dram_tpr10 >> 0xc & 0xf) << 1;
}
}
} else {
switch (para->dram_type) {
case 3:
uVar1 = para->dram_tpr10;
for (i = 0; i < 0x20; i = i + 1) {
*(uint *) ((i + 0x120c1e0) * 4) = (uVar1 >> 4 & 0xf) << 1;
}
REG32(0x048307dc) = (para->dram_tpr10 & 0xf) << 1;
REG32(0x048307b8) = (para->dram_tpr10 >> 8 & 0xf) << 1;
REG32(0x048307e0) = REG32(0x048307dc);
if ((para->dram_para2 & 0x1000) != 0) {
REG32(0x04830784) = (para->dram_tpr10 >> 0xc & 0xf) << 1;
}
break;
case 4:
uVar1 = para->dram_tpr10;
for (i = 0; i < 0x20; i = i + 1) {
*(uint *) ((i + 0x120c1e0) * 4) = (uVar1 >> 4 & 0xf) << 1;
}
REG32(0x048307dc) = (para->dram_tpr10 & 0xf) << 1;
REG32(0x04830784) = (para->dram_tpr10 >> 8 & 0xf) << 1;
REG32(0x048307e0) = REG32(0x048307dc);
break;
case 7:
uVar1 = para->dram_tpr10;
for (i = 0; i < 0x20; i = i + 1) {
*(uint *) ((i + 0x120c1e0) * 4) = (uVar1 >> 4 & 0xf) << 1;
}
REG32(0x048307dc) = (para->dram_tpr10 & 0xf) << 1;
REG32(0x04830788) = (para->dram_tpr10 >> 8 & 0xf) << 1;
REG32(0x048307e0) = REG32(0x048307dc);
if ((para->dram_para2 & 0x1000) != 0) {
REG32(0x04830790) = (para->dram_tpr10 >> 0xc & 0xf) << 1;
}
break;
case 8:
}
}
break;
case 8:
}
}
}
return;
return;
}

0 comments on commit 2377326

Please sign in to comment.