Ignore:
Timestamp:
01/13/03 18:18:15 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy/candrv
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/candrv/network.cc

    r1701 r1702  
    240240            if (!fNodes[i]->IsZombieNode())
    241241                fNodeInitialized[i] = TRUE;
    242             else
    243                 fNodes[i]=NULL;
     242            /*else
     243                fNodes[i]=NULL;*/
    244244        }
    245245    lout << "- All Nodes setup." << endl;
     
    288288    return rc;
    289289}
     290
     291// --------------------------------------------------------------------------
     292//
     293// returns true if one of the nodes is a zombie node
     294//
     295bool Network::HasZombie() const
     296{
     297    for (int i=0; i<32; i++)
     298        if (fNodes[i])
     299            if (fNodes[i]->IsZombieNode())
     300                return true;
     301
     302    return false;
     303}
     304
     305// --------------------------------------------------------------------------
     306//
     307// try to reboot all zombie nodes to get them working again. all other
     308// nodes are left untouched.
     309//
     310bool Network::RebootZombies()
     311{
     312    lout << "- Trying to reboot all Zombies..." << endl;
     313    for (int i=0; i<32; i++)
     314        if (fNodes[i])
     315            if (fNodes[i]->IsZombieNode())
     316                if (!fNodes[i]->Reboot())
     317                {
     318                    lout << "- Failed to reboot " << fNodes[i]->GetNodeName() << "." << endl;
     319                    return false;
     320                }
     321
     322    lout << "- All Zombies rebooted." << endl;
     323
     324    return true;
     325}
  • trunk/MagicSoft/Cosy/candrv/network.h

    r1140 r1702  
    3232
    3333    bool HasError() const;
     34    bool HasZombie() const;
     35
     36    bool RebootZombies();
    3437
    3538    ClassDef(Network, 0) // collection of nodes (nodedrv)
  • trunk/MagicSoft/Cosy/candrv/nodedrv.cc

    r1690 r1702  
    8787// --------------------------------------------------------------------------
    8888//
     89// This should be called from a master or main thread to get a node out
     90// of the Zombie-Status. Overload it by your needs.
     91//
     92bool NodeDrv::Reboot()
     93{
     94    fIsZombie = false;
     95    return true;
     96}
     97
     98// --------------------------------------------------------------------------
     99//
    89100// Init device, sets the pointer to the whole network and enables
    90101// the Can messages to be passed through the interface:
     
    315326bool NodeDrv::WaitForSdo(WORD_t idx, BYTE_t subidx, WORDS_t timeout)
    316327{
    317     return fNetwork->WaitForSdo(fId, idx, subidx, timeout);
     328    bool rc = fNetwork->WaitForSdo(fId, idx, subidx, timeout);
     329
     330    if (!rc)
     331        fIsZombie = kTRUE;
     332
     333    return rc;
    318334}
    319335
  • trunk/MagicSoft/Cosy/candrv/nodedrv.h

    r1690 r1702  
    3434    void DelError()        { fError = 0; }
    3535
    36     Bool_t fIsZombie;
     36    Bool_t fIsZombie; // A Zombie node is a node which doesn't answer...
    3737
    3838public:
     
    6060    virtual void HandlePDO3(BYTE_t *data, timeval_t *tv) {};
    6161    virtual void HandlePDO4(BYTE_t *data, timeval_t *tv) {};
     62
     63    virtual bool Reboot();
    6264
    6365    void SendPDO1(BYTE_t data[8]);
  • trunk/MagicSoft/Cosy/candrv/vmodican.cc

    r1699 r1702  
    202202    const WORD_t cobid = desc>>5;
    203203
    204     switch (msg->cmd)
     204    switch (msg->cmd) // FROM mican.h
    205205    {
    206206    case M_MSG_LOST:
     
    208208        return;
    209209
     210    case M_BCAN_TX_con:  /* confirm (+/-) transmission */
     211        cout << "VmodIcan reports: CTXcon=0x35" << endl;
     212        cout << "This normally means, that the transmission of the following CAN frame failed:" << hex << endl;
     213        cout << "Descr: 0x" << cobid << dec;
     214        cout << "  Rtr: "   << (rtr?"Yes":"No");
     215        cout << "  Len: "   << (int)len << endl;
     216        return;
     217
    210218    case M_BCAN_EVENT_ind:
    211         cout << "VmodIcan reports: CEVTind=0x37, " << hex;
     219        cout << "VmodIcan reports: CEVTind=0x37: " << hex;
    212220        switch (msg->data[0]) // error indicator
    213221        {
Note: See TracChangeset for help on using the changeset viewer.