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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 m* k6 L8 b" f7 m6 ?( j1 T
  1. [code]EDMA sample test application
    , E6 f  v$ V, I& j# l+ P/ u( u( i
  2. /*
    + |2 v1 }' e$ H
  3. * edma_test.c
    . j8 E& P$ K. E3 \. ]. J
  4. *2 H) s5 t" C* }; o$ z4 q5 R
  5. * brief  EDMA3 Test Application; ?: t. @$ Y  e/ m
  6. *( k, p: n( T, }" a+ A% G( t
  7. *   This file contains EDMA3 Test code.& K6 ]! b' y1 ?- _8 r+ B9 ^/ X
  8. *
    ! b% I6 r, F: d) r' I% o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: G4 v% v) V4 s0 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ R9 K" Z- E4 P0 {2 x6 T8 }
  11. *         TO CHANGE.' x5 E/ f: k- f1 c7 {/ Q5 ^" x2 Q8 Z' d
  12. *2 N& ^0 W9 o  L  x/ g( p' Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 {: N6 }$ o1 a' a: i
  14. *  U" E$ P3 L2 J: g# `
  15. * This program is free software; you can redistribute it and/or
    * \$ D9 _' G: w( T* a
  16. * modify it under the terms of the GNU General Public License as. D3 t1 t2 _: M2 |
  17. * published by the Free Software Foundation version 2.
    ' G' {0 @1 V2 L; j' n
  18. *2 i9 e0 t! R' K  F/ d. [( n! r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 A9 M' M, \) G& |' l6 s
  20. * kind, whether express or implied; without even the implied warranty
      H% a8 i8 l; u2 T' w$ _8 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 i0 e# |0 E- S$ m0 i% R* S
  22. * GNU General Public License for more details.6 j" e' i: r6 I7 v) {
  23. */
    * R/ m6 B9 g/ D9 o
  24. ! `# n6 a# q% R! ^, V7 X  E
  25. #include <linux/module.h>  i/ j# ~5 a* {" O- T' ~& a
  26. #include <linux/init.h>
    8 B+ n  E* b+ _- U" ^
  27. #include <linux/errno.h>
    9 T5 S1 x0 l3 a' }  q! G4 D9 R. y
  28. #include <linux/types.h>6 u* @* Y+ o  ?
  29. #include <linux/interrupt.h>7 `; Y$ v( y6 I, O: I9 k6 D* ]
  30. #include <asm/io.h>
    # m/ H$ d; N  |3 z2 P- L
  31. #include <linux/moduleparam.h>
    ! z7 O" v# m- r8 p6 {
  32. #include <linux/sysctl.h>$ U" q2 }. j2 {! r; f
  33. #include <linux/mm.h>9 }6 N2 c) D. b6 o7 ~; m
  34. #include <linux/dma-mapping.h>) U+ @6 r% x9 E' E0 t) G6 j

  35. 9 u0 G" Q8 u- ^' n2 j
  36. #include <mach/memory.h>2 S5 U/ @' |. F- o, m% m; r+ P$ r9 G
  37. #include <mach/hardware.h>4 r; n6 a) W- k  t$ y
  38. #include <mach/irqs.h>! o, f$ c. V6 a- T1 y
  39. #include <asm/hardware/edma.h>& N8 @- A3 D# l" H
  40. & H: ~0 u' D- B! k( Y& \) E; c  l
  41. #undef EDMA3_DEBUG
    0 H: `- r- ^5 z/ I/ D6 m6 M
  42. /*#define EDMA3_DEBUG*/
    1 n; C& X' j7 l5 B& C) J. R
  43. 4 G4 P" d7 Y7 c( p3 L& g+ T
  44. #ifdef EDMA3_DEBUG
    % c/ O% s- j. m. Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 A/ U6 S9 M9 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% r5 k0 @& m( r7 J$ c* l, ?! Q8 k6 D/ M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 y/ G" @+ {! {2 ], }
  48. #else% X% i) O% S; z) r
  49. #define DMA_PRINTK( x... )
    % w' Y+ u. G8 b: j5 U  V+ @
  50. #define DMA_FN_IN( B% n- Y/ u5 l; l
  51. #define DMA_FN_OUT
    7 x$ ~' q! [3 k5 J4 p; z: C
  52. #endif
    / U+ D' K2 P- ?! o, Z* i  U$ S, k

  53. , x- r+ K' V9 D" P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * s1 G# C) b9 W% e
  55. #define STATIC_SHIFT                32 o0 w. o: L5 G9 x7 p! o* `* N
  56. #define TCINTEN_SHIFT               20
    / t( r+ G0 G" |) j4 w
  57. #define ITCINTEN_SHIFT              218 m% q* \+ h$ q
  58. #define TCCHEN_SHIFT                22
    + Q5 n  h) e6 j; I3 S
  59. #define ITCCHEN_SHIFT               23* w3 k1 Y+ o/ C$ z

  60. , N7 f( ?% W" ], U: R
  61. static volatile int irqraised1 = 0;
    + {. z7 g; H; y; g/ B( a
  62. static volatile int irqraised2 = 0;  K/ d. U7 _: R0 Q
  63. 8 A/ @% I! |3 W$ w; \! G) @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 y  P6 A8 a9 Q" z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: a' E! M  C( d: J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 `% }# ^, z$ p6 j/ M5 V
  67. " @. v  u0 z$ g; \/ W) n
  68. dma_addr_t dmaphyssrc1 = 0;) {/ q* K( A9 A1 _1 X7 k( }
  69. dma_addr_t dmaphyssrc2 = 0;
    # C8 v; R7 x' e0 w
  70. dma_addr_t dmaphysdest1 = 0;
    ( n3 t& Q/ V, R! |5 ]
  71. dma_addr_t dmaphysdest2 = 0;
    ; [1 Z# r( ]7 M( ^8 r0 m/ I+ k

  72. 2 e& o  A* z9 L' }% f3 Y
  73. char *dmabufsrc1 = NULL;) y4 y& X5 V! w
  74. char *dmabufsrc2 = NULL;! g$ ?) P* E% ~/ E; b* F& w
  75. char *dmabufdest1 = NULL;. \2 l1 o1 l! @2 R* F, @8 l+ u3 a# S
  76. char *dmabufdest2 = NULL;* z- y5 c9 ~4 g% o

  77. 4 g: ]( w. V: ~' f
  78. static int acnt = 512;
    # A2 p$ J9 w9 z) f$ j& |3 z  @
  79. static int bcnt = 8;
    0 V! B( e  T- N' C* ~6 S4 [9 T9 e2 u
  80. static int ccnt = 8;
    % w+ R" ^2 n# r9 \: R/ r; t

  81. ) I4 p9 Y: `2 u. D/ l- s
  82. module_param(acnt, int, S_IRUGO);( z7 b& j# ]% P& m9 H; J$ o: G* Z
  83. module_param(bcnt, int, S_IRUGO);
    * A0 q) |  v2 q- t9 U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 G  \7 s6 j" x# y0 z
/ w: z0 [& {( ]( W" t7 j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- K0 \& I; j! Z2 s5 Q3 Z5 G6 {0 P0 karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: M  f- D- t  K; R9 ]  N5 p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# [6 Z7 F# A5 [( v7 V  r
2 A8 \* [. w7 U1 I9 }9 V( O& {) q  [  g' W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 20:43 , Processed in 0.046437 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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