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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. S2 @& K0 A$ i: E4 T0 Q
  1. [code]EDMA sample test application
    % Q0 B( l/ B. r; k8 k3 q& }' T3 u
  2. /*4 [2 T3 m  K9 k5 z
  3. * edma_test.c4 C9 q. P( ?; A7 k  X* z7 s9 B
  4. *
    2 }& |0 p+ C& I/ y" z
  5. * brief  EDMA3 Test Application
    4 J7 ^" a0 _0 f/ N+ g$ A
  6. *. J; D: w# S3 [  k+ F% Q: M& B
  7. *   This file contains EDMA3 Test code.
    - d- J5 o8 Q# |' }. C0 T
  8. *6 b0 w5 D( k% d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. P  Z, c$ x. g- h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" Q$ W& D% v7 V- ~% p. g5 h
  11. *         TO CHANGE.( y! a, a  _0 v: k6 `9 S: I
  12. *3 G. f. R5 b' ?" N% u7 ?+ o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; p' h! n7 a3 n7 f! L
  14. *
    ) }/ x& }# D# ~2 ~8 F* b5 K
  15. * This program is free software; you can redistribute it and/or# M2 {/ R& W% E' {/ }9 S
  16. * modify it under the terms of the GNU General Public License as
    ' v# s6 u2 G! p8 n7 B
  17. * published by the Free Software Foundation version 2.' v: J% t  a  `* Z+ |: J. n, j
  18. *, k+ R' W% O- }2 v7 j( e0 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' r3 N! K0 R; z6 d- v' M' U
  20. * kind, whether express or implied; without even the implied warranty
    * u- n# X* D1 q7 ^/ f! E) b  R  A- Q7 [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # W; t% ~) K+ o. w% y6 V. c
  22. * GNU General Public License for more details.
    ; E, t( R0 [+ X' J( ?8 L) `9 X% D
  23. */' D% [9 d1 v) o' i7 |9 u

  24. 9 o3 Z; Y* B: O( A) N& ^: z
  25. #include <linux/module.h>1 }1 h; o1 K& I; f$ a3 D6 O# P9 M4 ?
  26. #include <linux/init.h>% o1 D9 E& R7 O  J
  27. #include <linux/errno.h>
    5 e% e8 W* b: x3 G
  28. #include <linux/types.h>  t3 H  p; s! i8 j0 X$ k$ L* R. r
  29. #include <linux/interrupt.h>; {. C$ q/ w$ G
  30. #include <asm/io.h>1 j. j. S7 d) D
  31. #include <linux/moduleparam.h>
    / D9 j% J9 X  ]+ P* a
  32. #include <linux/sysctl.h>
    " N/ p& J9 [! x* Y7 Q0 I
  33. #include <linux/mm.h>+ J; Y% j2 p, u8 e) ?# U
  34. #include <linux/dma-mapping.h>+ \0 l' i& A, E9 d
  35. 5 t9 \8 `# x$ v5 u/ M
  36. #include <mach/memory.h>
    ' a1 n2 ~5 C) h
  37. #include <mach/hardware.h>  |3 Q6 d; c2 s5 g9 T! c
  38. #include <mach/irqs.h>
      X. S8 Y4 K( H- q& {% `
  39. #include <asm/hardware/edma.h>
    8 a7 Z" r: Y3 d& y8 I( Q, u! g
  40. : [2 s2 b6 p( A: A' n
  41. #undef EDMA3_DEBUG8 a' A* p. q. ]8 w
  42. /*#define EDMA3_DEBUG*// {& y* s  H* u# s

  43. ( K7 L) g) @8 {9 x0 x) N" l' l
  44. #ifdef EDMA3_DEBUG/ _3 p1 V6 x, Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ Z& N. @2 L4 U' j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 ^/ V3 `* H# |4 D; y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' e* t  T. a. B0 C
  48. #else
    & Y- i" ~/ P/ H3 ?1 {# C% Y
  49. #define DMA_PRINTK( x... )! T0 }8 o( z" E% V# u( X* r
  50. #define DMA_FN_IN$ m: w8 d* O/ C
  51. #define DMA_FN_OUT+ \6 n4 Z3 U$ \8 Q  C1 \4 H, }
  52. #endif
    4 b- H5 b" y$ S9 \& U& R& a' k* Z

  53. - k: B3 o. S6 h/ W2 N8 m% U1 X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 B5 \( L8 c+ K5 I7 h
  55. #define STATIC_SHIFT                3
    * F8 M/ Z, R8 _% t( O
  56. #define TCINTEN_SHIFT               20' v1 _( c6 O4 Q' E2 h$ w
  57. #define ITCINTEN_SHIFT              21
    - o0 \/ N, d" Y! }6 ~1 l" z
  58. #define TCCHEN_SHIFT                22
    4 h. F& M. T3 c4 ^2 b7 L
  59. #define ITCCHEN_SHIFT               23
    2 P6 Q- c4 H4 g; k- a

  60. : B9 J/ g  c+ k# D
  61. static volatile int irqraised1 = 0;
    6 `6 l& T. x0 P+ E' j% u
  62. static volatile int irqraised2 = 0;
    8 A( t. {9 E  T& |! _

  63. 3 R0 n4 R  e( N9 P- u4 z8 o5 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- o0 |, j4 d* I$ z' S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ E6 F- A  T- e9 _- \0 Z4 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / }5 m  [: }. v+ Q/ g& i1 E; m
  67. ( \4 m5 u/ ]8 `9 `: @
  68. dma_addr_t dmaphyssrc1 = 0;
    ( D7 p; d+ ^: |8 b$ B
  69. dma_addr_t dmaphyssrc2 = 0;
    ( P1 N' A. {; m7 i  G3 j/ |
  70. dma_addr_t dmaphysdest1 = 0;- A+ B8 t" ^& p
  71. dma_addr_t dmaphysdest2 = 0;  q( u4 l6 y4 D, L5 o

  72. 1 a, L( O$ e+ W" t* F; O0 A5 c
  73. char *dmabufsrc1 = NULL;
    6 P: y& g7 J/ O/ R# D7 A3 s! j
  74. char *dmabufsrc2 = NULL;
    7 S% O* t2 L* ]7 Y! u+ F
  75. char *dmabufdest1 = NULL;
    9 {* W5 P$ x, c* N9 Y# Y, d
  76. char *dmabufdest2 = NULL;& y( o4 y" a! Y2 n! o' w3 z8 j1 W

  77. ; m' s  B2 A0 [) [) z7 i  n
  78. static int acnt = 512;
    $ s8 ?3 @- e' j- R( ^: ^9 u
  79. static int bcnt = 8;/ a% W# V$ b) Z
  80. static int ccnt = 8;
    3 I; v0 k, C2 L' L6 s

  81. 1 }' _6 Q: H! a4 z( _2 t$ \) E
  82. module_param(acnt, int, S_IRUGO);8 d; ^) g3 u# V1 T5 T( ^- b
  83. module_param(bcnt, int, S_IRUGO);
    $ P+ L  A1 h; ^. y* B  e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 [2 y: k' @  K( O6 o# S# u5 [7 _
' q& i, k2 c& h3 E, W! g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ A) F6 _3 Y3 {* Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 ~3 g5 m8 E& s5 a6 W( A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ S( D7 v. H. |* C' j
7 m# ]  h0 f0 }

, f2 r4 R+ Y7 {) H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-13 02:22 , Processed in 0.040085 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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