update hal_template for test

This commit is contained in:
Matthew GONG
2020-03-20 13:11:30 +08:00
parent 992e917199
commit 8db101bd13
14 changed files with 14 additions and 10 deletions
Binary file not shown.
+6 -4
View File
@@ -26,7 +26,7 @@
* | See matlabroot/simulink/src/sfuntmpl_doc.c for a more detailed template | * | See matlabroot/simulink/src/sfuntmpl_doc.c for a more detailed template |
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
* Created: Fri Mar 20 10:17:18 2020 * Created: Fri Mar 20 12:57:38 2020
*/ */
#define S_FUNCTION_LEVEL 2 #define S_FUNCTION_LEVEL 2
@@ -55,7 +55,7 @@
#define NUM_OUTPUTS 2 #define NUM_OUTPUTS 2
/* Output Port 0 */ /* Output Port 0 */
#define OUT_PORT_0_NAME DI #define OUT_PORT_0_NAME DI
#define OUTPUT_0_WIDTH 1 #define OUTPUT_0_WIDTH DYNAMICALLY_SIZED
#define OUTPUT_DIMS_0_COL 1 #define OUTPUT_DIMS_0_COL 1
#define OUTPUT_0_DTYPE boolean_T #define OUTPUT_0_DTYPE boolean_T
#define OUTPUT_0_COMPLEX COMPLEX_NO #define OUTPUT_0_COMPLEX COMPLEX_NO
@@ -110,7 +110,8 @@
extern void hal_di_Start_wrapper(void); extern void hal_di_Start_wrapper(void);
extern void hal_di_Outputs_wrapper(const uint16_T *start_idx, extern void hal_di_Outputs_wrapper(const uint16_T *start_idx,
boolean_T *DI, boolean_T *DI,
int32_T *ErrorCode); int32_T *ErrorCode,
const int_T y_width);
/*====================* /*====================*
* S-function methods * * S-function methods *
*====================*/ *====================*/
@@ -221,8 +222,9 @@ static void mdlOutputs(SimStruct *S, int_T tid)
const uint16_T *start_idx = (uint16_T *) ssGetInputPortRealSignal(S, 0); const uint16_T *start_idx = (uint16_T *) ssGetInputPortRealSignal(S, 0);
boolean_T *DI = (boolean_T *) ssGetOutputPortRealSignal(S, 0); boolean_T *DI = (boolean_T *) ssGetOutputPortRealSignal(S, 0);
int32_T *ErrorCode = (int32_T *) ssGetOutputPortRealSignal(S, 1); int32_T *ErrorCode = (int32_T *) ssGetOutputPortRealSignal(S, 1);
const int_T y_width = ssGetOutputPortWidth(S, 0);
hal_di_Outputs_wrapper(start_idx, DI, ErrorCode); hal_di_Outputs_wrapper(start_idx, DI, ErrorCode, y_width);
} }
BIN
View File
Binary file not shown.
+5 -3
View File
@@ -1,5 +1,5 @@
%% File : hal_di.tlc %% File : hal_di.tlc
%% Created : Fri Mar 20 10:17:18 2020 %% Created : Fri Mar 20 12:57:38 2020
%% %%
%% Description: %% Description:
%% Simulink Coder wrapper functions interface generated for %% Simulink Coder wrapper functions interface generated for
@@ -32,7 +32,8 @@
extern void hal_di_Outputs_wrapper(const uint16_T *start_idx, extern void hal_di_Outputs_wrapper(const uint16_T *start_idx,
boolean_T *DI, boolean_T *DI,
int32_T *ErrorCode); int32_T *ErrorCode,
const int_T y_width);
extern void hal_di_Terminate_wrapper(void); extern void hal_di_Terminate_wrapper(void);
@@ -61,7 +62,8 @@
%assign pu0 = LibBlockInputSignalAddr(0, "", "", 0) %assign pu0 = LibBlockInputSignalAddr(0, "", "", 0)
%assign py0 = LibBlockOutputSignalAddr(0, "", "", 0) %assign py0 = LibBlockOutputSignalAddr(0, "", "", 0)
%assign py1 = LibBlockOutputSignalAddr(1, "", "", 0) %assign py1 = LibBlockOutputSignalAddr(1, "", "", 0)
hal_di_Outputs_wrapper(%<pu0>, %<py0>, %<py1>); %assign py_width = LibBlockOutputSignalWidth(0)
hal_di_Outputs_wrapper(%<pu0>, %<py0>, %<py1>, %<py_width>);
%% %%
%endfunction %endfunction
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
@@ -18,7 +18,6 @@
#endif #endif
/* %%%-SFUNWIZ_wrapper_includes_Changes_END --- EDIT HERE TO _BEGIN */ /* %%%-SFUNWIZ_wrapper_includes_Changes_END --- EDIT HERE TO _BEGIN */
#define u_width 1 #define u_width 1
#define y_width 1
/* /*
* Create external references here. * Create external references here.
@@ -58,7 +57,8 @@ discrete_input_init();
*/ */
void hal_di_Outputs_wrapper(const uint16_T *start_idx, void hal_di_Outputs_wrapper(const uint16_T *start_idx,
boolean_T *DI, boolean_T *DI,
int32_T *ErrorCode) int32_T *ErrorCode,
const int_T y_width)
{ {
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --- EDIT HERE TO _END */ /* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --- EDIT HERE TO _END */
#ifdef HAL_IMPL #ifdef HAL_IMPL
@@ -69,7 +69,7 @@ void hal_pwm_in_Outputs_wrapper(const uint16_T *start_idx,
* *
* ErrorCode - return zero on success, otherwise nonzero on failures. * ErrorCode - return zero on success, otherwise nonzero on failures.
*/ */
if (is_pwm_out_init) if (is_pwm_in_init)
{ {
// TODO set pwm outputs // TODO set pwm outputs
ErrorCode[0] = 0; ErrorCode[0] = 0;