OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ I; ~* S. s* F# U$ M
  1. [code]EDMA sample test application
    1 {; Q2 D) j" U; I7 O
  2. /*
    0 q$ |8 M! ^- O0 }. Z! i
  3. * edma_test.c) i; m& Z5 Z& r  |1 p5 r
  4. *1 z; ?( C7 ~) j) a" E/ v; ^
  5. * brief  EDMA3 Test Application
    + m; i+ @5 i0 P1 s
  6. *" S. P5 O% l0 g7 y4 @% n, d2 J
  7. *   This file contains EDMA3 Test code.- v9 z) e& d( }; o
  8. *
    , P1 d0 Z# T3 b& I) {) @+ y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" H# d( z3 H4 R, @6 _  l* m. H) `4 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 K& p% f# w( q' q- `
  11. *         TO CHANGE.( o8 Q/ M# ]8 ]% Z
  12. ** R1 }8 y  p6 n$ n- b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 N9 k! w" E) D1 p3 x
  14. *. o  E# H2 ~6 V# L0 b/ x
  15. * This program is free software; you can redistribute it and/or
    . c8 E/ c9 ^; h/ U: N7 Y
  16. * modify it under the terms of the GNU General Public License as
    + g9 Z1 J% z5 L% H8 K7 Z
  17. * published by the Free Software Foundation version 2.! s0 v5 F1 u% d+ ~! s0 i
  18. *
    ; r( h2 s5 k4 e9 M9 O& g; @* I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , n" y% b# e% g, L0 ^
  20. * kind, whether express or implied; without even the implied warranty( H; h+ G3 p# x5 h8 [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 R% Z5 |0 g+ i2 \8 J
  22. * GNU General Public License for more details.
    0 q: O! J3 ]1 J! m4 A4 r
  23. */6 w; Y* w( j2 q, E" N* j9 z- x

  24. 2 u9 g% T  K2 j0 O* ]( K; ]
  25. #include <linux/module.h>
    3 A, Y+ z  k+ \8 p6 ]" \$ _# t
  26. #include <linux/init.h>
    6 U. h9 z) f5 i5 G  Q6 _& f( f
  27. #include <linux/errno.h>
    0 U: q" o: J  }0 q' v
  28. #include <linux/types.h>. \& ~) M# y5 u% C
  29. #include <linux/interrupt.h>
    $ u8 C* U7 I' l$ ^- @5 X8 A! w
  30. #include <asm/io.h>
    ; A4 D% g8 O: H7 d: F* N  |7 \+ `
  31. #include <linux/moduleparam.h>& M7 u: L: H, i/ S; S  r$ E
  32. #include <linux/sysctl.h>: |, j, q9 A6 C; _
  33. #include <linux/mm.h>
    ) o; w3 h6 r% Q4 Q
  34. #include <linux/dma-mapping.h>( I) o6 j3 E7 T8 b
  35. 9 R  ?; f2 Y2 Q  |, e. b3 a! x! l
  36. #include <mach/memory.h>
    & D: s) ^( ?, j7 h$ m( R* S
  37. #include <mach/hardware.h>
    9 G: Y! C- N" c9 F
  38. #include <mach/irqs.h>: A4 \  T: J( E4 L6 A
  39. #include <asm/hardware/edma.h>
    ' d  W' C0 S! c1 i5 K, v  U

  40. % ]) r+ _9 l, T: N$ e
  41. #undef EDMA3_DEBUG
    ) k6 N2 @6 x( O9 f: v  U+ z
  42. /*#define EDMA3_DEBUG*/
    . i' l& F  F" M" _! k

  43. . Y2 J, L; I! M$ B
  44. #ifdef EDMA3_DEBUG/ g( B  b/ E" @) j6 t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' P! a9 \8 B- {0 [/ p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 M3 y: i+ n. {" y' M1 i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 j" |# |1 N/ f' k7 D; Z- O
  48. #else
    : E( r3 M& Z& e
  49. #define DMA_PRINTK( x... )
    " Y" p$ ~# B" U4 q
  50. #define DMA_FN_IN- X0 }" }8 w( I) \3 w3 J+ K
  51. #define DMA_FN_OUT
    " T% j% L5 g) c! D
  52. #endif
    ( p6 E% c! ]. s
  53. ' P- }) c4 W8 ?! |  A; g, g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ l" L7 o. B* J9 ?/ @  w
  55. #define STATIC_SHIFT                3
    - N% A; h7 R* l8 R) r
  56. #define TCINTEN_SHIFT               203 M+ d$ H3 g1 w& g; T& G( Q
  57. #define ITCINTEN_SHIFT              21' I: p1 w- A" `+ L
  58. #define TCCHEN_SHIFT                22
    # z7 ]/ @3 r. H5 Y/ Z: r; @
  59. #define ITCCHEN_SHIFT               23
    " A+ y  e8 i0 K% y/ m' x% C# E

  60. 9 J6 q) ?) U# e9 W0 W0 z% S! Y
  61. static volatile int irqraised1 = 0;
    $ P/ G' r- {$ G5 D* C4 @
  62. static volatile int irqraised2 = 0;3 n5 J. ^, Y1 y! P
  63. ( I5 Q0 A/ r. w7 ~$ u" O2 E* L4 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 p  h9 O# W+ I8 F8 A/ N1 d5 U! C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Q& u& w& O2 n& E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% l- \( \; }8 g3 y* Y8 y  k8 J$ C
  67. " K& X5 i  M3 n& W! F
  68. dma_addr_t dmaphyssrc1 = 0;, u6 U4 U& k% h; g6 B* {3 \
  69. dma_addr_t dmaphyssrc2 = 0;) ^& M) ^1 \  d' p
  70. dma_addr_t dmaphysdest1 = 0;! D5 A3 ^% @" z' u1 {
  71. dma_addr_t dmaphysdest2 = 0;# X: H- Y$ V5 K# z
  72. ! d) l5 D6 w/ i! j
  73. char *dmabufsrc1 = NULL;
    ) ]+ I# I( C, Y6 B0 T/ i& Y
  74. char *dmabufsrc2 = NULL;: |- i& e. A6 r2 {7 y
  75. char *dmabufdest1 = NULL;& x7 P0 r: o7 @2 G- W& A
  76. char *dmabufdest2 = NULL;
    * A- Q' z" k, b& I! M* W5 _
  77. 1 [- q- B" j+ b' F/ J: j
  78. static int acnt = 512;
      [+ N1 Z( x6 ?
  79. static int bcnt = 8;
    # M1 V/ Z  N$ `9 \
  80. static int ccnt = 8;( c: _( k0 j4 O) Z% f" n5 z5 V" @5 L
  81. , O/ e, v0 S* c
  82. module_param(acnt, int, S_IRUGO);
    ) c# z, z. P+ C
  83. module_param(bcnt, int, S_IRUGO);, s, J  C: _# ]5 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" i2 n3 ^9 T4 ^/ L# ?1 a( B8 g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, s  ]  v$ t5 h( Q5 x2 A$ o9 narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 A7 n0 g; _; p# A' n% z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 V- C2 P* @9 I: e4 N7 d6 Q
9 d* g( h3 M' J- u
0 f( c" Q0 l" I" V( H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 04:46 , Processed in 0.039925 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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