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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' W  v4 _9 K8 c" d# ?& m
  1. [code]EDMA sample test application
    4 |; S8 C/ g* Q* |/ {" }: [4 ]
  2. /*
      Z: R0 U0 ]# C6 ]
  3. * edma_test.c
    9 f# x& S! a" S' T7 i
  4. *6 d$ b: C0 M: K
  5. * brief  EDMA3 Test Application7 g8 D3 W) R5 g) W
  6. *. L& q+ m4 E( P$ L
  7. *   This file contains EDMA3 Test code.
    ) m1 @" B# Y* r8 ~
  8. *1 g! E/ C* H6 V$ g8 S1 p  L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' U0 {6 k- B7 F& {) U( c" L# E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ T* j8 q" X1 r6 `5 N5 m
  11. *         TO CHANGE.% f1 |# w( z$ f0 \) m; r$ u% i  \
  12. *
    : p  W; {7 G; l6 Q* c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 Z# P( Q- O5 |& w% r6 Q/ p
  14. *
    ) l; J: d& {7 }; v- {# `: D: U) N
  15. * This program is free software; you can redistribute it and/or- Y5 Z# g4 a: |! q" U
  16. * modify it under the terms of the GNU General Public License as
    4 J) j. B$ X" d# e
  17. * published by the Free Software Foundation version 2.
    ' ~  N0 x2 A0 I
  18. *
    - B! s2 {& r/ _5 U* `7 ^! J7 m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ ]' N# B1 @' E1 O, u7 _) O
  20. * kind, whether express or implied; without even the implied warranty
    ) k. X" f* X! m5 @6 O! F. |% q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) r- y0 ]$ i0 c$ C( \
  22. * GNU General Public License for more details.! `% s/ H3 k  ^# F: _7 Q4 g) w; ~
  23. */  G4 \/ C. b: {% e
  24. ! e) H, b) g1 M$ v; d
  25. #include <linux/module.h>
    2 n& w' I7 _2 A# {
  26. #include <linux/init.h>/ K% E& f2 ^* X/ N6 u3 `# i6 `8 y6 }
  27. #include <linux/errno.h>
    8 `9 ~: ?+ P, c$ y: a
  28. #include <linux/types.h>! R3 T) g3 K- V' o- E) e1 M
  29. #include <linux/interrupt.h>
    , b* X/ ^% O, i5 s, k0 h
  30. #include <asm/io.h>; H# h( j; j/ w0 x
  31. #include <linux/moduleparam.h>
    1 u* |  w/ V# h& _- W4 e, R  T* G
  32. #include <linux/sysctl.h>
    " w8 a1 j4 v% q5 |9 z' C
  33. #include <linux/mm.h>
    ( L7 K: O, P1 F4 m; E  G
  34. #include <linux/dma-mapping.h>' j# E7 ~* a: F$ P: A1 q
  35. . ?7 |4 f, I; k
  36. #include <mach/memory.h>. C; g* ?! P+ C5 W$ P
  37. #include <mach/hardware.h>
    ! ?/ |; Q$ P6 i, ^5 w/ l4 V
  38. #include <mach/irqs.h>
    / P% M; D6 w- o+ p7 ]
  39. #include <asm/hardware/edma.h>9 m  @1 E1 I3 T) |
  40. - c9 a% Z; C' x
  41. #undef EDMA3_DEBUG
    : C- }* F, a; b6 [+ R9 t
  42. /*#define EDMA3_DEBUG*/
    $ j) e8 u5 X! m% C  p" J

  43. " U7 I" \$ z: Z" q
  44. #ifdef EDMA3_DEBUG! E  n: h% T5 `5 Z+ y! W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 Q9 v. X' e, Q: k' Q  e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 n/ T6 f0 C4 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 s) J: }5 o% y0 e; {8 W
  48. #else# c0 ]( E  C# ?" O* ]1 q. E' X. W
  49. #define DMA_PRINTK( x... )
    6 e5 ~& }' I( j, P% y; y
  50. #define DMA_FN_IN
    6 J0 q! l1 b' F
  51. #define DMA_FN_OUT" l8 [% e. R2 @7 _8 t) B1 g, v
  52. #endif
    5 Z3 b/ s3 N4 u2 D
  53. 9 `. K. c& M& f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + i8 r" d$ d+ Z. r8 @( }* S
  55. #define STATIC_SHIFT                3
    - n/ A6 Z! k7 G
  56. #define TCINTEN_SHIFT               20: _, b6 o0 W) {% ^( Y" {$ d
  57. #define ITCINTEN_SHIFT              21
    7 T  `  F6 P, p% T& v) D1 [* _2 P
  58. #define TCCHEN_SHIFT                220 O" u% e7 ~( o  V3 N- G
  59. #define ITCCHEN_SHIFT               239 k: y$ g( D0 X  O

  60. ) Z* T% v7 b; V- r) O2 l% C4 L4 z
  61. static volatile int irqraised1 = 0;/ G7 S2 n7 u6 D) a2 M( \
  62. static volatile int irqraised2 = 0;/ T( x( _+ ]+ a. c- @# S
  63. % O, d8 t0 z7 e) Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; C  O5 h! v! X7 {7 F# F: E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 Q0 z# p) f7 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 R1 P# H, {% V& I% u5 c4 v# Y

  67. 3 Z/ L. ^, d* @/ z; o! h
  68. dma_addr_t dmaphyssrc1 = 0;  n9 ?+ ^* F, `' ?8 N) W3 s, p* w* s
  69. dma_addr_t dmaphyssrc2 = 0;0 E  T/ [4 C; V. O4 @2 p, r2 [
  70. dma_addr_t dmaphysdest1 = 0;3 H3 _: U) Y, g; }
  71. dma_addr_t dmaphysdest2 = 0;
    , g) u1 }+ m( S2 Q$ o4 Z
  72. 5 ^# _1 I- M0 ?' j" q# p. Q* b  z
  73. char *dmabufsrc1 = NULL;
    6 [- m! e+ {5 g% @  m$ ^
  74. char *dmabufsrc2 = NULL;  j  s; G8 H7 j4 Y, i! G( R3 t
  75. char *dmabufdest1 = NULL;) I6 o" O9 d* ?
  76. char *dmabufdest2 = NULL;
    " z$ u3 K! W4 w( o4 \

  77. 2 I1 |, Y9 m7 Y5 @) D) ~
  78. static int acnt = 512;8 Y' y# E( f9 z; ]. x; x* C
  79. static int bcnt = 8;
    . i8 r- S4 W1 Z) a+ l
  80. static int ccnt = 8;$ E$ z$ e  @3 i6 B

  81. ; [: ~0 p( C) ]/ Q5 q- L) r
  82. module_param(acnt, int, S_IRUGO);6 c. n5 |* Y0 R0 s
  83. module_param(bcnt, int, S_IRUGO);, x# }' R5 f9 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 H$ O8 t$ k1 B+ l0 k6 r

& p6 I7 g% e, f) }/ [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ l, R9 ^" z# l0 ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- W( ~% y( n- F& {8 V" T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: B) f" }: f8 |, Z: }, w

2 ~/ y" b0 g/ G- H& Z# F
+ C: P6 B& R, I6 L, j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 02:48 , Processed in 0.041322 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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