Skip to content

Commit

Permalink
test: pointer type conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
laqieer committed Dec 24, 2024
1 parent aab5af7 commit 5f567c9
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
6 changes: 3 additions & 3 deletions test/detect-save-type/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ int main(void) {
tte_init_con();

// Test SRAM
err = sram_write(0, "S", 1);
err = sram_write(0, (u8 *)"S", 1);
if (!err) {
tte_printf("Save Type: SRAM\n");
sram_write(0x8000, "R", 1);
char a = '\0';
sram_write(0x8000, (u8 *)"R", 1);
u8 a = '\0';
sram_read(0, &a, 1);
switch (a) {
case 'R':
Expand Down
10 changes: 5 additions & 5 deletions test/eeprom-512B/eeprom-512B.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ int main(void) {
u16 buffer[BUFFER_SIZE];

REG_DISPCNT = DCNT_MODE0 | DCNT_BG0;

tte_init_chr4c_default(0, BG_CBB(0) | BG_SBB(31));

tte_init_con();
Expand All @@ -23,13 +23,13 @@ int main(void) {
}

// Write Test
err = eeprom_write(0, "EEPROM_Vnnn\n");
err = eeprom_write(0, (u16 *)"EEPROM_Vnnn\n");
if (err) {
tte_printf("EEPROM(512B) Write Error: %s\n", SavErrMsgs[err]);
goto end;
}

err = eeprom_write(1, "nnn\n");
err = eeprom_write(1, (u16 *)"nnn\n");
if (err) {
tte_printf("EEPROM(512B) Write Error: %s\n", SavErrMsgs[err]);
goto end;
Expand All @@ -45,7 +45,7 @@ int main(void) {
if (err) {
tte_printf("EEPROM(512B) Read Error: %s\n", SavErrMsgs[err]);
}
tte_write(buffer);
tte_write((char *)buffer);

// Final Result
tte_write("EEPROM(512B) Test Passed!");
Expand All @@ -57,5 +57,5 @@ int main(void) {
while (1) {
VBlankIntrWait();
}

}
10 changes: 5 additions & 5 deletions test/eeprom-8KB/eeprom-8KB.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ int main(void) {
u16 buffer[BUFFER_SIZE];

REG_DISPCNT = DCNT_MODE0 | DCNT_BG0;

tte_init_chr4c_default(0, BG_CBB(0) | BG_SBB(31));

tte_init_con();
Expand All @@ -23,13 +23,13 @@ int main(void) {
}

// Write Test
err = eeprom_write(0, "EEPROM_Vnnn\n");
err = eeprom_write(0, (u16 *)"EEPROM_Vnnn\n");
if (err) {
tte_printf("EEPROM(8KB) Write Error: %s\n", SavErrMsgs[err]);
goto end;
}

err = eeprom_write(1, "nnn\n");
err = eeprom_write(1, (u16 *)"nnn\n");
if (err) {
tte_printf("EEPROM(8KB) Write Error: %s\n", SavErrMsgs[err]);
goto end;
Expand All @@ -45,7 +45,7 @@ int main(void) {
if (err) {
tte_printf("EEPROM(8KB) Read Error: %s\n", SavErrMsgs[err]);
}
tte_write(buffer);
tte_write((char *)buffer);

// Final Result
tte_write("EEPROM(8KB) Test Passed!");
Expand All @@ -57,5 +57,5 @@ int main(void) {
while (1) {
VBlankIntrWait();
}

}
10 changes: 5 additions & 5 deletions test/flash-128KB/flash-128KB.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ int main(void) {
u8 buffer[BUFFER_SIZE];

REG_DISPCNT = DCNT_MODE0 | DCNT_BG0;

tte_init_chr4c_default(0, BG_CBB(0) | BG_SBB(31));

tte_init_con();
Expand All @@ -25,13 +25,13 @@ int main(void) {
}

// Write Test
err = flash_write(64 * 1024, "FLASH1M_Vnnn\n", BUFFER_SIZE);
err = flash_write(64 * 1024, (u8 *)"FLASH1M_Vnnn\n", BUFFER_SIZE);
if (err) {
tte_printf("Flash(128KB) Write Error: %s\n", SavErrMsgs[err]);
goto end;
}

err = flash_write(0, "Error: 0x0E010000 is mirrored to 0x0E000000\n", BUFFER_SIZE);
err = flash_write(0, (u8 *)"Error: 0x0E010000 is mirrored to 0x0E000000\n", BUFFER_SIZE);
if (err) {
tte_printf("Flash(128KB) Write Error: %s\n", SavErrMsgs[err]);
goto end;
Expand All @@ -42,7 +42,7 @@ int main(void) {
if (err) {
tte_printf("Flash(128KB) Read Error: %s\n", SavErrMsgs[err]);
}
tte_write(buffer);
tte_write((char *)buffer);

// Final Result
if (memcmp(buffer, "FLASH1M_Vnnn\n", 12) == 0)
Expand All @@ -55,5 +55,5 @@ int main(void) {
while (1) {
VBlankIntrWait();
}

}
8 changes: 4 additions & 4 deletions test/flash-64KB/flash-64KB.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ int main(void) {
u8 buffer[BUFFER_SIZE];

REG_DISPCNT = DCNT_MODE0 | DCNT_BG0;

tte_init_chr4c_default(0, BG_CBB(0) | BG_SBB(31));

tte_init_con();
Expand All @@ -23,7 +23,7 @@ int main(void) {
}

// Write Test
err = flash_write(0, "FLASH512_Vnnn\n", BUFFER_SIZE);
err = flash_write(0, (u8 *)"FLASH512_Vnnn\n", BUFFER_SIZE);
if (err) {
tte_printf("Flash(64KB) Write Error: %s\n", SavErrMsgs[err]);
goto end;
Expand All @@ -34,7 +34,7 @@ int main(void) {
if (err) {
tte_printf("Flash(64KB) Read Error: %s\n", SavErrMsgs[err]);
}
tte_write(buffer);
tte_write((char *)buffer);

// Final Result
tte_write("Flash(64KB) Test Passed!");
Expand All @@ -46,5 +46,5 @@ int main(void) {
while (1) {
VBlankIntrWait();
}

}
8 changes: 4 additions & 4 deletions test/sram/sram.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ int main(void) {
u8 buffer[BUFFER_SIZE];

REG_DISPCNT = DCNT_MODE0 | DCNT_BG0;

tte_init_chr4c_default(0, BG_CBB(0) | BG_SBB(31));

tte_init_con();

// Write Test
err = sram_write(0, "SRAM_Vnnn\n", BUFFER_SIZE);
err = sram_write(0, (u8 *)"SRAM_Vnnn\n", BUFFER_SIZE);
if (err) {
tte_printf("SRAM Write Error: %s\n", SavErrMsgs[err]);
goto end;
Expand All @@ -27,7 +27,7 @@ int main(void) {
if (err) {
tte_printf("SRAM Read Error: %s\n", SavErrMsgs[err]);
}
tte_write(buffer);
tte_write((char *)buffer);

// Final Result
tte_write("SRAM Test Passed!");
Expand All @@ -39,5 +39,5 @@ int main(void) {
while (1) {
VBlankIntrWait();
}

}

0 comments on commit 5f567c9

Please sign in to comment.