Example #1
0
 def gen_cFile(self):
     fp = open(os.path.join(ModuleObj.get_genPath(), self.__fileName), 'w')
     gen_str = ''
     gen_str += ModuleObj.writeComment()
     gen_str += self.fill_cFile()
     fp.write(gen_str)
     fp.close()
Example #2
0
    def get_cfgInfo(self):
        cp = configparser.ConfigParser(allow_no_value=True)
        cp.read(ModuleObj.get_cmpPath())

        PmicData._var_list = cp.options('APPLICATION')

        if self.__chipName == '':
            return
        #parse the pmic config file
        cmpPath = os.path.join(sys.path[0], 'config', self.__chipName + '.cmp')
        if not os.path.exists(cmpPath) or not os.path.isfile(cmpPath):
            log(LogLevel.error,
                'Can not find %s pmic config file!' % (self.__chipName))
            sys.exit(-1)
        cp.read(cmpPath)
        self.__defLdo = cp.get('PMIC_TABLE', 'LDO_APPNAME_DEFAULT')
        self.__headerList = cp.get('PMIC_TABLE', 'INCLUDE_HEADER').split(':')
        self.__func = cp.get('PMIC_TABLE', 'FUNCTION')

        for i in range(1, cp.getint('PMIC_TABLE', 'NUM_LDO') + 1):
            key = 'LDO_NAME%d' % (i)
            self.__paraList.append(cp.get(key, 'PARAMETER_NAME'))

        #parse app count in fig file
        cp.read(ModuleObj.get_chipId() + '.fig')

        cp.read(ModuleObj.get_figPath())
        self.__appCount = cp.getint('Chip Type', 'PMIC_APP_COUNT')
Example #3
0
    def read(self, node):
        nodes = node.childNodes

        for node in nodes:
            if node.nodeType == xml.dom.Node.ELEMENT_NODE:
                if cmp(node.nodeName, 'count') == 0:
                    self.__count = node.childNodes[0].nodeValue
                    continue

                varNode = node.getElementsByTagName('varName')
                detNode = node.getElementsByTagName('debounce_time')
                polNode = node.getElementsByTagName('polarity')
                senNode = node.getElementsByTagName('sensitive_level')
                deeNode = node.getElementsByTagName('debounce_en')

                data = EintData()
                if len(varNode):
                    data.set_varName(varNode[0].childNodes[0].nodeValue)

                if len(detNode):
                    data.set_debounceTime(detNode[0].childNodes[0].nodeValue)

                if len(polNode):
                    data.set_polarity(polNode[0].childNodes[0].nodeValue)

                if len(senNode):
                    data.set_sensitiveLevel(senNode[0].childNodes[0].nodeValue)

                if len(deeNode):
                    data.set_debounceEnable(deeNode[0].childNodes[0].nodeValue)

                ModuleObj.set_data(self, node.nodeName, data)

        return True
Example #4
0
    def read(self, node):
        nodes = node.childNodes
        for node in nodes:
            if node.nodeType == xml.dom.Node.ELEMENT_NODE:
                if node.nodeName == 'count':
                    continue

                varNode = node.getElementsByTagName('varName')
                curNode = node.getElementsByTagName('current')

                key = re.findall(
                    r'\D+',
                    node.nodeName)[0].upper() + self.__suffix + '%s' % (
                        re.findall(r'\d+', node.nodeName)[0])

                if key not in ModuleObj.get_data(self):
                    continue

                data = ModuleObj.get_data(self)[key]

                if len(varNode):
                    data.set_varName(varNode[0].childNodes[0].nodeValue)

                if len(curNode):
                    data.set_current(curNode[0].childNodes[0].nodeValue)

                ModuleObj.set_data(self, key, data)

        return True
Example #5
0
    def fill_dtsiFile(self):
        gen_str = '''#include <dt-bindings/interrupt-controller/irq.h>\n'''
        gen_str += '''#include <dt-bindings/interrupt-controller/arm-gic.h>\n'''
        gen_str += '''\n'''

        gen_str += self.fill_mappingTable()

        sorted_list = sorted(ModuleObj.get_data(self).keys(), key=compare)

        for key in sorted_list:
            value = ModuleObj.get_data(self)[key]
            gen_str += '''&%s {\n''' %(value.get_varName().lower())
            gen_str += '''\tinterrupt-parent = <&eintc>;\n'''

            temp = ''
            polarity = value.get_polarity()
            sensitive = value.get_sensitiveLevel()

            if cmp(polarity, 'High') == 0 and cmp(sensitive, 'Edge') == 0:
                temp = 'IRQ_TYPE_EDGE_RISING'
            elif cmp(polarity, 'Low') == 0 and cmp(sensitive, 'Edge') == 0:
                temp = 'IRQ_TYPE_EDGE_FALLING'
            elif cmp(polarity, 'High') == 0 and cmp(sensitive, 'Level') == 0:
                temp = 'IRQ_TYPE_LEVEL_HIGH'
            elif cmp(polarity, 'Low') == 0 and cmp(sensitive, 'Level') == 0:
                temp = 'IRQ_TYPE_LEVEL_LOW'

            gen_str += '''\tinterrupts = <%s %s>;\n''' %(self.refGpio(key[4:], True)[0], temp)
            gen_str += '''\tdebounce = <%s %d>;\n''' %(self.refGpio(key[4:], True)[0], string.atoi(value.get_debounceTime()) * 1000)
            gen_str += '''\tstatus = \"okay\";\n'''
            gen_str += '''};\n'''
            gen_str += '''\n'''

        return gen_str
Example #6
0
    def fill_dtsiFile(self):
        gen_str = '''&auxadc {\n'''
        gen_str += '''\tadc_channel@ {\n'''
        gen_str += '''\t\tcompatible = "mediatek,adc_channel";\n'''

        val = -1

        # sort by the key, or the sequence is dissorted
        #sorted_list = sorted(ModuleObj.get_data(self).keys())
        for key in sorted_key(ModuleObj.get_data(self).keys()):
            value = ModuleObj.get_data(self)[key]

            if value == "TEMPERATURE":
                gen_str += '''\t\tmediatek,%s0 = <%d>;\n''' % (
                    value.lower(), string.atoi(key[3:]))
            else:
                gen_str += '''\t\tmediatek,%s = <%d>;\n''' % (
                    value.lower(), string.atoi(key[3:]))

            if value == "ADC_FDD_RF_PARAMS_DYNAMIC_CUSTOM_CH":
                val = string.atoi(key[3:])

        gen_str += '''\t\tstatus = \"okay\";\n'''
        gen_str += '''\t};\n'''
        gen_str += '''};\n'''

        gen_str += self.fill_extraNode(val)

        return gen_str
Example #7
0
    def fill_pinctrl_hFile(self):
        gen_str = '''#include <linux/pinctrl/pinctrl.h>\n'''
        gen_str += '''#include <pinctrl-mtk-common.h>\n\n'''
        gen_str += '''static const struct mtk_desc_pin mtk_pins_%s[] = {\n''' % (
            ModuleObj.get_chipId().lower())

        #sorted_list = sorted(ModuleObj.get_data(self).keys(), key = compare)
        for key in sorted_key(list(ModuleObj.get_data(self).keys())):
            #for key in sorted_list:
            value = ModuleObj.get_data(self)[key]
            gen_str += '''\tMTK_PIN(\n'''
            gen_str += '''\t\tPINCTRL_PIN(%s, \"%s\"),\n''' % (key[4:],
                                                               key.upper())
            gen_str += '''\t\tNULL, \"%s\",\n''' % (
                ModuleObj.get_chipId().lower())
            gen_str += '''\t\tMTK_EINT_FUNCTION(NO_EINT_SUPPORT, NO_EINT_SUPPORT)'''
            for i in range(0, GpioData._modNum):
                mode_name = GpioData.get_modeName(key, i)

                if mode_name != '':
                    lst = []
                    if mode_name.find('//') != -1:
                        lst = mode_name.split('//')
                    else:
                        lst.append(mode_name)
                    for j in range(0, len(lst)):
                        gen_str += ''',\n\t\tMTK_FUNCTION(%d, "%s")''' % (
                            i + j * 8, lst[j])
            gen_str += '''\n\t),\n'''

        gen_str += '''};\n'''

        return gen_str
Example #8
0
    def parse(self):
        if not os.path.exists(self.__path):
            msg = '%s is not a available path!' % (self.__path)
            log(LogLevel.error, msg)
            return False

        data = xml.dom.minidom.parse(self.__path)

        root = data.documentElement
        # get 'general' node
        node = root.getElementsByTagName('general')
        # get chip name and project name
        ModuleObj.set_chipId(node[0].getAttribute('chip'))

        msg = 'Chip ID : %s' % (node[0].getAttribute('chip'))
        log(LogLevel.info, msg)
        msg = 'Project Info: %s' % (
            node[0].getElementsByTagName('proj')[0].childNodes[0].nodeValue)
        log(LogLevel.info, msg)

        # initialize the objects mapping table
        self.init_objs()
        # get module nodes from DWS file
        nodes = node[0].getElementsByTagName('module')

        for node in nodes:
            tag = node.getAttribute('name')
            obj = self.create_obj(tag)
            if obj == None:
                msg = 'can not find %s node in DWS!' % (tag)
                log(LogLevel.error, msg)
                return False
            obj.parse(node)

        return True
Example #9
0
    def get_cfgInfo(self):
        cp = configparser.ConfigParser(allow_no_value=True)
        cp.read(ModuleObj.get_cmpPath())

        # get GPIO_FREQ section
        keys = cp.options('GPIO_FREQ')
        for key in keys:
            value = cp.get('GPIO_FREQ', key)
            GpioData._freqMap[key] = value

        # get GPIO_MODE section
        keys = cp.options('GPIO_MODE')
        for key in keys:
            value = cp.get('GPIO_MODE', key)
            GpioData._specMap[key] = value

        GpioData._mapList = cp.options('GPIO_VARIABLES_MAPPING')

        cp.read(ModuleObj.get_figPath())
        ops = cp.options('GPIO')
        for op in ops:
            value = cp.get('GPIO', op)
            list = re.split(r' +|\t+', value)
            tmp_list = list[0:len(list) - 2]
            temp = []
            for item in tmp_list:
                str = item[6:len(item) - 1]
                temp.append(str)
            GpioData._modeMap[op] = temp

            data = GpioData()
            data.set_smtNum(string.atoi(list[len(list) - 1]))
            ModuleObj.set_data(self, op.lower(), data)
Example #10
0
 def gen_mapDtsi(self):
     gen_str = ''
     fp = open(os.path.join(ModuleObj.get_genPath(), self.__fileMap), 'w')
     gen_str += ModuleObj.writeComment()
     gen_str += self.fill_mapping_dtsiFile()
     fp.write(gen_str)
     fp.close()
Example #11
0
 def __init__(self):
     ModuleObj.__init__(self, 'pmic_drv.h', 'cust_pmic.dtsi')
     self.__fileName = 'pmic_drv.c'
     self.__chipName = ''
     self.__defLdo = ''
     self.__appCount = -1
     self.__func = ''
     self.__paraList = []
     self.__headerList = []
    def fill_hFile(self):
        gen_str = ''
        sorted_list = sorted(ModuleObj.get_data(self).keys())

        for key in sorted_list:
            value = ModuleObj.get_data(self)[key]
            gen_str += '''#define AUXADC_%s_CHANNEL\t\t\t%s\n''' %(value.upper(), key[3:])

        return gen_str
Example #13
0
 def __init__(self):
     ModuleObj.__init__(self, 'cust_gpio_boot.h', 'cust_gpio.dtsi')
     self.__fileName = 'cust_gpio_usage.h'
     self.__filePinfunc = '%s-pinfunc.h' % (ModuleObj.get_chipId().lower())
     self.__filePinCtrl = 'pinctrl-mtk-%s.h' % (
         ModuleObj.get_chipId().lower())
     self.__fileScp = 'cust_scp_gpio_usage.h'
     self.__fileMap = 'cust_gpio_usage_mapping.dtsi'
     self.__drvCur = False
Example #14
0
 def gen_scpUsage(self):
     gen_str = ''
     fp = open(os.path.join(ModuleObj.get_genPath(), self.__fileScp), 'w')
     gen_str += ModuleObj.writeComment()
     gen_str += ModuleObj.writeHeader(self.__fileScp)
     gen_str += self.fill_cFile()
     gen_str += ModuleObj.writeTail(self.__fileScp)
     fp.write(gen_str)
     fp.close()
Example #15
0
 def gen_pinCtrl(self):
     gen_str = ''
     fp = open(os.path.join(ModuleObj.get_genPath(), self.__filePinCtrl),
               'w')
     gen_str += ModuleObj.writeComment()
     gen_str += ModuleObj.writeHeader(self.__filePinCtrl)
     gen_str += self.fill_pinctrl_hFile()
     gen_str += ModuleObj.writeTail(self.__filePinCtrl)
     fp.write(gen_str)
     fp.close()
Example #16
0
    def fill_hFile(self):
        gen_str = ''
        gen_str += '''#ifdef __cplusplus\n'''
        gen_str += '''extern \"C\" {\n'''
        gen_str += '''#endif\n'''

        gen_str += '''#define CUST_EINTF_TRIGGER_RISING\t\t\t1\n'''
        gen_str += '''#define CUST_EINTF_TRIGGER_FALLING\t\t\t2\n'''
        gen_str += '''#define CUST_EINTF_TRIGGER_HIGH\t\t\t4\n'''
        gen_str += '''#define CUST_EINTF_TRIGGER_LOW\t\t\t8\n'''

        gen_str += '''#define CUST_EINT_DEBOUNCE_DISABLE\t\t\t0\n'''
        gen_str += '''#define CUST_EINT_DEBOUNCE_ENABLE\t\t\t1\n'''

        gen_str += '''\n\n'''

        sorted_list = sorted(list(ModuleObj.get_data(self).keys()),
                             key=compare)

        for key in sorted_list:
            value = ModuleObj.get_data(self)[key]
            gen_str += '''#define CUST_EINT_%s_NUM\t\t\t%s\n''' % (
                value.get_varName().upper(), key[4:])
            gen_str += '''#define CUST_EINT_%s_DEBOUNCE_CN\t\t%s\n''' % (
                value.get_varName().upper(), value.get_debounceTime())

            temp = ''
            polarity = value.get_polarity()
            sensitive = value.get_sensitiveLevel()

            if cmp(polarity, 'High') == 0 and cmp(sensitive, 'Edge') == 0:
                temp = 'CUST_EINTF_TRIGGER_RISING'
            elif cmp(polarity, 'Low') == 0 and cmp(sensitive, 'Edge') == 0:
                temp = 'CUST_EINTF_TRIGGER_FALLING'
            elif cmp(polarity, 'High') == 0 and cmp(sensitive, 'Level') == 0:
                temp = 'CUST_EINTF_TRIGGER_HIGH'
            elif cmp(polarity, 'Low') == 0 and cmp(sensitive, 'Level') == 0:
                temp = 'CUST_EINTF_TRIGGER_LOW'

            gen_str += '''#define CUST_EINT_%s_TYPE\t\t\t%s\n''' % (
                value.get_varName().upper(), temp)

            temp = ''
            if cmp(value.get_debounceEnable(), 'Disable') == 0:
                temp = 'CUST_EINT_DEBOUNCE_DISABLE'
            elif cmp(value.get_debounceEnable(), 'Enable') == 0:
                temp = 'CUST_EINT_DEBOUNCE_ENABLE'
            gen_str += '''#define CUST_EINT_%s_DEBOUNCE_EN\t\t%s\n\n''' % (
                value.get_varName().upper(), temp)

        gen_str += '''#ifdef __cplusplus\n'''
        gen_str += '''}\n'''
        gen_str += '''#endif\n'''

        return gen_str
Example #17
0
    def fill_hFile(self):
        gen_str = ''
        for key in sorted_key(list(ModuleObj.get_data(self).keys())):
            value = ModuleObj.get_data(self)[key]
            if value.get_varName() == '':
                continue
            idx = string.atoi(key[5:])
            name = self.__list[idx]
            gen_str += '''#define GPIO_%s\t\tGPIO_%s\n''' % (
                name.upper(), value.get_varName())

        return gen_str
Example #18
0
    def fill_mapping_dtsiFile(self):
        gen_str = '''&gpio_usage_mapping {\n'''

        #sorted_list = sorted(ModuleObj.get_data(self).keys(), key = compare)
        for key in sorted_key(list(ModuleObj.get_data(self).keys())):
            #for key in sorted_list:
            value = ModuleObj.get_data(self)[key]
            for varName in value.get_varNames():
                if varName != '' and varName.lower() in GpioData._mapList:
                    gen_str += '''\t%s = <&pio %s 0>;\n''' % (varName, key[4:])

        gen_str += '''};\n'''
        return gen_str
Example #19
0
    def read(self, node):
        nodes = node.childNodes
        for node in nodes:
            if node.nodeType == xml.dom.Node.ELEMENT_NODE:
                if node.nodeName == 'count':
                    continue

                varNode = node.getElementsByTagName('varName')

                data = PowerData()
                data.set_varName(varNode[0].childNodes[0].nodeValue)

                ModuleObj.set_data(self, node.nodeName, data)

        return True
Example #20
0
    def getCfgInfo(self):
        cp = configparser.ConfigParser(allow_no_value=True)
        cp.read(ModuleObj.get_figPath())

        self.__list = cp.options('POWER')
        self.__list = self.__list[1:]
        self.__list = sorted(self.__list)
    def read(self, node):
        nodes = node.childNodes
        try:
            for node in nodes:
                if node.nodeType == xml.dom.Node.ELEMENT_NODE:
                    if node.nodeName == 'count':
                        count = node.childNodes[0].nodeValue
                        continue
                    subNode = node.getElementsByTagName('varName')
                    if len(subNode):
                        ModuleObj.set_data(self, node.nodeName, subNode[0].childNodes[0].nodeValue)
        except:
            msg = 'read adc content fail!'
            log(LogLevel.error, msg)
            return False

        return True
Example #22
0
    def read(self, node):
        nodes = node.childNodes
        try:
            for node in nodes:
                if node.nodeType == xml.dom.Node.ELEMENT_NODE:
                    if cmp(node.nodeName, 'count') == 0:
                        self.__count = node.childNodes[0].nodeValue
                        continue

                    varNode = node.getElementsByTagName('varName')
                    detNode = node.getElementsByTagName('debounce_time')
                    polNode = node.getElementsByTagName('polarity')
                    senNode = node.getElementsByTagName('sensitive_level')
                    deeNode = node.getElementsByTagName('debounce_en')
                    dedNode = node.getElementsByTagName('dedicated_en')
                    srcNode = node.getElementsByTagName('srcPin')
                    sktNode = node.getElementsByTagName('socketType')

                    data = Md1EintData()
                    if len(varNode):
                        data.set_varName(varNode[0].childNodes[0].nodeValue)
                    if len(detNode):
                        data.set_debounceTime(detNode[0].childNodes[0].nodeValue)
                    if len(polNode):
                        data.set_polarity(polNode[0].childNodes[0].nodeValue)
                    if len(senNode):
                        data.set_sensitiveLevel(senNode[0].childNodes[0].nodeValue)
                    if len(deeNode):
                        data.set_debounceEnable(deeNode[0].childNodes[0].nodeValue)
                    if len(dedNode):
                        data.set_dedicatedEn(dedNode[0].childNodes[0].nodeValue)
                    if len(srcNode) and len(srcNode[0].childNodes):
                        data.set_srcPin(srcNode[0].childNodes[0].nodeValue)
                    if len(sktNode) and len(sktNode[0].childNodes):
                        data.set_socketType(sktNode[0].childNodes[0].nodeValue)

                    ModuleObj.set_data(self, node.nodeName, data)
        except:
            msg = 'read md1_eint content fail!'
            util.log(LogLevel.error, msg)
            return False

        return True
Example #23
0
    def fill_hFile(self):
        gen_str = '''typedef enum {\n'''
        gen_str += '''\tCLOCK_BUFFER_DISABLE,\n'''
        gen_str += '''\tCLOCK_BUFFER_SW_CONTROL,\n'''
        gen_str += '''\tCLOCK_BUFFER_HW_CONTROL\n'''
        gen_str += '''} MTK_CLK_BUF_STATUS;\n'''
        gen_str += '''\n'''

        gen_str += '''typedef enum {\n'''
        gen_str += '''\tCLK_BUF_DRIVING_CURR_AUTO_K = -1,\n'''
        gen_str += '''\tCLK_BUF_DRIVING_CURR_0,\n'''
        gen_str += '''\tCLK_BUF_DRIVING_CURR_1,\n'''
        gen_str += '''\tCLK_BUF_DRIVING_CURR_2,\n'''
        gen_str += '''\tCLK_BUF_DRIVING_CURR_3\n'''
        gen_str += '''} MTK_CLK_BUF_DRIVING_CURR;\n'''
        gen_str += '''\n'''

        for key in sorted_key(list(ModuleObj.get_data(self).keys())):
            value = ModuleObj.get_data(self)[key]
            if key.find('RF') != -1:
                gen_str += '''#define %s_STATUS\t\t\t\tCLOCK_BUFFER_%s\n''' % (
                    key[3:], value.get_varName())

        gen_str += '''\n'''

        for key in sorted_key(list(ModuleObj.get_data(self).keys())):
            if key.find('RF') != -1:
                continue
            value = ModuleObj.get_data(self)[key]
            idx = value.get_curList().index(value.get_current())
            if cmp(value.get_curList()[0], DEFAULT_AUTOK) == 0:
                idx -= 1

            if idx >= 0:
                gen_str += '''#define %s_DRIVING_CURR\t\tCLK_BUF_DRIVING_CURR_%d\n''' % (
                    key, idx)
            else:
                gen_str += '''#define %s_DRIVING_CURR\t\tCLK_BUF_DRIVING_CURR_AUTO_K\n''' % (
                    key)

        gen_str += '''\n'''

        return gen_str
Example #24
0
    def fill_cFile(self):
        gen_str = ''
        for header in self.__headerList:
            gen_str += '''#include <%s>\n''' % (header)

        gen_str += '''\n'''
        gen_str += '''void pmu_drv_tool_customization_init(void)\n'''
        gen_str += '''{\n'''
        idx = 0

        for key in sorted_key(list(ModuleObj.get_data(self).keys())):
            value = ModuleObj.get_data(self)[key]
            if value.get_defEnable() != 0:
                gen_str += '''\t%s(%s,%d);\n''' % (self.__func,
                                                   self.__paraList[idx],
                                                   value.get_defEnable() - 1)
            idx += 1
        gen_str += '''}\n'''

        return gen_str
Example #25
0
    def fill_dtsiFile(self):
        gen_str = '''&rf_clock_buffer_ctrl {\n'''
        gen_str += '''\tmediatek,clkbuf-quantity = <%d>;\n''' % (self.__count)
        gen_str += '''\tmediatek,clkbuf-config = <'''

        #sorted_list = sorted(ModuleObj.get_data(self).keys())
        for key in sorted_key(list(ModuleObj.get_data(self).keys())):
            if key.find('RF') == -1:
                continue
            value = ModuleObj.get_data(self)[key]
            gen_str += '''%d ''' % (ClkData._varList.index(
                value.get_varName()))

        gen_str = gen_str.rstrip()
        gen_str += '''>;\n'''

        gen_str += '''\tstatus = \"okay\";\n'''
        gen_str += '''};\n'''

        return gen_str
Example #26
0
    def get_cfgInfo(self):
        cp = configparser.ConfigParser(allow_no_value=True)
        cp.read(ModuleObj.get_cmpPath())

        ops = cp.options('Key_definition')
        for op in ops:
            KpdData._keyValueMap[op.upper()] = string.atoi(
                cp.get('Key_definition', op))

        KpdData._keyValueMap['NC'] = 0

        cp.read(ModuleObj.get_figPath())
        if cp.has_option('KEYPAD_EXTEND_TYPE', 'KEY_ROW'):
            KpdData.set_row_ext(
                string.atoi(cp.get('KEYPAD_EXTEND_TYPE', 'KEY_ROW')))
        if cp.has_option('KEYPAD_EXTEND_TYPE', 'KEY_COLUMN'):
            KpdData.set_col_ext(
                string.atoi(cp.get('KEYPAD_EXTEND_TYPE', 'KEY_COLUMN')))

        return True
Example #27
0
    def fill_dtsiFile(self):
        gen_str = '''&auxadc {\n'''
        gen_str += '''\tadc_channel@ {\n'''
        gen_str += '''\t\tcompatible = "mediatek,adc_channel";\n'''

        # sort by the key, or the sequence is dissorted
        #sorted_list = sorted(ModuleObj.get_data(self).keys())
        for key in sorted_key(ModuleObj.get_data(self).keys()):
            value = ModuleObj.get_data(self)[key]

            if value == "TEMPERATURE":
                gen_str += '''\t\tmediatek,%s0 = <%d>;\n''' %(value.lower(), string.atoi(key[3:]))
            else:
                gen_str += '''\t\tmediatek,%s = <%d>;\n''' %(value.lower(), string.atoi(key[3:]))

        gen_str += '''\t\tstatus = \"okay\";\n'''
        gen_str += '''\t};\n'''
        gen_str += '''};\n'''

        return gen_str
Example #28
0
    def fill_hFile(self):
        gen_str = ''
        gen_str += '''#define CUST_EINT_MD_LEVEL_SENSITIVE\t\t0\n'''
        gen_str += '''#define CUST_EINT_MD_EDGE_SENSITIVE\t\t1\n'''

        gen_str += '''\n'''

        if self.__bSrcPinEnable:
            for (key, value) in list(self.__srcPin.items()):
                gen_str += '''#define %s\t\t%s\n''' %(key, value)
            gen_str += '''\n'''

        gen_str += '''#define CUST_EINT_POLARITY_LOW\t\t0\n'''
        gen_str += '''#define CUST_EINT_POLARITY_HIGH\t\t1\n'''
        gen_str += '''\n'''

        gen_str += '''#define CUST_EINT_LEVEL_SENSITIVE\t\t0\n'''
        gen_str += '''#define CUST_EINT_EDGE_SENSITIVE\t\t1\n'''
        gen_str += '''\n'''

        count = 0
        for key in sorted_key(list(ModuleObj.get_data(self).keys())):
            value = ModuleObj.get_data(self)[key]
            if cmp(value.get_varName(), 'NC') == 0:
                continue
            num = key[4:]
            count += 1
            gen_str += '''#define CUST_EINT_MD1_%s_NAME\t\t\t"%s"\n''' %(num, value.get_varName())
            gen_str += '''#define CUST_EINT_MD1_%s_NUM\t\t\t%s\n''' %(num, num)
            gen_str += '''#define CUST_EINT_MD1_%s_DEBOUNCE_CN\t\t%s\n''' %(num, value.get_debounceTime())
            gen_str += '''#define CUST_EINT_MD1_%s_POLARITY\t\tCUST_EINT_POLARITY_%s\n''' %(num, value.get_polarity().upper())
            gen_str += '''#define CUST_EINT_MD1_%s_SENSITIVE\t\tCUST_EINT_MD_%s_SENSITIVE\n''' %(num, value.get_sensitiveLevel().upper())
            gen_str += '''#define CUST_EINT_MD1_%s_DEBOUNCE_EN\t\tCUST_EINT_DEBOUNCE_%s\n''' %(num, value.get_debounceEnable().upper())
            gen_str += '''#define CUST_EINT_MD1_%s_DEDICATED_EN\t\t%s\n''' %(num, int(value.get_dedicatedEn()))
            if self.__bSrcPinEnable:
                gen_str += '''#define CUST_EINT_MD1_%s_SRCPIN\t\t\t%s\n''' %(num, value.get_srcPin())
            gen_str += '''\n'''

        gen_str += '''#define CUST_EINT_MD1_CNT\t\t\t%d\n''' %(count)

        return gen_str
Example #29
0
    def fill_hFile(self):
        gen_str = ''
        used = []
        for key in sorted_key(list(ModuleObj.get_data(self).keys())):
            value = ModuleObj.get_data(self)[key]
            for name in value.get_nameList():
                if name.strip() != '':
                    used.append(name)
                    gen_str += '''#define PMIC_APP_%s\t\t\t%s_POWER_LDO_%s\n''' % (
                        name, self.__chipName[5:11], value.get_ldoName())

        gen_str += '''\n'''

        gen_str += '''/**********Output default name********************/\n'''

        for varName in PmicData._var_list:
            if not varName.upper() in used:
                gen_str += '''#define PMIC_APP_%s\t\t\t%s\n''' % (
                    varName.upper(), self.__defLdo)

        return gen_str
Example #30
0
    def read(self, node):
        nodes = node.childNodes
        for node in nodes:
            if node.nodeType == xml.dom.Node.ELEMENT_NODE:
                if cmp(node.nodeName, 'chip') == 0:
                    if len(node.childNodes) == 0:
                        break
                    self.__chipName = node.childNodes[0].nodeValue
                    continue
                if cmp(node.nodeName, 'count') == 0:
                    continue
                ldoNode = node.getElementsByTagName('ldoVar')
                defNode = node.getElementsByTagName('defEn')

                data = PmicData()
                if len(ldoNode):
                    data.set_ldoName(ldoNode[0].childNodes[0].nodeValue)

                if len(defNode):
                    number = -1
                    if cmp(defNode[0].childNodes[0].nodeValue, 'SKIP') == 0:
                        number = 0
                    elif cmp(defNode[0].childNodes[0].nodeValue, 'OFF') == 0:
                        number = 1
                    else:
                        number = 2
                    data.set_defEnable(number)

                name_list = []
                for i in range(0, 6):
                    key = 'varName%d' % (i)
                    nameNode = node.getElementsByTagName(key)
                    if len(nameNode):
                        name_list.append(nameNode[0].childNodes[0].nodeValue)

                data.set_nameList(name_list)

                ModuleObj.set_data(self, node.nodeName, data)

        return True