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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , }) Y  t" v  s, o2 k  n
  1. [code]EDMA sample test application
    ) N5 R8 W. h. H- u* x5 i' C9 u7 h
  2. /*
    ' Y% M. w  V, F
  3. * edma_test.c# S3 X" [, E- G
  4. *4 X. |! B2 a  f, @& {8 a
  5. * brief  EDMA3 Test Application
    & L# l8 i+ |. R) V0 p, M. ~
  6. *2 ]" P' [) F4 |$ F* ~- D2 |3 @: u
  7. *   This file contains EDMA3 Test code.1 ]( K# u( {" z1 J
  8. *
    ) b: `" O: f6 A4 e; x; t% D4 q$ i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & l/ j9 @$ U6 k- C  B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! _) R' }0 [- N8 R9 r4 c# U
  11. *         TO CHANGE.& X3 u6 ~8 g: P) ^* V
  12. *
    / s2 b6 s- f6 U: B9 x; ^/ t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 s- h8 Z8 L. H" z$ a# L. q3 `( s: n
  14. *
    % o5 b& y6 z, q$ c8 n' I
  15. * This program is free software; you can redistribute it and/or
    : b! H' F1 Y7 E9 p4 L: Z
  16. * modify it under the terms of the GNU General Public License as
    - V8 P' z) j/ e& }4 t/ o0 T
  17. * published by the Free Software Foundation version 2.
    : Q) w1 u/ ^8 k/ `$ S& \
  18. *1 [/ _( a- p3 \$ ?) d( {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - ~  k4 i/ z8 \% H" {
  20. * kind, whether express or implied; without even the implied warranty
    4 x9 ?0 Y/ F' e/ m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 [+ j" L; J* V5 [8 H. O
  22. * GNU General Public License for more details.
    $ }( h. \* _* p  D
  23. */
    5 k1 T: s% _& t" P- R

  24. $ o0 o2 S! \2 k. F
  25. #include <linux/module.h>
    " ~7 l5 ?+ o; i
  26. #include <linux/init.h>! Y- o7 D7 k8 K! U' O+ c1 i8 `
  27. #include <linux/errno.h>
    & ]; p* l% A& j9 q3 I
  28. #include <linux/types.h>% ?2 v' K5 d; b3 J& a# X( g9 Z
  29. #include <linux/interrupt.h>; x5 N8 @4 d9 j6 k, a' w8 @
  30. #include <asm/io.h>
    2 t  @2 n: m+ h% B
  31. #include <linux/moduleparam.h>- N1 K0 M8 ]; m0 Y
  32. #include <linux/sysctl.h>
    8 O0 t8 }' |% t% i: o. ]: p
  33. #include <linux/mm.h>
    - |3 Q/ i6 P3 \* b- k
  34. #include <linux/dma-mapping.h>  C, ~' [1 e+ X) k

  35. 1 j7 c& g6 w7 G8 s: C
  36. #include <mach/memory.h>0 a' U0 H% O4 `! g( E0 C  n
  37. #include <mach/hardware.h>4 [8 g, x1 w- a( Q- o
  38. #include <mach/irqs.h>
      r+ b! R* l$ I0 h% E$ `$ S; M
  39. #include <asm/hardware/edma.h>
    ) K) C- k7 R$ l+ K8 Z  a
  40. 0 D9 P3 E, l+ s& v$ G5 U
  41. #undef EDMA3_DEBUG
    * M3 Q" e0 f5 |' S% n5 B
  42. /*#define EDMA3_DEBUG*/
    9 ^8 G" T5 H& n4 U9 l

  43. 0 k1 {; `. A$ O+ T) W; V$ t
  44. #ifdef EDMA3_DEBUG! |! }; h7 z6 r( p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  `" T( p3 a* `3 w) Y, D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) M" l3 j4 A, n4 F( n4 O# B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 z9 C0 s' z$ m1 _
  48. #else
    8 _1 C0 U# p9 y9 {/ r) s9 ]
  49. #define DMA_PRINTK( x... )4 s! y9 u; `" y( c' R4 D- h' R
  50. #define DMA_FN_IN3 @0 l: n9 a; ~
  51. #define DMA_FN_OUT2 z* N5 `( h/ v9 G5 ^" ^
  52. #endif* f. p1 M8 q; v: r9 {

  53. 1 F( M" F0 o4 G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 n$ F/ S/ U$ m( q; B
  55. #define STATIC_SHIFT                3
    : j, x5 P( L) A2 ^
  56. #define TCINTEN_SHIFT               20
    ! w! b6 @; J. w8 u2 _2 E. P, M
  57. #define ITCINTEN_SHIFT              21
    6 H$ v; n/ h3 l  M% M% ]
  58. #define TCCHEN_SHIFT                22
    2 R9 e; y/ Q2 f
  59. #define ITCCHEN_SHIFT               23$ C8 B- ~( f4 o9 g
  60. 5 V. U7 o+ [4 V) L2 s, r* H3 s% b
  61. static volatile int irqraised1 = 0;6 @& x, q# O2 c0 h. @! Q7 \( i
  62. static volatile int irqraised2 = 0;9 Z, w! t# Z$ |2 W. s. R! `# ?
  63. ' W  p9 v' w4 A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 v4 b: Q2 o! V9 r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + y1 V( v- y' _( Y. `& p7 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + S2 [) @4 ~: K+ a6 o+ Q6 X1 x
  67. ; \4 e1 N) R+ o) F* |) i* z- |
  68. dma_addr_t dmaphyssrc1 = 0;6 H  E# P$ p; [3 i, [
  69. dma_addr_t dmaphyssrc2 = 0;
    6 f( |  ^# q. D
  70. dma_addr_t dmaphysdest1 = 0;
    5 o$ Y8 e5 C& p8 ?
  71. dma_addr_t dmaphysdest2 = 0;
    # i( f! j( x/ _7 R) [: G2 V

  72. # p: A1 n6 k5 e3 V. R. @" X# L
  73. char *dmabufsrc1 = NULL;  E4 s+ k( z  r
  74. char *dmabufsrc2 = NULL;
    1 [# |8 {, W1 D; n" ]
  75. char *dmabufdest1 = NULL;* F9 c5 X# T# o
  76. char *dmabufdest2 = NULL;6 l. w* B4 w- b9 L5 i# F4 J
  77. 9 U/ q5 H/ f, O) V. q4 @
  78. static int acnt = 512;; [& w) j* ?2 s% q0 k6 t9 l3 {
  79. static int bcnt = 8;
    4 `2 E( o+ A; R: v3 S! K+ f7 a
  80. static int ccnt = 8;
    * b, g: ], w9 ^
  81. 7 U$ k5 n0 |0 m: L* B7 C
  82. module_param(acnt, int, S_IRUGO);
    / P  ^2 D5 Y: [- }& O. D# j# B# h
  83. module_param(bcnt, int, S_IRUGO);6 H, @, g: Z1 J- p4 \) `& E3 |( k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* T6 L9 ?8 i+ g$ `2 F) y! M
. }. t: T) J# ]! n7 v" U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ W% O" O1 t+ @2 [9 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 s5 ^5 X& u  ?* r7 A* M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 d! Z) z- Y; N9 `
/ F. b4 }* c# O1 T; K5 s% _( [9 K) W; Y: P# m/ H& C: U& Z9 r/ t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-28 23:20 , Processed in 0.037863 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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