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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 [. k/ |. p$ W6 Y4 e
  1. [code]EDMA sample test application, m1 D- {, ^. i8 I. z6 M1 T& l
  2. /*
    $ c( h8 f) I* X! e; [
  3. * edma_test.c2 X& M) J# \) l4 e& r* p) q6 n; |
  4. *
    $ V" T, r) E9 ]- g5 `3 B
  5. * brief  EDMA3 Test Application
    7 T, V  W' }' Q$ q
  6. *
    2 n8 x6 v: X: k: r$ O
  7. *   This file contains EDMA3 Test code.0 L) m! N1 x1 ]( h' }, S; Z# c) S
  8. *
      Y9 d- B( c/ y) M- W* \; V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 I5 r) s, V0 ]9 F: ?0 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! y: z$ v+ f# W; P/ u. ^# {
  11. *         TO CHANGE.
    & R$ N* K' k/ {6 M9 d5 X" Y1 h/ W
  12. *4 g# H( ]9 F' _# {" z# |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : i( E0 H8 {4 _' u
  14. *! F8 N, O: ]7 Q+ ?6 a$ z
  15. * This program is free software; you can redistribute it and/or# d7 s# _1 {! n) A' _( T& @4 w9 @& C
  16. * modify it under the terms of the GNU General Public License as
    , J1 l, ?* F+ Y+ S% V# d. ^$ f
  17. * published by the Free Software Foundation version 2.
    / e# h2 e6 w$ P$ @6 |
  18. *: v1 K. ^/ ^1 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 x1 N4 G; Q! d0 G
  20. * kind, whether express or implied; without even the implied warranty
    ; c9 B# B5 ~  c! Q, q* ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 [! y' k& L" @! x" G+ C
  22. * GNU General Public License for more details.3 Y: c) t1 b9 i( t+ }" Z2 a  _
  23. */
    ' b; n( t$ Y  u( @/ F3 ^6 X
  24. & |8 i+ e5 N+ L, P& I) x' M% {
  25. #include <linux/module.h>
    5 P! p% O. O1 o# E2 ~
  26. #include <linux/init.h>
    # D) o$ ^7 r+ Y3 B( h  F. M* ^
  27. #include <linux/errno.h>' C& b# m1 Q: l
  28. #include <linux/types.h>
    + s: N1 s, P3 R9 o
  29. #include <linux/interrupt.h>* V3 x2 ?# _, j/ [" w
  30. #include <asm/io.h>; T, V9 G, l9 S
  31. #include <linux/moduleparam.h>1 K& d; T7 @$ Q
  32. #include <linux/sysctl.h>
    8 F( W8 r$ M" E5 Q  U
  33. #include <linux/mm.h>0 c+ {  g' ?7 R2 s1 i
  34. #include <linux/dma-mapping.h>
    & q; s  Z- r' @, s. x  a1 ~

  35. ! v* g7 [5 i5 {- @  E. b$ y
  36. #include <mach/memory.h>
    & {+ x0 k0 [+ s
  37. #include <mach/hardware.h># N: O- {* ]: `# d0 I  W
  38. #include <mach/irqs.h>
    $ r( d1 \# U+ k5 }
  39. #include <asm/hardware/edma.h>& n! U7 j$ H; X! K0 M. t# l
  40. 1 @7 k: l7 B( U! I( C2 X/ r- |1 y
  41. #undef EDMA3_DEBUG
    ! c, v1 L3 Q/ }/ t% T7 e
  42. /*#define EDMA3_DEBUG*/
    7 q) N1 v8 A- g2 m# }

  43. * o# x$ `) o; F8 D( p+ }1 k
  44. #ifdef EDMA3_DEBUG( h0 U6 Z0 p' Z3 {4 ^  j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , B  @0 ?! N- d& N, C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 l4 q( N& |( R- Q7 j7 k: w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 G& p2 i7 m" R- n) H% T- j
  48. #else  X7 @0 p/ g3 F$ s
  49. #define DMA_PRINTK( x... )
    0 H$ P2 p3 u$ _- P5 }- ?/ N, H
  50. #define DMA_FN_IN
    3 I3 C. P7 V$ j4 e2 n
  51. #define DMA_FN_OUT
    - D% s% S+ i8 n& P
  52. #endif5 Q7 N# {5 r. {: l$ |% d

  53. 9 {$ O1 e3 P8 U/ C' _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  x0 ?  r; v' g- c4 \' y
  55. #define STATIC_SHIFT                3
    5 P& t7 C1 y8 Y2 R
  56. #define TCINTEN_SHIFT               20; F' c% Q% m+ i4 P! |) d7 \
  57. #define ITCINTEN_SHIFT              21. x6 {9 X3 w8 h3 `+ A7 z8 f$ o( I* i, d
  58. #define TCCHEN_SHIFT                22
    7 L* i: r$ W* p
  59. #define ITCCHEN_SHIFT               23
    " m1 D" P- h# x) r! h
  60. 3 W/ r1 Z( y( U8 `: ]$ h5 G6 F7 ^
  61. static volatile int irqraised1 = 0;- k# ^% x# T* q0 L2 S8 x9 W
  62. static volatile int irqraised2 = 0;
    % E2 E8 s" E  h5 u* B; w
  63. 9 C8 T. C2 ^9 M0 \. T  ?6 b: Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! w; e% x' W2 U% G) o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " ^  T8 E) T9 M3 U8 v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 V% `) L8 ?4 d: n" K+ }! c
  67. 5 x7 K. a* H, C" ]0 S( Z% |+ B' F
  68. dma_addr_t dmaphyssrc1 = 0;
    ! t( Z2 N' V- C. V2 O3 ~
  69. dma_addr_t dmaphyssrc2 = 0;
    * |4 N5 M: ]% ~7 Q1 u
  70. dma_addr_t dmaphysdest1 = 0;7 Y' c1 o5 C  {4 k' J
  71. dma_addr_t dmaphysdest2 = 0;- O' w# b( j2 R
  72. ' j% s+ G: o& J% l! l) n  J9 z
  73. char *dmabufsrc1 = NULL;/ T) p, }* R, b1 T. U
  74. char *dmabufsrc2 = NULL;7 U; c" p; _7 W6 S- z
  75. char *dmabufdest1 = NULL;- I9 ^& ]' X* ^/ ^  ~$ L
  76. char *dmabufdest2 = NULL;
    ; I' a  e2 R/ [) _6 v
  77. " `; Y; t$ k& h1 m2 e3 b1 Y+ k
  78. static int acnt = 512;& }: x! T' g1 g' m$ ~% d
  79. static int bcnt = 8;  X4 k+ ]2 T- ?8 Z% f2 R6 g
  80. static int ccnt = 8;
    4 l1 y9 `! O) Z- A5 F2 b
  81. 8 ]. X& U0 g0 \: N" x  s
  82. module_param(acnt, int, S_IRUGO);
    : ^! Z* L8 e: T$ x! `: _8 L$ r
  83. module_param(bcnt, int, S_IRUGO);
    & ?5 V# J; e4 S/ y/ D! b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# E& a  t2 k1 D$ x! K
; i. ^6 ~$ v) M0 _& m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) S3 j) K5 h# j+ z( i2 q% w  darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( C3 N8 O3 w4 b+ o* a. n) P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ _$ }3 C7 k1 N' j* q! `

2 D" E; f% d' Z5 f. T8 d: }6 l  a) f! h: ^, ]2 k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-19 16:14 , Processed in 0.042733 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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