Rockbox Technical Forums

Rockbox Development => New Ports => Topic started by: slade on October 27, 2010, 12:29:06 PM

Title: Samsung YP-R0
Post by: slade on October 27, 2010, 12:29:06 PM
I am working on a port for YP-R0

Anybody who wants to join let me know.
So far I have been able to extract original firmware and found a few places to inject rockbox. Either create a zImage Kernel or try to crack the bootloader to be able to dual boot.

Please let me know if you want to join.

Update could please someone take a look if it is what I think

I have found the follwing usb.sh script with the /usr/local/bin folder of the YP-R0 (I could repack firmware with making this adjustment.)
Quote
#!/bin/sh

if [ $1 == "on" ]
then
   lsmod | grep g_file_storage
   if [ $? == 0 ]
   then
      umount /mnt/media1/dev/gadget
   fi

   if [ -d /mnt/media0 ]
   then
      umount /mnt/media1
      umount /mnt/media0
   fi

   lsmod | grep rfs
   if [ $? == 0 ]
   then
      rmmod rfs
   fi

   lsmod | grep g_file_storage
   if [ $? == 0 ]
   then
      #umount /mnt/media1/dev/gadget
      rmmod gadgetfs
      rmmod g_file_storage
      rmmod arcotg_udc
   fi

   lsmod | grep g_file_storage
   if [ $? != 0 ]
   then
      modprobe g-file-storage file=/dev/stl3,/dev/stl2 removable=1
     fi

     echo "OK! USB Connected to /mnt/media0 ! wuwanggood"

elif  [ $1 == "off" ]
then
   lsmod | grep g_file_storage
   if [ $? == 0 ]
   then
      modprobe g-file-storage -r
   fi

   lsmod | grep rfs
   if [ $? != 0 ]
   then
      insmod /lib/modules/2.6.24-445-g48ec830/kernel/fs/rfs/rfs.ko
   fi

   #losetup -o 8192 /dev/loop0 /mnt/media_file/media0
   #mount -t vfat /dev/loop0 /mnt/media0
   mount -t rfs /dev/stl3 /mnt/media0 -o codepage=utf8
   mount -t rfs /dev/stl2 /mnt/media1 -o codepage=utf8

   echo "OK! USB disconnected!"
fi

If I understand right, it checks wether the mp3 Player is connected via USB (I guess another program is invoking the shellscript with argument "on" or "off")
shouldn't I be able to share another drive (which actually is the system drive /dev/stl1) and be able to connect to it.
Of course I would need to create another folder under mount.

Thanks for you help.
Title: Re: Samsung YP-R0
Post by: slade on November 01, 2010, 03:29:15 PM
Hello Everybody I managed to be able to run scripts on my YP-R0
Its still original Firmware (but firmware is linux) I can run every script I would want to.
I would need you guys to maybe give me some input on which information is mandatory for a successful rockbox port.
I did alter the original firmware and flashed it back!
The first script I ran was :
cat /proc/cpuinfo

Code: [Select]
Processor : ARMv6-compatible processor rev 3 (v6l)
BogoMIPS : 530.84
Features : swp half thumb fastmult vfp edsp java
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xb76
CPU revision : 3
Cache type : write-back
Cache clean : cp15 c7 ops
Cache lockdown : format C
Cache format : Harvard
I size : 16384
I assoc : 4
I line length : 32
I sets : 128
D size : 16384
D assoc : 4
D line length : 32
D sets : 128

Hardware : Freescale MX37 3-Stack Board
Revision : 37000
Serial : 2XXXXXXXXXXXXXXXXXX

cat /proc/meminfo
Code: [Select]
MemTotal:        62612 kB
MemFree:         42412 kB
Buffers:         10144 kB
Cached:           4352 kB
SwapCached:          0 kB
Active:           1804 kB
Inactive:        12964 kB
SwapTotal:           0 kB
SwapFree:            0 kB
Dirty:               8 kB
Writeback:           0 kB
AnonPages:         304 kB
Mapped:            564 kB
Slab:              984 kB
SReclaimable:      424 kB
SUnreclaim:        560 kB
PageTables:         60 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
CommitLimit:     31304 kB
Committed_AS:     2068 kB
VmallocTotal:   778240 kB
VmallocUsed:       396 kB
VmallocChunk:   777756 kB

Kernel : 2.6.24-445-g48ec830
Title: Re: Samsung YP-R0
Post by: Chronon on November 01, 2010, 03:57:28 PM
Here's the port page:
http://www.rockbox.org/wiki/SamsungYP

If you don't get responses here you can try posting in the IRC channel too.  Most developers seem to spend more time there than on the forums.
Title: Re: Samsung YP-R0
Post by: pyro_maniac on November 03, 2010, 08:03:38 AM
Here's the port page:
http://www.rockbox.org/wiki/SamsungYP

I think slade is the author of that wiki page...

@slade:
You should try to build your own kernel and bring it onto the device. Try to get the kernel config and the kernel source code. There should be something on samsungs open source page.

I don't know if its needed to replace that linux. Maybe there can be a rockbox as an application solution as like as on android.
Title: Re: Samsung YP-R0
Post by: Chronon on November 03, 2010, 10:28:51 AM
I believe so.  I was more posting it for others since it didn't have a link in this topic yet.
Title: Re: Samsung YP-R0
Post by: slade on November 03, 2010, 12:14:54 PM
Yes I am the author of the port page too.

I think I will for now try to use rockbox as an application.

Is there a wiki documentation on how to compile rockbox sim with arm architecture?

I would be able to launch it via shell script. My main concern is that it wouldn't be able to get the music files with the simulator is there a way to adjust path to get access to files outside the simulator?

Thanks Guys!
Title: Re: Samsung YP-R0
Post by: Lorenzo92 on November 21, 2011, 03:23:03 PM
Hi all! I resumed a bit this port, I updated the port page too but most of the informations + early patch & test build are on ABI

http://www.anythingbutipod.com/forum/showpost.php?p=583651&postcount=336

I linked the page that contains the release build. You need to scroll a bit the thread for the other interesting posts :)

Anyway basics are working. I need to tell you that I'm using rockbox in everyday use and it's great!
Of course lots of things are to be done, mainly power management + optimizations.

So I tried to implement them but they are a bit too complex for my (low) C knowledge. I'm really lost in the code :p
So any hints for power management? Consider that I already removed (at least the percentage part) the simulator stuff. There is still powermanagement.c in target/hosted etc...

EDIT: forgot to say...It's an APPLICATION running on the YPR0 stock kernel. Dual booting is working (a key press enables rockbox for now)
Title: Re: Samsung YP-R0
Post by: saratoga on November 21, 2011, 05:19:42 PM
Basic power management consists of things like implementing boosting (so that the CPU clock is low most of the time and increases only when the PCM buffer gets low), implementing sleep functions for various peripherals (so that flash memory, the LCD controller and others can be switched off when not being actively used), and turning off any unneeded clocks/hardware/voltages.  However, since you're running on top of the stock kernel, some of these may already be implemented by the host OS.  Do you know how power management is handled in the stock music app?  Are there APIs for controlling the CPU clock and storage controller, or do you have direct access to this hardware?
Title: Re: Samsung YP-R0
Post by: Lorenzo92 on November 22, 2011, 07:31:44 AM
Basic power management consists of things like implementing boosting (so that the CPU clock is low most of the time and increases only when the PCM buffer gets low), implementing sleep functions for various peripherals (so that flash memory, the LCD controller and others can be switched off when not being actively used), and turning off any unneeded clocks/hardware/voltages.  However, since you're running on top of the stock kernel, some of these may already be implemented by the host OS.  Do you know how power management is handled in the stock music app?  Are there APIs for controlling the CPU clock and storage controller, or do you have direct access to this hardware?

1. I implemented CPU scaling in the kernel, and this is already working well.
2. The sleep for various peripherals uhm uhm. Something is surely managed by the kernel, others don't know.
3. The stock music app is more than a simple application as already said. yes it has direct access for quite all the things.
4. CPU clock is controlled by the usual way in linux. Storage controllers too (so tipical mount/unmount). I guess power management is already implemented thus.

Okay this is the power save part.
The other part that I'm interestend into, is the battery levels management. We use AS3543 codec. So code is quite already done, but I cannot manage to make it work because I don't have a right idea on how this is managed at all (ie: standard api calls for rb...)

EDIT:

was digging for the radio thing. I guess that the samsung module for it has no direct acess to registers via ioctl, only some common functions like set frequency etc. But since this is already implemented in RB, a good way to workaround that is to reverse the module initialization and build another one with only register read/write capability. But don't know if I am able to do this
OR, alternately I could try guessing the ioctl structures (as I did with ascodec) till to be able to use these functions (ioctl codes that I reversed)

    si470x.ko -> radio
    dev -> /dev/si470x
    0xA -> seek
    0xD -> RSSI info (???)
    0xC -> set rds
    0x8 -> set signal level???
    0x4 | 0x6 -> set radio region
    0x1 -> get frequency
    0x2 -> set frequency
    0x0 -> close radio

EDIT2: I was also looking for the ARM optimizations. I just discovered that they are enabled on maemo build. So as an application they are working.
I just wonder why, after enabling this:

#elif (CONFIG_CPU == IMX31L) \
  || ((CONFIG_PLATFORM & PLATFORM_MAEMO4) && defined(MAEMO_ARM_BUILD) \
  || (CONFIG_PLATFORM & PLATFORM_YPR0))
#define CPU_ARM
#define ARM_ARCH 6 /* ARMv6 */

I get this "strange" error:

make: *** No rule to make target `/home/lorenzo/YP-R0_DEV/rockbox/rockbox/build/pcm-mixer-armv6.c', needed by `/home/lorenzo/YP-R0_DEV/rockbox/rockbox/build/firmware/pcm_mixer.o'.  Stop.

As you can see it doesn't find the file because it points to the wrong path :S Any idea?


Last question for this post (sorry but time is limited so I need to exploit it at better), since a while (don't remeber exactly after what) there is a bad issue with the back key. In some context (like exiting a plugin or wps), pressing the back key will produce a "double" press uhm uhm
Title: Re: Samsung YP-R0
Post by: kugel. on November 23, 2011, 07:08:29 AM
EDIT2: I was also looking for the ARM optimizations. I just discovered that they are enabled on maemo build. So as an application they are working.
I just wonder why, after enabling this:

I suggest not to deal with various optimizations this early. Rather get the port into a reasonable state so it can be committed to SVN.
Title: Re: Samsung YP-R0
Post by: Lorenzo92 on November 23, 2011, 10:01:17 AM
EDIT2: I was also looking for the ARM optimizations. I just discovered that they are enabled on maemo build. So as an application they are working.
I just wonder why, after enabling this:

I suggest not to deal with various optimizations this early. Rather get the port into a reasonable state so it can be committed to SVN.

Okay. Will do that.
To keep you all informed, yesterday I managed to use some basic things of the radio module (samsung linux module).
Seek is working, RSSI get seem to work, but I need still to figure out how to get and set freq (well get is working as I get a value of 8750...). The only bad thing is that through ioctl I cannot access directly to the registers from outside :(