include/nmtMaster.h
author lbessard
Mon, 20 Apr 2009 17:42:36 +0200
changeset 546 13701680330c
parent 529 c171e11707c5
child 561 f9be4262c68d
permissions -rw-r--r--
Bug avoided reset PDO mapping fixed
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     1
/*
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     2
This file is part of CanFestival, a library implementing CanOpen Stack. 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     3
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     4
Copyright (C): Edouard TISSERANT and Francis DUPIN
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     5
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     6
See COPYING file for copyrights details.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     7
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     8
This library is free software; you can redistribute it and/or
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     9
modify it under the terms of the GNU Lesser General Public
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    10
License as published by the Free Software Foundation; either
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    11
version 2.1 of the License, or (at your option) any later version.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    12
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    13
This library is distributed in the hope that it will be useful,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    14
but WITHOUT ANY WARRANTY; without even the implied warranty of
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    16
Lesser General Public License for more details.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    17
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    18
You should have received a copy of the GNU Lesser General Public
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    19
License along with this library; if not, write to the Free Software
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    21
*/
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    22
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    23
/** @defgroup networkmanagement Network Management
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    24
 *  @ingroup userapi
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    25
 */
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    26
/** @defgroup nmtmaster NMT Master
529
c171e11707c5 Second time, Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 528
diff changeset
    27
 *  @brief NMT master provides mechanisms that control and monitor the state of nodes and their behavior in the network.
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    28
 *  @ingroup networkmanagement
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    29
 */
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    30
 
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    31
#ifndef __nmtMaster_h__
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    32
#define __nmtMaster_h__
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    33
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    34
#include "data.h"
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    35
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    36
/** 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    37
 * @ingroup nmtmaster
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    38
 * @brief Transmit a NMT message on the bus number bus_id
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    39
 * to the slave whose node_id is ID
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    40
 * 
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    41
 * bus_id is hardware dependant
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    42
 * cs represents the order of state changement:
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    43
 *  - cs =  NMT_Start_Node            // Put the node in operational mode             
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    44
 *  - cs =	 NMT_Stop_Node		   // Put the node in stopped mode
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    45
 *  - cs =	 NMT_Enter_PreOperational  // Put the node in pre_operational mode  
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    46
 *  - cs =  NMT_Reset_Node		   // Put the node in initialization mode 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    47
 *  - cs =  NMT_Reset_Comunication	   // Put the node in initialization mode 
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    48
 * The mode is changed according to the slave state machine mode :
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    49
 *  - initialisation  ---> pre-operational (Automatic transition)
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    50
 *  - pre-operational <--> operational
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    51
 *  - pre-operational <--> stopped
529
c171e11707c5 Second time, Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 528
diff changeset
    52
 *  - pre-operational, operational, stopped -> initialisation\n
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    53
 * @param *d Pointer on a CAN object data structure
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    54
 * @param Node_ID Id of the slave node
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    55
 * @param cs State changement
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    56
 * @return canSend(bus_id,&m)               
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    57
 */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    58
UNS8 masterSendNMTstateChange (CO_Data* d, UNS8 Node_ID, UNS8 cs);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    59
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    60
/**
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    61
 * @ingroup nmtmaster 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    62
 * @brief Transmit a Node_Guard message on the bus number bus_id
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    63
 * to the slave whose node_id is nodeId
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    64
 * 
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    65
 * bus_id is hardware dependant
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    66
 * @param *d Pointer on a CAN object data structure
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    67
 * @param nodeId Id of the slave node
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    68
 * @return canSend(bus_id,&m)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    69
 */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    70
UNS8 masterSendNMTnodeguard (CO_Data* d, UNS8 nodeId);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    71
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    72
/** 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    73
 * @ingroup nmtmaster
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    74
 * @brief Prepare a Node_Guard message transmission on the bus number bus_id
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    75
 * to the slave whose node_id is nodeId
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    76
 * 
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    77
 * Put nodeId = 0 to send an NMT broadcast.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    78
 * This message will ask for the slave, whose node_id is nodeId, its state
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    79
 * bus_id is hardware dependant
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    80
 * @param *d Pointer on a CAN object data structure
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 71
diff changeset
    81
 * @param nodeId Id of the slave node
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    82
 */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    83
void masterRequestNodeState (CO_Data* d, UNS8 nodeId);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    84
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    85
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 0
diff changeset
    86
#endif /* __nmtMaster_h__ */