發表文章

目前顯示的是 8月, 2012的文章

i2c_register_board_info & i2c_board_info

你可以在 /sys/bus/i2c/devices/ 下看到下面兩個 0-0049 0-0068 表示你的 i2c bus 有這兩個 device. 要如何註冊呢? i2c_register_board_info() 便可以將你要的裝置加入 i2c bus 中 . 1.       先建立 i2c_board_info, 填入你的 device 和 address . static struct i2c_board_info __initdata ts02_i2c[] = {         {                 I2C_BOARD_INFO("lm75a", 0x49),         },         {                 I2C_BOARD_INFO("ds1338", 0x68),         } }; 2.       i2c_register_board_info(0, ts02_i2c, ARRAY_SIZE(ts02_i2c)); 這樣就可以了 , 當然 driver 在 menuconfig 要記得勾選 . 開機後, 你可以看到下面資訊表示註冊成功. i2c /dev entries driver rtc-ds1307 0-0068: rtc core: registered ds1338 as rtc0 rtc-ds1307 0-0068: 56 bytes nvram i2c-gpio i2c-gpio.0: using pins 36 (SDA) and 37 (SCL) lm75 0-0049: hwmon1: sensor 'lm75a' ※     要注意的是 I2C_BOARD_INFO("ds1338", 0x68) 裡的 “ds1338” 需要和 id_table 相同 , 不然會有問題 . ※     #define I2C_BOARD_INFO(dev_type, dev_addr) \   .type = dev_type, .addr = (dev_addr) 所以

MTDPART_OFS_NXTBLK, MTDPART_OFS_APPEND

#define MTDPART_OFS_NXTBLK (-2) #define MTDPART_OFS_APPEND (-1) #define MTDPART_SIZ_FULL (0) MTDPART_OFS_NXTBLK: 指从上一个地址结束后的下一个block做为开始地址   MTDPART_OFS_APPEND:用来进行block边界对齐    MTDPART_SIZ_FULL: 用剩余的空间,即用满整个flash   先紀錄, 再研究!!

aplay, arecord, amixer 用法

1.  aplay 就是撥音樂的 aplay -l  **** List of PLAYBACK Hardware Devices **** card 0: DVR [TI81XX DVR], device 0: SSM2602-PCM ssm2602-hifi-0 []   Subdevices: 1/1   Subdevice #0: subdevice #0 card 0: DVR [TI81XX DVR], device 1: hdmi HDMI-DAI-CODEC-1 []   Subdevices: 1/1   Subdevice #0: subdevice #0 aplay -D plughw:0,0 1.wav -v plughw: card number, device number 2. arecord   就是錄音的 arecord -l **** List of CAPTURE Hardware Devices **** card 0: DVR [TI81XX DVR], device 0: SSM2602-PCM ssm2602-hifi-0 []   Subdevices: 1/1   Subdevice #0: subdevice #0 arecord -D plughw:0,1 test.wav -v plughw: card number, device number 可利用下面直接播出 arecord -Dhw:0,0 -r32000 -f cd|aplay -Dhw:0,0 -r32000 3. amixer  調整音量和參數用的 amixer -h 可以看到比較詳細的介紹 amixer  controls numid=2,iface=MIXER,name='Master Playback ZC Switch' numid=1,iface=MIXER,name='Master Playback Volume' numid=5,iface=MIXER,name='Mic Boost (+20dB)' numid=6,iface=MIXER,name='Mic Boost2 (+20dB)

Linux GPIO Driver Guide

Linux 提供標準的 gpio 使用方法,以下是 TI  reference http://processors.wiki.ti.com/index.php/Sitara_GPIO_Driver_User_Guide#Useful_docs http://www.mjmwired.net/kernel/Documentation/gpio.txt Driver Configuration This section describes about the kernel configurations for GPIO driver The default kernel configuration enables support for GPIO driver (built into the kernel). To enable or disable GPIO driver from kernel build, follow these steps: $ make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm menuconfig Select Device Drivers from the main menu. Power management options --- > [*] Networking support --- > Device Drivers --- > File systems --- > ... ... Select GPIO Support from the menu. PPS support --- > PTP clock support --- > -*- GPIO Support --- > < > Dallas's 1-wire support --- > ... ... Sysfs entries configuration GPIO can be access using SYSFS entries from User Space. For that Select  /sys/class/gpio/...