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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 w6 l0 q5 E) V: x+ T
  1. [code]EDMA sample test application! ~# q5 M% F! U& @$ r
  2. /*
    8 @0 J2 R, Z! k0 o: X# \+ V
  3. * edma_test.c$ {4 I; X, C  v6 C- B
  4. *
    8 V% c  l! p9 s) X; e- m, s; U
  5. * brief  EDMA3 Test Application$ h9 D2 _; J1 l
  6. *
    " {7 G+ ?8 O4 F
  7. *   This file contains EDMA3 Test code.) ?. C- a; ]% @+ z  p2 r
  8. *  E% G0 u, }/ s! h) R6 d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) e  W9 c2 x! _% U8 Z. i# D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) l$ ?' D' _4 }2 s7 v" R- _9 U
  11. *         TO CHANGE.
    9 V4 @/ @& c& p7 A6 J0 `1 _" g
  12. *
    / J9 B7 ^+ ~  l! ]3 p0 h& G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) V: U; z2 G" K- B, K  P& u
  14. *
    ! J( I. k* L  O7 m4 M
  15. * This program is free software; you can redistribute it and/or2 v, L3 H) P; Y& `2 R1 z
  16. * modify it under the terms of the GNU General Public License as" V. i9 p6 o- Y6 V# L
  17. * published by the Free Software Foundation version 2.7 l' Q1 W4 O  i/ d/ C4 l
  18. *
    7 v9 F5 P( r# `5 w4 S4 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ j/ {% D$ K  {1 g& A% E
  20. * kind, whether express or implied; without even the implied warranty9 [) b! D* K6 Q$ ]& _0 P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 H9 |0 Y) ?* y2 w6 w- A
  22. * GNU General Public License for more details.2 d* t# h$ ^0 Y8 {
  23. */7 `; ~# u+ z: I1 K# ]

  24. # k  u: d) A  \7 Q; L0 h, ^. [! [
  25. #include <linux/module.h>
    % y* `8 x# z8 A
  26. #include <linux/init.h>! ?/ y2 m5 R  r. m& i6 Z: f' \
  27. #include <linux/errno.h>- N2 a  [& @/ \
  28. #include <linux/types.h>; K# |, p7 m0 E) S3 ~
  29. #include <linux/interrupt.h>
    , {; v5 H2 o" U3 |  Z( p
  30. #include <asm/io.h>
    7 M) e! A0 }+ \% i0 Z2 H
  31. #include <linux/moduleparam.h>
    9 g, r( h5 A+ G
  32. #include <linux/sysctl.h>
    7 T0 ^) M# k8 \: s& y0 [
  33. #include <linux/mm.h>
    ! X2 y7 |3 M7 _  u
  34. #include <linux/dma-mapping.h>4 N5 C# O: {" E" U

  35. 4 d5 b9 A# S# V$ D! A( m
  36. #include <mach/memory.h>
    # P& e$ j4 b- n% c, d5 K
  37. #include <mach/hardware.h>
    3 H2 D$ h6 y+ `5 U: H4 o
  38. #include <mach/irqs.h>' a3 I6 K6 u: Y3 j4 W7 }
  39. #include <asm/hardware/edma.h>
    % B5 ~+ f5 L5 Y: K: ~3 q( n

  40. # V% c* Z+ V& U
  41. #undef EDMA3_DEBUG! B0 D; x1 J! D
  42. /*#define EDMA3_DEBUG*/
    % t0 w* M9 }) M: Q1 f# K

  43. * ~9 l1 a8 r, }4 M3 X
  44. #ifdef EDMA3_DEBUG
    ( L" [' D5 Q8 w' _; o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 u/ w% N+ `/ A4 j1 Y) o4 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 Y2 s# \7 `3 I, N6 C1 ?% T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      Y) `% b6 U3 t/ H* Q$ k% m# G
  48. #else& `( }! }) ]3 l
  49. #define DMA_PRINTK( x... )& e% p! q9 o& E6 v2 r2 F0 o9 `$ P9 H" \1 h
  50. #define DMA_FN_IN) N1 O8 O- W8 s. c
  51. #define DMA_FN_OUT
    " M) Q9 Q& S9 _
  52. #endif
    ( G2 B) n' |, n) n1 g

  53. & ^# S, b) B8 Z) C. D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 B. I: q. ]' Q# D3 E
  55. #define STATIC_SHIFT                3
    4 e! F, L, W" I" R$ \8 o) m; S
  56. #define TCINTEN_SHIFT               20
    & O& j: p/ j  a2 X" C' s5 `1 u
  57. #define ITCINTEN_SHIFT              21
    : I/ K8 f! B  Y
  58. #define TCCHEN_SHIFT                22
    0 `+ L, V& |! @
  59. #define ITCCHEN_SHIFT               23
    ' v6 _/ E6 u- n1 O, L9 ]

  60. . a' y7 @. H6 e& }/ }! }
  61. static volatile int irqraised1 = 0;
    / v# s2 }4 e, q. ]. D
  62. static volatile int irqraised2 = 0;
      \$ Z+ M0 j. N6 N& V
  63. 0 L1 J3 b, Q, H- V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 q: H1 e! y* {3 p  D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 M# ^4 H2 h- ?3 B$ V& |( A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 x5 l  e' L2 b! }% \
  67. : o% M2 o: R% r3 g# M
  68. dma_addr_t dmaphyssrc1 = 0;
    + l6 ^6 g- _9 G# @& S1 E
  69. dma_addr_t dmaphyssrc2 = 0;
    ) a- H) A* h- H: ^4 U( L5 e
  70. dma_addr_t dmaphysdest1 = 0;
    . r4 [+ [! I9 ]. y
  71. dma_addr_t dmaphysdest2 = 0;6 _# h9 I6 v" q7 ^: o9 z# U5 I# h
  72. ) A4 b% F+ k& r5 Q* ^5 N) }5 b
  73. char *dmabufsrc1 = NULL;: f# a4 i# _+ Y0 ~, _0 y2 I
  74. char *dmabufsrc2 = NULL;  _8 e  p+ F3 T3 }: c9 e
  75. char *dmabufdest1 = NULL;" k0 q" @& @& @6 D# U
  76. char *dmabufdest2 = NULL;
    : K: a# z3 e) w- ]. J1 A# z" p

  77. 5 R" h5 f: r, O; l# ]  I  C
  78. static int acnt = 512;7 @8 y! I, I$ i! K) |' T5 ]) @
  79. static int bcnt = 8;' }# n. `" u& _+ y& j
  80. static int ccnt = 8;
    ) [: S5 [* p6 }+ }& H/ k5 _
  81. " a/ E: H# J: {: C* }/ ]. s8 o
  82. module_param(acnt, int, S_IRUGO);: F; \% B" a! }4 E2 P1 Y: [7 R' w
  83. module_param(bcnt, int, S_IRUGO);1 F. G0 Z# M- _% {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 W6 j" \  v4 b: f( @
% E$ R' N+ K! p  d, r' A0 E0 `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 x; W1 ]) D- t$ b1 S$ q8 Rarm-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 m1 |# j" V. \4 m2 g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 l" O2 M: \9 v" g# v4 X

& @0 r0 G0 @4 w0 r+ F( d( H$ `# b" c
+ j& D9 ~5 l- _7 W% D( D/ B8 S0 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-12-3 03:54 , Processed in 0.049280 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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