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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 q: h( @+ U- F6 o3 H
  1. [code]EDMA sample test application
    - U( B- o( M+ \" X7 ^' J& n3 }
  2. /*/ ^& l+ T+ Z+ f5 T2 t9 Z2 @
  3. * edma_test.c
    1 _6 e. q" z* x& a' z% J9 K
  4. *. V/ _/ v3 i) u4 E% h$ d  Y; F
  5. * brief  EDMA3 Test Application
    ' i; M5 M3 O9 U+ F( s
  6. ** ~& [7 E3 {  \, o3 o; O1 c
  7. *   This file contains EDMA3 Test code.
    ) a2 Y# N5 e" H4 X9 L* t2 _0 a3 Y+ r/ r
  8. *
    . H; g% b- ?$ f( O; v3 d: a) v5 }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 `4 q, f2 E+ O4 \8 s  t1 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 N  J5 ^# q* K0 h! _
  11. *         TO CHANGE., I! L2 c- Q5 z6 o+ @# n
  12. *
    - ]8 t( u* d) Q5 ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 j# X7 N4 f( N+ J5 ]7 |2 |
  14. *, T* k9 Z! @1 [, e* ]6 [, j
  15. * This program is free software; you can redistribute it and/or
    % @2 e4 F. b2 ~4 `' E3 A7 D' h
  16. * modify it under the terms of the GNU General Public License as
    ) u7 L( R+ [/ y2 E
  17. * published by the Free Software Foundation version 2.
    ! d$ s4 X, P- k
  18. *7 B% p2 P- u2 s2 `! L& i% \: r/ }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 x- n. C+ T! F+ ]
  20. * kind, whether express or implied; without even the implied warranty
    8 w2 D" M. ^5 O+ y1 R0 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 ~+ }6 k; ]- B9 D8 {( C
  22. * GNU General Public License for more details.
    ; x- K& `0 O! r6 V3 Q' {
  23. */( y5 \7 C$ l& P

  24. 8 D' _9 T  `/ \+ {/ G7 P
  25. #include <linux/module.h>
    5 A! [- b. s7 N7 R& a1 T9 B# [
  26. #include <linux/init.h>5 _  s! _; n$ p0 P8 F
  27. #include <linux/errno.h>. b* B. u: Y; R; Z$ D/ }5 Z9 L
  28. #include <linux/types.h>
    5 y: P" E9 k, p7 y
  29. #include <linux/interrupt.h>& n/ f! @& g% t9 w
  30. #include <asm/io.h>
    ! H. |* a9 X5 G6 S2 h& L1 B
  31. #include <linux/moduleparam.h>$ `& f" D+ g& |$ d
  32. #include <linux/sysctl.h>: M1 [' q7 S9 `+ T$ r
  33. #include <linux/mm.h>
    . `' N! i. u; T7 ]: Y
  34. #include <linux/dma-mapping.h>
    ' ~* K7 f' J- ?; X

  35. * L$ \4 i" c+ E) P" C* e
  36. #include <mach/memory.h>+ U# D" k+ U; N2 F
  37. #include <mach/hardware.h>
    & j' r1 x$ d% L7 b
  38. #include <mach/irqs.h>
    ) D( b, T' G4 X- d
  39. #include <asm/hardware/edma.h># c6 t! ?% {3 s
  40. & G" V9 l. Z4 ^! X; A+ |
  41. #undef EDMA3_DEBUG5 g4 @7 N/ M0 k# c8 k1 o
  42. /*#define EDMA3_DEBUG*/
    $ Y5 C# }7 U% y) n( K
  43. , Y* Z; }* J/ t2 I8 {
  44. #ifdef EDMA3_DEBUG
    9 Y1 A& S" V3 Z6 \+ `6 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * [2 A) v1 M0 U: h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + b/ k% N; d& J  e) ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). r4 g3 M% V0 G: J% Z
  48. #else) q2 V6 a) M- d/ y/ t" s! i
  49. #define DMA_PRINTK( x... )# s- H$ n$ j& Z% t, {; h. _" d
  50. #define DMA_FN_IN) t9 e/ k/ i: L# N) H4 Q) X$ Y
  51. #define DMA_FN_OUT
    ( t4 [+ r% s  ~
  52. #endif
    9 \6 C" z' Y& {1 g7 c/ u, L

  53. ! {( a* Z4 c/ C0 W$ v9 a- ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & w. |  z& e! V( V5 ?
  55. #define STATIC_SHIFT                3$ g: B" Y( Z* D/ o1 q4 l5 y
  56. #define TCINTEN_SHIFT               20
    5 |1 [  @6 s9 s1 {( W; k
  57. #define ITCINTEN_SHIFT              21" Q- |$ s* T% F; g3 Y9 P! ^9 G
  58. #define TCCHEN_SHIFT                22( Z/ r1 R* y( |3 F* @' P
  59. #define ITCCHEN_SHIFT               23
    . j9 m* t, K/ m: k' t

  60. 3 S  [  @) \" d) }3 A3 s
  61. static volatile int irqraised1 = 0;
    ! g: [5 U& o2 H+ u9 W$ z$ C2 B9 o
  62. static volatile int irqraised2 = 0;
    3 j! r8 \8 _6 z' o: K
  63. . U2 r9 j7 ?, `6 ^0 v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - K5 t: C! W+ Q5 Z9 K3 p/ a9 @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / \8 a0 _, f/ j- k  r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 {) T. f! s- T4 |! ]* \+ M$ l! S

  67. % a5 N2 y2 c( b3 s
  68. dma_addr_t dmaphyssrc1 = 0;
    8 x/ F! `' I& q  S3 g
  69. dma_addr_t dmaphyssrc2 = 0;  D# T: z  Z3 i  g/ `' ]+ b! P  ~
  70. dma_addr_t dmaphysdest1 = 0;2 k: t( L9 f4 F. X2 d, P
  71. dma_addr_t dmaphysdest2 = 0;2 K) }9 h: N1 Z- g. y

  72.   m+ }1 k" E: `' z
  73. char *dmabufsrc1 = NULL;
    ( T2 L9 t7 O5 y, n% g& g% X
  74. char *dmabufsrc2 = NULL;
    . o9 C$ c# @" b2 ~9 r
  75. char *dmabufdest1 = NULL;
    4 f8 I: u- ~" G1 I7 }5 I
  76. char *dmabufdest2 = NULL;
    " K" b- l7 E% c( H# y

  77. 8 U) U6 W& Q' J. y+ y- V' f
  78. static int acnt = 512;
    8 q0 i8 Y* E+ g) v2 V9 J
  79. static int bcnt = 8;
    ' v/ v) H6 |0 [( r8 B3 ?
  80. static int ccnt = 8;
    7 O4 K6 Y3 x! M

  81. 6 D/ g  G7 p' G& i. W2 f, U" N) @  T( L
  82. module_param(acnt, int, S_IRUGO);9 g/ u/ l! q0 D2 [
  83. module_param(bcnt, int, S_IRUGO);
    9 \9 Q: m+ }; e; k$ ~& A; b. O
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 H- v2 b# L( C7 c' Q& L: i, W" @& Z3 G# A& m7 @8 x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ A& B& v3 J$ T3 Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, s2 R! Z/ r7 |+ s4 F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 _- m4 m8 B  u" s
6 E* C- S% \& g1 V! J! e) s( q4 {. E+ y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-25 06:20 , Processed in 0.044818 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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