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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 V, {3 U& n- x* d4 ?
  1. [code]EDMA sample test application
    4 K: V4 l+ u9 A3 u2 T& I
  2. /*
    ( P) G! D0 e3 B9 o7 }6 k
  3. * edma_test.c
    / M9 T7 Y) N( _
  4. *) X# A# D+ W; B# h  ~9 C" r
  5. * brief  EDMA3 Test Application2 M! K% Y7 O1 m) b. d: [8 m
  6. *
    3 G4 l3 q9 e4 [5 _9 ^
  7. *   This file contains EDMA3 Test code.3 s+ f/ m' i8 B3 p* A% |
  8. *# n7 D3 X7 [! a0 i+ V- j. ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % A3 h4 k, b; C: G: f& j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & e9 [$ y- q3 C7 q8 y' G8 D
  11. *         TO CHANGE.
    ( V& J8 n  T* S8 i- ]
  12. *
    ( n9 a( b1 \$ Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! F5 q4 l+ F$ Q; k/ P! |' d
  14. *
    # }0 _+ ^9 B9 x( b5 m
  15. * This program is free software; you can redistribute it and/or
    " `# w2 G" |' a0 x' {
  16. * modify it under the terms of the GNU General Public License as$ R5 a; A" p, u7 ~" m1 Z* K
  17. * published by the Free Software Foundation version 2.
    4 \2 C! H) B5 g4 U" P) f  H
  18. *, r* A' e1 |: Y6 P. T' X8 o; Q  G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% h* }. Z2 \2 n8 E! C* ^
  20. * kind, whether express or implied; without even the implied warranty: G- q4 i9 F3 _1 Y; J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / ~0 m0 g' {- w* t( L1 E+ f$ B
  22. * GNU General Public License for more details.
    " k; ~& a  y6 V8 Q- e9 |
  23. */
    6 V' p& b3 x8 I2 T

  24. 5 _" M& h  N! N+ o+ y3 T
  25. #include <linux/module.h>
    ( C  [  o- c: B3 f
  26. #include <linux/init.h>
    " m0 t$ E3 L1 E
  27. #include <linux/errno.h>
    % h' x- C# ]# D% A: {
  28. #include <linux/types.h>
    & W- Q  m" H+ D* y% s8 i9 r0 j
  29. #include <linux/interrupt.h>% h- k- C* ?1 f5 n' o
  30. #include <asm/io.h>- D8 h; }: f9 ]! Z1 n7 t
  31. #include <linux/moduleparam.h>
    % c8 j( k5 r4 t( F+ O5 H  Z
  32. #include <linux/sysctl.h>: A8 ]3 a+ b; L  T- [4 y- _
  33. #include <linux/mm.h>9 T. n+ B7 X2 r+ q/ k$ M
  34. #include <linux/dma-mapping.h>
    $ P3 c" a1 i5 g; X0 A0 }7 A1 e. q
  35.   M; T4 [# F' A* H' s$ r2 s$ L* b1 u* J
  36. #include <mach/memory.h>
    5 `3 e4 x! T1 R( U; D
  37. #include <mach/hardware.h>
    , V, [+ I. I: x4 s4 R
  38. #include <mach/irqs.h>; D, N3 C" B; c
  39. #include <asm/hardware/edma.h>2 X1 f7 F' u* l9 J* V3 `5 G
  40. ! Z+ e$ \, Q9 i% g# l6 T7 B
  41. #undef EDMA3_DEBUG5 `. _$ M1 ]$ R; E
  42. /*#define EDMA3_DEBUG*/
    1 \! ~9 I6 N0 S( z

  43. 1 l9 k) z  y7 i4 Z2 q) x
  44. #ifdef EDMA3_DEBUG% Q0 h- _! n* V* G, r' O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 B! D5 S9 P( J1 R# c2 r# ^+ H/ F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 d. ?; S5 |3 j. c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" N; e/ i2 I# p& u  X
  48. #else
    5 M" N) C6 f3 J1 J( q
  49. #define DMA_PRINTK( x... )
    1 ^8 P4 {4 @7 A7 d
  50. #define DMA_FN_IN
    & r. J: A0 b  E
  51. #define DMA_FN_OUT
    9 q  M. X  f( E6 [/ v6 V
  52. #endif1 b1 j4 J. q& ]" r0 F8 o( F5 m
  53. ( y) b9 \6 g( B# X; g5 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 D! s* `$ u$ `  r! T
  55. #define STATIC_SHIFT                3
    6 r, O- M" Q6 Z8 i* o
  56. #define TCINTEN_SHIFT               20
    - [  q3 \1 \% R" [" q, t5 B
  57. #define ITCINTEN_SHIFT              21. g3 K$ w; l' f
  58. #define TCCHEN_SHIFT                22, Q4 T" X, @5 a; k) n' |( j
  59. #define ITCCHEN_SHIFT               23
    5 }& S1 C; h: ~0 e5 i1 B
  60. ( ]' O8 l8 i' \4 Z- J7 S- p/ C
  61. static volatile int irqraised1 = 0;; C5 }7 O' j. w1 ?1 y
  62. static volatile int irqraised2 = 0;$ ~' v6 b$ @. U$ i! b# {
  63. 8 P7 i+ Q+ a# e7 n) B. f4 A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : e: v/ }8 A' k' o+ ^; p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / c. r" [# E) z8 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & G# d2 ?( z7 Y

  67. 9 L" }9 @( D! t! `4 r7 Y
  68. dma_addr_t dmaphyssrc1 = 0;
    " B  N3 w' [" m( `/ o, M
  69. dma_addr_t dmaphyssrc2 = 0;
    % O0 j" D7 y! t7 _$ g6 B2 F
  70. dma_addr_t dmaphysdest1 = 0;7 M  S  l( p* ~  H! {( l7 k8 S
  71. dma_addr_t dmaphysdest2 = 0;% C! h8 b. x+ Y4 j
  72. ( |% M5 d3 P3 V5 ~* e. G  b  t3 x
  73. char *dmabufsrc1 = NULL;
    + k( i5 W* L3 K3 R* U9 c5 @: j
  74. char *dmabufsrc2 = NULL;+ h7 S  O( `" R, b
  75. char *dmabufdest1 = NULL;( P. S" j* X. A+ A* g) z) e: [
  76. char *dmabufdest2 = NULL;
    " t. _- w# g: p

  77. ( `6 H0 Q4 N% Q. e+ B) i
  78. static int acnt = 512;
      Z3 T4 ?0 ~' ~0 ^/ e: k* i( y) J
  79. static int bcnt = 8;3 F' B& Z6 b. V3 z3 s0 x1 ]3 T3 @
  80. static int ccnt = 8;+ j. p1 \' U/ M5 v5 D7 O7 T% I: V. r

  81. 9 o& m3 u2 n8 }
  82. module_param(acnt, int, S_IRUGO);( I& C/ T5 c7 ]0 |0 f  t: `
  83. module_param(bcnt, int, S_IRUGO);
    . Y6 ?5 {% e& G0 Y3 J* D3 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 M( q% m% j3 Q/ j' W( V# W9 ]5 U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. X8 J6 D( Z$ g& w3 iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 r. T3 B7 k" G+ c( _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 \2 a+ a- E& I5 q2 R& h

# b/ Z3 h* \: f6 D7 q1 i( i+ y1 N% R0 @4 j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 02:57 , Processed in 0.039157 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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