OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 13736|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 W, ~' n. p$ x4 K: Q! y
  1. [code]EDMA sample test application5 M4 l8 M" j8 F. Z
  2. /*2 c+ D9 g0 @- R# ]: j  M( r
  3. * edma_test.c7 e; l) q3 u; m) X4 Y0 y
  4. *& e& v: d2 S0 A' a
  5. * brief  EDMA3 Test Application
    ( l& H3 S# ]. O
  6. *  J( B4 V% K% n0 J$ u, U) V
  7. *   This file contains EDMA3 Test code.! j3 {) U0 R9 {
  8. *
    2 C' w0 J( E) ]1 u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 i1 }" u; U# p1 u- ~- Y4 N5 [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' b9 E8 c* B8 i: F/ [
  11. *         TO CHANGE.
    4 n$ D/ q+ {4 t! Z
  12. *
    2 M0 \, h4 p1 J3 N  r# @9 z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & w& ]0 w) K; E: h
  14. *( l9 V' @# i) J
  15. * This program is free software; you can redistribute it and/or' _: z- @/ }! @7 \$ j$ m. b
  16. * modify it under the terms of the GNU General Public License as( J0 Z1 h: w6 D# g' |0 t
  17. * published by the Free Software Foundation version 2.  S' n/ J- U. n( t5 i$ S/ C
  18. *% v5 [/ C' m' K+ m1 h: ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& f, M) K: M# A
  20. * kind, whether express or implied; without even the implied warranty3 w/ k# J% O: r3 M+ S7 ^' U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! Q6 i" q! t+ u1 L8 x# S
  22. * GNU General Public License for more details.
    5 t$ L+ `$ A0 z7 S9 r( y; R
  23. */
    . l' D& I5 ~( a3 C* D0 T
  24. $ e5 O. q. }/ N3 B
  25. #include <linux/module.h>
    ! z2 C% d0 R4 I7 a, Q, w: W
  26. #include <linux/init.h>
    5 i# r- m8 h" G& M
  27. #include <linux/errno.h>1 X8 N* `! u) n
  28. #include <linux/types.h>
    6 v% k6 ~( S8 i$ o3 l
  29. #include <linux/interrupt.h>! ~: O& Z8 k1 I" t
  30. #include <asm/io.h>2 D( C# E( M& V
  31. #include <linux/moduleparam.h>5 ^# d5 H+ R# g2 R0 S# c& v
  32. #include <linux/sysctl.h>
    & K' U. f' S1 {) E7 Y
  33. #include <linux/mm.h>* N$ H  e9 d2 ?; Y& w% l% i0 P
  34. #include <linux/dma-mapping.h>0 O, L/ c) I- r5 P2 S

  35. ; h( j5 _+ X# R
  36. #include <mach/memory.h>1 r9 L$ T  ?8 g( F) ?
  37. #include <mach/hardware.h>
    + v7 s4 P" g" K# V& C+ K  ^
  38. #include <mach/irqs.h>% T7 \8 K8 W8 ^$ A. [
  39. #include <asm/hardware/edma.h>
    ' W  E9 A" I  M5 i5 H
  40. ( P/ R  |0 q# r6 d) R2 H' V) }
  41. #undef EDMA3_DEBUG
    9 C3 _8 q# o# J9 X
  42. /*#define EDMA3_DEBUG*/1 T( X* ?; U/ d

  43. 8 b- e) M3 V( J( ]& t  q# h; ?
  44. #ifdef EDMA3_DEBUG( ~0 d) r: f3 {9 U9 }/ D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). Y' c7 ~! t; M! A) F4 f7 d: J1 a" @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # f$ l8 i1 S, F* N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 b* L4 v* X: j( I' E) ~8 L( }
  48. #else
    5 O3 I0 u2 S  Z
  49. #define DMA_PRINTK( x... )
    " f& J6 d6 b7 `% m3 r! {9 }
  50. #define DMA_FN_IN' O2 c! {- |+ Y8 B- h1 l
  51. #define DMA_FN_OUT
    6 G8 N" x8 i* ]4 U! ^  \6 y
  52. #endif  q+ Z$ X+ }0 w+ }% W

  53. $ a" A: ]: W" m& G1 S& G6 E7 l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # f7 M5 {1 L" m( F' ?) b% i
  55. #define STATIC_SHIFT                3
    # p* U/ b( a" W3 h/ z. y; D
  56. #define TCINTEN_SHIFT               20
      Z5 a9 r4 g9 U' r
  57. #define ITCINTEN_SHIFT              21
    4 F* X+ M! p, `. x! F7 D
  58. #define TCCHEN_SHIFT                22
    # G3 t0 |8 M3 S$ x5 e8 }
  59. #define ITCCHEN_SHIFT               23
    4 w' w- I5 c0 L4 D6 A

  60. : v/ V% L3 {3 c- S% _6 {9 \. S
  61. static volatile int irqraised1 = 0;
    . M8 q& S0 ~% Y4 n0 e) w
  62. static volatile int irqraised2 = 0;
      x5 H3 k* ?4 r4 J$ ]
  63. & P+ i; p" k0 o" z4 A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- t1 g+ ~0 N9 Q$ T/ P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- `* G# Y5 O6 P1 j% A6 K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 u$ f3 L# i4 `% b. p- T" B
  67. $ ~' s. I/ i! Q) `- K
  68. dma_addr_t dmaphyssrc1 = 0;
    $ C& t7 T6 {( U$ R- P
  69. dma_addr_t dmaphyssrc2 = 0;
    + L" x* F$ o7 J0 B. P' c* n
  70. dma_addr_t dmaphysdest1 = 0;# o  I$ d6 _% O( T) _: @
  71. dma_addr_t dmaphysdest2 = 0;* C6 T9 ~' f/ {7 Y: \
  72. ) u/ ]. r) e8 Z6 y6 y
  73. char *dmabufsrc1 = NULL;; G8 _9 p4 w# A, Q
  74. char *dmabufsrc2 = NULL;
    - ]* b: B4 o+ x2 m, H
  75. char *dmabufdest1 = NULL;' c  ~4 R# Z5 w
  76. char *dmabufdest2 = NULL;
    # \: l- L8 Q# a7 L9 h( k# g

  77. + Z  O, \1 q( s6 S. f) U
  78. static int acnt = 512;
    + k: T( b6 h3 U: B0 o: L9 @
  79. static int bcnt = 8;
    * O7 R9 D$ d+ C2 j7 }3 K6 Z5 N! B
  80. static int ccnt = 8;
    # G: L6 f' U) w
  81. 3 h, y3 w1 @/ `4 n& e% w
  82. module_param(acnt, int, S_IRUGO);  I) u! m. R5 t3 B" b3 v$ R
  83. module_param(bcnt, int, S_IRUGO);
    1 [, _+ g2 o* E0 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! R$ c7 q( X! k* p- X2 Z- O( u2 S# J5 ~) o  k
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 ^8 {: E, C- V& A* V
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 C1 }$ s# D! U4 F/ }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- i  |, o8 k( Z' _) I1 n
) ?  }% O+ G5 C7 {+ \4 u

) ~; S) a3 g4 S/ J% u+ \9 n7 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-7-8 17:26 , Processed in 0.045637 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表