2016/4/1

imx6 CLKO

imx6 提供兩個 clock output: CLKO1, CLKO2

CLKO1 可以選擇 GPIO0 做 clk output
CLKO2 可以選擇 GPIO3 做 clk output

CLKO1.2 的控制 register 在 CCM_CCOSR (offset 0x60)

對照 kernel source : clk-imx6q.c
在 source code 李,叫 cko1, cko2
        clk[cko1]         = imx_clk_gate("cko1",           "cko1_podf",         base + 0x60, 7);
        clk[cko2]         = imx_clk_gate("cko2",           "cko2_podf",         base + 0x60, 24);
        ....
        clk[cko1_podf]        = imx_clk_divider("cko1_podf",        "cko1_sel",          base + 0x60, 4,  3);
        clk[cko2_podf]        = imx_clk_divider("cko2_podf",        "cko2_sel",          base + 0x60, 21, 3);
        ....
        clk[cko1_sel]         = imx_clk_mux("cko1_sel",         base + 0x60, 0,  4, cko1_sels,         ARRAY_SIZE(cko1_sels));
        clk[cko2_sel]         = imx_clk_mux("cko2_sel",         base + 0x60, 16, 5, cko2_sels,         ARRAY_SIZE(cko2_sels));
        ....

clk 是 struct clk

clk 軟體模型,依照一般 clk 的設置,叫下面的名子。:
  • clk source : parent, mux (imx_clk_mux)
  • divider : divider (imx_clk_divider)
  • enable/disable : gate (imx_clk_gate)
對照宣告的時候,後面的數字就是 register 的 offset, bit-shift , bit-width
拿 gate 來看,對照 datasheet, CCM_CCOSR:

  • bit 24: CLKO2_EN : enable/disable CLKO2
  • bit 21-23 : CLKO2_DIV : divider by 1,2,3,4...8
  • bit 16-20 : CLKO2_SEL : clko2 的 clk src
  • bit 7 : CLKO1_EN
  • bit 4-6 : CLKO1_DIV
  • bit 0-3 : CLKO1_SEL
可以對照看上面code 的宣告。

然後,因為這三個類型的操作不太相同,所以要為每個類型寫一個 operatio function.
各是:clk-gate2.c, clk-fixup-div.c, clk-fixup-mix.c

以 gate 來說。
implement imx_clk_gate 的code 在 clk-gate2.c
static struct clk_ops clk_gate2_ops = {
        .enable = clk_gate2_enable,
        .disable = clk_gate2_disable,
        .is_enabled = clk_gate2_is_enabled,
};
主要就是要實做這三個 gate 的 function.
enable/disable 最後 就是...
static void clk_gate2_do_hardware(struct clk_gate2 *gate, bool enable)
{
        u32 reg;

        reg = readl(gate->reg);
        if (enable)
                reg |= CCM_CCGR_FULL_ENABLE << gate->bit_idx;
        else
                reg &= ~(CCM_CCGR_FULL_ENABLE << gate->bit_idx);
        writel(reg, gate->reg);
}

統一的 clk interface 在 driver/clk/clk.c
呼叫 clk_enable( ) 就會:
static int __clk_enable(struct clk *clk)
{
        int ret = 0;

        if (!clk)
                return 0;

        if (WARN_ON(clk->prepare_count == 0))
                return -ESHUTDOWN;

        if (clk->enable_count == 0) {
                ret = __clk_enable(clk->parent);

                if (ret)
                        return ret;

                if (clk->ops->enable) {
                        ret = clk->ops->enable(clk->hw);
                        if (ret) {
                                __clk_disable(clk->parent);
                                return ret;
                        }
                }
        }

        clk->enable_count++;
        return 0;
}

-- 另外,一般用 clk_prepare_enable( )

所以,一定要 call 過 enable( ), 那個 clock 才會動。

2016/3/24

Android Studio 1.5.1 and JNI

https://codelabs.developers.google.com/codelabs/android-studio-jni/index.html?index=..%2F..%2Findex#0
照這一篇,step by step

重點大概是..
  • 要用 gradle-experimental:0.4.0
  • 所以配合的 gradle 是 2.8 (雖然最新的是 2.12)
  • build.gradle (Module: app) 內容要 follow experimanetal 的格式來寫。* 注意 "=" 號
  • build.gradle (Module: app) 新增 jni module
這樣改完,sync project 後,就可以寫 code 了。

寫 code 有很方便的 code-gen.只要在java code 宣告 native, 之後在宣告處出現的紅色燈泡按下...Create Function....
就會幫你寫好 c source 的 function 外框。

2016/3/22

PQI Air, A500 的 adaptor Mode

就是到 access page . advance.-- internet setting -- Operation Mode, 選 Bridge Mode
確認後等一陣子,再連上去後就 OK 了。

連上的 client 會向LAN request IP.

--- 在 user manual 上可以看到說明。

OpenGL texture compression support , android

http://developer.android.com/intl/zh-tw/guide/topics/graphics/opengl.html#textures
The Android framework provides support for the ETC1 compression format as a standard feature,
..
Beyond the ETC formats, Android devices have varied support for texture compression based on their GPU chipsets and OpenGL implementations.


如果真的要使用特定的 TC 功能,記得宣告在 manifest 中:
Note: Once you decide which texture compression formats your application will support, make sure you declare them in your manifest using <supports-gl-texture> . Using this declaration enables filtering by external services such as Google Play, so that your app is installed only on devices that support the formats your app requires. For details, see OpenGL manifest declarations.

google playstore 會依照 manifest 內容,決定用戶的手機能不能安裝該程式:
Each time you upload an application to the Google Play Developer Console, Google Play scans the application's manifest file and looks for any elements. It extracts the format descriptors from the elements and stores them internally as metadata associated with the application .apk and the application version.

When a user searches or browses for applications on Google Play, the service compares the texture compression formats supported by the application with those supported by the user's device. The comparison is based on the format descriptor strings and a match must be exact.

If any of an application's supported texture compression formats is also supported by the device, Google Play allows the user to see the application and potentially download it. Otherwise, if none of the application's formats is supported by the device, Google Play filters the application so that it is not available for download.
http://developer.android.com/intl/zh-tw/guide/topics/manifest/supports-gl-texture-element.html#market-texture-filtering

2016/3/8

tinyalsa : tinyplay

root@sabreauto_6q:/ # tinyplay                                                 
Usage: tinyplay file.wav [-D card] [-d device] [-p period_size] [-n n_periods] 

看一下source:
pcm.c : pcm_open( )
    snprintf(fn, sizeof(fn), "/dev/snd/pcmC%uD%u%c", card, device,
             flags & PCM_IN ? 'c' : 'p');

    pcm->flags = flags;
    pcm->fd = open(fn, O_RDWR);
看一下系統 /dev/snd/..
1|root@sabreauto_6q:/ # ls /dev/snd/
controlC0
controlC1
pcmC0D0c
pcmC0D0p
pcmC1D0c
timer
所以play 就是...
# tinyplay 1ch48k.wav -D 0 -d 0

bookmark : wandboard

2016/3/7

idmapping -- nfs with user permission

from http://serverfault.com/questions/514118/mapping-uid-and-gid-of-local-user-to-the-mounted-nfs-share


This is what idmapping is suppose to do. First of all, enable is on the client and server:
# echo N > /sys/module/nfs/parameters/nfs4_disable_idmapping
clean idmap cache and restart idmap daemon:
# nfsidmap -c
# service rpcidmapd restart
Now on server and the client will send instead of numeric IDs string principals like bob@YOURDOMAIN.COM. You need to have bob account on the both hosts - client and server. Nevertheless, the numeric ID's can be different.

shareimprove this answer
answered Sep 30 '14 at 5:32

kofemann
1,163717

Ftr, on nfs server the path is /sys/module/nfsd/parameters/nfs4_disable_idmapping (nfsd, not nfs) – Mike Purcell Dec 21 '15 at 19:42

原來 idmapd 要而外啟動,
ref: http://jamyy.us.to/blog/2014/03/6166.html

環境:
Server: CentOS / Fedora
Client: Debian / Ubuntu
Server
# yum install nfs-utils
# vi /etc/idmapd.conf
Domain = localdomain
# vi /etc/exports
/path *(rw,sync,no_root_squash,no_subtree_check)
# exportfs -rv
# service rpcbind start
# service nfs start
# chkconfig nfs on
# chkconfig rpcbind on
Client
$ sudo apt-get install nfs-common
$ sudo vi /etc/idmapd.conf
Domain = localdomain
$ sudo service nfs-common restart (Debian)
或
$ sudo service idmapd restart (Ubuntu 12.04)
Ubuntu 13.10 只要改好 /etc/idmapd.conf 立即生效, 無需其他操作
$ mount -t nfs4 remote:/path /local/mount/point

其他: