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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' H8 w" ~# z0 j% y4 w0 i
  1. [code]EDMA sample test application
    * f$ c2 K4 a6 x! v! G
  2. /*( {; H+ \. }0 r9 }
  3. * edma_test.c
    4 u$ |' ~/ h& m8 V; ?) y
  4. *0 o. z5 Q8 q* E1 ]  Q2 \9 j
  5. * brief  EDMA3 Test Application9 `: W8 s4 L, S, n" h' {- X
  6. *, a% X" z! A( Q, i# C. F
  7. *   This file contains EDMA3 Test code.
    7 d4 s/ m$ z  o/ t8 h$ X
  8. *2 V- h9 t1 X8 P3 [& u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 L2 s: A/ l5 O  b; F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / U1 o$ ~, Q1 ~+ u& R' ]
  11. *         TO CHANGE." C: B6 @+ z( ~2 K* w# o5 w
  12. *7 ~. i+ F7 `7 j1 A$ I! y- X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' A% @1 s# i, l3 _1 q
  14. ** ?! \0 h% {( }! w  B' }" M
  15. * This program is free software; you can redistribute it and/or
    7 W6 i+ R5 W+ C$ i
  16. * modify it under the terms of the GNU General Public License as$ t& n6 T  G/ d) T* ~. m
  17. * published by the Free Software Foundation version 2.3 L# j: b+ i3 ^6 e: c" a, a) i
  18. *
    $ L* T7 q/ x$ \% t" l' B: @; V/ ~& k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ k! K8 z% j4 s6 B3 R8 g/ \8 u
  20. * kind, whether express or implied; without even the implied warranty
    & c0 m8 P, h, I4 _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 }9 V8 F( e6 H) [
  22. * GNU General Public License for more details.
    7 H- J  T* v: Q. K: f6 L; K& \
  23. */
    ( ^6 X; @  k. K( S* t" p
  24. 4 Y, [" w/ Q1 K# k( k$ k" W
  25. #include <linux/module.h>
    + R8 A& j" G, ~# N0 N2 Q; B: h7 v
  26. #include <linux/init.h>
    & I7 E' o* ?. m( s& c7 @
  27. #include <linux/errno.h>
    3 V- N& J5 N" N" Y, k3 x
  28. #include <linux/types.h>. G6 X& |7 n- }  K& p) K- S
  29. #include <linux/interrupt.h>' T" }$ W5 D% x
  30. #include <asm/io.h>3 G" v; h6 b# r1 H& m
  31. #include <linux/moduleparam.h>
    ! H" f/ f" I* ?' O5 M) J
  32. #include <linux/sysctl.h>
    % s4 |3 M, q* f/ O
  33. #include <linux/mm.h>
    * |- V( f+ ^. t" y' B5 B" ?4 U' |
  34. #include <linux/dma-mapping.h>
    - Y6 l& m/ L" F- {( S3 t  |& M3 M

  35. ' ]$ S& u- w5 t2 q6 J$ b+ M$ J2 a
  36. #include <mach/memory.h>
    3 V, y9 c# S; d% W; V/ v
  37. #include <mach/hardware.h>
    0 U9 Q- T4 v1 g  X
  38. #include <mach/irqs.h>( R# p, T% ]$ Q' b8 d3 O+ m  J/ w
  39. #include <asm/hardware/edma.h>
    5 M1 }3 l7 G+ a) s5 s2 F
  40. ( A& y& J! s5 `- n5 h+ C# M* Q
  41. #undef EDMA3_DEBUG
    + X  {7 c+ P3 Q! ^0 E, j; b
  42. /*#define EDMA3_DEBUG*/: R- S" x1 h; e" ?5 d. H; M" b
  43. ) m0 {  P8 \7 i8 N* @1 a/ M! f4 o; B
  44. #ifdef EDMA3_DEBUG1 @8 h7 A* b/ a& G5 `  z* @* j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % j  }' N* ]& L5 J+ l+ K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 R# C( s/ o( }. S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . l1 y& z9 w" F- N( w
  48. #else
    8 j% j  v! S2 X9 C- z; M
  49. #define DMA_PRINTK( x... ), e+ n+ |" C* F( G& C2 u' M
  50. #define DMA_FN_IN
    , C1 ~0 }2 a$ L' z( H
  51. #define DMA_FN_OUT8 u3 d& K& g  y4 a9 g
  52. #endif
    8 O9 D# h' m( E8 [

  53. + }4 l% h4 {5 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 u7 ~6 R: `- x% X3 ?
  55. #define STATIC_SHIFT                3
    & E3 F9 }+ y# f' k
  56. #define TCINTEN_SHIFT               200 G. X3 r+ ]$ w$ r  Q: a
  57. #define ITCINTEN_SHIFT              21
    8 L6 D" ?6 }) e  Y. I* {8 E
  58. #define TCCHEN_SHIFT                22
    & B% j7 Y7 J$ y6 L4 [
  59. #define ITCCHEN_SHIFT               23
    " A  }# f4 C6 P3 I

  60. 7 |/ r7 ^; ?( S7 V2 R& p
  61. static volatile int irqraised1 = 0;
    # u# [. W3 L: P! j  r" ?- V1 n
  62. static volatile int irqraised2 = 0;  s) W2 c% L  o* d9 T

  63. 7 u) ~: R- x6 ^$ m( g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 H3 e- e" {$ k/ S. }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - T& _" i' q( P7 X1 w$ c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' [6 R* V2 s8 Z+ _7 O
  67. * h" g! l( Q6 C
  68. dma_addr_t dmaphyssrc1 = 0;6 g# s3 F  N: O! G! u, ^
  69. dma_addr_t dmaphyssrc2 = 0;
    ; @% h1 w% y% Y
  70. dma_addr_t dmaphysdest1 = 0;: c* x- V: _3 [9 A, i! m
  71. dma_addr_t dmaphysdest2 = 0;
    ) G5 D; v% P' ^5 a3 G
  72. $ G1 ?, z1 W/ r4 {$ G& L( [9 N
  73. char *dmabufsrc1 = NULL;% w5 ~# Y9 I$ M; S& b
  74. char *dmabufsrc2 = NULL;% H. Y1 X+ h, n
  75. char *dmabufdest1 = NULL;
    # k& _" B8 q9 c
  76. char *dmabufdest2 = NULL;; f' m6 c2 I) A6 s
  77. - ^; p: k, h8 K- o  Z7 K
  78. static int acnt = 512;5 Y4 B+ f* v( Y9 Q
  79. static int bcnt = 8;% u" P& }) N+ V
  80. static int ccnt = 8;
    $ f" d! k$ _0 @$ T. v
  81.   ]. v" a6 q' c" v; @) V
  82. module_param(acnt, int, S_IRUGO);- Q, m0 x& U$ `! x0 u9 {
  83. module_param(bcnt, int, S_IRUGO);
    ' \- ^' G$ }( S* x& j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 r9 e3 o" \$ I7 d

; i+ ~4 R, j1 B) M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 _& o) c$ x' M, Y9 l' r9 L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 H% y7 Y. s5 }, ^- n7 }! Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( S7 J: G  x( k; E
5 |1 d) S, W) S5 \# ]# d0 `# G0 W
# D" E+ c1 {! A# u# w  d* k" ]0 t( z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-23 16:34 , Processed in 0.046328 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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