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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* }! `+ f' v* w( [3 L
  1. [code]EDMA sample test application2 I% Y8 }' d8 @( H3 x
  2. /*3 b+ C5 J9 W. k+ a4 J8 [
  3. * edma_test.c2 w8 G, [* s3 o
  4. *
    ) y2 O" X/ w. g  n' U
  5. * brief  EDMA3 Test Application+ A9 y: J: u# P
  6. *
    , ^: ]% r% H! s6 B' b
  7. *   This file contains EDMA3 Test code.% k$ r6 @  ~3 G8 t! s. R
  8. *
    4 f0 R# K1 R; N: }: u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& F: V! Q* j* c# Y4 C# {" A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . m! ?, t& z& O" t% v' o
  11. *         TO CHANGE.; D& v8 A+ r* _$ L7 b/ e
  12. *! S4 \/ N* [5 k. a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 j8 v6 ]8 \8 s3 q) ~
  14. *
    " \6 p$ y. V5 V) @( k) M9 t1 |
  15. * This program is free software; you can redistribute it and/or! I. I, c: }$ @9 H# o: R
  16. * modify it under the terms of the GNU General Public License as
    1 a! _! K2 Z/ T7 H# p
  17. * published by the Free Software Foundation version 2.
    / S! j% O/ u) _$ V- ^3 j9 Y
  18. *, E8 V, r( l1 Q+ W6 [% I4 V& V# q! ^  r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& F- ?4 }, W. a6 k' j
  20. * kind, whether express or implied; without even the implied warranty# r5 Q5 O* S, A9 B* |' q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 W) |0 l  {+ y; A3 F2 ^) @
  22. * GNU General Public License for more details.& d; I. \' r$ J) Q- z4 @. p5 @$ L
  23. */
    # {* U* ^  G$ p; \9 v8 }7 @
  24. 2 ?' k. O- r* B& p
  25. #include <linux/module.h>
    ' n: b+ Y+ Z! K' \- r
  26. #include <linux/init.h>( `* Q2 Q5 B: S4 y# M1 E2 @
  27. #include <linux/errno.h>: s* Y1 }: ?( Y; m+ B* q
  28. #include <linux/types.h>1 z( L% b/ f7 u) @1 F
  29. #include <linux/interrupt.h>" z7 T7 G* z: S0 N- `+ s# m- K
  30. #include <asm/io.h>9 t, ]% E9 G3 b# `, ^* i- Y/ F( g3 Z
  31. #include <linux/moduleparam.h>
    9 B7 F5 U% _3 p; Y6 I* ^
  32. #include <linux/sysctl.h>6 ^1 C  L5 E/ U3 s4 r* g, `* m
  33. #include <linux/mm.h>6 @- P, k9 ]4 P4 G
  34. #include <linux/dma-mapping.h>. d! s2 @% d% C

  35. # w0 ^3 T/ j5 P2 c2 ^
  36. #include <mach/memory.h>
    8 o- _" i# }$ @3 @
  37. #include <mach/hardware.h>/ o+ W, v/ F. h
  38. #include <mach/irqs.h>
    # P; u  |- b7 g* d
  39. #include <asm/hardware/edma.h>
    % E4 R% L) [% d1 k) N; ^1 n: y

  40. ' V( I: x: T2 i; c8 \: i. B# D) g
  41. #undef EDMA3_DEBUG
    + A" }+ M8 Z' [7 p
  42. /*#define EDMA3_DEBUG*/3 `5 F2 T! B$ ~& Z8 x: H
  43. % i& d( H: Z; H  z& H. G9 }
  44. #ifdef EDMA3_DEBUG
    7 Z; k, X. G: `! ]3 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 r/ z( h( s$ ?" P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! L" B4 M) ~5 e1 T( @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / L; e8 j6 I; \
  48. #else( x$ b% P" |( ^  [* @# }: G
  49. #define DMA_PRINTK( x... )
    7 U. ~, ^# k' w& v
  50. #define DMA_FN_IN
    " v9 K+ I; M9 w) t) \5 s
  51. #define DMA_FN_OUT
    * s" M) s0 m9 k9 o: z3 R9 s
  52. #endif: O$ X7 |6 T/ j' s4 p/ H4 r
  53. 5 d1 z' {" S' \3 _' i: f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 d: a% \  b% Q" g8 q. B" ^  F
  55. #define STATIC_SHIFT                3, U% z) Y1 V& k. u& N6 N
  56. #define TCINTEN_SHIFT               203 P9 P# a6 S# x1 Q9 s3 e
  57. #define ITCINTEN_SHIFT              21$ O) Z- z( i; s9 Z* M: j% q' r3 P7 U
  58. #define TCCHEN_SHIFT                22
    ' J$ S7 d, [8 z
  59. #define ITCCHEN_SHIFT               23
    4 s" Z% Q5 z; C. a

  60. - f2 ?3 X4 t# M6 o; ^( a% I
  61. static volatile int irqraised1 = 0;
    & z5 f1 i% v8 T7 B4 y
  62. static volatile int irqraised2 = 0;1 t: ~  q- I6 r6 T7 E7 K
  63. . F9 J0 O( R" c) B! c8 P# k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( C/ r$ i' \1 Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & b4 L' G1 \9 j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / f" r$ S' s% C3 p! ~3 q

  67. ! i! V/ v) W8 ]7 o
  68. dma_addr_t dmaphyssrc1 = 0;
    5 ^, ?) m, ?; D0 d6 u
  69. dma_addr_t dmaphyssrc2 = 0;
    1 z5 s$ r1 P) i; f
  70. dma_addr_t dmaphysdest1 = 0;4 F$ Z) M6 S0 [) m! ~
  71. dma_addr_t dmaphysdest2 = 0;" e& p3 c8 U# P5 N& {4 g3 e

  72. ( v. t9 t- J$ \7 n* i8 n$ ?. Z  F( g
  73. char *dmabufsrc1 = NULL;7 }7 j! H1 j% F! U3 k8 ]
  74. char *dmabufsrc2 = NULL;
    ! d3 t" _7 P4 O3 c3 ^6 i- O, u
  75. char *dmabufdest1 = NULL;
    - w$ a3 h$ B5 d/ S2 e
  76. char *dmabufdest2 = NULL;$ C8 D4 ]$ L) ~# S5 g5 q- d# i! I

  77. 5 e% S6 e# ?( e7 y5 z: k
  78. static int acnt = 512;
    5 y0 ]5 f4 E& ]! I! e7 m
  79. static int bcnt = 8;. S) |% u/ G: p
  80. static int ccnt = 8;" }& ^4 B8 a" f" l: q
  81. " G' [( A8 F( C! K
  82. module_param(acnt, int, S_IRUGO);% B& T  Y9 `" K; p6 v2 A# ^
  83. module_param(bcnt, int, S_IRUGO);* s2 H1 d# D% g$ y8 f" f3 a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 l$ C; D. O2 a# M3 G1 w1 e
" ?3 ?& {1 \, V      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 X: Z0 B* O" S  C4 X7 d8 p" O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& K' I, f& M/ |& O1 m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 ~. ^+ c, U. B5 ^% V
8 F( y- u/ C8 J8 u( k9 D, ^  y/ Y6 ]: s0 |
9 k6 U- [& b( }; h, O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 20:12 , Processed in 0.039684 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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