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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ T! d% I+ K; j7 h' i: O
  1. [code]EDMA sample test application
    ; v3 k6 R9 y. o9 y9 `1 _
  2. /*
    " J6 N' Z) r5 t
  3. * edma_test.c* V6 l. S" C# o3 R
  4. *- q4 n8 T- E) q2 M% M  p* f
  5. * brief  EDMA3 Test Application
    3 }( _* [0 w+ J; W) j
  6. *
    6 A( M/ j3 _, l
  7. *   This file contains EDMA3 Test code.; i; l( L/ Y" C
  8. *, C! {& B! Y& w3 t+ x6 @$ V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ x# @. e, N, h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 j# @+ ^- b. |( [# M( ~$ Q- H
  11. *         TO CHANGE.
    " v. c1 Y$ c1 t$ s2 p4 b9 D
  12. *
    % x9 N) p) e) u6 \: G; N9 y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; i  |! w/ _7 g9 I, w- ~: Y: h
  14. *7 x; d$ Y/ W5 ?& [! Y
  15. * This program is free software; you can redistribute it and/or
    + ]* b" p) C- G/ w* O" m8 x
  16. * modify it under the terms of the GNU General Public License as9 N: T& `4 \, e
  17. * published by the Free Software Foundation version 2.
    : _' S2 {9 ]! h2 [" J& c
  18. *
    6 c* V+ k9 ~( N# H7 N( D' c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' N: L7 F* g; x/ b/ _- P4 s
  20. * kind, whether express or implied; without even the implied warranty
    # ?$ D" t5 k; x' G5 x- B1 F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! ]' g/ H8 }# m2 z, T7 K9 s
  22. * GNU General Public License for more details.
    . W9 r  l) A% e( X# U) `+ `
  23. */
    3 q+ [$ w% g0 [* [- ?6 J% ]
  24. # @' M( |/ n( u# n2 Y' l0 V% o
  25. #include <linux/module.h>: ?+ Q" }9 r6 d* }
  26. #include <linux/init.h>) D6 [% ^! y3 k. B5 k6 N! a
  27. #include <linux/errno.h>
    : `/ s1 F- D4 t( F9 v
  28. #include <linux/types.h>* x3 N2 l* t* `5 [1 k& J: }4 w2 R
  29. #include <linux/interrupt.h>/ H) W) y6 h' k
  30. #include <asm/io.h>
    . {7 I% T$ M2 }1 b
  31. #include <linux/moduleparam.h>& C; ~6 C5 k- m
  32. #include <linux/sysctl.h>, ]! I( _0 u& P
  33. #include <linux/mm.h>0 x; y7 |$ p7 t, a' L3 x( ^$ Z
  34. #include <linux/dma-mapping.h>
    - u$ a0 f' \8 h9 ~0 g
  35. 1 s5 T7 r1 B% V9 k) y1 B
  36. #include <mach/memory.h>
    & G- p" W; p0 l, W7 a& O
  37. #include <mach/hardware.h>
    : W* N/ i0 j5 |$ ^- |
  38. #include <mach/irqs.h>- s/ f- j! G: b' X8 u) F0 A  q; E
  39. #include <asm/hardware/edma.h>
    , W7 m5 Q9 {5 q4 A
  40. " _/ Q; n5 C3 O: ~( w8 P( ~
  41. #undef EDMA3_DEBUG
    # z$ X  N! K5 c5 `' J, c
  42. /*#define EDMA3_DEBUG*/
    0 }, d' x/ e! i8 U7 Q

  43. : t- K0 A9 G& c. t) C' G
  44. #ifdef EDMA3_DEBUG# l* }! L- ]5 @; Y0 O. @0 r, a1 j4 }% C* q9 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 ~0 o4 x- z; n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); ]- D/ l" J) j" D" n+ a0 h1 Z( n1 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      j& K0 o" O6 H1 J, F
  48. #else
    7 X: M' {4 b# t1 a# J5 j5 t* M4 m
  49. #define DMA_PRINTK( x... )
    " T- v8 {2 Q7 d1 G: k4 S" m4 V
  50. #define DMA_FN_IN4 y& t3 m* a. s
  51. #define DMA_FN_OUT
    ! Q7 ~4 @* J/ E  ~6 _/ e
  52. #endif
    ) j) ~: }) X- ?! c, L" ^

  53. , w6 j( F) F- n9 O' w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( g7 o+ \$ R# G6 F
  55. #define STATIC_SHIFT                3
    1 r) R' z' A; ?5 v4 e
  56. #define TCINTEN_SHIFT               20" S- l$ O4 m0 f6 t
  57. #define ITCINTEN_SHIFT              21
    4 I7 t! h, r  P9 h: W
  58. #define TCCHEN_SHIFT                22
    ! h6 O7 p5 T7 D+ p; d
  59. #define ITCCHEN_SHIFT               23
    / y4 ^" Z' q4 P7 i! J1 C5 d7 W

  60. $ j4 ^. k% h- C1 F# k# F  d0 a
  61. static volatile int irqraised1 = 0;) O7 f7 A" }3 O" r5 x
  62. static volatile int irqraised2 = 0;
    , j5 V  N7 X0 B7 L: w

  63. . M! ]& V& ]* V8 w' c" M6 t/ A+ @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ L+ \9 E, q. E( G( e' H, N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " I8 a7 ~: z) e9 v4 L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; R; i# n/ ^* X3 i" F) Y9 D
  67. 8 w% a9 E+ y2 m. S8 J
  68. dma_addr_t dmaphyssrc1 = 0;, h. e  v  U* J4 f
  69. dma_addr_t dmaphyssrc2 = 0;9 H8 ]% E  ?& q5 E! h6 T5 ?
  70. dma_addr_t dmaphysdest1 = 0;
    8 E9 P/ [9 A, c6 H3 V3 z. Z
  71. dma_addr_t dmaphysdest2 = 0;
    ' R9 [8 }1 ^6 q9 S

  72. ; l4 z2 l+ u3 d1 N, z9 p- w
  73. char *dmabufsrc1 = NULL;
    % \% E0 @3 U5 P& H, M$ ^2 h3 Q
  74. char *dmabufsrc2 = NULL;
    ) I$ _8 t% J. m' M" R* v  l: V
  75. char *dmabufdest1 = NULL;4 F, T/ h4 I3 M9 ?- }( T! S
  76. char *dmabufdest2 = NULL;
    4 P2 u8 ?( [" W, a: F) T

  77. ; K6 A  E: x9 E, K% i7 r1 _' B  n0 h
  78. static int acnt = 512;
    " |7 c5 z, K1 P; [
  79. static int bcnt = 8;: W, H- z3 W! x1 u6 W! R& T0 }
  80. static int ccnt = 8;
    , f4 H8 {6 T# Z; J% w  L

  81. $ S4 _4 |7 Q# ]: A) u
  82. module_param(acnt, int, S_IRUGO);5 l4 u! `, N3 J; l+ H7 [! O# o
  83. module_param(bcnt, int, S_IRUGO);$ b2 a! Q( K( `. Y" r' s) N1 p, p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ Z8 D" ^9 g' Y3 F

7 T. e0 n: n# D, |" ~7 j& l- p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' w) L+ h  ?! t7 L4 R8 m2 V: darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& [% P$ _- \( j2 Q1 B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ L8 r0 X9 \8 l9 G2 w; ~7 k
5 }4 t- W5 ^* J; U: v$ |) q- G% R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-28 03:51 , Processed in 0.043107 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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