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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 d( M& r5 b8 f5 |5 b4 Z3 }
  1. [code]EDMA sample test application( F4 ?& Y$ M+ l5 l+ X
  2. /*- T) w0 {4 k# E9 L; g( ^2 y4 v4 m
  3. * edma_test.c
    , R% H. w& V$ g4 S8 ^
  4. *  r  ~, F6 q3 f. T) R7 j! {
  5. * brief  EDMA3 Test Application1 o7 V" P* m& q, C$ w
  6. *, \7 N6 G7 G0 k8 i, y2 S3 }4 v8 C# v+ ]
  7. *   This file contains EDMA3 Test code.
    * b% }4 @5 X# ]/ s4 @  @+ `7 r
  8. *. A. q6 ~; Q( g. a5 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 ]! E/ ?* M/ t: p9 X  w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 x; y( h1 G  `# n5 F  ^
  11. *         TO CHANGE.
    9 \% p. B$ i8 ]8 c
  12. *
    7 {# A6 n1 E+ X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: E6 i0 c8 I& D; O& a
  14. *$ ?* I4 r2 t  H( b& N& z: d9 s
  15. * This program is free software; you can redistribute it and/or
    + b+ Z# U5 _! y) R9 m
  16. * modify it under the terms of the GNU General Public License as! D0 a. e$ r% P- i3 j
  17. * published by the Free Software Foundation version 2.
    # }+ e/ ?' v& h. }
  18. *" q& a: P* l+ d1 [) `  A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ g9 U# S8 g9 t* |
  20. * kind, whether express or implied; without even the implied warranty
    & i8 r. c* ~! u$ N+ o9 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 J6 ~2 ?7 A, ^: y- I9 ~* ]
  22. * GNU General Public License for more details.* E4 H8 N& o2 i- n/ s- m# U+ t
  23. */' i- h1 R2 R9 N0 O/ ^
  24. : Y7 s" p; l6 m
  25. #include <linux/module.h># O1 B8 T5 x0 k$ ^* e+ }! b3 @
  26. #include <linux/init.h>
    ; }. e9 Y. u7 i  O' L4 Y
  27. #include <linux/errno.h>5 A6 v2 `4 I# O* ]$ T
  28. #include <linux/types.h>* z" X3 C# g+ X4 E* u0 P2 X! d
  29. #include <linux/interrupt.h>
    " @" g1 V; D8 ]; c1 G6 Y
  30. #include <asm/io.h>
    / a/ r, Q8 x% m8 N9 h
  31. #include <linux/moduleparam.h>% w/ {8 O/ ^/ D% u! `% c9 ^
  32. #include <linux/sysctl.h>9 L! G% h# V5 Q. ?2 J
  33. #include <linux/mm.h>3 I. ?. A; T3 J; R1 j
  34. #include <linux/dma-mapping.h>7 k# {+ ]4 d) f+ `+ ^) o
  35. ! b* Q5 [5 ]7 x" G& {: y* T
  36. #include <mach/memory.h>2 N3 y& I- N( \+ g/ T
  37. #include <mach/hardware.h>' k3 S$ s4 ?7 }9 k- z
  38. #include <mach/irqs.h>
    0 {2 r' ]( x- v; C: G& ^6 T; T
  39. #include <asm/hardware/edma.h>
    * w( e, r8 W# M: |9 H' j

  40.   ~8 F  ^& e6 K1 Q5 {% s# n
  41. #undef EDMA3_DEBUG  i% y- t, a6 k$ T; V
  42. /*#define EDMA3_DEBUG*/
    - Y: d7 A0 @3 c, W

  43. ; \0 [- X. m: e0 a' k
  44. #ifdef EDMA3_DEBUG9 [/ h' v1 j7 \. n) `+ x8 ~' W$ f$ A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 z# ]' L) D- a# c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 M5 U$ ]- y; u) z6 X9 t6 P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 p: \* @- x( T" Q2 `- _! a
  48. #else
    1 m  r9 ?/ L% S% i* |# k
  49. #define DMA_PRINTK( x... )
    8 I1 j7 t* b* P1 e9 z( j: l
  50. #define DMA_FN_IN
    / a4 ~& V0 Q: q7 s
  51. #define DMA_FN_OUT" X# l: o4 p; W$ P, ?# X
  52. #endif
    ! C$ r) U! E7 t: v/ T8 n- g( ?0 B
  53. 3 I0 {0 Y9 r+ v5 e& t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& x  e" T0 j# g3 d. P8 F0 t9 W  c
  55. #define STATIC_SHIFT                3
    0 X0 Q2 B- {9 x: Q9 @
  56. #define TCINTEN_SHIFT               20
    . f& k' X! K% ~- e# G6 _8 p9 q
  57. #define ITCINTEN_SHIFT              21% g1 b# i( H, P9 r! W3 r
  58. #define TCCHEN_SHIFT                22
    ( x) L" |$ S8 U2 q& B2 t1 W
  59. #define ITCCHEN_SHIFT               23
    7 k8 u% x5 ]7 ?

  60. 6 x: e3 z5 ^0 T, d* \/ M% s8 ]
  61. static volatile int irqraised1 = 0;7 G# S+ Z& `; y' o
  62. static volatile int irqraised2 = 0;7 v9 O; h: s8 l8 n8 G: t

  63. - V9 \& _, |% a0 G. m" U$ ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! t4 d4 v) s; r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' J: R. k% G+ r- C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- f* F' E- T: C; u. Z5 `: u

  67. 6 T# b; K* s/ M' A& V  h) |
  68. dma_addr_t dmaphyssrc1 = 0;. c5 v$ V0 U. W1 q1 o
  69. dma_addr_t dmaphyssrc2 = 0;& t5 Y& p; E3 t7 \2 P
  70. dma_addr_t dmaphysdest1 = 0;
    8 }2 k9 t1 \6 A6 |: A6 u
  71. dma_addr_t dmaphysdest2 = 0;$ P* a1 i5 N3 I1 Q

  72. 0 I7 r1 Y6 C1 ]- @5 i# \, a
  73. char *dmabufsrc1 = NULL;. J+ Z# [8 t8 z! L" [
  74. char *dmabufsrc2 = NULL;
    * b) I1 W1 }1 K/ ^( D
  75. char *dmabufdest1 = NULL;
    ; O" }; W% U8 d7 S% M/ c9 w5 b
  76. char *dmabufdest2 = NULL;# J/ [. x4 T8 x3 r4 b: K( [
  77. . Y" j1 k6 ^) ^& Z9 U
  78. static int acnt = 512;
    % b( C+ ]9 y) ]$ S
  79. static int bcnt = 8;$ z; O' c; J% Y' J7 i5 T. o
  80. static int ccnt = 8;- X) a- I9 X4 R( I
  81. + q/ D7 i% w! f" L8 `
  82. module_param(acnt, int, S_IRUGO);
    ) g+ ?5 O) O5 i5 c5 D% C3 v, ?
  83. module_param(bcnt, int, S_IRUGO);
      n: H% p! N- K7 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 H2 e6 D" t7 C4 H1 g  o! b/ d9 d% s3 j6 y+ ~/ @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 P3 ]2 W! w. n4 Q& i% W( f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( _4 a0 y2 B) g+ u1 j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 {! X& \* s( y( I7 _6 e6 ~4 v. {5 o8 h& w( x* z- x
3 }/ c8 U& L- M4 Z. O  `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-17 17:02 , Processed in 0.041458 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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