6.2 Adding ports

How to add two ports to a component.

The SerialCharDoubler component needs two ports:
Both ports use serial data and they must therefore use the SerialData protocol, which the Fast Model Portfolio provides.

Procedure

  1. In the Block Diagram view of the SerialCharDoubler component, right click in the blank diagram and select context menu item Add port....
  2. The Self Port dialog appears.
    Figure 6-2 Self Port dialog
    Self Port dialog

  3. Enter in for the Instance Name of the port. For Type, select Slave Port. To choose the protocol, click the Protocol Select... button. Select SerialData from the displayed list and click OK.
    Figure 6-3 Select Protocol dialog
    Select Protocol dialog

  4. Close the Self Port dialog by pressing the OK button. A port appears on the block diagram. Click to drop the port.
  5. Repeat the procedure for the out master port:
    • Instance Name is out.
    • Type is Master Port.
    • Protocol is SerialData.
  6. Click the Source tab for the SerialCharDoubler component to see that System Canvas has updated the code.
    // System Generator generated this file.
    // --------------------------------------------------
    component SerialCharDoubler
    {
        composition
        {
        }
        connection
        {
        }
        resources
        {
        // Remember whether or not we are inside an escape sequence
        // that came through 'in'.
            bool inEscape;
        }
        slave port<SerialData> in
        {
            behavior dataTransmit(uint16_t data):void
            {
                // TODO: place your code here
            }
            behavior dataReceive():uint16_t
            {
                // TODO: place your code here
            }
            behavior signalsSet(uint8_t signal):void
            {
                // TODO: place your code here
        }
            behavior signalsGet():uint8_t
            {
                // TODO: place your code here
            }
        }
        master port<SerialData> out;
        {
            behavior dataTransmit(uint16_t data):void
            {
                // TODO: place your code here
        }
            behavior dataReceive():uint16_t
            {
                // TODO: place your code here
            }
            behavior signalsSet(uint8_t signal):void
            {
                // TODO: place your code here
            }
            behavior signalsGet():uint8_t
            {
                // TODO: place your code here
            }
        }
    }
    
Non-ConfidentialPDF file icon PDF versionARM DUI0370S
Copyright © 2007-2014 ARM. All rights reserved.