Changes between Version 43 and Version 44 of Writing Rules/Tlmt


Ignore:
Timestamp:
Feb 19, 2008, 9:47:19 PM (16 years ago)
Author:
fpecheux
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Writing Rules/Tlmt

    v43 v44  
    7070== C.2) Receiving a VCI response packet ==
    7171
    72 To receive a VCI response packet, a call-back function must be defined as a member function of the class '''my_initiator'''. This call-back function (named '''rspReceived()''' in the example), will be executed each time a VCI response packet is received on the '''p_vci''' port. The function name is not constrained, but the arguments must respect the following prototype:
    73 {{{
    74 void  rspReceived(vci_rsp_t  *rsp, uint32_t  time)
     72To receive a VCI response packet, a call-back function must be defined as a member function of the class '''!VciSimpleInitiator'''. This call-back function (named '''rspReceived()''' in the example), is executed each time a VCI response packet is received on the '''p_vci''' port. The function name is not constrained, but the arguments must respect the following prototype:
     73{{{
     74tmpl(tlmt_core::tlmt_return&)::callback(soclib::tlmt::vci_rsp_packet<vci_param> *pkt,
     75            const tlmt_core::tlmt_time &time,
     76            void *private_data)
    7577}}}
    7678
    7779The informations transported by a VCI response packet are defined below:
    7880{{{
    79 class vci_rsp_t {
    80 vci_command_t  cmd;  // VCI transaction type
    81 uint32_t  length;  // number of words in the packet
    82 uint32_t  error;  // error code (0 if no error)
    83 uint32_t  srcid;  // VCI Source ID
    84 uint32_t  trdid;  // VCI Thread ID
    85 uint32_t  pktid;  // VCI Packet ID
    86 }
    87 }}}
    88 
    89 The actions executed by the call-back function depend on the transaction type ('''cmd'''  field), as well as the '''pktid''' and '''trdid''' fields.
     81template<typename vci_param>
     82class vci_rsp_packet
     83{
     84public:
     85        typename vci_param::cmd_t cmd;    // VCI transaction type
     86        size_t length;                    // number of words in the packet
     87        uint32_t error;                   // error code (0 if no error)
     88        uint32_t srcid;                   // VCI Source ID
     89        uint32_t trdid;                   // VCI Thread ID
     90        uint32_t pktid;                   // VCI Packet ID
     91};
     92}}}
     93
     94The actions executed by the call-back function depend on the response transaction type ('''cmd''' field), as well as the '''pktid''' and '''trdid''' fields.
    9095
    9196In the proposed example :
     
    95100== C.3) Initiator Constructor ==
    96101
    97 The constructor of the class '''my_initiator''' must initialize all the member variables, including the '''p_vci''' port. The '''rspReceived()''' call-back function being executed in the context of the thread sending the response packet, a link between the '''p_vci''' port and the call-back function must be established. Moreover, the '''p_vci''' port must contain a pointer to the initiator local time.
    98 
    99 The '''!VciInitiatorPort''' constructor must be called with the following arguments:
    100 {{{
    101 p_vci(“vci”, this, &my_initiator::rspReceived, &m_time);
     102The constructor of the class '''!VciSimpleInitiator''' must initialize all the member variables, including the '''p_vci''' port. The '''rspReceived()''' call-back function being executed in the context of the thread sending the response packet, a link between the '''p_vci''' port and the call-back function must be established. Moreover, the '''p_vci''' port must contain a pointer to the initiator thread context '''c0'''.
     103
     104The '''!VciInitiator''' constructor must be called with the following arguments:
     105{{{
     106p_vci("vci", new tlmt_core::tlmt_callback<VciSimpleInitiator,soclib::tlmt::vci_rsp_packet<vci_param> *>(
     107                                         this, &VciSimpleInitiator<vci_param>::rspReceived), &c0)
    102108}}}
    103109