Initial commit

This commit is contained in:
Sylvain PILLOT 2022-12-10 16:01:22 +01:00
commit 37879ae8ec
12 changed files with 238 additions and 0 deletions

13
.gitignore vendored Normal file
View File

@ -0,0 +1,13 @@
# Build files
/build-fx
/build-cg
/*.g1a
/*.g3a
# Python bytecode
__pycache__/
# Common IDE files
*.sublime-project
*.sublime-workspace
.vscode

41
CMakeLists.txt Normal file
View File

@ -0,0 +1,41 @@
# Configure with [fxsdk build-fx] or [fxsdk build-cg], which provide the
# toolchain file and module path of the fxSDK
cmake_minimum_required(VERSION 3.15)
project(MyAddin)
include(GenerateG1A)
include(GenerateG3A)
include(Fxconv)
find_package(Gint 2.1 REQUIRED)
set(SOURCES
src/main.c
# ...
)
# Shared assets, fx-9860G-only assets and fx-CG-50-only assets
set(ASSETS
# ...
)
set(ASSETS_fx
assets-fx/example.png
# ...
)
set(ASSETS_cg
assets-cg/example.png
# ...
)
fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} WITH_METADATA)
add_executable(myaddin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}})
target_compile_options(myaddin PRIVATE -Wall -Wextra -Os)
target_link_libraries(myaddin Gint::Gint)
if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G)
generate_g1a(TARGET myaddin OUTPUT "OCTst_Mo.g1a"
NAME "MyAddin" ICON assets-fx/icon.png)
elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
generate_g3a(TARGET myaddin OUTPUT "OCTst_Co.g3a"
NAME "MyAddin" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)
endif()

BIN
assets-cg/example.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -0,0 +1,3 @@
example.png:
type: bopti-image
name: img_example

BIN
assets-cg/icon-sel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

BIN
assets-cg/icon-uns.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
assets-fx/example.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -0,0 +1,3 @@
example.png:
type: bopti-image
name: img_example

BIN
assets-fx/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

6
build Executable file
View File

@ -0,0 +1,6 @@
rm -r build-cg
rm -r build-fx
rm *.g3a
rm *.g1a
fxsdk build-cg VERBOSE=1
fxsdk build-fx VERBOSE=1

1
send Executable file
View File

@ -0,0 +1 @@
fxlink -sw -u *.g3a

171
src/main.c Normal file
View File

@ -0,0 +1,171 @@
#include <gint/display.h>
#include <gint/keyboard.h>
#include <gint/clock.h>
const clock_frequency_t *Myfreq;
int main(void)
{
dclear(C_WHITE);
dtext(1, 1, C_BLACK, "Sample OC for SH3/SH4 test add-in.");
dupdate();
getkey();
Myfreq = clock_freq();
dclear(C_WHITE);
dtext(1, 1, C_BLACK, "STEP 1 :");
dprint(1, 10, C_BLACK, "Init. OC Param = F%d.", clock_get_speed() );
dprint(1, 20, C_BLACK, "CPU Fq= %dMHz", Myfreq->Pphi_f );
dprint(1, 30, C_BLACK, "Pphi div = %d", Myfreq->Pphi_div );
dtext(1, 40,C_BLACK, "Swch to F1 and wt5s" );
dtext(1, 50, C_BLACK, "[press a key to start]");
dupdate();
getkey();
clock_set_speed( CLOCK_SPEED_F1 );
sleep_ms( 5000 );
dclear(C_WHITE);
dtext(1, 1, C_BLACK, "STEP 2 :");
dprint(1, 10, C_BLACK, "Curr. OC Param = F%d.", clock_get_speed() );
dprint(1, 20, C_BLACK, "CPU Fq= %dMHz", Myfreq->Pphi_f );
dprint(1, 30, C_BLACK, "Pphi div = %d", Myfreq->Pphi_div );
dtext(1, 40,C_BLACK, "Swch to F2 and wt5s" );
dtext(1, 50, C_BLACK, "[press a key to start]");
dupdate();
getkey();
clock_set_speed( CLOCK_SPEED_F2 );
sleep_ms( 5000 );
dclear(C_WHITE);
dtext(1, 1, C_BLACK, "STEP 3 :");
dprint(1, 10, C_BLACK, "Curr. OC Param = F%d.", clock_get_speed() );
dprint(1, 20, C_BLACK, "CPU Fq= %dMHz", Myfreq->Pphi_f );
dprint(1, 30, C_BLACK, "Pphi div = %d", Myfreq->Pphi_div );
dtext(1, 40,C_BLACK, "Swch to F3 and wt5s" );
dtext(1, 50, C_BLACK, "[press a key to start]");
dupdate();
getkey();
clock_set_speed( CLOCK_SPEED_F3 );
sleep_ms( 5000 );
dclear(C_WHITE);
dtext(1, 1, C_BLACK, "STEP 4 :");
dprint(1, 10, C_BLACK, "Curr. OC Param = F%d.", clock_get_speed() );
dprint(1, 20, C_BLACK, "CPU Fq= %dMHz", Myfreq->Pphi_f );
dprint(1, 30, C_BLACK, "Pphi div = %d", Myfreq->Pphi_div );
dtext(1, 40,C_BLACK, "Swch to F4 and wt5s" );
dtext(1, 50, C_BLACK, "[press a key to start]");
dupdate();
getkey();
clock_set_speed( CLOCK_SPEED_F4 );
sleep_ms( 5000 );
dclear(C_WHITE);
dtext(1, 1, C_BLACK, "STEP 5 :");
dprint(1, 10, C_BLACK, "Curr. OC Param = F%d.", clock_get_speed() );
dprint(1, 20, C_BLACK, "CPU Fq= %dMHz", Myfreq->Pphi_f );
dprint(1, 30, C_BLACK, "Pphi div = %d", Myfreq->Pphi_div );
dtext(1, 40,C_BLACK, "Swch to F5 and wt5s" );
dtext(1, 50, C_BLACK, "[press a key to start]");
dupdate();
getkey();
clock_set_speed( CLOCK_SPEED_F5 );
sleep_ms( 5000 );
dclear(C_WHITE);
dtext(1, 1, C_BLACK, "STEP 6 :");
dprint(1, 10, C_BLACK, "Curr. OC Param = F%d.", clock_get_speed() );
dprint(1, 20, C_BLACK, "CPU Fq= %dMHz", Myfreq->Pphi_f );
dprint(1, 30, C_BLACK, "Pphi div = %d", Myfreq->Pphi_div );
dtext(1, 40,C_BLACK, "We are now at the END :D !!!" );
dtext(1, 50, C_BLACK, "[press a key to exit]"); dupdate();
getkey();
/*
clock_set_speed( CLOCK_SPEED_F1 );
//sleep_ms( 5000 );
dclear(C_WHITE);
dprint(1, 1, C_BLACK, "Curr. OC Param = F%d.", clock_get_speed() );
dprint(1, 11, C_BLACK, "CK= %dkHz PL1=%d", Myfreq->CKIO_f/1000, Myfreq->PLL1 );
dprint(1, 21, C_BLACK, "If= %dkHz Idv=%d", Myfreq->Iphi_f/1000, Myfreq->Iphi_div );
dprint(1, 31, C_BLACK, "Bf= %dkHz Bdv=%d", Myfreq->Bphi_f/1000, Myfreq->Bphi_div );
dprint(1, 41, C_BLACK, "Pf= %dkHz Pdv=%d", Myfreq->Pphi_f/1000, Myfreq->Pphi_div );
dtext(1, 55, C_BLACK, "[Next ...]");
dupdate();
getkey();
clock_set_speed( CLOCK_SPEED_F2 );
//sleep_ms( 5000 );
dclear(C_WHITE);
dprint(1, 1, C_BLACK, "Curr. OC Param = F%d.", clock_get_speed() );
dprint(1, 11, C_BLACK, "CK= %dkHz PL1=%d", Myfreq->CKIO_f/1000, Myfreq->PLL1 );
dprint(1, 21, C_BLACK, "If= %dkHz Idv=%d", Myfreq->Iphi_f/1000, Myfreq->Iphi_div );
dprint(1, 31, C_BLACK, "Bf= %dkHz Bdv=%d", Myfreq->Bphi_f/1000, Myfreq->Bphi_div );
dprint(1, 41, C_BLACK, "Pf= %dkHz Pdv=%d", Myfreq->Pphi_f/1000, Myfreq->Pphi_div );
dtext(1, 55, C_BLACK, "[Next ...]");
dupdate();
getkey();
clock_set_speed( CLOCK_SPEED_F3 );
//sleep_ms( 5000 );
dclear(C_WHITE);
dprint(1, 1, C_BLACK, "Curr. OC Param = F%d.", clock_get_speed() );
dprint(1, 11, C_BLACK, "CK= %dkHz PL1=%d", Myfreq->CKIO_f/1000, Myfreq->PLL1 );
dprint(1, 21, C_BLACK, "If= %dkHz Idv=%d", Myfreq->Iphi_f/1000, Myfreq->Iphi_div );
dprint(1, 31, C_BLACK, "Bf= %dkHz Bdv=%d", Myfreq->Bphi_f/1000, Myfreq->Bphi_div );
dprint(1, 41, C_BLACK, "Pf= %dkHz Pdv=%d", Myfreq->Pphi_f/1000, Myfreq->Pphi_div );
dtext(1, 55, C_BLACK, "[Next ...]");
dupdate();
getkey();
clock_set_speed( CLOCK_SPEED_F4 );
//sleep_ms( 5000 );
dclear(C_WHITE);
dprint(1, 1, C_BLACK, "Curr. OC Param = F%d.", clock_get_speed() );
dprint(1, 11, C_BLACK, "CK= %dkHz PL1=%d", Myfreq->CKIO_f/1000, Myfreq->PLL1 );
dprint(1, 21, C_BLACK, "If= %dkHz Idv=%d", Myfreq->Iphi_f/1000, Myfreq->Iphi_div );
dprint(1, 31, C_BLACK, "Bf= %dkHz Bdv=%d", Myfreq->Bphi_f/1000, Myfreq->Bphi_div );
dprint(1, 41, C_BLACK, "Pf= %dkHz Pdv=%d", Myfreq->Pphi_f/1000, Myfreq->Pphi_div );
dtext(1, 55, C_BLACK, "[Next ...]");
dupdate();
getkey();
clock_set_speed( CLOCK_SPEED_F5 );
//sleep_ms( 5000 );
dclear(C_WHITE);
dprint(1, 1, C_BLACK, "Curr. OC Param = F%d.", clock_get_speed() );
dprint(1, 11, C_BLACK, "CK= %dkHz PL1=%d", Myfreq->CKIO_f/1000, Myfreq->PLL1 );
dprint(1, 21, C_BLACK, "If= %dkHz Idv=%d", Myfreq->Iphi_f/1000, Myfreq->Iphi_div );
dprint(1, 31, C_BLACK, "Bf= %dkHz Bdv=%d", Myfreq->Bphi_f/1000, Myfreq->Bphi_div );
dprint(1, 41, C_BLACK, "Pf= %dkHz Pdv=%d", Myfreq->Pphi_f/1000, Myfreq->Pphi_div );
dtext(1, 55, C_BLACK, "[Finished ...]");
dupdate();
getkey();
*/
return 1;
}