Skip to content

Instantly share code, notes, and snippets.

@mhubig
Created April 9, 2010 14:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhubig/361226 to your computer and use it in GitHub Desktop.
Save mhubig/361226 to your computer and use it in GitHub Desktop.
# -*- coding: mbcs -*-
# Created by makepy.py version 0.5.00
# By python version 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)]
# From type library 'Memtool.dll'
# On Fri Apr 09 15:43:58 2010
"""Infineon Memtool 1.0 Type Library"""
makepy_version = '0.5.00'
python_version = 0x20605f0
import win32com.client.CLSIDToClass, pythoncom, pywintypes
import win32com.client.util
from pywintypes import IID
from win32com.client import Dispatch
# The following 3 lines may need tweaking for the particular server
# Candidates are pythoncom.Missing, .Empty and .ArgNotFound
defaultNamedOptArg=pythoncom.Empty
defaultNamedNotOptArg=pythoncom.Empty
defaultUnnamedArg=pythoncom.Empty
CLSID = IID('{661A8816-7984-11D2-9C7F-006097804445}')
MajorVersion = 1
MinorVersion = 0
LibraryFlags = 8
LCID = 0x0
from win32com.client import DispatchBaseClass
class DISMTFlashMod(DispatchBaseClass):
"""DISMTFlashMod Interface"""
CLSID = IID('{661A8843-7984-11D2-9C7F-006097804445}')
coclass_clsid = IID('{661A8844-7984-11D2-9C7F-006097804445}')
def EraseChip(self):
"""method ChipErase"""
return self._oleobj_.InvokeTypes(7, LCID, 1, (24, 0), (),)
def EraseSector(self, Index=defaultNamedNotOptArg):
"""method SectorErase"""
return self._oleobj_.InvokeTypes(8, LCID, 1, (24, 0), ((3, 1),),Index
)
def ProgramSections(self):
"""method Program"""
return self._oleobj_.InvokeTypes(9, LCID, 1, (24, 0), (),)
def RemoveAllSections(self):
"""method RemoveAllSections"""
return self._oleobj_.InvokeTypes(14, LCID, 1, (24, 0), (),)
def ShowSetup(self):
"""method Setup"""
return self._oleobj_.InvokeTypes(13, LCID, 1, (24, 0), (),)
def VerifySections(self):
"""method Verify"""
return self._oleobj_.InvokeTypes(10, LCID, 1, (24, 0), (),)
_prop_map_get_ = {
"CanChipErase": (3, 2, (3, 0), (), "CanChipErase", None),
"CanProgram": (5, 2, (3, 0), (), "CanProgram", None),
"CanSectorErase": (4, 2, (3, 0), (), "CanSectorErase", None),
"CanVerify": (6, 2, (3, 0), (), "CanVerify", None),
"Description": (2, 2, (8, 0), (), "Description", None),
"Name": (1, 2, (8, 0), (), "Name", None),
"NumOfSections": (11, 2, (3, 0), (), "NumOfSections", None),
"NumOfSectors": (12, 2, (3, 0), (), "NumOfSectors", None),
}
_prop_map_put_ = {
}
class DISMTMemtool(DispatchBaseClass):
"""DISMTMemtool Interface"""
CLSID = IID('{661A883D-7984-11D2-9C7F-006097804445}')
coclass_clsid = IID('{661A883E-7984-11D2-9C7F-006097804445}')
def AddSelectedSections(self):
"""method AddSelectedSections"""
return self._oleobj_.InvokeTypes(20, LCID, 1, (24, 0), (),)
def Cleanup(self):
"""method Cleanup"""
return self._oleobj_.InvokeTypes(5, LCID, 1, (24, 0), (),)
def ConnectTarget(self):
"""method ConnectTarget"""
return self._oleobj_.InvokeTypes(10, LCID, 1, (24, 0), (),)
def DisconnectTarget(self):
"""method DisconnectTarget"""
return self._oleobj_.InvokeTypes(11, LCID, 1, (24, 0), (),)
def GetFlashModByIndex(self, Index=defaultNamedNotOptArg):
"""method GetFlashModByIndex"""
ret = self._oleobj_.InvokeTypes(8, LCID, 1, (9, 0), ((3, 1),),Index
)
if ret is not None:
ret = Dispatch(ret, u'GetFlashModByIndex', None)
return ret
def GetFlashModByName(self, Name=defaultNamedNotOptArg):
"""method GetFlashModByName"""
ret = self._oleobj_.InvokeTypes(9, LCID, 1, (9, 0), ((8, 1),),Name
)
if ret is not None:
#ret = Dispatch(ret, u'GetFlashModByName', None)
ret = Dispatch(ret, u'GetFlashModByName', '{661A8843-7984-11D2-9C7F-006097804445}')
return ret
def GetSectionSize(self, Index=defaultNamedNotOptArg):
"""method GetSectionSize"""
return self._oleobj_.InvokeTypes(15, LCID, 1, (3, 0), ((3, 1),),Index
)
def GetSectionStartAddr(self, Index=defaultNamedNotOptArg):
"""method GetSectionStartAddr"""
return self._oleobj_.InvokeTypes(14, LCID, 1, (3, 0), ((3, 1),),Index
)
def Init(self, TargInfoFile=defaultNamedNotOptArg):
"""method Init"""
return self._oleobj_.InvokeTypes(4, LCID, 1, (24, 0), ((8, 1),),TargInfoFile
)
def OpenFile(self, File=defaultNamedNotOptArg):
"""method OpenFile"""
return self._oleobj_.InvokeTypes(12, LCID, 1, (24, 0), ((8, 1),),File
)
def SelectAllSections(self):
"""method SelectAllSections"""
return self._oleobj_.InvokeTypes(16, LCID, 1, (24, 0), (),)
def SelectSection(self, Index=defaultNamedNotOptArg):
"""method SelectSection"""
return self._oleobj_.InvokeTypes(18, LCID, 1, (24, 0), ((3, 1),),Index
)
def ShowSetup(self):
"""method Setup"""
return self._oleobj_.InvokeTypes(6, LCID, 1, (24, 0), (),)
def UnselectAllSections(self):
"""method UnselectAllSections"""
return self._oleobj_.InvokeTypes(17, LCID, 1, (24, 0), (),)
def UnselectSection(self, Index=defaultNamedNotOptArg):
"""method UnselectSection"""
return self._oleobj_.InvokeTypes(19, LCID, 1, (24, 0), ((3, 1),),Index
)
_prop_map_get_ = {
"NumOfFlashMods": (7, 2, (3, 0), (), "NumOfFlashMods", None),
"NumOfSections": (13, 2, (3, 0), (), "NumOfSections", None),
"SerPort": (1, 2, (9, 0), (), "SerPort", None),
"TargInfo": (2, 2, (9, 0), (), "TargInfo", None),
"TargIntf": (3, 2, (9, 0), (), "TargIntf", None),
}
_prop_map_put_ = {
}
class DISMTSerPort(DispatchBaseClass):
"""DISMTSerPort Interface"""
CLSID = IID('{661A8840-7984-11D2-9C7F-006097804445}')
coclass_clsid = IID('{661A8841-7984-11D2-9C7F-006097804445}')
_prop_map_get_ = {
}
_prop_map_put_ = {
}
class DISMTTargInfo(DispatchBaseClass):
"""DISMTTargInfo Interface"""
CLSID = IID('{661A8846-7984-11D2-9C7F-006097804445}')
coclass_clsid = IID('{661A8847-7984-11D2-9C7F-006097804445}')
_prop_map_get_ = {
}
_prop_map_put_ = {
}
class DISMTTargIntf(DispatchBaseClass):
"""DISMTTargIntf Interface"""
CLSID = IID('{661A8848-7984-11D2-9C7F-006097804445}')
coclass_clsid = IID('{661A8849-7984-11D2-9C7F-006097804445}')
def ExecSpecialCmd(self, bstrCmd=defaultNamedNotOptArg):
"""method ExecSpecialCmd"""
return self._oleobj_.InvokeTypes(1, LCID, 1, (24, 0), ((8, 1),),bstrCmd
)
_prop_map_get_ = {
}
_prop_map_put_ = {
}
class _DSMTFlashModEvents:
"""_DSMTFlashModEvents Interface"""
CLSID = CLSID_Sink = IID('{766BC6B7-C322-484A-A508-97C1548AED50}')
coclass_clsid = IID('{661A8844-7984-11D2-9C7F-006097804445}')
_public_methods_ = [] # For COM Server support
_dispid_to_func_ = {
1 : "OnNextOperation",
2 : "OnProgressChanged",
}
def __init__(self, oobj = None):
if oobj is None:
self._olecp = None
else:
import win32com.server.util
from win32com.server.policy import EventHandlerPolicy
cpc=oobj._oleobj_.QueryInterface(pythoncom.IID_IConnectionPointContainer)
cp=cpc.FindConnectionPoint(self.CLSID_Sink)
cookie=cp.Advise(win32com.server.util.wrap(self, usePolicy=EventHandlerPolicy))
self._olecp,self._olecp_cookie = cp,cookie
def __del__(self):
try:
self.close()
except pythoncom.com_error:
pass
def close(self):
if self._olecp is not None:
cp,cookie,self._olecp,self._olecp_cookie = self._olecp,self._olecp_cookie,None,None
cp.Unadvise(cookie)
def _query_interface_(self, iid):
import win32com.server.util
if iid==self.CLSID_Sink: return win32com.server.util.wrap(self)
# Event Handlers
# If you create handlers, they should have the following prototypes:
# def OnNextOperation(self, Operation=defaultNamedNotOptArg):
# """event OnNextOperation"""
# def OnProgressChanged(self, Progress=defaultNamedNotOptArg):
# """event OnProgressChanged"""
from win32com.client import CoClassBaseClass
class SMTFlashMod(CoClassBaseClass): # A CoClass
# SMTFlashMod Class
CLSID = IID('{661A8844-7984-11D2-9C7F-006097804445}')
coclass_sources = [
_DSMTFlashModEvents,
]
default_source = _DSMTFlashModEvents
coclass_interfaces = [
DISMTFlashMod,
]
default_interface = DISMTFlashMod
# This CoClass is known by the name 'SMT.Memtool.1'
class SMTMemtool(CoClassBaseClass): # A CoClass
# SMTMemtool Class
CLSID = IID('{661A883E-7984-11D2-9C7F-006097804445}')
coclass_sources = [
]
coclass_interfaces = [
DISMTMemtool,
]
default_interface = DISMTMemtool
# This CoClass is known by the name 'SMT.SerPort.1'
class SMTSerPort(CoClassBaseClass): # A CoClass
# SMTSerPort Class
CLSID = IID('{661A8841-7984-11D2-9C7F-006097804445}')
coclass_sources = [
]
coclass_interfaces = [
DISMTSerPort,
]
default_interface = DISMTSerPort
# This CoClass is known by the name 'SMT.TargInfo.1'
class SMTTargInfo(CoClassBaseClass): # A CoClass
# SMTTargInfo Class
CLSID = IID('{661A8847-7984-11D2-9C7F-006097804445}')
coclass_sources = [
]
coclass_interfaces = [
DISMTTargInfo,
]
default_interface = DISMTTargInfo
# This CoClass is known by the name 'SMT.TargIntf.1'
class SMTTargIntf(CoClassBaseClass): # A CoClass
# SMTTargIntf Class
CLSID = IID('{661A8849-7984-11D2-9C7F-006097804445}')
coclass_sources = [
]
coclass_interfaces = [
DISMTTargIntf,
]
default_interface = DISMTTargIntf
DISMTFlashMod_vtables_dispatch_ = 1
DISMTFlashMod_vtables_ = [
(( u'Name' , u'pVal' , ), 1, (1, (), [ (16392, 10, None, None) , ], 1 , 2 , 4 , 0 , 28 , (3, 0, None, None) , 0 , )),
(( u'Description' , u'pVal' , ), 2, (2, (), [ (16392, 10, None, None) , ], 1 , 2 , 4 , 0 , 32 , (3, 0, None, None) , 0 , )),
(( u'CanChipErase' , u'pVal' , ), 3, (3, (), [ (16387, 10, None, None) , ], 1 , 2 , 4 , 0 , 36 , (3, 0, None, None) , 0 , )),
(( u'CanSectorErase' , u'pVal' , ), 4, (4, (), [ (16387, 10, None, None) , ], 1 , 2 , 4 , 0 , 40 , (3, 0, None, None) , 0 , )),
(( u'CanProgram' , u'pVal' , ), 5, (5, (), [ (16387, 10, None, None) , ], 1 , 2 , 4 , 0 , 44 , (3, 0, None, None) , 0 , )),
(( u'CanVerify' , u'pVal' , ), 6, (6, (), [ (16387, 10, None, None) , ], 1 , 2 , 4 , 0 , 48 , (3, 0, None, None) , 0 , )),
(( u'EraseChip' , ), 7, (7, (), [ ], 1 , 1 , 4 , 0 , 52 , (3, 0, None, None) , 0 , )),
(( u'EraseSector' , u'Index' , ), 8, (8, (), [ (3, 1, None, None) , ], 1 , 1 , 4 , 0 , 56 , (3, 0, None, None) , 0 , )),
(( u'ProgramSections' , ), 9, (9, (), [ ], 1 , 1 , 4 , 0 , 60 , (3, 0, None, None) , 0 , )),
(( u'VerifySections' , ), 10, (10, (), [ ], 1 , 1 , 4 , 0 , 64 , (3, 0, None, None) , 0 , )),
(( u'NumOfSections' , u'pVal' , ), 11, (11, (), [ (16387, 10, None, None) , ], 1 , 2 , 4 , 0 , 68 , (3, 0, None, None) , 0 , )),
(( u'NumOfSectors' , u'pVal' , ), 12, (12, (), [ (16387, 10, None, None) , ], 1 , 2 , 4 , 0 , 72 , (3, 0, None, None) , 0 , )),
(( u'ShowSetup' , ), 13, (13, (), [ ], 1 , 1 , 4 , 0 , 76 , (3, 0, None, None) , 0 , )),
(( u'RemoveAllSections' , ), 14, (14, (), [ ], 1 , 1 , 4 , 0 , 80 , (3, 0, None, None) , 0 , )),
]
DISMTMemtool_vtables_dispatch_ = 1
DISMTMemtool_vtables_ = [
(( u'SerPort' , u'pVal' , ), 1, (1, (), [ (16393, 10, None, None) , ], 1 , 2 , 4 , 0 , 28 , (3, 0, None, None) , 0 , )),
(( u'TargInfo' , u'pVal' , ), 2, (2, (), [ (16393, 10, None, None) , ], 1 , 2 , 4 , 0 , 32 , (3, 0, None, None) , 0 , )),
(( u'TargIntf' , u'pVal' , ), 3, (3, (), [ (16393, 10, None, None) , ], 1 , 2 , 4 , 0 , 36 , (3, 0, None, None) , 0 , )),
(( u'Init' , u'TargInfoFile' , ), 4, (4, (), [ (8, 1, None, None) , ], 1 , 1 , 4 , 0 , 40 , (3, 0, None, None) , 0 , )),
(( u'Cleanup' , ), 5, (5, (), [ ], 1 , 1 , 4 , 0 , 44 , (3, 0, None, None) , 0 , )),
(( u'ShowSetup' , ), 6, (6, (), [ ], 1 , 1 , 4 , 0 , 48 , (3, 0, None, None) , 0 , )),
(( u'NumOfFlashMods' , u'pVal' , ), 7, (7, (), [ (16387, 10, None, None) , ], 1 , 2 , 4 , 0 , 52 , (3, 0, None, None) , 0 , )),
(( u'GetFlashModByIndex' , u'Index' , u'pVal' , ), 8, (8, (), [ (3, 1, None, None) ,
(16393, 10, None, None) , ], 1 , 1 , 4 , 0 , 56 , (3, 0, None, None) , 0 , )),
(( u'GetFlashModByName' , u'Name' , u'pVal' , ), 9, (9, (), [ (8, 1, None, None) ,
(16393, 10, None, None) , ], 1 , 1 , 4 , 0 , 60 , (3, 0, None, None) , 0 , )),
(( u'ConnectTarget' , ), 10, (10, (), [ ], 1 , 1 , 4 , 0 , 64 , (3, 0, None, None) , 0 , )),
(( u'DisconnectTarget' , ), 11, (11, (), [ ], 1 , 1 , 4 , 0 , 68 , (3, 0, None, None) , 0 , )),
(( u'OpenFile' , u'File' , ), 12, (12, (), [ (8, 1, None, None) , ], 1 , 1 , 4 , 0 , 72 , (3, 0, None, None) , 0 , )),
(( u'NumOfSections' , u'pVal' , ), 13, (13, (), [ (16387, 10, None, None) , ], 1 , 2 , 4 , 0 , 76 , (3, 0, None, None) , 0 , )),
(( u'GetSectionStartAddr' , u'Index' , u'StartAddr' , ), 14, (14, (), [ (3, 1, None, None) ,
(16387, 10, None, None) , ], 1 , 1 , 4 , 0 , 80 , (3, 0, None, None) , 0 , )),
(( u'GetSectionSize' , u'Index' , u'Size' , ), 15, (15, (), [ (3, 1, None, None) ,
(16387, 10, None, None) , ], 1 , 1 , 4 , 0 , 84 , (3, 0, None, None) , 0 , )),
(( u'SelectAllSections' , ), 16, (16, (), [ ], 1 , 1 , 4 , 0 , 88 , (3, 0, None, None) , 0 , )),
(( u'UnselectAllSections' , ), 17, (17, (), [ ], 1 , 1 , 4 , 0 , 92 , (3, 0, None, None) , 0 , )),
(( u'SelectSection' , u'Index' , ), 18, (18, (), [ (3, 1, None, None) , ], 1 , 1 , 4 , 0 , 96 , (3, 0, None, None) , 0 , )),
(( u'UnselectSection' , u'Index' , ), 19, (19, (), [ (3, 1, None, None) , ], 1 , 1 , 4 , 0 , 100 , (3, 0, None, None) , 0 , )),
(( u'AddSelectedSections' , ), 20, (20, (), [ ], 1 , 1 , 4 , 0 , 104 , (3, 0, None, None) , 0 , )),
]
DISMTSerPort_vtables_dispatch_ = 1
DISMTSerPort_vtables_ = [
]
DISMTTargInfo_vtables_dispatch_ = 1
DISMTTargInfo_vtables_ = [
]
DISMTTargIntf_vtables_dispatch_ = 1
DISMTTargIntf_vtables_ = [
(( u'ExecSpecialCmd' , u'bstrCmd' , ), 1, (1, (), [ (8, 1, None, None) , ], 1 , 1 , 4 , 0 , 28 , (3, 0, None, None) , 0 , )),
]
RecordMap = {
}
CLSIDToClassMap = {
'{661A8849-7984-11D2-9C7F-006097804445}' : SMTTargIntf,
'{766BC6B7-C322-484A-A508-97C1548AED50}' : _DSMTFlashModEvents,
'{661A883D-7984-11D2-9C7F-006097804445}' : DISMTMemtool,
'{661A883E-7984-11D2-9C7F-006097804445}' : SMTMemtool,
'{661A8840-7984-11D2-9C7F-006097804445}' : DISMTSerPort,
'{661A8841-7984-11D2-9C7F-006097804445}' : SMTSerPort,
'{661A8843-7984-11D2-9C7F-006097804445}' : DISMTFlashMod,
'{661A8844-7984-11D2-9C7F-006097804445}' : SMTFlashMod,
'{661A8846-7984-11D2-9C7F-006097804445}' : DISMTTargInfo,
'{661A8847-7984-11D2-9C7F-006097804445}' : SMTTargInfo,
'{661A8848-7984-11D2-9C7F-006097804445}' : DISMTTargIntf,
}
CLSIDToPackageMap = {}
win32com.client.CLSIDToClass.RegisterCLSIDsFromDict( CLSIDToClassMap )
VTablesToPackageMap = {}
VTablesToClassMap = {
'{661A8843-7984-11D2-9C7F-006097804445}' : 'DISMTFlashMod',
'{661A8848-7984-11D2-9C7F-006097804445}' : 'DISMTTargIntf',
'{661A883D-7984-11D2-9C7F-006097804445}' : 'DISMTMemtool',
'{661A8846-7984-11D2-9C7F-006097804445}' : 'DISMTTargInfo',
'{661A8840-7984-11D2-9C7F-006097804445}' : 'DISMTSerPort',
}
NamesToIIDMap = {
'DISMTTargIntf' : '{661A8848-7984-11D2-9C7F-006097804445}',
'DISMTSerPort' : '{661A8840-7984-11D2-9C7F-006097804445}',
'_DSMTFlashModEvents' : '{766BC6B7-C322-484A-A508-97C1548AED50}',
'DISMTTargInfo' : '{661A8846-7984-11D2-9C7F-006097804445}',
'DISMTFlashMod' : '{661A8843-7984-11D2-9C7F-006097804445}',
'DISMTMemtool' : '{661A883D-7984-11D2-9C7F-006097804445}',
}
@DPastl
Copy link

DPastl commented Sep 30, 2019

Hey there! How did you make this file / how does one go about using it? I'm really interested in scripting use of the memtool.

@Pramod-SP
Copy link

Hi there, Please provide any reference document to understand this code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment