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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 H0 @5 q( P1 B; D  x7 u
  1. [code]EDMA sample test application0 [8 g( D7 }* f8 q2 {0 m
  2. /*
    9 A4 C+ J: ]& c: D( O
  3. * edma_test.c
    5 r) C* b! }% ?
  4. *
    # W9 z* f: z  q; u* d( p+ c
  5. * brief  EDMA3 Test Application- A+ F$ `+ s8 W5 |
  6. *
    % c( T. E6 I5 Q; e; L
  7. *   This file contains EDMA3 Test code.
    2 E/ y6 [% Y+ @) P; l
  8. ** V/ ~! [' R$ S! s: Z4 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; f- t2 L+ Z9 m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ T6 ~! \2 y  {  _, s0 E& j, g
  11. *         TO CHANGE.
    ) ^4 q. q6 f, ^% ?+ c
  12. *" q  n, L: S4 q4 V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - j4 o% ]: ?# U1 h
  14. *
    ! m& G+ ]; v+ l
  15. * This program is free software; you can redistribute it and/or
    4 k2 x. g' Z3 T9 T' A5 t
  16. * modify it under the terms of the GNU General Public License as
    , [$ L: M' B, d# ?
  17. * published by the Free Software Foundation version 2.  V+ w0 n. v2 P% j8 P# F' z1 N
  18. *
    - ]+ N1 ^5 S5 T, B* L/ D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ p5 [0 [! @" Y& D
  20. * kind, whether express or implied; without even the implied warranty
    9 C- V2 e2 D; I; |: l2 D" b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 Z( |8 ^6 ^) Z
  22. * GNU General Public License for more details.
    : G  ?& z0 k& a& t6 b
  23. */3 Z0 [5 `8 Y6 l( Q! [' n

  24. ' H  |7 D% c$ G
  25. #include <linux/module.h>
    7 V, ~0 I1 {5 H- W: M# U3 q
  26. #include <linux/init.h>; t' O0 p9 [, Y: h5 M$ X! L# S
  27. #include <linux/errno.h>
    ' p0 \7 n. L# E, d. o) r6 p' D
  28. #include <linux/types.h>: W' u0 I9 m4 `
  29. #include <linux/interrupt.h>/ ]" O3 N- c$ p# [* F2 O
  30. #include <asm/io.h>
    6 Q; m& S6 i% {% J
  31. #include <linux/moduleparam.h>
      s( @5 I8 A: M" j$ H8 Q) s1 j
  32. #include <linux/sysctl.h>
    8 ^- x& Q" w2 ?6 L& b0 d4 w
  33. #include <linux/mm.h>; M" D+ O3 z3 w
  34. #include <linux/dma-mapping.h>
      C( I3 h9 l! c! U6 d
  35. - C+ a( O- l' e. X  ]# c
  36. #include <mach/memory.h>
    9 v3 j6 d( b( Q1 c
  37. #include <mach/hardware.h>
      P! R7 U0 Z2 P" @9 ]
  38. #include <mach/irqs.h>6 @: |5 |- @* s8 N% |$ H
  39. #include <asm/hardware/edma.h>; |9 h" z: j) a, g: h

  40. 0 Z! G3 J( \) d  i+ i2 l0 o. c% z
  41. #undef EDMA3_DEBUG
      Y3 a' {4 [8 S) `# x) p$ A
  42. /*#define EDMA3_DEBUG*/
    " L8 Y2 p: [4 b! f7 n6 i
  43. ( c1 p; ]- V1 P1 q2 c, U
  44. #ifdef EDMA3_DEBUG0 L/ |3 P* T4 l0 j: b) k! ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), n0 }# ^8 D. R; Z3 h  n' s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 H6 k( @" c6 ^4 ?8 Y% Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# W2 r1 B( h# G* Q( t4 V
  48. #else& e+ P: h) H  `5 S* K, f2 h$ N1 u, Q
  49. #define DMA_PRINTK( x... )/ j. }1 ?& N+ M. `
  50. #define DMA_FN_IN
    . ~- q  v! K. s5 [: V' s- K. B! O4 _/ b7 O
  51. #define DMA_FN_OUT  C. W* e  K5 x' _
  52. #endif
    : w* E* U8 d) L* D$ @4 ?$ ?" k' F

  53. ) @" O- E; J* v0 g+ F/ q" r9 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . b) E# b4 L5 U" ?' }' \! m
  55. #define STATIC_SHIFT                3
    $ U# y5 \& U/ b  S* }+ K' k
  56. #define TCINTEN_SHIFT               205 {$ j! b  U, N% L0 R: v( h% p
  57. #define ITCINTEN_SHIFT              21
    2 l& \0 z# f* N/ r8 o
  58. #define TCCHEN_SHIFT                22
    ' R; {* k' e$ V1 E# c- ?% A
  59. #define ITCCHEN_SHIFT               23
    2 m; D; x- F2 b# E; q. h

  60. 8 ?" j/ Y+ T* E# e
  61. static volatile int irqraised1 = 0;
    ; T/ x  {3 e& n1 C( f* p
  62. static volatile int irqraised2 = 0;  b" D+ B( Q  g5 W" a( R: v- `

  63. * u# Z$ ?+ L+ u" }! L: S$ d) u+ F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' u; D1 F- k' x4 M7 U$ @+ |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ K) b7 i# u# e* w+ V' e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / _- L+ z7 @1 h8 [$ f+ @  A
  67. 5 i3 O. n& W4 h' i
  68. dma_addr_t dmaphyssrc1 = 0;5 N8 l% ?9 y& G  N/ O( o  P* g
  69. dma_addr_t dmaphyssrc2 = 0;
      `: \( o9 Q7 L( y1 D: \
  70. dma_addr_t dmaphysdest1 = 0;( S" U. J. b" N: T& a: e
  71. dma_addr_t dmaphysdest2 = 0;2 t) k5 }/ B% B9 u
  72. - T! R1 w$ ?! m. k1 A
  73. char *dmabufsrc1 = NULL;: c0 [' V' o. @( G- X: B9 r
  74. char *dmabufsrc2 = NULL;
    $ ~1 @1 ]( E5 u3 x1 L
  75. char *dmabufdest1 = NULL;
    7 u' H- u3 a/ f* U& R9 \% j
  76. char *dmabufdest2 = NULL;! F9 m( o; [' |! `
  77. $ ^# z3 O: z7 o* I( g
  78. static int acnt = 512;% `  L% X, ]" e
  79. static int bcnt = 8;
    9 {1 l, t0 s) u7 m9 g
  80. static int ccnt = 8;
    4 p$ o. u$ x1 j% S) h5 _  x) ?
  81. - A5 P, c8 r" E0 G& f
  82. module_param(acnt, int, S_IRUGO);
    6 w, A" {7 `; j3 N% r
  83. module_param(bcnt, int, S_IRUGO);. V' }' z5 E- X2 D! J: X4 q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! ]3 u+ a; y& s2 V7 b% V) u
6 A2 d. j: |- _+ \# w+ E' E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( l( X+ A; `2 n" B  W+ ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 S! E7 i7 m3 ~1 n: s+ L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" v  Q, s: w' K* a* l$ R
8 s* z5 n, X; {- G
0 N! z: l6 }- \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-17 12:54 , Processed in 0.037916 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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