29#ifndef INC_CINOSCOPMODULE_H
30#define INC_CINOSCOPMODULE_H
38#define DF_INOS_COP_MAX_MODULES 16
40#define DF_INOS_COP_PORT_ADDRESS 0x80000000
41#define DF_INOS_COP_PORT_MEMORY_SIZE 256
43#define DF_INOS_COP_RAM_ADDRESS 0x00000000UL
44#define DF_INOS_COP_RAM_MEMORY_SIZE 512
47#define DF_INOS_COP_PORT_RAM_ADR 0xF8
48#define DF_INOS_COP_PORT_RAM_DAT 0xF9
49#define DF_INOS_COP_PORT_STATUS 0xFC
50#define DF_INOS_COP_PORT_APPREV 0xFE
51#define DF_INOS_COP_PORT_SEQREV 0xFF
53#define DF_INOS_COP_PORT_ENABLE_WRITE 0x4000
56#define DF_INOS_COP_FLAG_EEPROM_VALID 0x00000001
58#define DF_INOS_COP_FLAG_XML_MOD_VALID 0x00000002
60#define DF_INOS_COP_FLAG_RAM_PROTECT 0x00000004
62#define DF_INOS_COP_FLAG_LITTLE_ENDIAN 0x00000008
64#define DF_INOS_COP_FLAG_INFO_1 0x00000010
67#define DF_INOS_COP_STRT_OPTION_SLOW 0x00000001
93 eOptSubName = 0x00000001
118#if INOS_BYTE_ORDER == INOS_LITTLE_ENDIAN
205class CINOSBusPortHandlerRangeCondition;
220 {
return &m_pDesc->
m_cName[0]; };
223 {
return m_cTargetInfo; };
231 {
return (
void*)((uintptr)&m_Eeprom+auOffset); };
235 {
return sizeof(m_Eeprom); };
238 {
return m_CardNode; };
266 memcpy(&m_Eeprom, &aBoardInfo,
sizeof(aBoardInfo));
274 return m_uFpgaRevision;
280 return m_uAddressSwitch;
295 { m_pNext = apNext;};
305 uint32
PutBlock32(uint32 auDest, uint32* apSource, uint16 auNumber,
314 uint32
GetBlock32(uint32 auSource, uint32* apDest, uint16 auNumber,
318 uint32
PutBlock16(uint32 auDest, uint16* apSource, uint16 auNumber, uint32 auFlags = 0);
320 uint32
GetBlock16(uint32 auSource, uint16* apDest, uint16 auNumber, uint32 auFlags = 0);
328 uint32
PutBlock8(uint32 auDest, uint8* apSource, uint16 auNumber,
337 uint32
GetBlock8(uint32 auSource, uint8* apDest, uint16 auNumber,
350 #if defined(INOS_PORTS_64BIT)
352 uint32 PortPut64(uint16 auNumber, uint64 auValue);
354 uint32 PortGet64(uint16 auNumber, uint64& auValue);
360 uint32
GetVariable(
const char* apName,
char* apValue, uint32 auLength);
363 uint32
GetVariableEx(
const char* apName, uint32 auIncoType,
void* apValue, uint32 auSize);
372 void* apParameters,
void* apResult);
391 CINCOCOPDevice* apDevice,
bool abOnline);
422 #if INOS_BYTE_ORDER == INOS_LITTLE_ENDIAN
425 case 1 :
return *((T*) ((uintptr)p^3));
426 case 2 :
return *((T*) ((uintptr)p^2));
427 case 4 :
return *((T*)p);
429 uint64 u = (uint64(*((T*)p))<<32) + *((T*)((uintptr)p+4));
456 m_uFlags=(m_uFlags&~DF_INOS_COP_FLAG_XML_MOD_VALID)|
510 {
return m_uPortCachable[auNumber>>5] & (1<<(auNumber&0x1f)); }
516 {
return (m_ePortCache == ePortCacheEnabled) && (m_uPortCacheValid[auNumber>>5] & (1<<(auNumber&0x1f))); }
522 eCnsUpdateCacheOk = 3,
523 eCnsUpdateCacheMax = 16,
529 CINCOCOPDevice* m_pDevice;
537 char m_cEepromInfo[256];
539 uint32 m_uFpgaRevision;
541 uint16 m_uAddressSwitch;
543 char m_cTargetInfo[256];
545 uint16 m_uMemoryPortSize;
546 uint32 m_uMemoryPortBgn;
547 uint32 m_uMemoryPortEnd;
549 uint32 m_uMemoryRam16BitSize;
550 uint32 m_uMemoryRamBgn;
551 uint32 m_uMemoryRamEnd;
553 enum EPortCacheState {
556 } m_ePortCache = ePortCacheEnabled;
558 uint16 m_uPortCache[256]{};
560 uint32 m_uPortCachable[8]{};
562 uint32 m_uPortCacheValid[8]{};
564 uint16 m_uPortStatus;
568 CINOSIncoAction* m_pStartup;
570 CINCOObject* m_pInco;
572 std::vector<CINOSCOPModule *> m_Distribution;
578 const char* m_pModXml;
580 const char* m_pCardNodeXml;
582 uint32 m_uCardNodeXmlSize;
584 char* m_pCardNodeXmlCompressed;
586 uint32 m_uCardNodeXmlCompressedSize;
#define DF_INOS_COP_FLAG_LITTLE_ENDIAN
Flag if ram is little endian.
Definition cinoscopmodule.h:62
#define DF_INOS_COP_FLAG_EEPROM_VALID
Flag if eeprom could be read and is valid.
Definition cinoscopmodule.h:56
#define DF_INOS_COP_FLAG_RAM_PROTECT
Flag if ram config ports (0xF8/0xF9) need enable flag before writing.
Definition cinoscopmodule.h:60
#define DF_INOS_COP_FLAG_XML_MOD_VALID
Flag if module's xml config file is valid.
Definition cinoscopmodule.h:58
#define DECLARE_DYNAMIC(aClass)
Definition cinospartitionmemory.h:328
The main class handling a COP bus, local or remote (GinLink passive).
Definition cinoscopmaster.h:251
The class handling a single COP module.
Definition cinoscopmodule.h:214
const char * GetName()
get module name
Definition cinoscopmodule.h:219
const char * GetStateText()
Get state text.
uint32 PutBlock16(uint32 auDest, uint16 *apSource, uint16 auNumber, uint32 auFlags=0)
put block of 16 bit values
bool IsPortCached(uint16 auNumber)
Check if port cached.
Definition cinoscopmodule.h:515
void RegisterRam()
Register variables pointing into onboard ram.
void ResolveEepromValues(XMLNode &aAction)
Resolve values with eeprom references (e.g. uint16:Eeprom[80]).
T GetEepromValue(uint32 auOffset)
Get eeprom value with certain type.
Definition cinoscopmodule.h:419
CINOSCOPModule * GetNext()
module pointer to next cop module
Definition cinoscopmodule.h:291
bool IsEepromValid()
Return true if eeprom is valid.
Definition cinoscopmodule.h:475
bool CheckRangeCondition(CINOSBusPortHandlerRangeCondition *apCond)
Check if the condition of a range is met.
void * GetEepromAddress(uint32 auOffset)
get eeprom address
Definition cinoscopmodule.h:230
uint32 GetFpgaRevision()
Get the fpga revision.
Definition cinoscopmodule.h:273
uint32 GetAddress()
get module address
Definition cinoscopmodule.h:227
uint16 GetAddressSwitch()
Get the address switch read after scanning.
Definition cinoscopmodule.h:279
void UpdatePortCache(uint16 auNumber, uint8 auSize)
Update cache of given port.
CINOSCOPModule(CINOSCOPMaster *apMaster, SINOSCOPModule *apDesc, SINOSCOPModuleEeprom *apEeprom, XMLNode aCardNode, CINCOCOPDevice *apDevice, bool abOnline)
Constructor of COP module.
uint32 GetVariable(const char *apName, real64 &arValue)
get variable from module tree
void DisablePortCache()
Disable port cache.
uint32 GetVariableEx(const char *apName, uint32 auIncoType, void *apValue, uint32 auSize)
get variable from module tree
uint32 PortGet32(uint16 auNumber, uint32 &auValue)
get 32 bit value from cop module port
void SetXmlModValid(bool abXmlModValid)
Set validity of module's xml file.
Definition cinoscopmodule.h:455
uint32 GetVariable(const char *apName, char *apValue, uint32 auLength)
get variable from module tree
bool IsOnline()
Return online state of cop module.
bool HasRamPortsProtected()
Check if module needs config enable bit set for writing ram ports F8/F9.
Definition cinoscopmodule.h:250
bool IsPortCachable(uint16 auNumber)
Check if port cachable.
Definition cinoscopmodule.h:509
void FixPortRegistration(CINCOItem *apItem, uint32 *apTable, uint32 auTableSize)
Fix the registration of a write port item (recursively).
void SetXmlMod(const char *apModXml)
Set content of module's xml file.
Definition cinoscopmodule.h:463
void FixPortRegistration()
Adjust the ports registration to show the real value.
void SetBoardInfo(SINOSCOPModuleEeprom &aBoardInfo)
Set board info for target registration.
Definition cinoscopmodule.h:265
virtual const char * GetXmlCompressedAddr()
get address of xml description
void SetNext(CINOSCOPModule *apNext)
set pointer to next cop module
Definition cinoscopmodule.h:294
void UpdateTargetString()
Terminate eeprom strings and update info string.
void GetBoardInfo(SINOSCOPModuleEeprom &aBoardInfo, bool &abEepromValid)
Get board info for target registration.
Definition cinoscopmodule.h:260
virtual uint32 GetXmlSize()
get size of xml description
void SetDistributionModule(CINOSCOPModule *apDist, char *apXml)
set pointer to distribution module
void Startup()
run startup actions
XMLNode GetXmlNode()
Get card node.
Definition cinoscopmodule.h:237
CINCOCOPDevice * GetDevice()
get pointer to cop inco device
Definition cinoscopmodule.h:396
uint32 GetEepromSize()
get eeprom address
Definition cinoscopmodule.h:234
uint32 PortGet16(uint16 auNumber, uint16 &auValue)
get 16 bit value from cop module port
uint32 CallProcedure(const char *apName, long aiNrOfParameters, void *apParameters, void *apResult)
call procedure.
virtual uint32 EepromWrite()
Write cop bus module eeprom.
virtual uint32 EepromRead()
Read cop bus module eeprom.
uint32 GetBlock8(uint32 auSource, uint8 *apDest, uint16 auNumber, uint32 auFlags=0)
Read a number of 8 bit values.
const char * GetInfo()
get module info
Definition cinoscopmodule.h:222
virtual ~CINOSCOPModule()
Destructor.
uint32 PutVariable(const char *apName, const char *apValue)
put variable in module tree
uint32 GetBlock16(uint32 auSource, uint16 *apDest, uint16 auNumber, uint32 auFlags=0)
get block of 16 bit values
uint32 PortPut32(uint16 auNumber, uint32 auValue)
put 32 bit value to cop module port
CINCOObject * GetInco()
get inco
Definition cinoscopmodule.h:240
virtual uint32 GetXmlCompressedSize()
get compressed size of xml description
uint32 PutBlock32(uint32 auDest, uint32 *apSource, uint16 auNumber, uint32 auFlags=0)
Write a number of 32 bit values.
uint32 PutBlock8(uint32 auDest, uint8 *apSource, uint16 auNumber, uint32 auFlags=0)
Write a number of 8 bit values.
void EnablePortCache()
Enable port cache.
uint32 PutVariable(const char *apName, real64 arValue)
put variable in module tree
void SetupPortCache(uint16 auNumber, uint8 auSize, const char *apType)
Check if given port needs to be cached.
uint32 GetBlock32(uint32 auSource, uint32 *apDest, uint16 auNumber, uint32 auFlags=0)
Read a number of 32 bit values.
bool IsRamLittleEndian()
Check if module ram is little endian.
Definition cinoscopmodule.h:255
uint32 PortPut16(uint16 auNumber, uint16 auValue)
put 16 bit value to cop module port
Struct for the COP module board info data.
Definition cinoscopmodule.h:121
char m_cCardName[24]
card name
Definition cinoscopmodule.h:132
uint8 m_uDataOffset
data offset
Definition cinoscopmodule.h:126
uint32 m_uSeriesNumber
series number
Definition cinoscopmodule.h:140
uint32 m_uOptions
options
Definition cinoscopmodule.h:142
uint32 m_uWorkNumber
work number
Definition cinoscopmodule.h:136
char m_cRevision[4]
revision
Definition cinoscopmodule.h:134
uint8 m_uChecksum
check sum
Definition cinoscopmodule.h:124
uint16 m_uVersion
structure revision
Definition cinoscopmodule.h:128
uint64 m_uMacNumber
mac number
Definition cinoscopmodule.h:138
uint32 m_uCardNumber
card number
Definition cinoscopmodule.h:130
Struct of the eeprom data of a COP module.
Definition cinoscopmodule.h:174
DECLARE_DYNAMIC(SINOSCOPModuleEeprom)
Support dynamic object handling.
void SetChecksum()
Insert checksum into structure.
bool ChecksumOk()
Return true if internal checksum is ok.
uint8 m_uReserved[8]
reserved
Definition cinoscopmodule.h:176
void Clear()
Clear data so checksum becomes invalid.
uint8 GetChecksum(uint32 auLength)
Calculate checksum.
uint8 m_uData[1024-64]
Start of data (pointed to by DataOffset).
Definition cinoscopmodule.h:183
Struct with data describing a COP module.
Definition cinoscopmodule.h:91
inosName32 m_cName
module name (modname.subname)
Definition cinoscopmodule.h:97
uint32 m_uAddress
module address
Definition cinoscopmodule.h:99
uint32 m_uEepromSize
eeprom size
Definition cinoscopmodule.h:101
char m_cProductCode[16]
required product code (e.g. 6108386xx) or empty if don't care
Definition cinoscopmodule.h:108
uint32 m_uOptions
module options (Bit 0=1 -> only use sub module name for process image
Definition cinoscopmodule.h:104
char m_cRevision[16]
required revision (e.g. 0x000001xx) or empty if don't care
Definition cinoscopmodule.h:110
DECLARE_DYNAMIC(SINOSCOPModule)
Support dynamic object handling.
uint32 m_uVendorId
vendor id (0x00000000-indel, 0x80000000-custom)
Definition cinoscopmodule.h:106