TASTE Communication Device
Contents
Introduction
Communication Device (CD) is a new type of TASTE project, that allows to model low level system drivers and integrate CD driver with existing or new TASTE project. It comes with two pre-defined templates: Broker and Broker + Packetizer. Depending on a selected template CD allows to model either Broker or Broker and Packetizer communication components. CommunicationDevice is a part of the SpaceCreator and Kazoo projects.
Capabilities
The following functionalities are supported:
- creation of new CD project from QTC wizard – SpaceCreator
- modeling and implementation of broker and packetizer
- CD code generation done be Kazoo templates
- integration with full TASTE project
How to create CD project
Communication device project can be created form QT Creator wizard that can be opened with TASTE command. Then under File->New File or Project (Ctrl + N)
Non-Qt Project -> Communication Device Project
CD wizard starts with “Project Location” tab. User shall provide Name for the project and path under which project will be created.
Next tab “Project Initialization” provides capabilities of selecting interface view template and CD board. Under IV template either “Broker” or “Broker_Packetizer” can be selected. Under Communication Device board either “x86 Linux CPP” or “SAM V71 FreeRTOS N7S” can be selected.
Next tab is standard “Kit Selection” tab.
Under last tab that is “Project Management” version control can be added. Also wizard displays all files that will be added to Communication Device project.
Generated CD project files details
Communication Device Project wizard adds the following files to the project:
taste.pro | empty taste.pro file that will be automatically generated during build |
Makefile | entry build and clean procedure that includes Kazoo and SC dependencies definitions |
deploymentvew.dv.xml | predefined deploymentview.dv.xml that includes CD build partition |
interfaceview.xml | interfaceview with Broker, Packetizer and interfaces. In this file user shall model Broker or Broker and Packetizer (depending on a template) along with required and provided components interfaces. |
<project_name>.acn | ACN project model for custom binary encoding rules. |
<project_name>.asn | ASN non user-editable model that contains all the basic data types. |
<project_name>.pro/shared | QTC project files with custom user build settings. |
<project_name>configuration.acn | ACN project configuration model for custom binary encoding rules. |
<project_name>configuration.asn | ASN user-editable model that contains definition of Driver Configuration. This file will be used by ocarina-components.aadl and Board1.xml and shall be implemented by the user. |
<project_name>privatedata.acn | ACN project privatedata model for custom binary encoding rules. |
<project_name>privatedata.asn | ASN user-editable model that contains definition of Private Data structure. This type shall be used in main.c[pp] to indicate the type of the variable that is passed as a private pointer to the driver. Shall be implemented by the user. |
Exemplary CD broker and packetizer modeling and implementation
Based on selected CD “Interface view template” either broker or broker and packetizer can be modeled and implemented. In this example second template will be used.
CD IV file specifics – fixed system elements
After opening IV file in the editor user can find (depending on selected template) Broker and Packetizer components. These are virtual components that are not taken for final code generation. Purpose of those elements is to provide “must have” set of interfaces. Those are required to match newly created and modeled communication components to existing in TASTE runtime calls.
User can’t remove those element neither the interfaces and will be informed about that while trying to do so.
Modeling Packetizer component
While modeling Packetizer user shall provide a TASTE function that implements needed interfaces and connect that function to pre-defined virtual Packetizer component. Also each interface shall contain set of input and output parameters. The easiest way to do so is by dragging each interface from virtual Packetizer with left Ctrl key pressed and drop it on custom function. This way each interface will be copied along with set of parameters.
Packetize and depacketizer interface parameters:
To avoid build errors another function can be connected to Broker and it’s implementation is not required.
Implementation of Packetizer component
At this point CD project is able to generate source code for MyPacketizer function that can be extended with user implementation. Screens below presents empty mypacketizer.c/h files.
For this example simple implementations of “Packetize” and “Depacketize” functions will be implemented and Init function will not be used. Screens bellow presents exemplary implementation of those functions.
Communication Device project with packetizer component implementation is ready to be integrated wit full TASTE project. See another chapters to follow TASTE project integration.
Modeling Broker component
While modeling Broker user shall provide a TASTE function that implements needed interfaces and connect that function to pre-defined virtual Broker component. Also each interface shall contain set of input and output parameters. The easiest way to do so is by dragging each interface from virtual Broker with left Ctrl key pressed and drop it on custom function. This way each interface will be copied along with set of parameters.
Init interface requires one input parameter of type “InitRequestData”. Receive interface requires one input parameter of type “ReceiveRequestData”. Deliver interface requires one input parameter of type “DeliverRequestData”. All of those types are defined in non-user editable “<project name>.asn” (described in “Generated CD project files details” section ) file. Also those types can be selected from parameters tab while editing interface.
Modeling driver configuration
To model driver configuration user shall provide “DRIVER-CONFIGURATION” model definition in “<project name>configuration.asn” (described in “Generated CD project files details” section ) file. As an example we will model simple ethernet device configuration.
Modeling driver private data
To model driver private data user shall provide “DRIVER-PRIVATE-DATAVIEW” model definition in “<project name>privatedata.asn” (described in “Generated CD project files details” section ) file. As an example we will model single type, that will carry a pointer to cpp based linux_ip_socket class.
Implementation of Broker component
At this point Communication Device project is ready to generate code that can be used to implement Broker component. Screen below presents generated driver code that shall be extended by the user with correct implementation.
For this example simple implementations of “Init” and “Deliver” functions will be tested. Screens bellow presents exemplary implementation of those functions.
Communication Device project with Broker component implementation is ready to be integrated wit full TASTE project. See another chapters to follow TASTE project integration.
How to integrate new CD into full TASTE project
Your Communication Device project contains “snippets” directory with 2 files inside. You shall integrate these files with corresponding files from your Taste instance installation.
Board1.xml is usually stored in /home/taste/.local/share/QtProject/QtCreator/HWlibrary/ directory and ocarina_components.aadl is usually in /home/taste/tool-src/misc/aadl-library/.
The comments in both files guide you in merge process. The following example shows how to merge Board1.xml snippet with existing “x86 Linux CPP” board.
You shall copy entire <Port> XML tag (the part between and markers) and paste it at the bottom of the existing port list of “x86 Linux CPP” board in global Board1.xml.
You are allowed to change the port name. Remember, that the path in “asn1file” attribute points to the ASN file from your CD project, therefore you shall keep it valid. When you move your driver project somewhere else in your filesystem, you have to update the path in Board1.xml
Such prepared environment allows you to build a new taste project with your driver. You can create new Taste project as usual by typing “taste” command in terminal. After that you can add a board in Deployment View with your port. In the following example it is “port_testcd”.
You can change port settings by double clicking the port.
Please note, that “asn1file”, “asn1module” and “asn1type” contain values that are designed by you in your driver’s project. To change configuration of the driver double click the “Config” field.
You can set the values of all settings that your driver needs – according to the ASN file from your driver’s project.