OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! z3 z$ }; \/ k) M7 T1 n8 M9 k6 x
  1. [code]EDMA sample test application' D3 c, w6 {' S0 Z  F$ ~) d1 P
  2. /*0 p& O4 L/ P$ |: n" J$ ~6 b0 C5 ]$ s" Z
  3. * edma_test.c
    ; c9 C! q' h9 b5 i% i
  4. *$ K7 b: [% |  `- |9 F# V% u
  5. * brief  EDMA3 Test Application
    ! t; j$ X9 e* Q
  6. *
    4 E$ ~* ^5 a$ {2 ]6 x% q5 D
  7. *   This file contains EDMA3 Test code.
    4 D% S5 P2 c, |6 p$ N
  8. *
    $ [$ q, d3 I  ?: X* }& W' q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 ]6 b6 K' O# s* v4 H2 E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % g# p1 p2 \0 f5 `6 E" [1 _  Q
  11. *         TO CHANGE.0 Z! h7 z1 E6 |
  12. *$ Y! i3 S/ B% T2 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 ?8 _6 T! r2 J5 A
  14. *; R4 J8 K$ ]" H# b- t# y* U: E
  15. * This program is free software; you can redistribute it and/or
    . ?% V% ~: n# Z3 h8 g0 \
  16. * modify it under the terms of the GNU General Public License as8 C- Q2 W, a' e9 u$ x% w/ l  K3 Q
  17. * published by the Free Software Foundation version 2.5 y* W& u1 G5 V0 H
  18. *6 O4 A6 Z3 _8 N/ P9 s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ U. {: l5 _) e' \2 \# h
  20. * kind, whether express or implied; without even the implied warranty
    : `' ]5 s& P  i; R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 L- L( v6 ?! P3 s: N7 J
  22. * GNU General Public License for more details.# T6 e+ A0 h. h5 w8 m3 V- f( c
  23. */
    ( N1 l1 A& u. X; Z  H, A* v/ K; ]
  24. * R  }4 M& u% P: [
  25. #include <linux/module.h>$ \$ k$ r) ]1 i& a9 R6 B, Q5 m
  26. #include <linux/init.h>
    7 j5 U( W3 F% Z. O. [
  27. #include <linux/errno.h>( A8 ^' @6 M! N) N5 \
  28. #include <linux/types.h>
    ! M0 r* Q5 ~7 d, L- q! c
  29. #include <linux/interrupt.h>) J) y* X% \  C
  30. #include <asm/io.h>
    2 {$ R  p$ ~! \# b' y; B4 F" H1 R
  31. #include <linux/moduleparam.h>
    & t2 r* Z( k; _4 I- G! Y& r5 m! Q
  32. #include <linux/sysctl.h>
    . z  W$ _7 r& J5 a' ^2 N; e
  33. #include <linux/mm.h>% s9 C( ?4 Q7 m3 T2 ?3 D( s' T
  34. #include <linux/dma-mapping.h>' w  M& C2 G5 P4 ?5 s
  35. / C$ B5 F1 d& R2 w" t% J
  36. #include <mach/memory.h>: Y5 J# D. _3 @: ?8 \3 N4 e$ s
  37. #include <mach/hardware.h>; O" _0 s' k6 }: J
  38. #include <mach/irqs.h>
    ! E9 s5 a! K' H( \3 Y4 }
  39. #include <asm/hardware/edma.h>* }( ~; T: V: a" L6 H  W; {& `/ ~) i
  40. ! h3 r8 F  f& Q9 K& i
  41. #undef EDMA3_DEBUG
    ; W1 q- d$ L: H2 E9 S4 b
  42. /*#define EDMA3_DEBUG*/
    - x* w" l: T/ }0 g+ F5 t

  43. 1 ^# i+ B8 Z  `2 i
  44. #ifdef EDMA3_DEBUG
    & i8 N) F% X% F8 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 @0 M9 j& }+ ~) H" b+ l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( ^# y# [8 a' \9 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 U. X. C  s% Z' L) L
  48. #else
    # ~! c* E$ v  P; B- [1 Q6 H
  49. #define DMA_PRINTK( x... )
    7 I! Y3 L, g9 V4 f) U
  50. #define DMA_FN_IN
    4 o) w( V. |; j8 k1 H! Y" C1 E
  51. #define DMA_FN_OUT, C9 J- x3 v4 b4 w6 s5 D' N% T
  52. #endif. G9 @% S$ @* t9 E- }

  53. : u( {/ O7 o+ U, m4 _# i+ @9 T; G- ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& }+ h. F  |0 t& p- w; G6 Y
  55. #define STATIC_SHIFT                3  R2 R* k4 [( ^* Y4 D! ~
  56. #define TCINTEN_SHIFT               20: L0 C0 ?' k- X6 A0 g( D4 Y) R
  57. #define ITCINTEN_SHIFT              21) h% k' u% \. v( F4 g6 S0 c
  58. #define TCCHEN_SHIFT                22
    2 _/ u; ^7 j! c; J3 b
  59. #define ITCCHEN_SHIFT               23- k8 |+ k) S6 [# Y7 N  v' p+ p4 _1 s
  60. / a4 S2 h! ]1 m0 b, v% w7 N# n9 ^
  61. static volatile int irqraised1 = 0;. U: i1 @( c2 h: @3 b
  62. static volatile int irqraised2 = 0;
    - l2 [/ t- I) Y+ Y$ M+ j
  63. 0 T  m; @9 h0 b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % C/ F" d$ g/ e3 m8 v: a3 ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ v3 b- F& J/ Z, R2 N$ @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ A7 J( g2 M" e/ X; b8 C

  67. 5 M# S% n9 [0 z: K
  68. dma_addr_t dmaphyssrc1 = 0;
    , t1 k2 E7 M4 z7 J6 r. U' M
  69. dma_addr_t dmaphyssrc2 = 0;5 v8 [2 V! U0 r) b
  70. dma_addr_t dmaphysdest1 = 0;
    2 l% D) ?. Z( h. D' w
  71. dma_addr_t dmaphysdest2 = 0;3 z! t5 a/ n6 O( \* F9 L( S

  72. 3 `5 g. O$ A7 u; _
  73. char *dmabufsrc1 = NULL;4 T2 g7 B8 G2 P9 U
  74. char *dmabufsrc2 = NULL;
    % ^! R1 H5 @/ h7 D, Q3 m+ d
  75. char *dmabufdest1 = NULL;  O$ W2 R" c9 L7 ~. F
  76. char *dmabufdest2 = NULL;
    / S. r% g9 d" c% L6 V
  77. ! Z( H$ Y3 n+ t6 y$ u- g8 C: s6 e
  78. static int acnt = 512;
    4 b* t+ D7 c+ h  J5 @
  79. static int bcnt = 8;
    # p5 ^/ X! v5 k: }, k' c/ \
  80. static int ccnt = 8;
    ) g" A' d, F6 V1 F/ C

  81.   ?3 \' Z# x! T' S1 ], t
  82. module_param(acnt, int, S_IRUGO);
    4 I4 X/ h" t( y; m5 `! k
  83. module_param(bcnt, int, S_IRUGO);) Y, x7 }. Z) W7 Z8 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 d  F  _) t. a# \0 ~. w
# _. B' D6 t& f* K9 k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; ]$ u" a" Y/ F" q2 u! h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. I1 b: y% w! V7 S& C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 G# i, x3 k: S- |

: R1 ^3 h/ a* N$ k, x% @6 I  r9 M! H6 q" e% A# s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 12:28 , Processed in 0.038899 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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