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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 O. h/ c2 f3 K1 x0 X
  1. [code]EDMA sample test application. L/ v3 F, M1 n% F
  2. /*& }1 e9 t: g! _% H
  3. * edma_test.c
    1 b7 t# B( e/ Z" x: {
  4. *
      [2 L  {) n7 `
  5. * brief  EDMA3 Test Application+ o( U2 \6 o- @6 E
  6. *
    3 ]& G" K; i; h, G
  7. *   This file contains EDMA3 Test code.
    : a+ Y7 F$ [" @$ ^/ Y
  8. *2 P$ U0 A' m2 r# I( j2 L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , W& ?  f: i$ i* y/ k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: |; U3 }: `/ A; ]
  11. *         TO CHANGE.* F+ `+ E8 ]  w* ~
  12. *" y! }! @) ?7 l' o; F; {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ x, k0 p. d2 C8 ?: M
  14. *8 |9 [# U1 I1 f6 s1 Q2 G
  15. * This program is free software; you can redistribute it and/or
    ! x$ E; U4 \1 p) p
  16. * modify it under the terms of the GNU General Public License as# s9 Q1 |/ \+ o% i5 c- e2 {+ @! \" z
  17. * published by the Free Software Foundation version 2.1 f, v1 f. u  B3 T% U) g
  18. *. T0 w- J4 y* O& o# l/ n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ _* w' w/ m/ @! U( k
  20. * kind, whether express or implied; without even the implied warranty0 z, g4 P  P4 K  k) C* ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . t8 H4 e8 S! ^
  22. * GNU General Public License for more details.+ V$ m2 @6 m) M1 d* Z
  23. */
    * h& d# I" e9 C# ?( d+ ?. t) |

  24. 8 }* g4 t) G% f5 H4 Q' M4 ?+ Q. O
  25. #include <linux/module.h>
    2 g0 d) K8 |' q' s
  26. #include <linux/init.h>
    3 O- v0 i- K. w# {
  27. #include <linux/errno.h>
    0 S8 w9 a, b3 z' O0 {
  28. #include <linux/types.h>
      T) N  \: L0 n" N! U* W1 I
  29. #include <linux/interrupt.h>+ J5 |$ w5 O; J& A
  30. #include <asm/io.h>
    8 K4 L# i7 Y% ~0 V+ ^& g4 a6 p
  31. #include <linux/moduleparam.h>; @; k# ?8 L0 u8 @- B
  32. #include <linux/sysctl.h>& ?8 }4 H* V8 I: ^
  33. #include <linux/mm.h>
    6 {& n+ R8 Z5 O3 `
  34. #include <linux/dma-mapping.h>
    9 U( [/ j5 M+ e6 n4 S, q
  35. " u6 s  Z, J5 M2 n5 \  c
  36. #include <mach/memory.h>, E5 g% @1 w9 u/ ?3 O; E  o0 W! G
  37. #include <mach/hardware.h>+ q! a. F' D. {5 ^9 }! n, b
  38. #include <mach/irqs.h>7 g& @; o7 P- e4 Y: ~; @1 J7 |( ]
  39. #include <asm/hardware/edma.h>
    * y% R; O- T3 E1 C

  40. & z* Z  _! T# i$ d2 Z
  41. #undef EDMA3_DEBUG
    $ Y3 C8 f/ k0 U7 D2 Q
  42. /*#define EDMA3_DEBUG*/
    + A; |! i! M9 r2 n) Q% ^

  43. ! p# x* x& C& |/ ]
  44. #ifdef EDMA3_DEBUG# j3 N5 O) ]+ X$ ?$ U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      T3 b  J/ f% G- ~0 F8 x: I! z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 P# Y& N) @; w1 }4 W8 c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; H; c5 @# B5 J; b2 w1 L# p. S
  48. #else
    ! V6 a4 W: N( `* ~
  49. #define DMA_PRINTK( x... )
    + o; L" p. x1 W0 I) p0 W, k
  50. #define DMA_FN_IN
    * P. o1 k; L. s- ^0 V
  51. #define DMA_FN_OUT& X% O& p+ u  T  a6 ]% A" F
  52. #endif3 Z0 B! G9 J, u9 L+ r5 L; I

  53. , h: @" n1 E/ C1 ]3 X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ E  w# D& M* g* J! _
  55. #define STATIC_SHIFT                3- G  n; @. v# @! f1 {
  56. #define TCINTEN_SHIFT               208 r% \. O+ {, K8 g
  57. #define ITCINTEN_SHIFT              21
    2 J* ^& v! [  t9 P- S/ N
  58. #define TCCHEN_SHIFT                22) V7 U4 p1 _; r( O  ]
  59. #define ITCCHEN_SHIFT               23% Q# d3 i/ [  c' ~# R
  60. ! q3 v( g# H1 J( Q
  61. static volatile int irqraised1 = 0;$ q: T8 j/ M1 g( z' X% z8 \; y! S
  62. static volatile int irqraised2 = 0;" n4 v6 J& J2 N1 o  {

  63. , N5 L/ y/ u: Y" W, ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 d; n6 F* J6 F1 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 v: R4 t4 g' R& `; @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) X- w0 h, s' e% M

  67. 4 z7 o  Z4 {2 Z0 ~8 h. [+ ~, W
  68. dma_addr_t dmaphyssrc1 = 0;$ w  I5 x. b  c% K3 P. d4 ?
  69. dma_addr_t dmaphyssrc2 = 0;% C2 V! P1 X; c7 \
  70. dma_addr_t dmaphysdest1 = 0;
    / B' q. S% X, N3 j: b' g1 Y" z- k
  71. dma_addr_t dmaphysdest2 = 0;
    5 Z3 b( Y1 Q$ D0 \$ n' e' v2 i& F

  72. ' `. B. P( x: n  w3 T) R; b
  73. char *dmabufsrc1 = NULL;
    ) M5 ?8 g9 ]% g  O  G; J0 e9 x5 I( F
  74. char *dmabufsrc2 = NULL;: m: r' q: R7 W) Y& U8 `
  75. char *dmabufdest1 = NULL;% T$ h; C0 W  ]: }) u' ^
  76. char *dmabufdest2 = NULL;
    % M6 b; P! @  a

  77. 8 m1 g4 Y) ?& H% ?! E1 o# e8 r
  78. static int acnt = 512;
      r& Y  h- R6 v/ R2 ~
  79. static int bcnt = 8;
    - `/ ]& [/ f/ o% q" F' Z9 i9 _7 P8 d
  80. static int ccnt = 8;# c: u7 |! W: `( _# U, }8 ^

  81. . E0 _) @9 \9 M- |
  82. module_param(acnt, int, S_IRUGO);
    - e+ ]8 f$ l: L' ~, X( @
  83. module_param(bcnt, int, S_IRUGO);, @( ~3 K9 J- B( {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 G2 H8 J; ~. E9 p/ \2 d
, _* y& h! N, a& W. K4 E8 O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* s& z$ t3 v' p" x8 L1 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, b9 O. \1 e. E3 L* H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 P" Z; @/ q$ K' N9 f# f, r+ ^( T. n* V  V. @3 H$ L$ q
* N& ~, ^0 D5 q* N4 E  R. ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 06:09 , Processed in 0.037351 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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