summaryrefslogtreecommitdiff
path: root/AT91SAM7S256/armdebug/FantomModule/fantom/iModule.h
blob: 1f03849e2ce7261a275112c1f6dbfcc0dca53240 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/*!
   \file iModule.h
   \brief Interface for a firmware module on a LEGO MINDSTORMS NXT.
*/
/*
   � Copyright 2005-2006,
   National Instruments Corporation.
   All rights reserved.

   File:        iModule.h
   Originated:  8 Aug 2005
*/

#ifndef ___fantom_iModule_h___
#define ___fantom_iModule_h___

#ifndef ___fantom_platform_h___
   #include "platform.h"
#endif

#ifndef ___fantom_tStatus_h___
   #include "tStatus.h"
#endif


// defines...


namespace nFANTOM100
{

   /*!
      \class iModule
      \brief Interface to a firmware module on a LEGO MINDSTORMS NXT.
   */
   class iModule
   {
      friend class tNXT;
      
      // methods
      protected:
   
         //! Destructor
         virtual ~iModule() = 0;

      public:

         //! Retrieves the name of this module.
         /*!
            \param moduleName Populated with the name of this module. The module name character
               array must be able to accomodate a NULL-terminated, 15.3 formatted module name.
               That is, it must have a capacity of 20 bytes.
         */
         virtual void getName( ViChar moduleName[] ) const = 0;
         
         //! Retrieves the internal module ID of this module.
         /*!
            \return The internal module ID of this module.
         */
         virtual ViUInt32 getModuleID( void ) const = 0;
         
         //! Retrieves the size in bytes of this module.
         /*!
            \return The size in bytes of this module.
         */
         virtual ViUInt32 getModuleSize( void ) const = 0;
         
         //! Retrieves the size in bytes of the I/O map associated with this module.
         /*!
            \return The size in bytes of the I/O map associated with this module.
         */
         virtual ViUInt32 getModuleIOMapSize( void ) const = 0;
         
         //! Reads a portion of this module's I/O map.
         /*!
            Reads the data located at [I/O map address] + [specified offset in bytes] into the
               specified data buffer.  The read will attempt to copy the specified number of
               bytes.  No read occurs if the specified status is fatal.  The ownership of data
               buffer is not transferred to this module object.

            \param offsetInBytes The index of the byte in the I/O map at which to start the read.
            \param numberOfBytes The number of bytes that should be read from the I/O map.
            \param dataBufferPtr A pointer to the data buffer that will be populated with the
               data that is read.  The capacity of the specified data buffer must be at least the
               specified number of bytes.
            \param status Status chaining object.
            \return The number of bytes actually read from the I/O map.
            
            \post The specified data buffer may be deallocated.
         */
         virtual ViUInt32 readIOMap( ViUInt32 offsetInBytes, ViUInt32 numberOfBytes,
               ViPBuf dataBufferPtr, tStatus& status ) = 0;
         
         //! Writes a portion of this module's I/O map.
         /*!
            Writes the specified data into this module's I/O map.  The write starts at  [I/O map
               address] + [specified offset in bytes] and stops after the specified number of
               bytes have been written.  No write occurs if the specified status is fatal.   The
               ownership of data buffer is not transferred to this module object.

            \param offsetInBytes The index of the byte in the I/O map at which to start the write.
            \param numberOfBytes The number of bytes to write into the I/O map.
            \param dataBufferPtr A pointer to the data buffer that contains the data that will be
               written. The capacity of the specified data buffer must be at least the specified
               number of bytes.
            \param status Status chaining object.
            \return The number of bytes actually written into the I/O map.
            
            \post The specified data buffer may be deallocated.
         */
         virtual ViUInt32 writeIOMap( ViUInt32 offsetInBytes, ViUInt32 numberOfBytes,
               const ViByte dataBufferPtr[], tStatus& status ) = 0;

   };

}; // nFANTOM100

typedef ViObject nFANTOM100_iModule;

extern "C"
{
   nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iModule_getName(
         nFANTOM100_iModule modulePtr,
         ViChar moduleName[],
         ViStatus* status );

   nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iModule_getModuleID(
         nFANTOM100_iModule modulePtr,
         ViStatus* status );

   nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iModule_getModuleSize(
         nFANTOM100_iModule modulePtr,
         ViStatus* status );

   nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iModule_getIOMapSize(
         nFANTOM100_iModule modulePtr,
         ViStatus* status );

   nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iModule_readIOMap(
         nFANTOM100_iModule modulePtr,
         ViUInt32 offset,
         ViUInt32 numberBytesToRead,
         ViPBuf dataBuffer,
         ViStatus* status );

   nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iModule_writeIOMap(
         nFANTOM100_iModule modulePtr,
         ViUInt32 offset,
         ViUInt32 numberBytesToWrite,
         const ViByte dataBuffer[],
         ViStatus* status );
}

#endif // ___fantom_iModule_h___