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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) ?/ u% |& N, h! \# ~$ k3 a
  1. [code]EDMA sample test application5 z" z- Y3 p: v0 O4 C
  2. /*+ k8 {  n! F9 M4 i6 U
  3. * edma_test.c
    ) Y( v' X3 r) Q2 H
  4. *
    0 {1 e! ~$ ^* C8 n) h  X# d8 E
  5. * brief  EDMA3 Test Application
      G% A1 j0 v9 E
  6. *0 v7 e& |. a0 U/ R
  7. *   This file contains EDMA3 Test code.; k# ^1 l7 E$ @& }* P4 Y
  8. *
    8 J$ k3 v4 |4 A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + W- K4 \" U  f; g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 G* u$ ~, v# W% z/ r$ |
  11. *         TO CHANGE.
    ) ?# A) T6 h6 m/ I
  12. *
    & I4 K9 A3 X8 u7 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 B+ u( ?  o, x( Y( g$ S# q, e4 ~
  14. *
    0 i3 q5 J, \- p; {& U% ~/ S
  15. * This program is free software; you can redistribute it and/or0 X, }# m% i* Q
  16. * modify it under the terms of the GNU General Public License as: i' l/ x- }* i; y/ R4 S
  17. * published by the Free Software Foundation version 2.* G# ~0 _, A& l) }
  18. *0 k1 u. s3 v7 k  X- P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ ]. E7 G; d& L6 ?
  20. * kind, whether express or implied; without even the implied warranty/ }. k8 j! L% g' j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( i# Q5 q; Z( q
  22. * GNU General Public License for more details.
    3 m/ k9 A" O5 ]! b
  23. */
    9 V' ^  }8 L$ K$ s

  24. & N& P0 e+ w) z1 y) D  V  l
  25. #include <linux/module.h>
    ' z& S* V) k1 N5 P# i
  26. #include <linux/init.h>
    2 d$ K; Z* J& S# U3 p, G
  27. #include <linux/errno.h>
    ! Q1 t2 Y+ P  e( t( {
  28. #include <linux/types.h>
    2 v% \3 h% @% U. M# a' B$ i+ Z7 Q
  29. #include <linux/interrupt.h>
    & q: t; y0 I4 ?, O1 [  c. G
  30. #include <asm/io.h># ~% V1 u' X' {% U' G2 V
  31. #include <linux/moduleparam.h>  {; z& o2 O8 c; R$ a0 b5 i; H0 U: w
  32. #include <linux/sysctl.h>+ D. G. E# Q( {2 P
  33. #include <linux/mm.h>
    : k/ D: x+ H9 T+ s1 A: F
  34. #include <linux/dma-mapping.h>
    % }4 s( {* e9 y8 v

  35. $ U/ H) K# `" v: ]  R4 z% l. T
  36. #include <mach/memory.h>
    7 T% T0 A& j1 k: ~6 u8 F" I/ X
  37. #include <mach/hardware.h>
    : g4 m; R0 x+ `' y+ i# K- }
  38. #include <mach/irqs.h>1 h( W& d5 M! ?" g
  39. #include <asm/hardware/edma.h>
    / _- w$ Z0 x  E- d) I! P

  40. ' D8 U* V( e; _7 x5 f2 Z" K" Y
  41. #undef EDMA3_DEBUG- x0 `9 Q1 L  H( Q2 x# Q2 F
  42. /*#define EDMA3_DEBUG*/
    ' x3 e; X+ {5 |5 J/ B; E# U) V
  43. ; \3 I, J5 S$ A* x) t
  44. #ifdef EDMA3_DEBUG
    4 F2 T* X- z6 A& y: J# k% _1 g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- f5 V% ]2 ?; h& F- B3 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ g( O% l3 Y5 ^! }. V; }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 Y8 S* c) J% q* E  t
  48. #else
    7 S9 v5 v- O( q' o- T8 b: k
  49. #define DMA_PRINTK( x... )5 N( z4 H; R/ a1 J
  50. #define DMA_FN_IN  p' J* [0 N. z3 x9 C
  51. #define DMA_FN_OUT
    % [/ @- g: U8 J: K2 S$ M$ T* S
  52. #endif
    # a/ j  \$ e* m+ y" z1 S+ B

  53. 4 W; {+ y/ ^& l) I8 v: _2 j6 y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , W3 @$ D% i/ a3 _
  55. #define STATIC_SHIFT                3
    ' i9 h) h) c" d. J$ H) d. D4 F
  56. #define TCINTEN_SHIFT               20$ F0 L( |/ j  D$ O4 ^2 D
  57. #define ITCINTEN_SHIFT              21
    + |3 H: n& H/ B; G
  58. #define TCCHEN_SHIFT                227 M/ i1 c2 j9 ^
  59. #define ITCCHEN_SHIFT               23# V" D) K3 \% [, D, @' u( ~3 d, Q

  60. ' L/ x3 m* o8 D3 [, y, x
  61. static volatile int irqraised1 = 0;
    7 V5 B$ b% s+ n$ `2 ]
  62. static volatile int irqraised2 = 0;
    2 J6 w* l. I' e
  63. / R- k  i; F0 O9 y8 |$ J- `* ]6 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & F& f: X' c2 t; u' @% |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & L& [, N2 T2 Q  m& s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 h" u! G5 Y( M3 `7 V; a, _  q

  67. * E- R% s+ r$ k% N5 W) M7 S( \
  68. dma_addr_t dmaphyssrc1 = 0;
    8 `: x3 E0 T; u6 z' y" n
  69. dma_addr_t dmaphyssrc2 = 0;+ Y" t- @9 a9 L8 P3 f" w- U. l
  70. dma_addr_t dmaphysdest1 = 0;% r: x) p1 B8 r/ d4 m4 [, s
  71. dma_addr_t dmaphysdest2 = 0;
      t; M7 i4 f0 T( `1 k8 L/ U: ^
  72. * j. q; h7 y3 y$ Q7 k' G5 q
  73. char *dmabufsrc1 = NULL;
    # T; i$ g0 h7 J, U# B9 V
  74. char *dmabufsrc2 = NULL;- _- [1 w$ Z$ ^+ E9 g2 ~/ r
  75. char *dmabufdest1 = NULL;
    - J* y2 A8 N) R6 R/ k$ Z
  76. char *dmabufdest2 = NULL;
    5 t( u4 ?  y0 e) l' d) V  o" Z
  77. ) Z5 F8 A1 R4 O9 s2 U
  78. static int acnt = 512;2 m1 T( [% J/ J8 y
  79. static int bcnt = 8;
    2 `' f! [% M- }; p2 `
  80. static int ccnt = 8;
    3 O1 Z4 n, k3 W' N2 `

  81. 9 `( n  j$ R2 e9 K, ?1 ]8 i
  82. module_param(acnt, int, S_IRUGO);  C. z4 }+ N! d9 {+ `- c
  83. module_param(bcnt, int, S_IRUGO);
    , V0 d6 O8 W3 k& r( K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, [7 g+ b7 G$ ~$ K% y5 u, V
( Q2 L9 C8 C8 c$ _4 m6 x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 Q" U- p7 t/ D( Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 J& |+ x% y7 @* [/ H, Z0 N+ s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( F# A" [! N  |9 J$ [2 d
/ P2 a  A# |' ]9 T. j9 B" N. o' z; [( G3 E% l+ L6 |" g; o8 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 13:42 , Processed in 0.040217 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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