Subversion Repositories freemyipod

Rev

Rev 922 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 922 Rev 949
Line 105... Line 105...
105
        self.logger = logger
105
        self.logger = logger
106
        self.logger.debug("Initializing Emcore object\n")
106
        self.logger.debug("Initializing Emcore object\n")
107
        self.lib = Lib(self.logger)
107
        self.lib = Lib(self.logger)
108
        
108
        
109
        self.getversioninfo()
109
        self.getversioninfo()
110
        if self.lib.dev.swtypeid != 2:
110
        if self.lib.dev.swtypeid not in swtypes:
111
            raise DeviceError("Connected to unknown software type. Exiting")
111
            raise DeviceError("Connected to unknown software type. Exiting")
112
        
112
        
113
        self.getmallocpoolbounds()
113
        self.getmallocpoolbounds()
114
    
114
    
115
    @command()
115
    @command()
Line 142... Line 142...
142
        return resp
142
        return resp
143
    
143
    
144
    @command()
144
    @command()
145
    def getmallocpoolbounds(self):
145
    def getmallocpoolbounds(self):
146
        """ This returns the memory range of the malloc pool """
146
        """ This returns the memory range of the malloc pool """
-
 
147
        try:
147
        resp = self.lib.monitorcommand(struct.pack("<IIII", 1, 1, 0, 0), "III", ("lower", "upper", None))
148
            resp = self.lib.monitorcommand(struct.pack("<IIII", 1, 1, 0, 0), "III", ("lower", "upper", None))
148
        self.logger.debug("Malloc pool bounds = 0x%X - 0x%X\n" % (resp.lower, resp.upper))
149
            self.logger.debug("Malloc pool bounds = 0x%X - 0x%X\n" % (resp.lower, resp.upper))
149
        self.lib.dev.mallocpool.lower = resp.lower
150
            self.lib.dev.mallocpool.lower = resp.lower
150
        self.lib.dev.mallocpool.upper = resp.upper
151
            self.lib.dev.mallocpool.upper = resp.upper
-
 
152
            self.lib.dev.havemalloc = True
151
        return resp
153
            return resp
-
 
154
        except:
-
 
155
            self.logger.debug("Device doesn't have a memory allocator\n")
-
 
156
            self.lib.dev.havemalloc = True
-
 
157
            return None
152
    
158
    
153
    @command()
159
    @command()
154
    def reset(self, force=False):
160
    def reset(self, force=False):
155
        """ Reboot the device """
161
        """ Reboot the device """
156
        return self.lib.monitorcommand(struct.pack("<IIII", 2, 0 if force else 1, 0, 0))
162
        return self.lib.monitorcommand(struct.pack("<IIII", 2, 0 if force else 1, 0, 0))
Line 1075... Line 1081...
1075
        self.version.minorv = None
1081
        self.version.minorv = None
1076
        self.version.patchv = None
1082
        self.version.patchv = None
1077
        self.swtypeid = None
1083
        self.swtypeid = None
1078
        self.hwtypeid = None
1084
        self.hwtypeid = None
1079
        
1085
        
-
 
1086
        self.havemalloc = False
1080
        self.mallocpool = Bunch()
1087
        self.mallocpool = Bunch()
1081
        self.mallocpool.lower = None
1088
        self.mallocpool.lower = None
1082
        self.mallocpool.upper = None
1089
        self.mallocpool.upper = None
1083
    
1090
    
1084
    def __del__(self):
1091
    def __del__(self):