Esempio n. 1
0
    def setUp(self):
        self.s = Status()
        plat = ["", None, None]
        pscanner = PlatformScanner()
        platform_dict = pscanner.get_platforms()
        platform_names = platform_dict.keys()

        if "sim" in platform_names:
            #If sim is in the platforms, move it to the end
            platform_names.remove("sim")
            platform_names.append("sim")
        urn = None
        for platform_name in platform_names:
            if plat[1] is not None:
                break

            self.s.Debug("Platform: %s" % str(platform_name))

            platform_instance = platform_dict[platform_name](self.s)
            #self.s.Verbose("Platform Instance: %s" % str(platform_instance))

            instances_dict = platform_instance.scan()

            for name in instances_dict:

                #s.Verbose("Found Platform Item: %s" % str(platform_item))
                n = instances_dict[name]
                plat = ["", None, None]

                if n is not None:
                    self.s.Important("Found a nysa instance: %s" % name)
                    n.read_sdb()
                    #import pdb; pdb.set_trace()
                    if n.is_device_in_platform(DRIVER):
                        plat = [platform_name, name, n]
                        break
                    continue

                #self.s.Verbose("\t%s" % psi)

        if plat[1] is None:
            self.sd = None
            return
        n = plat[2]
        self.n = n
        sdio_urn = n.find_device(DRIVER)[0]
        self.sd = DRIVER(n, sdio_urn)
        sdio_urn = n.find_device(SDIODeviceDriver)[0]
        self.sdio = SDIODeviceDriver(n, sdio_urn)
        self.s.set_level("verbose")

        self.s.Info("Using Platform: %s" % plat[0])
Esempio n. 2
0
    def setUp(self):
        self.s = Status()
        plat = ["", None, None]
        pscanner = PlatformScanner()
        platform_dict = pscanner.get_platforms()
        platform_names = platform_dict.keys()

        if "sim" in platform_names:
            #If sim is in the platforms, move it to the end
            platform_names.remove("sim")
            platform_names.append("sim")
        urn = None
        for platform_name in platform_names:
            if plat[1] is not None:
                break

            self.s.Debug("Platform: %s" % str(platform_name))

            platform_instance = platform_dict[platform_name](self.s)
            #self.s.Verbose("Platform Instance: %s" % str(platform_instance))

            instances_dict = platform_instance.scan()

            for name in instances_dict:

                #s.Verbose("Found Platform Item: %s" % str(platform_item))
                n = instances_dict[name]
                plat = ["", None, None]

                if n is not None:
                    self.s.Important("Found a nysa instance: %s" % name)
                    n.read_sdb()
                    #import pdb; pdb.set_trace()
                    if n.is_device_in_platform(DRIVER):
                        plat = [platform_name, name, n]
                        break
                    continue

                #self.s.Verbose("\t%s" % psi)

        if plat[1] is None:
            self.sd = None
            return
        n = plat[2]
        self.n = n
        sdio_urn = n.find_device(DRIVER)[0]
        self.sd = DRIVER(n, sdio_urn)
        sdio_urn = n.find_device(SDIODeviceDriver)[0]
        self.sdio = SDIODeviceDriver(n, sdio_urn)
        self.s.set_level("verbose")

        self.s.Info("Using Platform: %s" % plat[0])
Esempio n. 3
0
class Test(unittest.TestCase):
    def setUp(self):
        self.s = Status()
        plat = ["", None, None]
        pscanner = PlatformScanner()
        platform_dict = pscanner.get_platforms()
        platform_names = platform_dict.keys()

        if "sim" in platform_names:
            #If sim is in the platforms, move it to the end
            platform_names.remove("sim")
            platform_names.append("sim")
        urn = None
        for platform_name in platform_names:
            if plat[1] is not None:
                break

            self.s.Debug("Platform: %s" % str(platform_name))

            platform_instance = platform_dict[platform_name](self.s)
            #self.s.Verbose("Platform Instance: %s" % str(platform_instance))

            instances_dict = platform_instance.scan()

            for name in instances_dict:

                #s.Verbose("Found Platform Item: %s" % str(platform_item))
                n = instances_dict[name]
                plat = ["", None, None]

                if n is not None:
                    self.s.Important("Found a nysa instance: %s" % name)
                    n.read_sdb()
                    #import pdb; pdb.set_trace()
                    if n.is_device_in_platform(DRIVER):
                        plat = [platform_name, name, n]
                        break
                    continue

                #self.s.Verbose("\t%s" % psi)

        if plat[1] is None:
            self.sd = None
            return
        n = plat[2]
        self.n = n
        sdio_urn = n.find_device(DRIVER)[0]
        self.sd = DRIVER(n, sdio_urn)
        sdio_urn = n.find_device(SDIODeviceDriver)[0]
        self.sdio = SDIODeviceDriver(n, sdio_urn)
        self.s.set_level("verbose")

        self.s.Info("Using Platform: %s" % plat[0])

    def test_sd_host_sdio(self):
        #self.s.Info("Host Control:\t\t0x%08X" % self.sd.get_control())
        self.sd.display_control()
        self.s.Info("Device Control:\t\t0x%08X" % self.sdio.get_control())
        self.s.Info("Delay: 0x%02X" % self.sd.get_input_delay())
        sd_host_input_delay_value = 63
        self.s.Info("Set host input delay to %d ( 0x%02X )" %
                    (sd_host_input_delay_value, sd_host_input_delay_value))
        self.sd.set_input_delay(sd_host_input_delay_value)
        self.s.Info("Delay: 0x%02X" % self.sd.get_input_delay())

        self.sdio.enable_sdio_device(False)
        self.sdio.reset_core()

        sdio_input_delay_value = 0
        self.s.Info("Delay: 0x%02X" % self.sdio.get_input_delay())
        self.s.Info("Set Input delay to %d ( 0x%02X )" %
                    (sdio_input_delay_value, sdio_input_delay_value))
        self.sdio.set_input_delay(sdio_input_delay_value)
        self.s.Info("Delay: 0x%02X" % self.sdio.get_input_delay())

        self.sdio.enable_sdio_device(True)
        #self.s.Info("Host Status:\t\t0x%08X" % self.sd.get_status())
        self.sd.display_status()
        self.s.Info("Device Control:\t\t0x%08X" % self.sdio.get_control())
        self.s.Info("Device Status:\t\t0x%08X" % self.sdio.get_status())
        self.s.Info("Host Attempting to set voltage range")
        self.sd.set_voltage_range(2.0, 3.6)
        self.s.Info("Host Enable SD Host")
        self.sd.enable_sd_host(True)

        self.s.Verbose("Setting Phy Select... should be no response")
        self.sdio.display_control()
        self.sdio.display_status()
        self.sd.cmd_phy_sel()
        self.sd.display_crcs()
        self.sdio.display_crcs()

        self.s.Verbose("Phy State should be 0x00")
        self.s.Info("SD Command:\t\t0x%08X" % self.sdio.get_sd_cmd())
        self.s.Info("Host Control:\t\t0x%08X" % self.sd.get_control())

        try:
            self.s.Verbose("Send Command 5")
            self.sd.cmd_io_send_op_cond(enable_1p8v=True)
            #self.sd.display_crcs()
            #self.sdio.display_crcs()
            #self.s.Info("SD Command:\t\t0x%08X" % self.sdio.get_sd_cmd())
            #self.s.Info("SD Command Arg:\t\t0x%08X" % self.sdio.get_sd_cmd_arg())
            #self.s.Info("Response Value:\t\t0x%0X" % self.sd.read_response())

            self.s.Verbose("Get Relative Address")
            self.sd.cmd_get_relative_card_address()
            #self.sd.display_crcs()
            #self.sdio.display_crcs()
            #self.s.Info("SD Command:\t\t0x%08X" % self.sdio.get_sd_cmd())
            #self.s.Info("SD Command Arg:\t\t0x%08X" % self.sdio.get_sd_cmd_arg())
            #self.s.Info("Response Value:\t\t0x%0X" % self.sd.read_response())

            self.s.Verbose("Enable Card")
            self.sd.cmd_enable_card(True)
            #self.sd.display_crcs()
            #self.sdio.display_crcs()

            self.s.Verbose("Read a configuration byte")
            value = self.sd.read_config_byte(0x00)
            # self.sd.display_crcs()
            # self.sdio.display_crcs()
            self.s.Important("Read Value: 0x%02X" % value)

        except SDHostException as e:
            self.s.Error("Failed data transfer!: %s" % str(e))
        '''
        self.sd.display_control()
        self.sd.display_status()
        self.sdio.display_status()
        self.s.Info("Clock Count:\t\t0x%08X" % self.sdio.get_clock_count())
        '''
        self.s.Info("Read data from CCCR")
        value = self.sd.read_sd_data(function_id=0,
                                     address=0x00,
                                     byte_count=0x08,
                                     fifo_mode=False)
        self.s.Info("Data from CCCR: %s" % print_hex_array(value))

        self.s.Info("Attempting to write data")
        #data_out = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
        data_out = [0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF]
        self.sdio.write_local_buffer(0, data_out)
        #data_out = [0xAA, 0x33, 0x22, 0x55, 0x0B, 0x00, 0x11, 0x44]
        #data_out = [0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF]
        try:
            self.sd.write_sd_data(function_id=1, address=0x00, data=data_out)
            #self.sd.display_control()
        except SDHostException as e:
            self.s.Error("Failed data transfer!: %s" % str(e))

        self.s.Important("Write data from host to SDIO Device")
        print "Sending data to SDIO:\t\t\t%s" % print_hex_array(data_out)
        #mem_data = self.sdio.read_memory(0x00, 2)
        #print "Data in Memory:\t\t\t\t%s" % print_hex_array(mem_data)
        data = self.sdio.read_local_buffer(0, len(data_out) / 4)
        print "SDIO Local Data:\t\t\t%s" % print_hex_array(data)
        print ""

        #self.s.Important("Put Data in SDIO Device, read this data from SD Host")
        #print "Write Data to SDIO buffer:\t\t%s" % print_hex_array(data_out)
        #self.sdio.write_local_buffer(0, data_out)

        #data = self.sdio.read_local_buffer(0, 2)
        #print "Read back data from SDIO buffer:\t%s" % print_hex_array(data)

        #value = self.sd.read_sd_data(function_id = 1, address = 0x00, byte_count = len(data_out), fifo_mode = False)
        #value = self.sd.read_sd_data(function_id = 1, address = 0x00, byte_count = 0x20, fifo_mode = False)
        value = self.sd.read_sd_data(function_id=1,
                                     address=0x00,
                                     byte_count=0x08,
                                     fifo_mode=False)
        #self.s.Info("SD Command:\t\t0x%08X" % self.sdio.get_sd_cmd())
        #self.s.Info("SD Command Arg:\t\t0x%08X" % self.sdio.get_sd_cmd_arg())
        print "Data From SDIO:\t\t\t\t%s" % print_hex_array(value)
        self.sd.display_crcs()
        self.sdio.display_crcs()
        #data = self.sdio.read_local_buffer(0, 2)
        #print "Data: %s" % print_hex_array(data)

        #value = self.sd.read_sd_data(function_id = 1, address = 0x00, byte_count = 8, fifo_mode = False)
        #print "Value: %s" % str(value)

        SIZE = 256
        print "Long Write: %d" % SIZE
        data_out = []
        for i in range(SIZE):
            value = i % 256
            data_out.append(value)

        self.sd.write_sd_data(function_id=1, address=0x00, data=data_out)
        data = self.sd.read_sd_data(function_id=1,
                                    address=0x00,
                                    byte_count=len(data_out))
        print "Data From SDIO:\t\t\t\t%s" % print_hex_array(data)
Esempio n. 4
0
class Test (unittest.TestCase):

    def setUp(self):
        self.s = Status()
        plat = ["", None, None]
        pscanner = PlatformScanner()
        platform_dict = pscanner.get_platforms()
        platform_names = platform_dict.keys()

        if "sim" in platform_names:
            #If sim is in the platforms, move it to the end
            platform_names.remove("sim")
            platform_names.append("sim")
        urn = None
        for platform_name in platform_names:
            if plat[1] is not None:
                break

            self.s.Debug("Platform: %s" % str(platform_name))

            platform_instance = platform_dict[platform_name](self.s)
            #self.s.Verbose("Platform Instance: %s" % str(platform_instance))

            instances_dict = platform_instance.scan()

            for name in instances_dict:

                #s.Verbose("Found Platform Item: %s" % str(platform_item))
                n = instances_dict[name]
                plat = ["", None, None]

                if n is not None:
                    self.s.Important("Found a nysa instance: %s" % name)
                    n.read_sdb()
                    #import pdb; pdb.set_trace()
                    if n.is_device_in_platform(DRIVER):
                        plat = [platform_name, name, n]
                        break
                    continue

                #self.s.Verbose("\t%s" % psi)

        if plat[1] is None:
            self.sd = None
            return
        n = plat[2]
        self.n = n
        sdio_urn = n.find_device(DRIVER)[0]
        self.sd = DRIVER(n, sdio_urn)
        sdio_urn = n.find_device(SDIODeviceDriver)[0]
        self.sdio = SDIODeviceDriver(n, sdio_urn)
        self.s.set_level("verbose")

        self.s.Info("Using Platform: %s" % plat[0])

    def test_sd_host_sdio(self):
        #self.s.Info("Host Control:\t\t0x%08X" % self.sd.get_control())
        self.sd.display_control()
        self.s.Info("Device Control:\t\t0x%08X" % self.sdio.get_control())
        self.s.Info("Delay: 0x%02X" % self.sd.get_input_delay())
        sd_host_input_delay_value = 63
        self.s.Info("Set host input delay to %d ( 0x%02X )" % (sd_host_input_delay_value, sd_host_input_delay_value))
        self.sd.set_input_delay(sd_host_input_delay_value)
        self.s.Info("Delay: 0x%02X" % self.sd.get_input_delay())

        self.sdio.enable_sdio_device(False)
        self.sdio.reset_core()

        sdio_input_delay_value = 0
        self.s.Info("Delay: 0x%02X" % self.sdio.get_input_delay())
        self.s.Info("Set Input delay to %d ( 0x%02X )" % (sdio_input_delay_value, sdio_input_delay_value))
        self.sdio.set_input_delay(sdio_input_delay_value)
        self.s.Info("Delay: 0x%02X" % self.sdio.get_input_delay())

        self.sdio.enable_sdio_device(True)
        #self.s.Info("Host Status:\t\t0x%08X" % self.sd.get_status())
        self.sd.display_status()
        self.s.Info("Device Control:\t\t0x%08X" % self.sdio.get_control())
        self.s.Info("Device Status:\t\t0x%08X" % self.sdio.get_status())
        self.s.Info("Host Attempting to set voltage range")
        self.sd.set_voltage_range(2.0, 3.6)
        self.s.Info("Host Enable SD Host")
        self.sd.enable_sd_host(True)

        self.s.Verbose("Setting Phy Select... should be no response")
        self.sdio.display_control()
        self.sdio.display_status()
        self.sd.cmd_phy_sel()
        self.sd.display_crcs()
        self.sdio.display_crcs()

        self.s.Verbose("Phy State should be 0x00")
        self.s.Info("SD Command:\t\t0x%08X" % self.sdio.get_sd_cmd())
        self.s.Info("Host Control:\t\t0x%08X" % self.sd.get_control())

        try:
            self.s.Verbose("Send Command 5")
            self.sd.cmd_io_send_op_cond(enable_1p8v = True)
            #self.sd.display_crcs()
            #self.sdio.display_crcs()
            #self.s.Info("SD Command:\t\t0x%08X" % self.sdio.get_sd_cmd())
            #self.s.Info("SD Command Arg:\t\t0x%08X" % self.sdio.get_sd_cmd_arg())
            #self.s.Info("Response Value:\t\t0x%0X" % self.sd.read_response())

            self.s.Verbose("Get Relative Address")
            self.sd.cmd_get_relative_card_address()
            #self.sd.display_crcs()
            #self.sdio.display_crcs()
            #self.s.Info("SD Command:\t\t0x%08X" % self.sdio.get_sd_cmd())
            #self.s.Info("SD Command Arg:\t\t0x%08X" % self.sdio.get_sd_cmd_arg())
            #self.s.Info("Response Value:\t\t0x%0X" % self.sd.read_response())

            self.s.Verbose("Enable Card")
            self.sd.cmd_enable_card(True)
            #self.sd.display_crcs()
            #self.sdio.display_crcs()

            self.s.Verbose("Read a configuration byte")
            value = self.sd.read_config_byte(0x00)
           # self.sd.display_crcs()
           # self.sdio.display_crcs()
            self.s.Important("Read Value: 0x%02X" % value)

        except SDHostException as e:
            self.s.Error("Failed data transfer!: %s" % str(e))

        '''
        self.sd.display_control()
        self.sd.display_status()
        self.sdio.display_status()
        self.s.Info("Clock Count:\t\t0x%08X" % self.sdio.get_clock_count())
        '''
        self.s.Info("Read data from CCCR")
        value = self.sd.read_sd_data(function_id = 0, address = 0x00, byte_count = 0x08, fifo_mode = False)
        self.s.Info("Data from CCCR: %s" % print_hex_array(value))

        self.s.Info ("Attempting to write data")
        #data_out = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
        data_out = [0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF]
        self.sdio.write_local_buffer(0, data_out)
        #data_out = [0xAA, 0x33, 0x22, 0x55, 0x0B, 0x00, 0x11, 0x44]
        #data_out = [0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF]
        try:
            self.sd.write_sd_data(function_id = 1, address = 0x00, data = data_out)
            #self.sd.display_control()
        except SDHostException as e:
            self.s.Error("Failed data transfer!: %s" % str(e))

        self.s.Important("Write data from host to SDIO Device")
        print "Sending data to SDIO:\t\t\t%s" % print_hex_array(data_out)
        #mem_data = self.sdio.read_memory(0x00, 2)
        #print "Data in Memory:\t\t\t\t%s" % print_hex_array(mem_data)
        data = self.sdio.read_local_buffer(0, len(data_out) / 4)
        print "SDIO Local Data:\t\t\t%s" % print_hex_array(data)
        print ""



        #self.s.Important("Put Data in SDIO Device, read this data from SD Host")
        #print "Write Data to SDIO buffer:\t\t%s" % print_hex_array(data_out)
        #self.sdio.write_local_buffer(0, data_out)

        #data = self.sdio.read_local_buffer(0, 2)
        #print "Read back data from SDIO buffer:\t%s" % print_hex_array(data)

        #value = self.sd.read_sd_data(function_id = 1, address = 0x00, byte_count = len(data_out), fifo_mode = False)
        #value = self.sd.read_sd_data(function_id = 1, address = 0x00, byte_count = 0x20, fifo_mode = False)
        value = self.sd.read_sd_data(function_id = 1, address = 0x00, byte_count = 0x08, fifo_mode = False)
        #self.s.Info("SD Command:\t\t0x%08X" % self.sdio.get_sd_cmd())
        #self.s.Info("SD Command Arg:\t\t0x%08X" % self.sdio.get_sd_cmd_arg())
        print "Data From SDIO:\t\t\t\t%s" % print_hex_array(value)
        self.sd.display_crcs()
        self.sdio.display_crcs()
        #data = self.sdio.read_local_buffer(0, 2)
        #print "Data: %s" % print_hex_array(data)

        #value = self.sd.read_sd_data(function_id = 1, address = 0x00, byte_count = 8, fifo_mode = False)
        #print "Value: %s" % str(value)

        SIZE = 256
        print "Long Write: %d" % SIZE
        data_out = []
        for i in range (SIZE):
            value = i % 256
            data_out.append(value)

        self.sd.write_sd_data(function_id = 1, address = 0x00, data = data_out)
        data = self.sd.read_sd_data(function_id = 1, address = 0x00, byte_count = len(data_out))
        print "Data From SDIO:\t\t\t\t%s" % print_hex_array(data)