diff --git a/ZDistA_komp.dll b/ZDistA_komp.dll deleted file mode 100644 index c297bcc..0000000 Binary files a/ZDistA_komp.dll and /dev/null differ diff --git a/ZDistA_komp.exp b/ZDistA_komp.exp index d4ab821..c5a5402 100644 Binary files a/ZDistA_komp.exp and b/ZDistA_komp.exp differ diff --git a/compile_dll.bat b/compile_dll.bat index 991a688..cafe42a 100644 --- a/compile_dll.bat +++ b/compile_dll.bat @@ -28,10 +28,19 @@ if errorlevel 1 ( exit /b 1 ) +REM Kompilacja wrappera +clang %CFLAGS% %INCLUDES% ^ + -c helper_impl.c -o helper_impl.o 2>&1 + +if errorlevel 1 ( + echo Blad kompilacji helper_impl.c + exit /b 1 +) + REM Linkowanie do DLL z eksportami clang -target x86_64-pc-windows-msvc -shared ^ -o ZDistA_komp.dll ^ - ZDistA_komp.o ZDistA_wrapper.o ^ + ZDistA_komp.o ZDistA_wrapper.o helper_impl.o ^ -lkernel32 2>&1 if errorlevel 1 ( diff --git a/helper_impl.c b/helper_impl.c index aae16a8..12ca132 100644 --- a/helper_impl.c +++ b/helper_impl.c @@ -41,3 +41,36 @@ int set_bit_ptr_struct(u32 io, struct binary_io *b) { } return 1; } + +int set_float_ptr(u32 io,void *float_ptr) +{ + float *fptr; + + // fptr = (float *)(log_manager.nets_data + (io >> 3)); + // if((u8 *)fptr > (log_manager.nets_data + sizeof(log_manager.nets_data) - sizeof(float))) + // return -1; + + *(u32 *)float_ptr=(u32)fptr; + + return 0; +} + +int set_pointer_in_ptr(u32 io, u32 *pointer_ptr) +{ + u32 *f_ptr; + + f_ptr = (u32 *)(log_manager.nets_data + (io >> 3)); + if((u8 *)f_ptr > (log_manager.nets_data+sizeof(log_manager.nets_data) - sizeof(void *))) + return -1; + + if((u32)f_ptr == (u32)&log_manager.nets_data[0]) // if pointer connected to net '0' + *(u32 *)pointer_ptr=(u32)f_ptr; + else + *(u32 *)pointer_ptr=(u32)*f_ptr; + + if(!*f_ptr) + return -1; + + return 0; +} + diff --git a/src/misc.h b/src/misc.h index c28b226..0be6eb4 100644 --- a/src/misc.h +++ b/src/misc.h @@ -153,7 +153,7 @@ extern struct klapacz_config klap_cfg; #define MDSTAT4 *((volatile int*)0x01C10810) #define MDSTAT10 *((volatile int*)0x01E27828) -extern Semaphore_Handle spi_semaphore; +//extern Semaphore_Handle spi_semaphore; extern volatile int was_irq; extern u16 bus_an_cur_timestamp; @@ -334,7 +334,7 @@ extern u16 bus_out_data_test[MAX_OUT_CARDS]; extern u8 bus_bin_data_ench[MAX_BIN_CARDS]; extern u8 force_bus_bin_data_ench[MAX_BIN_CARDS]; -extern Swi_Handle swi_notify; +//extern Swi_Handle swi_notify; #define PWM1_SET(x,y) *((volatile uint16_t*)x) = y #define PWM1_GET(x) *((volatile uint16_t*)x)