<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 基于S3C2440處理器SPI移植全過程

          基于S3C2440處理器SPI移植全過程

          作者: 時(shí)間:2016-11-10 來源:網(wǎng)絡(luò) 收藏
          環(huán)境

          硬件:S3C2440(ARM920T)

          本文引用地址:http://www.ex-cimer.com/article/201611/317171.htm

          嵌入式操作系統(tǒng):Linux2.6.24內(nèi)核

          文件系統(tǒng):Yaffs2文件系統(tǒng)

          服務(wù)器:SuSe10.0 Linux服務(wù)器

          第一步:內(nèi)核配置

          需要在內(nèi)核中選擇以上幾個(gè)選項(xiàng):

          很多網(wǎng)友發(fā)郵件說Linux2.6.24內(nèi)核在SPI選項(xiàng)上未發(fā)現(xiàn)有Samsung S3C2440 series SPI 或 Samsung S3C24XX series SPI 和User mode SPI device driver support這兩個(gè)選項(xiàng)。

          其實(shí)在Linux2.6.24內(nèi)核里已經(jīng)兼容了對(duì)SPI的操作。只是在Linux2.6.24/drivers/spi/Kconfig中未能選中此選項(xiàng)。至于什么原因看下面的說明:打開Linux2.6.24/drivers/spi/Kconfig

          找到以下幾個(gè)選項(xiàng):

          config SPI_BITBANG
          tristate "Bitbanging SPI master"
          depends on SPI_MASTER#&& EXPERIMENTAL
          help
          With a few GPIO pins, your system can bitbang the SPI protocol.
          Select this to get SPI support through I/O pins (GPIO, parallel
          port, etc). Or, some systems SPI master controller drivers use
          this code to manage the per-word or per-transfer accesses to the
          hardware shift registers.

          This is library code, and is automatically selected by drivers that
          need it. You only need to select this explicitly to support driver
          modules that arent part of this kernel tree.

          使用SPI的時(shí)候需要把Bitbanging SPI master打開,但是依賴的條件EXPERIMENTAL,這里我們把這個(gè)條件去掉,然后再找到:

          config SPI_S3C24XX
          tristate "Samsung S3C24XX series SPI"
          depends on SPI_MASTER && ARCH_S3C2410 && EXPERIMENTAL
          select SPI_BITBANG
          help
          SPI driver for Samsung S3C24XX series ARM SoCs

          config SPI_S3C2440
          tristate "Samsung S3C2440 series SPI"
          depends on SPI_MASTER && ARCH_S3C2410
          select SPI_BITBANG
          help
          Add by SmallBox at 2011.02.18 SPI driver for Samsung S3C24XX series ARM SoCs
          以上藍(lán)色的字是我添加的。為了區(qū)別Linux內(nèi)核默認(rèn)的配置!修改到這里保存,退出。然后打開該目錄下面的Makefile文件,需要做以下修改:

          添加:

          obj-$(CONFIG_SPI_S3C2440) += spi_s3c24xx.o

          這里說明一下:如果不想在Kconfig中添加我添加的選項(xiàng),這里就不需要修改Makefile文件了。因?yàn)楸旧硪呀?jīng)有對(duì)S3C24XX的支持!

          修改后保存退出!

          下面需要修改的是Linux2.6.24里面的文件:

          1)打開smallbox@linux-server:/home/Linux2.6.24/arch/arm/plat-s3c24xx/devs.c添加一下語句

          這里還需要說明一下,添加后編譯會(huì)出現(xiàn)錯(cuò)誤。還需要增加相應(yīng)的頭文件:

          #include
          #include
          #include

          如果還有錯(cuò)誤,可能就是你的頭文件添加的不夠。繼續(xù)查找添加,知道Make成功;

          2)打開smallbox@linux-server:/home/Linux2.6.24/arch/arm/mach-s3c2440/mach-hyh2440.c 文件添加

          static struct platform_device *utu2440_devices[] __initdata = {
          &s3c_device_usb,
          &s3c_device_lcd,
          &s3c_device_wdt,
          &s3c_device_i2c,
          &s3c_device_iis,
          &s3c_device_usbgadget,
          &s3c_device_ts,
          &s3c_device_dm9000,
          &s3c_device_nand,
          &s3c_device_sound,
          &s3c_device_buttons,
          &s3c_device_rtc,
          &s3c_device_sdi,
          &s3c_device_spi0,

          };
          保存退出!

          最后就可以Make了。下載你的內(nèi)核,啟動(dòng)你的硬件,你會(huì)在dev下發(fā)現(xiàn)spidev0.1這個(gè)設(shè)備了!



          關(guān)鍵詞: S3C2440SPI移植全過

          評(píng)論


          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();