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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* q; L/ \9 O  @! ]! d
  1. [code]EDMA sample test application( `+ v' V: s* L2 K6 _0 h, \5 c
  2. /*
    " ?% n. `/ d3 t) R( R
  3. * edma_test.c! n- H1 q3 j& u9 F4 \
  4. *
    4 ~! x; T+ M; }
  5. * brief  EDMA3 Test Application
    / S4 _6 `. k- N& _/ z4 q' h9 c+ t
  6. *
    2 h, K/ @7 G2 P( S8 b" U* n) v9 T
  7. *   This file contains EDMA3 Test code.
    8 W* W; S) X6 h& F$ R- u
  8. *! g1 B3 g8 T* \9 [  a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* @# g1 b: R6 o2 w8 l6 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 q" O8 }' n2 _( d' M
  11. *         TO CHANGE.& {0 V( p1 ?- h, ]' W4 I; r+ _" S8 G
  12. *1 b( A) O0 d4 R. R7 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 Q- ~1 w, o+ {; g8 V
  14. *
    & c, v9 w4 b' |8 S3 L4 N, s* w1 p2 v
  15. * This program is free software; you can redistribute it and/or
    & S  c/ y4 T# Q* R) E" Q
  16. * modify it under the terms of the GNU General Public License as
    / r: t* Z) G# c9 v
  17. * published by the Free Software Foundation version 2.. G! a$ R% w4 p. y; {
  18. *
    ! e8 s2 d8 ?& x# p! }. t4 u/ w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. X2 k# p& [; D. R
  20. * kind, whether express or implied; without even the implied warranty
    3 N0 q6 P8 D- y) T; F& J3 q( q% t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! X8 a  X6 P+ X  H5 p. e% H) \# j
  22. * GNU General Public License for more details.$ N2 ?% d( h* }& t; k3 \
  23. */! y4 ^/ a  x/ d

  24. & Q4 A8 r# |$ t6 F0 r2 v2 t
  25. #include <linux/module.h>1 n& }. b7 a9 w3 x
  26. #include <linux/init.h>
    " L! y. ?3 D5 J: u
  27. #include <linux/errno.h>
    % h4 C1 Q7 m: ^- `
  28. #include <linux/types.h>5 u  i: N2 s* D3 x8 [
  29. #include <linux/interrupt.h>
    ) q/ E: g9 d% b. g1 S
  30. #include <asm/io.h>
    6 ^1 u" u* ~* J% M
  31. #include <linux/moduleparam.h>1 n6 H% Q1 ]1 x' n. i
  32. #include <linux/sysctl.h>
    ' T4 e/ _! H& R5 f0 k9 c7 W
  33. #include <linux/mm.h>
    & }; i! k7 C. d: O& J4 q9 c
  34. #include <linux/dma-mapping.h>
    & y8 W2 j9 w/ Y% C/ Q

  35. " [- b. K9 b2 L5 o' }
  36. #include <mach/memory.h>; y- r9 J: Z4 @, \, s7 E
  37. #include <mach/hardware.h>) Z5 h  w# u! J+ u' i/ C- ~
  38. #include <mach/irqs.h>
    ! Q% R; q8 m  z
  39. #include <asm/hardware/edma.h>3 x1 i; ^7 v' B
  40. ( d( A! l$ Q( E/ }  g
  41. #undef EDMA3_DEBUG
    2 x9 F3 I8 V7 Q1 b
  42. /*#define EDMA3_DEBUG*/5 l+ c! D% D! Q
  43. . `% q9 M1 o- {" ]/ @& T
  44. #ifdef EDMA3_DEBUG
    $ M4 j3 T1 t" v$ k: I; C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), u: ~: r* Y, ?8 _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; Y. n, z/ V$ t# ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  N/ k, S8 T, K1 m  l
  48. #else1 S% T/ P: }1 ]1 ~' ^
  49. #define DMA_PRINTK( x... )% r8 M) j, _3 l( H5 ?
  50. #define DMA_FN_IN
    8 E4 x/ N8 f7 V8 Y. k+ T
  51. #define DMA_FN_OUT2 _6 Z: R1 ]) p
  52. #endif
    - R# H, J' U. V% o: ?

  53. 8 ~/ O9 h) S; ?# W! B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + v: [8 g4 z" U" K. H1 P0 P
  55. #define STATIC_SHIFT                3! R0 W0 k" ~* ?' P' C, z
  56. #define TCINTEN_SHIFT               20% j7 b1 e3 t! y
  57. #define ITCINTEN_SHIFT              21* y' m5 C, c* W) e" l+ n
  58. #define TCCHEN_SHIFT                22
    6 f2 ~! P  o5 `# c
  59. #define ITCCHEN_SHIFT               23
    ( b) k5 P, s) m
  60. ! r. P: a, W. o& j6 [! V/ t
  61. static volatile int irqraised1 = 0;
    ; ^  j( F( c* q
  62. static volatile int irqraised2 = 0;
    2 {5 G6 g9 T. J0 c" `
  63. 4 Q, J4 [4 G; ]1 w  o* i1 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 z) E# \( |, x2 o+ N. K' \2 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; _3 l  J6 [( @. E3 x1 T* v2 S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, t( c6 j. V4 e( b: ^- z
  67.   k" z9 b8 n' ^0 u5 m
  68. dma_addr_t dmaphyssrc1 = 0;
    . n# k. h4 x: l! J
  69. dma_addr_t dmaphyssrc2 = 0;6 ~8 u6 N8 D1 A; ^
  70. dma_addr_t dmaphysdest1 = 0;
    , g+ v+ J! Q' t7 Q- r
  71. dma_addr_t dmaphysdest2 = 0;
    3 F1 `! ~9 y- ]7 J' Q6 P9 ~; H7 _
  72. % P, |9 r% J0 _) G4 ]; K4 M
  73. char *dmabufsrc1 = NULL;$ T* l: \4 g- A2 i3 i; y/ N
  74. char *dmabufsrc2 = NULL;
    1 p  }. y8 H+ y/ x" B
  75. char *dmabufdest1 = NULL;0 l$ ]5 w4 d2 m4 H/ w& q7 \
  76. char *dmabufdest2 = NULL;" S2 |1 f4 \" |& l) H

  77. % K' @* I& F0 _8 ]" S
  78. static int acnt = 512;$ L: R! `! t4 O& D- n" |/ v$ O  T
  79. static int bcnt = 8;
    , _: A; u2 O2 ?) L9 A" D" c; M
  80. static int ccnt = 8;
    - H0 Q9 E* @# l, J  {. P& R
  81.   l) A9 T% b* l$ H: i# L0 n- I
  82. module_param(acnt, int, S_IRUGO);
    0 l( d$ _7 S4 f1 b& y+ o: N+ u. n) f
  83. module_param(bcnt, int, S_IRUGO);' Y+ I; m; {8 T/ {% D, T- i9 D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 j# A4 v$ q% O/ K9 z) E3 y$ }4 E# K. d- x- |1 p0 v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( H& s. F# ^# 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 H+ t4 \: e9 R9 h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; s4 m) E  p9 M/ a* q- w
- @; J# @) I1 I5 e& ~& b2 }% G
6 L* q7 f4 F  c- h  P5 `' J8 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 09:07 , Processed in 0.040734 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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