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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ t3 @0 Y$ p; |4 h
  1. [code]EDMA sample test application; H% ~: a$ u* K3 H7 Q
  2. /*
    . B9 Q9 R  d- c
  3. * edma_test.c4 H( _: g; n7 F: @) A& ]( P
  4. *# s3 E1 Z( x6 W: o
  5. * brief  EDMA3 Test Application4 ^# m" b# |. y7 t1 d% Y
  6. *
    , o4 A3 O/ e' A- ^
  7. *   This file contains EDMA3 Test code.  K( \8 P. J$ P8 g% t
  8. *( t3 [2 _! o6 O% R, B3 E! O* \& M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! I7 v! J  o, y# {! ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 x* \( R- U& E( N. H
  11. *         TO CHANGE.
    * a5 `  `) P, S9 j5 u& W6 W
  12. *
    - s+ g' W3 e! b% P6 q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 Y+ r' ^( n) e2 A8 J
  14. *3 |# t' d& e5 r9 q% C/ N
  15. * This program is free software; you can redistribute it and/or
    , N) Z% x* @$ Y( c& @# h; a
  16. * modify it under the terms of the GNU General Public License as
    6 v4 u8 ^, D; Z& V- p. U
  17. * published by the Free Software Foundation version 2.
    . b+ c' \, x+ j
  18. *
    ) U* z6 l& e9 d% _3 u0 @. K, s" T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " w6 ]# L, t: r0 M0 Q
  20. * kind, whether express or implied; without even the implied warranty! A, t! |* K. [/ O2 m5 g0 r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 y6 J( m! }5 R# S$ R9 _
  22. * GNU General Public License for more details.
    / g' C, X/ }4 B. o+ j; w
  23. */
    " y7 g- w1 b" _% v1 L

  24. " K' s% y2 m* A" w# ?& a
  25. #include <linux/module.h>& j4 X$ ~% t& S1 G
  26. #include <linux/init.h>
    3 E( ~4 ^* g" {: [: e) @( n5 c3 {
  27. #include <linux/errno.h>9 v4 [9 K: |" {/ Z4 {, l. l  x
  28. #include <linux/types.h>2 a! |, @6 l2 e/ q" o4 i$ m
  29. #include <linux/interrupt.h>
    0 T6 T% G$ a( T* ]
  30. #include <asm/io.h>2 `; @, S1 o& a
  31. #include <linux/moduleparam.h>
    1 e* m& p% a; |  V+ i. Q! Y
  32. #include <linux/sysctl.h>
    7 @" Q7 p6 R5 b) |# A& `
  33. #include <linux/mm.h>
      X1 u" @7 _7 z8 s) q
  34. #include <linux/dma-mapping.h>
    , S, C, c% ?' C. j2 k

  35. : f- j2 A, s( z) w1 r7 g
  36. #include <mach/memory.h>
    : ^+ A$ c* G7 t3 c" d/ f
  37. #include <mach/hardware.h>. {3 ~& E7 m/ @' d
  38. #include <mach/irqs.h>* S' w9 ?/ _% x/ D) m
  39. #include <asm/hardware/edma.h>
    1 K& x1 w! \! M9 Y* m6 v$ e

  40. . X, }$ A9 q+ h, |
  41. #undef EDMA3_DEBUG
    6 |+ v9 m; F& m3 p5 z$ }7 D
  42. /*#define EDMA3_DEBUG*/; w, q/ Z1 r9 H% \" V! t3 i

  43. - G0 `8 P3 T" W9 }4 v9 \, c
  44. #ifdef EDMA3_DEBUG
    ( e; u! T& d8 h7 ~5 q) y: f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % v& g4 b! @! b/ d2 f( `7 N0 X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ c4 h; A, X% R& b) p+ p& p3 n  ?% s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! _7 \! y2 S& h7 |7 s# m2 {
  48. #else
    5 Y# a! i: P6 N9 f
  49. #define DMA_PRINTK( x... )* F. v4 X5 W0 \) ^6 ?2 q' P
  50. #define DMA_FN_IN6 v, F0 g9 `8 a9 \. Z4 O6 Z
  51. #define DMA_FN_OUT" ~% T. `( k, x' k+ p/ d5 C+ C, @
  52. #endif
    , U  V0 [" O* Z: B! o, O6 q
  53. # b# ^2 X$ Y( i9 O/ b' o$ A+ }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); U6 B$ |; v: O7 l. g
  55. #define STATIC_SHIFT                3
    6 t+ d" Z9 j$ a1 L
  56. #define TCINTEN_SHIFT               20' o3 D. h/ Z7 |% x/ |8 P! w- a
  57. #define ITCINTEN_SHIFT              21
    # B2 T3 e/ a: G* q, g% H
  58. #define TCCHEN_SHIFT                222 x2 W3 x+ k8 {) I% P
  59. #define ITCCHEN_SHIFT               23
    % K7 W: J: c, ~3 s7 N# D

  60. - J9 y% Q1 M! @0 H7 w
  61. static volatile int irqraised1 = 0;
    ' ^! t' _0 C/ v. s9 u! r& X
  62. static volatile int irqraised2 = 0;
    ( r, ^+ i- {$ t( P- {$ L
  63. $ S. _! ^% y2 t* Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  R- o* S% c% R: ?! n: J) F# S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 x5 B/ s2 ?1 a( u. R, V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ [$ U4 g: P4 f
  67. ! x, a* J2 {4 z5 H: u4 H& y
  68. dma_addr_t dmaphyssrc1 = 0;
    5 `# b2 ^" x' r- S5 R1 E
  69. dma_addr_t dmaphyssrc2 = 0;1 |8 x3 f6 J( A: w  n: _4 r! N
  70. dma_addr_t dmaphysdest1 = 0;% s1 |: M: W# Q
  71. dma_addr_t dmaphysdest2 = 0;
    9 |# c7 m" q9 I1 u  D! M: n# h
  72. ' O' o- @9 e3 C+ j
  73. char *dmabufsrc1 = NULL;1 Z* G% U: T0 b# o4 F
  74. char *dmabufsrc2 = NULL;" t4 u4 s3 H( G: x4 j: U
  75. char *dmabufdest1 = NULL;
    1 F% i; I0 k) ?8 l; p; l9 I/ [
  76. char *dmabufdest2 = NULL;+ I  u7 U5 C1 {/ s2 e1 K" I/ R
  77. ' v8 m% N% Q: y6 F) r
  78. static int acnt = 512;
    ! r9 v& n; N7 U) @8 q1 Q5 e
  79. static int bcnt = 8;1 S! h# F# d# Y# x3 c
  80. static int ccnt = 8;
    - |# ^! o5 v; t4 f; D3 f( `1 |2 _
  81. 6 N7 Y  A% Z6 w( O2 Q9 c
  82. module_param(acnt, int, S_IRUGO);
    : [* m( L. n1 A9 e
  83. module_param(bcnt, int, S_IRUGO);
    ! f, R6 N6 N4 i* ]: N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ C! S- c1 b* z1 P" W
4 `5 ]4 n. P0 j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, ]8 H1 [$ _2 B8 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 ?3 u  g, b2 X6 h9 d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 I; y+ {) q0 O: u

" e2 u2 t9 B2 ]" T) s) g; u0 V  g( L; [/ }, l/ g0 O. t# g  z3 \+ T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 08:46 , Processed in 0.038108 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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