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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  E4 a! m6 q: M8 b* A
  1. [code]EDMA sample test application; `3 k. h# u6 u: v5 O3 R: L- Z
  2. /*0 W2 r1 _( [+ D/ c) a8 w2 m
  3. * edma_test.c
    " I/ H& D/ }1 h8 K+ `& N
  4. *
    ; n8 ], ^! ^4 q8 N% p, |+ P
  5. * brief  EDMA3 Test Application! b6 [9 l4 D+ `) r! F  y
  6. *# I/ \1 A/ Q9 s/ u0 ]4 [  ]4 ?
  7. *   This file contains EDMA3 Test code.
    ) g4 W8 Z- P3 P
  8. *' Y. y6 C& I7 o% ~0 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 M8 [+ j8 c2 N* q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ F& a: p) Y) h2 d
  11. *         TO CHANGE.
    0 B% C7 H$ E- x7 a/ y$ Y
  12. *
    , p5 b. W. c$ Z" Z0 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' C& L2 x# L7 b1 T# G: U& }
  14. *
    2 W# H$ a. B1 |' \; L: P, E$ J
  15. * This program is free software; you can redistribute it and/or
    4 e/ `( G) J: c) N. E
  16. * modify it under the terms of the GNU General Public License as
    $ t( X7 ~2 r( M; g
  17. * published by the Free Software Foundation version 2.
    0 x; D2 \4 S. }
  18. *
    / C: e; O" z8 X( c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 j4 f: G& r4 k, `+ [4 O: w4 d
  20. * kind, whether express or implied; without even the implied warranty, e" `1 F  X2 G" Q. m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( F# F& U+ T" h+ i. R* m7 T+ \
  22. * GNU General Public License for more details.4 l. I& ]8 W! c  ?( |  z
  23. */  b6 i5 e! z. E- r; m; u& h9 Y

  24. . `) R8 W  d1 B$ c
  25. #include <linux/module.h>
    0 {! P& y5 X  `& D
  26. #include <linux/init.h>
    % I. \/ C" m2 n% z. o
  27. #include <linux/errno.h>5 p* L; ^% ?5 i. \
  28. #include <linux/types.h>
    ; v# |* E8 Y* G! w1 t/ P3 d+ V
  29. #include <linux/interrupt.h>
    ' C0 m3 W# w! Q8 r- q
  30. #include <asm/io.h>
    1 C8 N* R/ M$ D$ F1 X
  31. #include <linux/moduleparam.h>
    9 r# {  [: K' }: y( ?$ o) ^
  32. #include <linux/sysctl.h>. D; c" L+ E% l0 b. w' f, I
  33. #include <linux/mm.h>
    * c/ A1 H- o" X1 v; t. x$ S- V2 B6 F
  34. #include <linux/dma-mapping.h>! n: g" r; T& C) H: }( l! K4 F2 F
  35. ; ^# ^2 D' Q' S+ Y0 O2 t( r/ F0 [
  36. #include <mach/memory.h>  F4 O5 ^. S8 H
  37. #include <mach/hardware.h>  P, o+ I  l- J$ G$ o  H$ e4 ^4 R
  38. #include <mach/irqs.h>
    , {; B& X# x! X0 K# L
  39. #include <asm/hardware/edma.h># B- M: s( t3 b0 v
  40. # Q6 h  j/ K3 Z$ W* R3 Z+ A* _) @
  41. #undef EDMA3_DEBUG4 j* z- {" V% Y+ v3 C, X
  42. /*#define EDMA3_DEBUG*/; C* t4 [; n' H& V6 N" e0 q

  43. ; z0 D6 O: ]! `; U, K
  44. #ifdef EDMA3_DEBUG' i4 o! D2 Z& c' C; i* d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) g7 p8 \' M# {, [9 A8 I) S5 W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # a' T' ~9 F3 K. s3 }1 i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! o) W  w# ?# ^  p4 K/ |
  48. #else' m5 f8 N3 Z1 M5 k6 ~
  49. #define DMA_PRINTK( x... )! W5 f! K: R% ~( S! v" \* t0 B
  50. #define DMA_FN_IN
      @0 O8 a% J7 S1 P
  51. #define DMA_FN_OUT6 [! g+ u& U, L* w, [
  52. #endif
    7 t1 }% N# ]  k& ?9 e/ W) L/ K
  53. * x5 W4 {9 [; n2 }* G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 X7 G" a) Y, [. v/ C
  55. #define STATIC_SHIFT                3
    & C: D6 b6 O9 t2 Y' o. I5 C$ v
  56. #define TCINTEN_SHIFT               20+ O& v* l# ^) x: L9 G0 E7 N7 B2 ~
  57. #define ITCINTEN_SHIFT              21
    " Y  D: u8 C0 G
  58. #define TCCHEN_SHIFT                22* O5 w/ q& U' @- o5 J: I( k
  59. #define ITCCHEN_SHIFT               23
    . \" g& _! N, j, B: c* K! M5 E

  60. ' O- u4 P0 b9 x
  61. static volatile int irqraised1 = 0;
    7 l$ ]# T7 E$ D# X7 ?& I
  62. static volatile int irqraised2 = 0;* ^. T, B0 ]) I
  63. 7 R; X# k9 q* q; b* b* d4 c/ G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* O; l9 e  W) U% V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 @- I8 J" j* G4 t* b3 w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; W+ q* U* V" F  ]8 a
  67. ' @( F, A; Q& R1 c+ D& W
  68. dma_addr_t dmaphyssrc1 = 0;* }% z# }. V, }. I
  69. dma_addr_t dmaphyssrc2 = 0;
    ; r0 a* O9 Y* @1 ]% j* S3 A
  70. dma_addr_t dmaphysdest1 = 0;
    5 C' W; |# \) n4 w5 E0 D
  71. dma_addr_t dmaphysdest2 = 0;
    4 n0 r2 n/ A+ c! s1 A) y
  72. $ D: x/ f! A9 @
  73. char *dmabufsrc1 = NULL;
    4 b  i; a. M+ l+ b! H, P  ~
  74. char *dmabufsrc2 = NULL;
    ( ~$ Q6 H5 @+ U  P4 w2 q4 _, c- c
  75. char *dmabufdest1 = NULL;0 S8 n4 V8 x8 ]
  76. char *dmabufdest2 = NULL;
    " j, J" M" L( \& ]/ G$ p/ K! q7 M
  77. 0 f2 A! g) B1 D: n% E* ?" s
  78. static int acnt = 512;
    - X; i' ?5 z3 P
  79. static int bcnt = 8;
    1 J2 X/ S" i4 I7 m0 d3 _6 d* i
  80. static int ccnt = 8;! ]$ z3 @* y0 T1 A9 i

  81. " R2 A6 ]7 C, w1 |
  82. module_param(acnt, int, S_IRUGO);9 K' i5 G5 A( z. S
  83. module_param(bcnt, int, S_IRUGO);8 J" E& H* v, c6 Q# x2 e# M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' I( Q  K' W1 Z( K
6 i& g/ {6 k2 s. {0 @- s% W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& m2 m) M& u  o: p1 [6 Y# w$ f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' w& O3 Q) {* P0 J; }. G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: S" A, `# }0 N
# {2 {" h( A4 r  i2 |2 M
& H4 Z# x, q# F) d& _" p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 16:43 , Processed in 0.103104 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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