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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" b5 }: \" ^9 E
  1. [code]EDMA sample test application/ Y/ s( d0 Z! o+ T+ }/ d/ I$ p
  2. /*+ E2 e/ m3 [/ T7 v5 g3 F2 [, `8 W3 F
  3. * edma_test.c
    ; p) @: ?2 e  |4 a
  4. *1 W& C: y/ s6 S' ]7 R
  5. * brief  EDMA3 Test Application, H! I1 Y1 h% S+ ^
  6. *1 p: v$ t3 Y2 I$ n) S+ P  o
  7. *   This file contains EDMA3 Test code.
    8 V" W. }, \6 h
  8. *2 Y/ C( ~  q3 k& b: y! p9 p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 j' {6 C5 k# s3 |; e3 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + v5 G  a4 T& O2 y
  11. *         TO CHANGE.6 C+ i) b7 c1 |/ E6 _
  12. *
    % s7 r" j  ~1 f# k, F- w0 e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 l0 }+ `3 z& D
  14. *4 s' M& e- J+ {, ?% J* I* h
  15. * This program is free software; you can redistribute it and/or
    + A: n& t6 X! {
  16. * modify it under the terms of the GNU General Public License as
    : t  l6 H, p  X2 J5 Q! ~
  17. * published by the Free Software Foundation version 2.7 R0 z( z- r4 ~: h
  18. *
    8 p' A$ @9 s' o2 B. n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 I# f& @* V% W/ g; R! ?& G, R- @
  20. * kind, whether express or implied; without even the implied warranty' \# v+ t! h' L# s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 ?/ L0 {. D2 Q3 S9 s
  22. * GNU General Public License for more details.
    4 o5 k1 Z1 Q( h! z( S" ~
  23. */
    % s0 R' N3 r* P- p

  24. 6 w- y! G9 V% \: z0 m
  25. #include <linux/module.h>
    # h2 a* N! y4 \( p4 r
  26. #include <linux/init.h>+ i2 ]9 m9 G3 j/ f
  27. #include <linux/errno.h>
    # j7 V" |5 Y+ l1 {1 I: K1 U
  28. #include <linux/types.h>. w* k- y* [% m
  29. #include <linux/interrupt.h>) d! q3 N$ W+ \0 {) M# h, S' T4 \
  30. #include <asm/io.h>+ \$ h. P2 e1 E% t, z
  31. #include <linux/moduleparam.h>
    # w$ P9 i. ]2 [/ l8 W' o
  32. #include <linux/sysctl.h>
    ; W: o5 `* S4 y! i
  33. #include <linux/mm.h># _. \6 k  N+ H, t' `& A. h2 Z
  34. #include <linux/dma-mapping.h>1 B7 S- n) D6 O  a

  35. 4 M3 h" {4 w/ Z, b# ?+ k$ E
  36. #include <mach/memory.h>$ i: a, x$ f, L$ q; Q( k
  37. #include <mach/hardware.h>
    ( {" s2 M8 Q* W# _$ O
  38. #include <mach/irqs.h>4 L. A1 I- O2 S+ a; T
  39. #include <asm/hardware/edma.h>6 |  l) M0 b- I
  40. * w( n2 ]! z8 [" W1 z/ z& G
  41. #undef EDMA3_DEBUG8 T! b/ _& g( i' ]# R
  42. /*#define EDMA3_DEBUG*/; j% [/ |) |7 |8 h6 F5 F( `  X
  43. # o' `4 J7 h9 N; N' l
  44. #ifdef EDMA3_DEBUG
    * r) d5 M" [+ Y3 o7 w1 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( X& h) A0 k9 y- _, t2 h$ W7 h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% F* h; Y1 V5 N& X/ ~6 O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , O& o" f5 K# j! b, p- A8 O  F% J
  48. #else
    % Q! G. a$ `& h0 _1 a) U0 S7 i
  49. #define DMA_PRINTK( x... )
    / o7 C. e$ y! j
  50. #define DMA_FN_IN
    $ c/ r' ]  q/ k* |* h# j
  51. #define DMA_FN_OUT9 `0 D: f- W7 U; e6 d7 e
  52. #endif
    7 m+ d1 n. ^6 H& V
  53. 7 ?2 E  Y/ c5 Y, [  h2 s: |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) K% j9 d  k3 J. Z$ g3 N) c! v3 ~
  55. #define STATIC_SHIFT                3
    * u; F; ], i& F( J$ A' o
  56. #define TCINTEN_SHIFT               20
    ' Z  b8 ^& ?4 A% O5 Q( t
  57. #define ITCINTEN_SHIFT              21
    ; Y, y9 n: p! T/ @( |
  58. #define TCCHEN_SHIFT                22' n+ k' ]& t& s+ c1 J% e. @
  59. #define ITCCHEN_SHIFT               23
    . L" X% Z4 I# B) w4 Y7 u* O! g6 `
  60.   O3 }1 r5 ^" j4 @
  61. static volatile int irqraised1 = 0;( S. {# W6 }( f0 Q1 _4 F! I) m2 b
  62. static volatile int irqraised2 = 0;
    : F) [) T" o  m& r/ e; Q, E

  63. 4 p7 w4 y) R. u9 {0 b7 a' k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) P% q# F& G3 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / k  f% Y2 X- E+ S9 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % }1 ~$ Y; F/ v: d, o: w# b  e. d+ K
  67. , ]# ?! C+ p& E9 _6 o
  68. dma_addr_t dmaphyssrc1 = 0;
    ( Z9 j" C1 B7 \
  69. dma_addr_t dmaphyssrc2 = 0;* @4 u9 Y! [+ d0 |# z
  70. dma_addr_t dmaphysdest1 = 0;  {" ]8 a3 ~7 v% Y
  71. dma_addr_t dmaphysdest2 = 0;
    $ E+ k7 c* s1 D! h

  72. / Y" S% a2 r8 F; g& Q' f
  73. char *dmabufsrc1 = NULL;; j. f% ?2 ~; `
  74. char *dmabufsrc2 = NULL;$ }7 E8 ?' ^- @7 W1 x1 t' K$ U( F
  75. char *dmabufdest1 = NULL;
    7 e! C! w0 ?' ]0 M8 ]& E
  76. char *dmabufdest2 = NULL;; a: H, @/ @, R6 k' a% V' s

  77. 8 O' I  O- d4 q/ p3 H& B
  78. static int acnt = 512;
    - z/ c- E5 e' T6 z1 }  M' k; u# a7 u
  79. static int bcnt = 8;; r8 K* l) c, j$ C# B' a2 J$ L7 C: J( H- a
  80. static int ccnt = 8;
    : f! @1 A9 b& y) N4 t
  81. : J7 ^4 d) j; [2 v$ l
  82. module_param(acnt, int, S_IRUGO);4 C& K1 U6 K) ]; u- L6 o* I. q1 ?
  83. module_param(bcnt, int, S_IRUGO);
    9 A+ B7 `: {3 n2 ]8 l4 ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ O( `9 D: T1 k6 p
( f+ {. }& @1 n/ {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. |6 Y  p5 i1 \& x2 S0 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: L6 Q3 }2 Q! i2 a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 t+ r0 S, U. |
7 y& l" g  g  X9 J0 j* R! u( {1 V7 I6 V' K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-19 06:27 , Processed in 0.040124 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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