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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ h- s4 q9 {. S; b5 M
  1. [code]EDMA sample test application
    ; ~. z, y* k# \+ @
  2. /*1 u1 n+ x2 L# o& Y1 O+ ~
  3. * edma_test.c  |% R: [0 c/ d- G6 @( `7 \$ K; P% \
  4. *; @. B6 Q: n! g5 s1 B
  5. * brief  EDMA3 Test Application
    2 U& Y1 E  A! Q
  6. *
    + E: [/ ?9 e: v6 ]7 r. h
  7. *   This file contains EDMA3 Test code.
    % B" |( w" ]: `2 ~0 B
  8. *! h" Y1 N- t8 \4 K+ M1 x1 i0 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% Z) v6 \/ l5 ~  x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , O* `7 ]) \  x' V8 ~4 T6 A5 B
  11. *         TO CHANGE.
    , E2 y; L6 L6 B  I
  12. *
    $ ?, k5 ~' R* @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 J0 j$ m" L) h+ l
  14. *0 s# L% r5 {, n  ]4 p
  15. * This program is free software; you can redistribute it and/or& n7 _9 s" ~, K. L$ u8 k
  16. * modify it under the terms of the GNU General Public License as
    . g# ?6 S: s) t7 j4 T& G1 C8 s: c
  17. * published by the Free Software Foundation version 2.
    " s# D) n$ p4 [# k8 {
  18. *
    4 a( `0 ?/ ~5 H# ^) k3 s' h0 Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 ?1 t% T4 F- ]8 ]/ u' x5 W# P
  20. * kind, whether express or implied; without even the implied warranty& Q6 Y1 {& e% m( M- v- v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / M; Z) M4 h& ^. o% q; C
  22. * GNU General Public License for more details.
    ( q  f, F$ v' k" p' C
  23. *// q( d- K8 E. m  _. v

  24. 5 j+ Y2 M% Y1 r. d4 a! @; B
  25. #include <linux/module.h>
    - }7 V% W4 W- B( c- s& _
  26. #include <linux/init.h>" `4 u' a. i* g1 n2 B
  27. #include <linux/errno.h>
    0 _) m" A0 S" k
  28. #include <linux/types.h>2 ], u, V5 k% m' }! j0 r  O
  29. #include <linux/interrupt.h>. T, H9 x. F; [8 {
  30. #include <asm/io.h>: e; Z7 l6 F$ Y; z; q- l) ~
  31. #include <linux/moduleparam.h>
    ' c; r4 I3 v  K% X; e9 K
  32. #include <linux/sysctl.h>) x# _9 V6 Q& s; f# {; q( ]- V9 H( C
  33. #include <linux/mm.h>
    ( o3 [7 c6 m- l1 ~
  34. #include <linux/dma-mapping.h>. w  }0 [/ K: R7 B4 }

  35. / Y) x8 J4 k$ K$ i3 |' I
  36. #include <mach/memory.h>
    7 w+ I2 c0 h, R0 V" {: B' i
  37. #include <mach/hardware.h>4 ]0 k6 K; l* h
  38. #include <mach/irqs.h>1 `4 m: r; @2 d2 Z$ T8 B, _$ h
  39. #include <asm/hardware/edma.h>( K( K4 Y4 c+ z" n

  40. 6 @9 `/ t8 @4 {0 h0 q) U
  41. #undef EDMA3_DEBUG
    , ?* K  N1 L9 o; a  t, c+ X! j$ R
  42. /*#define EDMA3_DEBUG*/
    # e4 J  X( f2 i: k7 G
  43. ( a, y0 H! ]$ h) d! R" A
  44. #ifdef EDMA3_DEBUG
    $ ^" w6 d" i) K8 K% R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # u# m9 x! y: M1 a; m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! Q: @% |2 q  Y: E% G6 m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 `) I5 r+ J+ d
  48. #else8 X* j+ d: P. S
  49. #define DMA_PRINTK( x... )- _' c  y! U2 E& @$ d3 V& q
  50. #define DMA_FN_IN
    0 y) U" l! Y, X
  51. #define DMA_FN_OUT
    $ m% ~- t. ?% T
  52. #endif
    5 r+ m" V' [+ {1 b" t" W
  53. ) I# j, |2 `' O6 |; {: G( R! ?/ i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& S2 n2 H) k- A( Y* n
  55. #define STATIC_SHIFT                3
    : q$ S, |. |3 x8 }
  56. #define TCINTEN_SHIFT               208 c( \7 h9 K) q. D( S+ g  P
  57. #define ITCINTEN_SHIFT              21
    9 y' n: k" R6 D7 a4 O' v/ I8 X
  58. #define TCCHEN_SHIFT                22
    ) p8 s  g7 @9 U* q1 B* {; U+ p3 m
  59. #define ITCCHEN_SHIFT               23
      `  ^( m8 n( o: l/ Z: [: H
  60. ( \# F5 K. d7 t7 S+ b
  61. static volatile int irqraised1 = 0;, A- `7 g4 k  k3 D% {: F% T" w
  62. static volatile int irqraised2 = 0;
    * q7 j; e3 S/ N

  63. $ D" p. N* x& p5 }# F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! p$ {( T! w" |0 k6 }7 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) B2 d# S, f' o3 U+ M3 t5 q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) k/ a; F8 Y% Q
  67. 7 ^0 `( A4 M/ e6 {- i5 K
  68. dma_addr_t dmaphyssrc1 = 0;
    5 U! n% F# r4 @1 l  n, w0 t
  69. dma_addr_t dmaphyssrc2 = 0;0 Y) f, \1 a% U, v& X  W9 r/ n7 g
  70. dma_addr_t dmaphysdest1 = 0;
    2 ], v: Y1 [8 c3 w; R2 i
  71. dma_addr_t dmaphysdest2 = 0;
    3 ?7 s  Y. P5 K: M
  72. / _: y  ]9 U( v" Q' h
  73. char *dmabufsrc1 = NULL;  `' `- V; Q5 T, h6 d& @. P
  74. char *dmabufsrc2 = NULL;$ y6 Q) E  r+ q" u" F
  75. char *dmabufdest1 = NULL;( q( q) V4 b: X& F% I
  76. char *dmabufdest2 = NULL;% @9 Q$ U. R) F* t, y. h" T" I

  77. ' w- F. V9 M. F: J0 Z
  78. static int acnt = 512;* |) t! _  V8 b5 G! H
  79. static int bcnt = 8;
    ) _; A3 {. B' t" k$ N
  80. static int ccnt = 8;- A) O, h. |3 R/ _5 ~

  81. : F- ~" B( n7 y, s8 ^! {, s
  82. module_param(acnt, int, S_IRUGO);
    ' i/ p! c; t! x0 _0 F
  83. module_param(bcnt, int, S_IRUGO);3 {4 y* Z9 M5 |8 \) {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) l8 w. c& Y  i4 X% w- d/ C' w
1 F6 j) h4 ^: G% H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 L# C+ y; U0 F# `2 sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. K; x+ I8 ?) X2 ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* R! F8 t- \1 x) C2 p  k0 q6 z' Z' f: G7 s0 W

, o  V6 g- r4 y! O2 \7 j' \) m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-8 16:39 , Processed in 0.039415 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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