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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ p/ W9 ^" n6 G* D
  1. [code]EDMA sample test application
    ( a  ?1 O4 D, L
  2. /*9 L' d7 i7 Z  W. G2 a. p
  3. * edma_test.c
    9 e+ |1 W' A, y& S1 h
  4. *
    * a8 `& Q4 H" l  u  B- A5 q3 t2 p
  5. * brief  EDMA3 Test Application
    2 O3 p5 z" P/ F0 [
  6. *8 e  b/ `. ]" m% _( ]
  7. *   This file contains EDMA3 Test code.
    , ~' f- l" E) P9 J2 ]6 N0 N# Q
  8. *; @- r0 a( e# j3 ^; a$ X, z) Z4 R( Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! E  p# d% I( B; o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * @% F+ x) S# M+ s
  11. *         TO CHANGE.0 \( v9 S- i5 [% N
  12. *
    ! a2 b1 M/ l! g- b6 L: N0 \/ N) a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 n/ R+ r" ^" c9 y
  14. *. b' f9 x# A3 }$ W
  15. * This program is free software; you can redistribute it and/or1 j" t5 d( @  l, X, q& ?
  16. * modify it under the terms of the GNU General Public License as+ o. ?' R9 x8 m) e9 a: Y! ~
  17. * published by the Free Software Foundation version 2.
    6 o8 Y$ q4 x2 r1 ?: m( Q
  18. *
    5 F- |- G* o0 O2 }( w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " U  J( I* V6 |5 [) w* \' r. B+ a
  20. * kind, whether express or implied; without even the implied warranty
    1 m, W. n/ H; ]% Y5 Q' l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# y- d. N/ H8 k
  22. * GNU General Public License for more details.8 f% n" a  K, L$ b* \  Z
  23. */' J% r; o# C% x0 x. r7 D* _, l

  24. , p: `8 i+ Y2 k! g3 t, X
  25. #include <linux/module.h>
    " q4 ^% k4 G# x$ C  d0 l
  26. #include <linux/init.h>8 X/ j# F; i7 \0 _& _9 x2 @  g1 h
  27. #include <linux/errno.h>% c" @3 D, U: w. e8 }8 [7 w
  28. #include <linux/types.h>1 Z$ g2 V1 t4 q7 `0 T
  29. #include <linux/interrupt.h>
    : [5 Z$ a1 ~' z
  30. #include <asm/io.h>4 |9 U* v8 @6 M' g) @9 o2 _
  31. #include <linux/moduleparam.h>" z" p$ z4 ^2 V! ^; x% ]  m
  32. #include <linux/sysctl.h>6 _* d; t) r% a- N7 A  w
  33. #include <linux/mm.h>9 u& C) E1 S. Y6 M2 o
  34. #include <linux/dma-mapping.h>5 w+ `1 J7 D" J8 U

  35. 3 j3 _4 i( V* l/ m' V) e
  36. #include <mach/memory.h>
    ; w1 k$ E9 j9 b: O  Q: L1 [
  37. #include <mach/hardware.h>
    3 O% |& d$ T. J2 w
  38. #include <mach/irqs.h>
    5 J2 Z5 U$ X1 i" d) ]
  39. #include <asm/hardware/edma.h>" x, G) g7 n, W2 c! C) ?6 _0 r

  40. 3 ]* m& e! a: N2 y
  41. #undef EDMA3_DEBUG+ s+ b8 b4 `: t: e: j; }9 J
  42. /*#define EDMA3_DEBUG*/) G, w; j% C5 v  N, c
  43. ( |* ~$ h1 X. U
  44. #ifdef EDMA3_DEBUG! T* ]# E+ w; y1 J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 n4 T! d( o5 x. u# W  ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , d8 p- X& ]" E  ^( a& q+ G" u7 i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 J( s# i4 {) ?/ Y
  48. #else+ F- A8 [. [1 ^9 I! L" \
  49. #define DMA_PRINTK( x... )% M1 b! q0 K- e8 [) `
  50. #define DMA_FN_IN6 N" N% I+ S/ T6 S7 J# F6 V& K
  51. #define DMA_FN_OUT0 I5 l/ [' l$ M$ _! K
  52. #endif) c' F! I  N9 K/ r& Q+ g3 C( g
  53. ; j. C' o" ?* V3 p7 s! Q. V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 ~5 d6 N( I6 o* M
  55. #define STATIC_SHIFT                3
    ( I! d3 z& \/ s7 d) D8 C- q
  56. #define TCINTEN_SHIFT               20
    & [2 X& V# Z9 L, _) z7 D
  57. #define ITCINTEN_SHIFT              21) ~2 O4 Z# h2 {) g
  58. #define TCCHEN_SHIFT                22
    ( ]$ r7 Y0 h# g5 z/ G/ H
  59. #define ITCCHEN_SHIFT               23
    , V+ M3 {, ]9 N: w
  60. % M& f5 B1 Z4 U
  61. static volatile int irqraised1 = 0;0 l9 t9 ~! E. l0 m" u+ Y2 e- V
  62. static volatile int irqraised2 = 0;+ }' g7 [) M$ h3 U: }2 d. F: L. Q" W
  63. , U- ^6 T3 L5 R$ S4 r6 n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " B+ R; k* q+ x( e" f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 n8 q. }5 y, f1 _6 x& Q+ ]0 Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* q+ J0 s. I% t7 k/ s6 }
  67. ( u# k/ Q8 q0 F+ p4 \! h: `
  68. dma_addr_t dmaphyssrc1 = 0;
      a) l! w2 m6 |& @+ v# p# |) r
  69. dma_addr_t dmaphyssrc2 = 0;; Q9 F; v0 L3 j3 \+ t/ \
  70. dma_addr_t dmaphysdest1 = 0;/ n5 o  R& e( l& L, L
  71. dma_addr_t dmaphysdest2 = 0;9 y$ h. T, R$ F7 D$ _# A
  72. # r& W$ h4 d" X" A
  73. char *dmabufsrc1 = NULL;
    7 g* Q9 c+ J  I! y& K+ W
  74. char *dmabufsrc2 = NULL;
    5 M6 r, ]4 g% q) O
  75. char *dmabufdest1 = NULL;
    - ]- }- ]0 [  ~% I6 p5 ~
  76. char *dmabufdest2 = NULL;
      Q- w. @# `+ m
  77. & v% S9 O8 G4 T- b; j4 H
  78. static int acnt = 512;9 u7 x: `" g; i" |2 b$ M
  79. static int bcnt = 8;
    % ?# O; _+ ?- C# D
  80. static int ccnt = 8;
    & [. t- ~" F- k  c/ R3 w

  81. ) v. ~) }; T/ i( `) F) F9 o. Q+ E
  82. module_param(acnt, int, S_IRUGO);: Z& K) e: J, m* h
  83. module_param(bcnt, int, S_IRUGO);
    . p+ B" k$ b; {, [2 M; |
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 o  C# k& J: l- I5 h: E9 U& f7 V" i5 Z: y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& G) U8 z! n' x8 o* I9 w% Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! V0 R6 A  z2 Y$ P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# U* L0 o% h, k) B6 j! L1 ?0 D$ Z& Y( \. S0 A# A
; `. [, ], J7 x2 Z( i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 21:04 , Processed in 0.040113 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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