INOS
CINOSCOPMaster Class Reference

The main class handling a COP bus, local or remote (GinLink passive). More...

#include <cinoscopmaster.h>

Public Types

enum  EOptionalFeatures {
  eNone = 0 , eEepromRead = (1<<0) , eEepromWrite = (1<<1) , eSpiRead = (1<<2) ,
  eSpiWrite = (1<<3) , e8kLayout = (1<<4) , eActive = (1<<5) , eParasite = (1<<6) ,
  eChief = (1<<7) , eAll = (eEepromRead | eEepromWrite | eSpiRead | eSpiWrite)
}
 
enum  {
  eIrqMax = 8 , eIrqMain = 1 , eIrqCore1 = 2 , eIrqMotor = 2 ,
  eIrqOverrun = 8
}
 

Public Member Functions

void Reset ()
 reset bus
 
void BusScan (XMLNode aConfigNode)
 scan bus
 
void BusStartup ()
 call startup actions of all modules
 
void SeqStart (uint32 auCycleTimeNs, uint32 auSyncPage=0, bool abSoftSync=false)
 start sequencer
 
void SeqStop ()
 stop sequencer
 
void SeqWatchdog (uint32 auBusControl, int16 aiCycleAdjust)
 handle watchdog (only on active master)
 
void ToggleWatchdog ()
 toggle watchdog (only on active master)
 
void SeqClear ()
 clear sequencer table
 
void SeqWrite (uint32 *apTable, bool abForceIrq=false, SINOSCOPSubroutine *apSubChain=0)
 write sequencer table
 
void SeqEnableIrq ()
 enable irq
 
uint32 SeqGetTime (uint32 uSubCycle=0)
 get table length [ns]
 
CINOSCOPModuleGetFirst ()
 get first module
 
CINOSCOPModuleGetNext (CINOSCOPModule *apModule)
 get next module
 
CINOSCOPModuleGetModule (uint32 auAddress)
 Get module by address.
 
CINOSCOPModuleGetModule (const char *apName)
 Get module by name.
 
bool HasModuleType (const char *apType)
 Return true if copbus has a module of the given type.
 
voidGetDprAddress (uint16 auDprOffset)
 get dpr address
 
CINCOCOPDeviceGetDevice ()
 get pointer to cop device
 
bool ReadModuleSpiData (uint32 auNumber, uint32 auCount, uint8 *apBuffer, uint32 auBufferSize)
 Read some data from a module's spi flash (fixed memory address).
 
bool WriteModuleSpiData (uint32 auNumber, uint32 auCount, uint8 *apBuffer)
 Write some data into a module's spi flash (fixed memory address).
 
 CINOSCOPMaster (CINCOCOPDevice *apDevice, bool abCopPas=false)
 Constructor.
 
virtual ~CINOSCOPMaster ()
 Destructor.
 
uint32 GetError ()
 Get errors of cop bus master.
 
bool ReadModuleEeprom (uint32 auNumber, SINOSCOPModuleEeprom &aEeprom, uint32 auSize)
 Complete sequence to read a module's eeprom.
 
bool WriteModuleEeprom (uint32 auNumber, SINOSCOPModuleEeprom &aEeprom, uint32 auSize)
 Write a module's eeprom.
 
uint32 * GetSeqTable ()
 Get pointer to sequence backup table.
 
uint32 GetSeqTableSize ()
 Get size of sequence table in uint32 units.
 
bool CheckRangeCondition (const char *apModule, CINOSBusPortHandlerRangeCondition *apCond)
 Check if the condition of a range is met.
 
void CreateModules (XMLNode aConfigNode)
 Create modules with given xml config file.
 
CINOSCOPModuleCreateModule (XMLNode xCard, const char *apModName, uint32 auAddress, uint32 auAppRev, uint32 auProductCode)
 Create a module with the given information.
 
bool IsModuleOnline ()
 Return online state of device's bus module.
 
void SetOptionalFeatures (uint32 auFeatures)
 
void AddOptionalFeatures (uint32 auFeature)
 
bool IsOptionalFeatureEnabled (EOptionalFeatures aeFeature) const
 
bool IsParasite () const
 
bool IsChief () const
 
uint32 GetCycleTimer () const
 

Friends

class CGINModuleActive
 
class CINOSMcTargetFieldbusMasterCopBus
 

Detailed Description

The main class handling a COP bus, local or remote (GinLink passive).

Member Enumeration Documentation

◆ EOptionalFeatures

Some features are not implemented by specific COP masters. e.g. the hammer board does not support EEPROM access or SPI read access. This enum lists all optional features. By default, a CINOSCOPMaster supports all features. Use SetOptionalFeatures to limit them.

Member Function Documentation

◆ AddOptionalFeatures()

void CINOSCOPMaster::AddOptionalFeatures ( uint32  auFeature)
inline

Add an optional feature.

Parameters
auFeatureoptional feature to be added

◆ CheckRangeCondition()

bool CINOSCOPMaster::CheckRangeCondition ( const char apModule,
CINOSBusPortHandlerRangeCondition apCond 
)

Check if the condition of a range is met.

Parameters
apModuleName of sub module where the range is used.
apCondCondition to check.
Returns
Success of check.

◆ CreateModule()

CINOSCOPModule * CINOSCOPMaster::CreateModule ( XMLNode  xCard,
const char apModName,
uint32  auAddress,
uint32  auAppRev,
uint32  auProductCode 
)

Create a module with the given information.

Parameters
xCardXml config for the module.
apModNameModule name to use e.g. user configured.
auAddressAddress of module on cop bus.
auAppRevGal revision with modules type.
auProductCodeCode number of module.
Returns
The created module.

◆ CreateModules()

void CINOSCOPMaster::CreateModules ( XMLNode  aConfigNode)

Create modules with given xml config file.

Parameters
aConfigNodeNode config that holds config for sub modules.

◆ GetCycleTimer()

uint32 CINOSCOPMaster::GetCycleTimer ( ) const
Returns
current cycletimer

◆ GetError()

uint32 CINOSCOPMaster::GetError ( )
inline

Get errors of cop bus master.

Returns
Error flags.

◆ GetModule()

CINOSCOPModule * CINOSCOPMaster::GetModule ( const char apName)

Get module by name.

Parameters
apNameName of desired module.
Returns
Found module or NULL.

◆ GetSeqTable()

uint32 * CINOSCOPMaster::GetSeqTable ( )
inline

Get pointer to sequence backup table.

Returns
Pointer to backup table.

◆ GetSeqTableSize()

uint32 CINOSCOPMaster::GetSeqTableSize ( )
inline

Get size of sequence table in uint32 units.

Returns
Size of table.

◆ HasModuleType()

bool CINOSCOPMaster::HasModuleType ( const char apType)

Return true if copbus has a module of the given type.

Parameters
apTypeRequested type name.
Returns
true if yes

◆ IsChief()

bool CINOSCOPMaster::IsChief ( ) const
inline
Returns
true if we're a chief

◆ IsModuleOnline()

bool CINOSCOPMaster::IsModuleOnline ( )

Return online state of device's bus module.

Returns
Online state of device's bus module.

◆ IsOptionalFeatureEnabled()

bool CINOSCOPMaster::IsOptionalFeatureEnabled ( EOptionalFeatures  aeFeature) const
inline
Returns
true if the feature aeFeature is supported by this cop master

◆ IsParasite()

bool CINOSCOPMaster::IsParasite ( ) const
inline
Returns
true if we're a parasite

◆ ReadModuleSpiData()

bool CINOSCOPMaster::ReadModuleSpiData ( uint32  auNumber,
uint32  auCount,
uint8 *  apBuffer,
uint32  auBufferSize 
)

Read some data from a module's spi flash (fixed memory address).

Parameters
auNumberAddress of cop module.
auCountNumber of bytes to read.
apBufferBuffer to take received data.
auBufferSizeSize of buffer.
Returns
True for success, false for error.

◆ SetOptionalFeatures()

void CINOSCOPMaster::SetOptionalFeatures ( uint32  auFeatures)
inline

Set the list of optionally supported features. Just "or" the enums in EOptionalFeatures. Note: By default, a COP master supports all optional features. Therefore, this function is only used to "limit" the supported features.

Parameters
auFeaturesOred list of EOptionalFeatures

◆ WriteModuleEeprom()

bool CINOSCOPMaster::WriteModuleEeprom ( uint32  auNumber,
SINOSCOPModuleEeprom aEeprom,
uint32  auSize 
)

Write a module's eeprom.

Parameters
auNumberAddress of module.
aEepromEeprom data to write.
Returns
True in case of error, false for success.

◆ WriteModuleSpiData()

bool CINOSCOPMaster::WriteModuleSpiData ( uint32  auNumber,
uint32  auCount,
uint8 *  apBuffer 
)

Write some data into a module's spi flash (fixed memory address).

Parameters
auNumberAddress of cop module.
auCountNumber of bytes to write.
apBufferBuffer with data to write.
Returns
True for success, false for error.

The documentation for this class was generated from the following file: