2014년 2월 20일 목요일

Mango220(Exynos4412) 이더넷 Iperf 테스트





1. 기본 iperf 테스트
1.1. 망고220 이 서버 일 때
<망고220 로그>
$ /data/data/com.magicandroidapps.iperf/bin/iperf -s -i 1&   
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0- 1.0 sec  2.54 MBytes  21.3 Mbits/sec
[  4]  1.0- 2.0 sec  3.25 MBytes  27.2 Mbits/sec
[  4]  2.0- 3.0 sec  3.30 MBytes  27.7 Mbits/sec
[  4]  3.0- 4.0 sec  3.27 MBytes  27.5 Mbits/sec
[  4]  4.0- 5.0 sec  3.21 MBytes  27.0 Mbits/sec
[  4]  5.0- 6.0 sec  3.28 MBytes  27.5 Mbits/sec
[  4]  6.0- 7.0 sec  3.28 MBytes  27.5 Mbits/sec
[  4]  7.0- 8.0 sec  3.29 MBytes  27.6 Mbits/sec
[  4]  8.0- 9.0 sec  3.31 MBytes  27.8 Mbits/sec
[  4]  9.0-10.0 sec  3.31 MBytes  27.8 Mbits/sec
[  4]  0.0-10.1 sec  32.2 MBytes  26.9 Mbits/sec



<HOST PC>
$ iperf -c 192.168.55.13
------------------------------------------------------------
Client connecting to 192.168.55.13, TCP port 5001
TCP window size: 23.5 KByte (default)
------------------------------------------------------------
[  3] local 192.168.55.8 port 59789 connected with 192.168.55.13 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.1 sec  32.2 MBytes  26.9 Mbits/sec












1.2. HOST PC가 서버 일 때
<망고220>
/data/data/com.magicandroidapps.iperf/bin/iperf -c 192.168.55.8

------------------------------------------------------------
Client connecting to 192.168.55.8, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.55.13 port 35105 connected with 192.168.55.8 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  35.6 MBytes  29.8 Mbits/sec



<HOSTPC>
$ iperf -s -i 1
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[  4] local 192.168.55.8 port 5001 connected with 192.168.55.13 port 35105
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0- 1.0 sec  3.20 MBytes  26.9 Mbits/sec
[  4]  1.0- 2.0 sec  3.53 MBytes  29.6 Mbits/sec
[  4]  2.0- 3.0 sec  3.60 MBytes  30.2 Mbits/sec
[  4]  3.0- 4.0 sec  3.54 MBytes  29.7 Mbits/sec
[  4]  4.0- 5.0 sec  3.61 MBytes  30.3 Mbits/sec
[  4]  5.0- 6.0 sec  3.60 MBytes  30.2 Mbits/sec
[  4]  6.0- 7.0 sec  3.60 MBytes  30.2 Mbits/sec
[  4]  7.0- 8.0 sec  3.60 MBytes  30.2 Mbits/sec
[  4]  8.0- 9.0 sec  3.61 MBytes  30.3 Mbits/sec
[  4]  9.0-10.0 sec  3.63 MBytes  30.5 Mbits/sec
[  4]  0.0-10.0 sec  35.6 MBytes  29.8 Mbits/sec








2. 이더넷 속도 관련 kernel 소스 수정

$ vi arch/arm/mach-exynos/mach-mango220.c
static void __init smdk4x12_smsc911x_init(void)
… 생략…
__raw_writel((0x0 << S5P_SROM_BCX__PMC__SHIFT) |
            (0x0 << S5P_SROM_BCX__TACP__SHIFT) |
            (0x1 << S5P_SROM_BCX__TCAH__SHIFT) |
            (0x0 << S5P_SROM_BCX__TCOH__SHIFT) |
            (0x2 << S5P_SROM_BCX__TACC__SHIFT) |
            (0x0 << S5P_SROM_BCX__TCOS__SHIFT) |
            (0x0 << S5P_SROM_BCX__TACS__SHIFT), S5P_SROM_BC1);

$vi drivers/net/smsc911x.c
static inline void reg_write(u32 addr, u32 val)
{
   *(volatile u16*)addr = (u16)val;
   *(volatile u16*)(addr + 2) = (u16)(val >> 16);
}
static inline u32 reg_read(u32 addr)
{
   volatile unsigned short __force  *addr_16 = (unsigned short *)(addr);
   //printk("addr_16 = 0x%x, addr = 0x%x \n",*addr_16,addr);  //by crazyboy 20140220 by treego;
   return ((readw(addr) & 0xFFFF) |
           ((readw(addr + 2) & 0xFFFF) << 16));
}

#if 1
static inline void
smsc911x_tx_writefifo(struct smsc911x_data *pdata, unsigned int *buf,
     unsigned int wordcount)
{
   unsigned long flags;
   int val;
   spin_lock_irqsave(&pdata->dev_lock, flags);
//#ifdef CRZ_SPEED_UP//crazyboys
#if 1
   while (wordcount--)
   {
    val = *buf++;
//   printk("write == reg=0x%x buf = 0x%x val = 0x%x \n",pdata->ioaddr + TX_DATA_FIFO,*buf,(u16)val);
    *(volatile u16*)(pdata->ioaddr + TX_DATA_FIFO) = (u16)val;
    *(volatile u16*)(pdata->ioaddr + TX_DATA_FIFO + 2) = (u16)(val >> 16);
   }

#else
//MANGO_DBG("== wordcount=%d\n",wordcount);
while (wordcount--)
__smsc911x_reg_write(pdata, TX_DATA_FIFO, *buf++);
goto out;
#endif
   spin_unlock_irqrestore(&pdata->dev_lock, flags);
}

#if 1
static inline void
smsc911x_rx_readfifo(struct smsc911x_data *pdata, unsigned int *buf,
    unsigned int wordcount)
{
unsigned long flags;
unsigned int test_val;
unsigned short *sp = (unsigned short *)buf;
volatile u16 *addr_16 = (u16 *)(pdata->ioaddr);
   spin_lock_irqsave(&pdata->dev_lock, flags);
//#ifdef CRZ_SPEED_UP//crazyboys
//  printk("CCRRZZZZZZ- pdata->ioaddr=0x%x addr_16 = 0x%x\n",pdata->ioaddr + TX_DATA_FIFO,addr_16);
//  printk("CCRRZZZZZZ- pdata->ioaddr=0x%x addr_16 = 0x%x\n",pdata->ioaddr,*addr_16);
   while (wordcount--)
   {
   #if 0 //crazyboys test Remove it
   *buf++=reg_read(0xf1000000);
   *buf++=reg_read(0xf1000000);
   while(1);
   #endif
//   printk("write == reg=0x%x buf = 0x%x \n",pdata->ioaddr + RX_DATA_FIFO,*buf);
    //printk("read == wordcount=%d\n",wordcount);
    *buf++=reg_read(pdata->ioaddr);
//   *buf++=__smsc911x_reg_read(pdata,RX_DATA_FIFO);
//   *buf++ = ((*addr_16 & 0x0000ffff) | (*(addr_16 + 1) << 16));
   // *buf++ = reg_read(0xeed20000);
     // *sp++=(*(volatile u16*)(0xf1000000));
     //*sp++=*addr_16;
   // udelay(1);
   //*sp++=(*(volatile u16*)(0xf1000002));
   //*sp++=*(addr_16+1);
   // udelay(5);
   }
   spin_unlock_irqrestore(&pdata->dev_lock, flags);
}

3. 소스 수정 후 iperf 테스트
3.1. 망고220 이 서버 일 때
<망고220 로그>
# /data/data/com.magicandroidapps.iperf/bin/iperf -s -i 1
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[  4] local 192.168.55.13 port 5001 connected with 192.168.55.8 port 50215
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0- 1.0 sec  4.65 MBytes  39.0 Mbits/sec
[  4]  1.0- 2.0 sec  4.49 MBytes  37.6 Mbits/sec
[  4]  2.0- 3.0 sec  4.51 MBytes  37.8 Mbits/sec
[  4]  3.0- 4.0 sec  4.62 MBytes  38.7 Mbits/sec
[  4]  4.0- 5.0 sec  4.54 MBytes  38.1 Mbits/sec
[  4]  5.0- 6.0 sec  4.56 MBytes  38.2 Mbits/sec
[  4]  6.0- 7.0 sec  4.64 MBytes  38.9 Mbits/sec
[  4]  7.0- 8.0 sec  4.63 MBytes  38.8 Mbits/sec
[  4]  8.0- 9.0 sec  4.82 MBytes  40.4 Mbits/sec
[  4]  9.0-10.0 sec  4.59 MBytes  38.5 Mbits/sec
[  4]  0.0-10.0 sec  46.2 MBytes  38.6 Mbits/sec



<HOST PC>
$ iperf -c 192.168.55.13
------------------------------------------------------------
Client connecting to 192.168.55.13, TCP port 5001
TCP window size: 23.5 KByte (default)
------------------------------------------------------------
[  3] local 192.168.55.8 port 50215 connected with 192.168.55.13 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  46.2 MBytes  38.6 Mbits/sec







3.2. HOST PC가 서버 일 때
<망고220>
/data/data/com.magicandroidapps.iperf/bin/iperf -c 192.168.55.8

------------------------------------------------------------
Client connecting to 192.168.55.8, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.55.13 port 55880 connected with 192.168.55.8 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  77.0 MBytes  64.5 Mbits/sec



<HOSTPC>
$ iperf -s -i 1
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[  4] local 192.168.55.8 port 5001 connected with 192.168.55.13 port 55880
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0- 1.0 sec  6.90 MBytes  57.9 Mbits/sec
[  4]  1.0- 2.0 sec  7.50 MBytes  62.9 Mbits/sec
[  4]  2.0- 3.0 sec  7.50 MBytes  62.9 Mbits/sec
[  4]  3.0- 4.0 sec  7.51 MBytes  63.0 Mbits/sec
[  4]  4.0- 5.0 sec  7.49 MBytes  62.8 Mbits/sec
[  4]  5.0- 6.0 sec  7.52 MBytes  63.1 Mbits/sec
[  4]  6.0- 7.0 sec  8.03 MBytes  67.4 Mbits/sec
[  4]  7.0- 8.0 sec  8.11 MBytes  68.1 Mbits/sec
[  4]  8.0- 9.0 sec  8.16 MBytes  68.5 Mbits/sec
[  4]  9.0-10.0 sec  8.16 MBytes  68.5 Mbits/sec
[  4]  0.0-10.0 sec  77.0 MBytes  64.5 Mbits/sec




2014년 2월 10일 월요일

Android Text logo 나오는 코드



Android Text logo 나오는 코드

Board: Mango210
OS : Android ICS 4.0.4
Kernel : 3.0.8



Android Source
core/init/init.c
if( load_565rle_image(INIT_IMAGE_FILE) ) {
       fd = open("/dev/tty0", O_WRONLY);
       if (fd >= 0) {
           const char *msg;
               msg = "\n"
           "\n"
           "\n"
           "\n"
           "\n"
           "\n"
           "\n"  // console is 40 cols x 30 lines
           "\n"
           "\n"
           "\n"
           "\n"
           "\n"
           "\n"
           "\n"
           "             A N D R O I D ";
           write(fd, msg, strlen(msg));
           close(fd);
       }
   }
   return 0;



core/init/init.c:    if( load_565rle_image(INIT_IMAGE_FILE) ) {
core/init/init.h:#define INIT_IMAGE_FILE        "/initlogo.rle"





2014년 2월 6일 목요일

망고24R2 Marvell Bluetooth HID 테스트 방법



망고24R2 Marvell Bluetooth HID 테스트 방법 § Mango24 공부방전체공개2014.02.06 21:19
답변 0 
조회 13

(2450 Bluetooth HID Keyboard 테스트)

2450는 kernel에 hidp 가 설정 안되어 있습니다.

kernel 소스에서 체크
[*] Networking support ---> <*> Bluetooth subsystem support --->


# insmod mbtchar.ko
# insmod bt8787.ko
BT FW is active(0)
BT: FW already downloaded!

블루투스 키보드의 connect버튼을 누루면, LED가 깜빡깜빡입니다. 이때, 아래 명령을 수행합니다.

# hidd --search
Searching ...
Connecting to device DC:2C:26:E7:51:FD
input: ITON Bluetooth Wireless Keyboard as /devices/virtual/bluetooth/hci0/hci0:1/input3
generic-bluetooth 0005:0A5C:8502.0001: input: BLUETOOTH HID v1.1b Keyboard [ITON Bluetooth Wireless Keyboard ] on 00:22:58:6E:8B:AB

위 명령만 수행하면, 알아서 페어링을 수행합니다.

# cat /proc/bus/input/devices
I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="gpio-keys"
P: Phys=gpio-keys/input0
S: Sysfs=/devices/platform/gpio-keys.0/input/input0
U: Uniq=
H: Handlers=kbd event0
B: PROP=0
B: EV=3
B: KEY=600 0 0 10000000

I: Bus=0019 Vendor=dead Product=beef Version=0102
N: Name="S3C24XX TouchScreen"
P: Phys=
S: Sysfs=/devices/virtual/input/input1
U: Uniq=
H: Handlers=mouse0 event1
B: PROP=0
B: EV=b
B: KEY=400 0 0 0 0 0 0 0 0 0 0
B: ABS=3

I: Bus=0005 Vendor=0a5c Product=8502 Version=011b
N: Name="ITON Bluetooth Wireless Keyboard "
P: Phys=00:22:58:6E:8B:AB
S: Sysfs=/devices/virtual/bluetooth/hci0/hci0:1/input2
U: Uniq=DC:2C:26:E7:51:FD
H: Handlers=sysrq kbd event2
B: PROP=0
B: EV=12001b
B: KEY=10000 2000007 ff9f387a d941d7ff febeffdf ffefffff ffffffff fffffffe
B: ABS=f00 0
B: MSC=10
B: LED=1f

아래 명령을 수행하고 블루투스 키보드에서 아무키나 누르면 아래와 같이 HEX값을 보실수 있습니다.

# hexdump /dev/input/event2

0000000 828b 386d 466b 0005 0004 0004 000c 0007
0000010 828b 386d 46a0 0005 0001 0017 0001 0000
0000020 828b 386d 46bb 0005 0000 0000 0000 0000
0000030 828b 386d fbe7 0006 0004 0004 000c 0007
0000040 828b 386d fc19 0006 0001 0017 0000 0000
0000050 828b 386d fc2b 0006 0000 0000 0000 0000
dsc에서는 이렇게 밖에 테스트 할 수 밖에.. 없습니다. 아직 LCD가 없기 때문에,


2450에서, QT로 확인해봅니다.


동작화면, 실행되고, 키보드로 아무키나 입력하면 아래와 같이 입력 하실 수 있습니다.

2014년 2월 4일 화요일

[Mango-DSC-Board] Linux BlueTooth SPP 테스트 방법



Linux BlueTooth SPP 테스트 방법 § Mango24 공부방전체공개2014.02.04 22:23
답변 0 
조회 18
추천0

Buildroot에서 bluez-utils가 되어 있는지 확인 하고, 안되어 있으면, 체크하고 다시 컴파일 해줍니다.

$ make menuconfig
Package Selection for the target ---> Networking applications --->

kernel소스에서 bluetooth관련 프로토콜이 되어 있는지 확인 하고, 안되어 있으면, 체크 하고 다시 컴파일 해줍니다.
[*] Networking support ---> <*> Bluetooth subsystem support --->
Bluetooth device drivers --->


부팅시 bt 드라이버를 올려주는지 확인!!! 없으면 수동으로 해주거나, 아래 파일 수정해서 재부팅 하면 됩니다.

# vi /etc/init.d/S39marvell
#!/bin/sh
#
# load marvell wifi ....
#

case "$1" in
start)
echo "Loading marvell SD8787 wifi/BT driver"
insmod /root/mlan.ko
insmod /root/sd8787.ko
insmod /root/mbtchar.ko
insmod /root/bt8787.ko
;;
stop)
echo -n "unloading marvell SD8787 wifi/BT..."
rmmod /root/sd8787.ko
rmmod /root/mlan.ko
rmmod /root/bt8787.ko
rmmod /root/mbtchar.ko
;;
restart|reload)
"$0" stop
"$0" start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac

exit $?





rfcomm.conf 파일을 수정합니다. device는 target 장치(핸드폰)의 블루투스 어드레스를 입력하시면 됩니다.
# vi /etc/bluetooth/rfcomm.conf
#
# RFCOMM configuration file.
#

rfcomm0 {
# Automatically bind the device at startup
bind no;

# Bluetooth address of the device
device 11:22:33:44:55:66;

# RFCOMM channel for the connection
channel 1;

# Description of the connection
comment "Example Bluetooth device";
}

부팅 이후, 아래 명령을 차례대로 실행합니다.

# hciconfig hci0 up
# hciconfig hci0 piscan (이 녀석이 search가능하도록 하게 하는 놈입니다.)
# sdptool add --channel=1 SP (SPP 가능 하도록 설정)
Serial Port service registered
# rfcomm listen 0 1&
# Waiting for connection on channel 1

꼭 백그라운드로 돌려야 합니다.





























안드로이드 어플 [ Bluetooth spp pro ] 파일을 이용해서 테스트 하시면 됩니다.
다른 bluetooth관련 어플은 연결이 되지 않습니다.

해당 장비가 Search가 되는 것을 확인 할 수 있습니다. 이것은 위에서 Search가능하도록 해주었기 때문에 가능합니다. 아니면, 검색조차 되지 않습니다.


사용가능한 Profile에 대한 UUID입니다. 자세한 사항은 Bluetooth uuid검색해서 참조 하시면 됩니다. 안드로이드에서 공용으로 사용되는 것입니다. Connect를 눌러서 연결은 합니다.
어떤 것으로 테스트해도 가능 하지만, Byte Stream mode가 터미널 창 같이 실시간으로 주고 받을수 있습니다.






실행이 되면, 아래와 같은 창이 뜹니다.







DSC 보드에서 확인해 보면, 블루투스가 연결이 되면, 아래와 같이 로그가 나옵니다.

Connection from 6C:83:36:9A:66:EB to /dev/rfcomm0
Press CTRL-C for hangup


보드의 터미널 창에서 아래와 같은 명령으로 송수신을 확인 할 수 있습니다.
# cat /dev/rfcomm0 &
# echo asdfasd > /dev/rfcomm0



안드로이드 어플에서도, 아래와 같이 확인 할 수 있습니다.
1번은 Tx 데이터 이고, 2번은 Rx데이터 입니다.

기타 bluez관련 명령어.

SP(Serial Port)가 가능한 장비 찾는 방법
# sdptool search SP
Inquiring ...
Searching for SP on 6C:83:36:9A:66:EB ...
Service Name: BluetoothChat
Service RecHandle: 0x10009
Service Class ID List:
UUID 128: 00001101-0000-1000-8000-00805f9b34fb
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 17

해당 장비의 가능한 Profile 찾는 방법
# sdptool browser 00:22:58:6E:8B:95
Browsing 00:22:58:6E:8B:95 ...
Service Name: Headset Audio Gateway
Service RecHandle: 0x10000
Service Class ID List:
"Headset Audio Gateway" (0x1112)
"Generic Audio" (0x1203)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 12
Profile Descriptor List:
"Headset" (0x1108)
Version: 0x0102

Service Name: Hands-Free Audio Gateway
Service RecHandle: 0x10001
Service Class ID List:
"Handsfree Audio Gateway" (0x111f)
"Generic Audio" (0x1203)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 13
Profile Descriptor List:
"Handsfree" (0x111e)
Version: 0x0105

Service Name: Audio Source
Service RecHandle: 0x10002
Service Class ID List:
"Audio Source" (0x110a)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 25
"AVDTP" (0x0019)
uint16: 0x102
Profile Descriptor List:
"Advanced Audio" (0x110d)
Version: 0x0102

Service Name: AVRCP TG
Service RecHandle: 0x10003
Service Class ID List:
"AV Remote Target" (0x110c)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 23
"AVCTP" (0x0017)
uint16: 0x103
Profile Descriptor List:
"AV Remote" (0x110e)
Version: 0x0103

Service Name: AVRCP CT
Service RecHandle: 0x10004
Service Class ID List:
"AV Remote" (0x110e)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 23
"AVCTP" (0x0017)
uint16: 0x103
Profile Descriptor List:
"AV Remote" (0x110e)
Version: 0x0100

Service Name: Serial Port
Service Description: COM Port
Service Provider: BlueZ
Service RecHandle: 0x10005
Service Class ID List:
"Serial Port" (0x1101)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 1
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Serial Port" (0x1101)
Version: 0x0100