static void mdlSetInputPortDataType(SimStruct *S, int_T port, DTypeId dataType) { int portWidth; if ( port == 0 ) { portWidth = ssGetInputPortWidth(S,0); if( isAcceptableDataType( S, dataType,portWidth ) ) { /* * Accept proposed data type if it is an unsigned integer type * force all data ports to use this data type. */ ssSetInputPortDataType( S, 0, dataType ); } else { /* Reject proposed data type */ ssSetErrorStatus(S,"Invalid input signal width, data type or input port is not connected. See mask help for valid data types."); goto EXIT_POINT; } } else { /* * Should not end up here. Simulink will only call this function * for existing input ports whose data types are unknown. */ ssSetErrorStatus(S, "Error setting input port data type."); goto EXIT_POINT; } EXIT_POINT: return; }
static void mdlSetDefaultPortDataTypes(SimStruct *S) { if ( ssGetInputPortDataType(S,0) == DYNAMICALLY_TYPED ){ if ( isAcceptableDataType(S,SS_UINT8,ssGetInputPortWidth(S,0))){ ssSetInputPortDataType( S, 0, SS_UINT8 ); }else{ ssSetErrorStatus(S,"Invalid input signal width, data type or input port is not connected. See mask help for valid data types."); } } }
static void mdlSetInputPortDataType(SimStruct *S, int_T port, DTypeId dataType) { /* dynamic typing for message input port */ if (port == 0) { if (isAcceptableDataType(S, dataType)) { /* * Accept proposed data type if it is std / xtd message type */ ssSetInputPortDataType(S, 0, dataType); } else { /* Reject proposed data type */ ssSetErrorStatus(S,"Invalid input signal data type."); return; } } else { /* * Should not end up here. Simulink will only call this function * for existing input ports whose data types are unknown. */ ssSetErrorStatus(S, "Error setting input port data type."); return; } }