Monday, August 31, 2009

Free DSP codecs!!!

Wow.. a blast of new sites for omapzoom..

And then I see this on the new omapzoom google groups!!!
* MPEG4 Video Dec
* H263 Video Dec
* JPEG Dec
* JPEG Enc
* AAC Dec
And you also now have a wiki for omap

Sunday, August 16, 2009

Plato! trace-visualize-debug-filter code path!

Got this link from a colleague - kinda useful if you would like to use it for your own purposes.. quote from the site:
PLATO is a tool for displaying and analyzing software traces from an application being debugged. It connects to TTIF (, included) which provides a lower overhead replacement for printf(), so as to minimize the chance that timing related bugs disappear when you enable debug traces, and also some binary trace APIs. PLATO can be running on a separate PC from the application being debugged, making it suited for embedded development. PLATO will decode/filter/display/visualize the traces

Friday, August 14, 2009

towards a integrated infrastructure for feature + errata handling in kernel

I have a confession to make: I am fanatic about clean code. I like it simple and I like it elegant.

Few days back, I had a chat on linux omap mailing list on what I'd dream to see instead of a half a dozen cpu_has_feature_XYZ() APIs in the system.. The thought is more of this form:
  • Some sort of infrastructure which is common to all silicons,platforms exist which provides method to register the tuple (silicon_rev_id | ip_module_rev_id, feature_errata_id)
  • Specific drivers such as DMA, I2C, McBSP, PRCM etc.. on registration provides to the system the an array of tuples for that device.
  • Platform on bootup provides the platform_data to the driver, which allows the driver to start, but now, it can also detect cpu_rev and can grap it's own IP Module rev from it's own register.. -> that is provided to the infrastructure

  • Every time there is a need to check to enable/disable feature/errata, all the code needs to do is:
if (is_enabled(dev, OMAP3_ISP) ) {
do my stuff;

is'nt that cleaner than
if (cpu_is_3430() && (cpu_rev >= OMAP3430_ES3P1) ) {
do my stuff;
if (cpu_is_3430() && (omap_features & OMAP_HAS_ISP) {
do my stuff;
  • Now what ever we do here can easily be displayed by the subsystem by exposing a cat /sys/devices/... /features or even club it with cat /proc/cpuinfo if that is what people want -> you can do it anytime anywhere if you retain just the data you need... ;)
  • No need to store the entire database of features in the infrastructure for ever, we can save memory by making the original array init_data and copying it into a list which is easier to search for the infrastructure..

Now, this infrastructure can also be readily used for external peripherals outside the chip - like camera sensors, RFBI displays etc.. come to think of this, it kinda looks the way how I2C board_info is handled in some ways.. hmmm...

Now, only thing I need is get some time to do this, as Kevin seems interested in the original patch.. couple of fortnights to go before i get some personal time to hack some *real* code.. ;) but what the heck.. if there is anyone out there who has the time and interest to do this.. go ahead and do it..

Thursday, August 13, 2009

Replace CAmELcASiNg with lower_casing

Finally irritated with a bunch of CaMELcASinG, decided to write a small script albeit not too clean or optimized for the job of a search and destroy
Since it is weird to write my own c interpreter to find the right targets to replace, I use output of ctags to generate tags file. if you are using kernel, you could just do a make tags to get the same output file.

# Silly little script to replace CaMELCaSInG to lower_casing
# Half a zillion thoughts later,
# why not use ctags which has c interpreter already to do
# function identification for us?
if [ ! -r 'tags' ]; then
echo "Sorry.. no tags file!"
exit 1
if [ ! -r "$1" ]; then
echo "I need a directory or a file for replacing.."
exit 2
DIR_FILE=`echo "$1"|sed -e "s/\//\\\//g"`
# tags have the following notation in field 4 (tab seperated)
# e - enum value
# d - define
# f - function
# F - File itself
# g - enum type
# m - structure parameter
# p - prototype
# r - kconfig define(refered)
# s - structure type
# t - typedefined variable
# v - variable
# x - extern defined variable
# we can choose to have different rules:
# rename rule i am going to follow:
# Any define -> convert camelcase to lower_case_define->convert to caps
# Any function, enum,struct param,prototype,struct type, typedef var,extern def ->
# camel_case to lower_case_define
# All files will be made unix file only (no point in dos + unix mixtures..)

#* @brief - changes camel casing to ones with smaller case
echo $1|tr '\_' '+' |sed 's/\([A-Z]\)/_\l\1/g' | sed 's/^_\([a-z]\)/\1/g' |\
tr 'A-Z' 'a-z' | sed "s/\([a-z][a-z]\+\)/-\1-/g"|tr -d '_'|\
tr '-' '_'|sed -e "s/_$//g"|sed -e "s/^_//g" | tr '+' '_' |\
sed -e "s/__*/_/g"|sed -e "s/_\([0-9][0-9]*\)/\1/g"|\
sed -e "s/^[a-z]\_\([a-z][a-z]\+\)/\1/g"


#* @brief - all_to_upper - Moves all to upper case
camel_to_norm $1 | tr 'a-z' 'A-Z'

#* @brief generate_list - will generate list of symbols from tags matching
generate_list() {
cut -d' ' -f1,4 $TMPFILE|grep "$1\$"|cut -d' ' -f1|sort|uniq

#* @brief find_files - finds list of files from tag file matching usage
cut -d' ' -f1,2 $TMPFILE|grep "^$1"|cut -d' ' -f2|sort|uniq
# grab the output for only the ones we want..
grep "$DIR_FILE" tags |grep -v "^\!"|sed -e "s/\/\^.*\"/REPLACE_1/g">$TMPFILE

echo "=====>Search and replace for pattern $1 with $2"
# Convert the functions back to smaller case and replace them in the files
for token in `generate_list "[$1]"`
if [ $2 -eq "1" ]; then
new=`camel_to_norm $token`
new=`all_to_upper $token`
if [ "$new" != "$token" ]; then
echo "==>Replacing $token with $low"
for file in `find_files $low`
echo "->replacing $token to $new in file $file"
cp $file $TMPFILE1
dos2unix $TMPFILE1
sed -e "s/\(W*\)$token\(\W*\)/\1$new\2/g" $TMPFILE1>$file
echo "==>not replacing $token"
echo "================= Replacing Defines ==============="
replace_pattern d 2
echo "================= Replacing Functions ==============="
replace_pattern efgmpstvx 1

Replace file_or_directory.

Note, we could definitely customize this by adding prefix or in cases where code originates from windoze environment, removing dw_ dl_ etc.. that is pretty easy to do once you pick on tags and know what to do for output ;)

Monday, August 10, 2009

omap PM in!

Kevin (PM) has put some cool stuff up on elinux page. may want to check it out..

Wednesday, August 05, 2009

Cool your laptop - linux governor

Check this script out:
for i in /sys/devices/system/cpu/cpu[0-9]; do echo $i `cat $i/cpufreq/scaling_governor`; done

and see here for a description and this for a bit of history

Birds of the kernel feathers come together

Been feeling guilty of not blogging the last few months.. anyways, here is something of interest.
For all those interested, see here

LinuxCon takes place on Sept 21-23 -> registration is running if you like to take part in. there is also bunch of parallel conferences happening. see the list here

what would really be interesting for OMAP is the linux plumber's conf and Han's new V4l2 plan

Be there if you would like to see a new architecture for OMAP3 and beyond taken care in new spec of V4l2...