コード例 #1
0
unsigned int cgxe_subscriber_method_dispatcher(SimStruct* S, int_T method, void*
  data)
{
  if (ssGetChecksum0(S) == 1367728901 &&
      ssGetChecksum1(S) == 1484596684 &&
      ssGetChecksum2(S) == 3577695903 &&
      ssGetChecksum3(S) == 643404390) {
    method_dispatcher_Muaidk3Mt9YKJ8xvv4B4QE(S, method, data);
    return 1;
  }

  return 0;
}
コード例 #2
0
unsigned int cgxe_CylinderSim_method_dispatcher(SimStruct* S, int_T method, void*
  data)
{
  if (ssGetChecksum0(S) == 106978902 &&
      ssGetChecksum1(S) == 377345797 &&
      ssGetChecksum2(S) == 3171370533 &&
      ssGetChecksum3(S) == 4112056921) {
    method_dispatcher_eJG1O6WbMNFUvHWZ3mwzSC(S, method, data);
    return 1;
  }

  return 0;
}
コード例 #3
0
unsigned int cgxe_ArduinoTests_method_dispatcher(SimStruct* S, int_T method,
  void* data)
{
  if (ssGetChecksum0(S) == 3704831919 &&
      ssGetChecksum1(S) == 2360107975 &&
      ssGetChecksum2(S) == 1785260133 &&
      ssGetChecksum3(S) == 555529238) {
    method_dispatcher_ghzL9u6H4AUvnUT3cRQ5DB(S, method, data);
    return 1;
  }

  return 0;
}
コード例 #4
0
/* Function: ProcessConnectMsg =================================================
 * Abstract:
 *  Process the EXT_CONNECT message and send response to host.
 */
PRIVATE boolean_T ProcessConnectMsg(SimStruct *S)
{
    int_T                   nSet;
    MsgHeader               msgHdr;
    int_T                   tmpBufSize;
    uint32_T                *tmpBuf = NULL;
    boolean_T               error   = EXT_NO_ERROR;
    
    const DataTypeTransInfo *dtInfo    = ssGetModelMappingInfo(S);
    uint_T                  *dtSizes   = dtGetDataTypeSizes(dtInfo);
    int_T                   nDataTypes = dtGetNumDataTypes(dtInfo);

    assert(connected);
    assert(!comminitialized);

    /*
     * Send the 1st of two EXT_CONNECT_RESPONSE messages to the host. 
     * The message consists purely of the msgHeader.  In this special
     * case the msgSize actually contains the number of bits per byte
     * (not always 8 - see TI compiler for C30 and C40).
     */
    msgHdr.type = (uint32_T)EXT_CONNECT_RESPONSE;
    msgHdr.size = (uint32_T)8; /* 8 bits per byte */

    error = ExtSetHostMsg(extUD,sizeof(msgHdr),(char_T *)&msgHdr,&nSet);
    if (error || (nSet != sizeof(msgHdr))) {
        fprintf(stderr,
            "ExtSetHostMsg() failed for 1st EXT_CONNECT_RESPONSE.\n");
        goto EXIT_POINT;
    }

    /* Send 2nd EXT_CONNECT_RESPONSE message containing the following 
     * fields:
     *
     * CS1 - checksum 1 (uint32_T)
     * CS2 - checksum 2 (uint32_T)
     * CS3 - checksum 3 (uint32_T)
     * CS4 - checksum 4 (uint32_T)
     * 
     * targetStatus  - the status of the target (uint32_T)
     *
     * nDataTypes    - # of data types        (uint32_T)
     * dataTypeSizes - 1 per nDataTypes       (uint32_T[])
     */

    {
        int nMsgEls    = 4 +                        /* checkSums       */
                         1 +                        /* targetStatus    */
                         1 +                        /* nDataTypes      */
                         dtGetNumDataTypes(dtInfo); /* data type sizes */

        tmpBufSize = nMsgEls * sizeof(uint32_T);
        tmpBuf     = (uint32_T *)malloc(tmpBufSize);
        if (tmpBuf == NULL) {
            error = EXT_ERROR; goto EXIT_POINT;
        }
    }
    
    /* Send message header. */
    msgHdr.type = EXT_CONNECT_RESPONSE;
    msgHdr.size = tmpBufSize;

    error = ExtSetHostMsg(extUD,sizeof(msgHdr),(char_T *)&msgHdr,&nSet);
    if (error || (nSet != sizeof(msgHdr))) {
        fprintf(stderr,
            "ExtSetHostMsg() failed for 2nd EXT_CONNECT_RESPONSE.\n");
        goto EXIT_POINT;
    }
   
    /* Checksums, target status & SL_DOUBLESize. */
    tmpBuf[0] = ssGetChecksum0(S);
    tmpBuf[1] = ssGetChecksum1(S);
    tmpBuf[2] = ssGetChecksum2(S);
    tmpBuf[3] = ssGetChecksum3(S);

    tmpBuf[4] = (uint32_T)modelStatus;

    /* nDataTypes and dataTypeSizes */
    tmpBuf[5] = (uint32_T)nDataTypes;
    (void)memcpy(&tmpBuf[6], dtSizes, sizeof(uint32_T)*nDataTypes);


    /* Send the message. */
    error = ExtSetHostMsg(extUD,tmpBufSize,(char_T *)tmpBuf,&nSet);
    if (error || (nSet != tmpBufSize)) {
        fprintf(stderr,
            "ExtSetHostMsg() failed.\n");
        goto EXIT_POINT;
    }

    commInitialized = TRUE;

EXIT_POINT:
    free(tmpBuf);
    return(error);
} /* end ProcessConnectMsg */