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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 i/ ?1 @$ V, Y/ d  _+ O' ~1 S. O2 V
  1. [code]EDMA sample test application4 Y# x# l+ U: a- q- O! B5 M
  2. /*
    ! b& _: }! g) j7 u6 E3 R
  3. * edma_test.c  M5 Y+ ^$ _. O8 Q8 a+ v
  4. *6 S" B( G  P# X# [4 f" \2 K
  5. * brief  EDMA3 Test Application
    " S4 r0 l) l5 R& s& d+ U
  6. *: F( }6 V1 T* ?& q- S
  7. *   This file contains EDMA3 Test code.
    : k+ f" p' L3 o2 e& C
  8. *
    1 N, R$ p* V% O* z0 ^( W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, q2 L4 d7 ?! E7 n$ g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 p3 B5 r5 E9 ~5 _: B% q) O
  11. *         TO CHANGE.
    ; v0 G2 r# ~  Z; N) \
  12. *; k2 R4 x' E/ J8 \4 F% S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 L1 B* D  X9 k. E0 m( `) M! w1 n0 I/ t
  14. *7 h: Q5 |/ T3 ], E0 H
  15. * This program is free software; you can redistribute it and/or
    $ h5 W! r* t# ?0 r3 V
  16. * modify it under the terms of the GNU General Public License as8 i' ?: D% ]& z3 e
  17. * published by the Free Software Foundation version 2.1 X, ~) C# I6 l/ [1 y
  18. *
    : d  w8 E: E6 T! _# V/ m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( P4 \" r. R! s, J2 q
  20. * kind, whether express or implied; without even the implied warranty
    1 \3 c# A( M% f/ {" v; x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- D) B. [& |2 Y& D; C
  22. * GNU General Public License for more details.
    - ]  g# n# F; U) t* e
  23. */
    5 V# L6 f& A& r2 T( V& }6 s
  24. 8 ]7 S+ i  K/ [" u! Y2 ]1 f! d5 f: _
  25. #include <linux/module.h>4 I1 A. {7 ~) l! B& O( h
  26. #include <linux/init.h>
    $ {' {, ]  _; E. e7 u
  27. #include <linux/errno.h>
    - L$ V# e6 ]/ g: c
  28. #include <linux/types.h>  p* k9 m/ z9 A. Q* R
  29. #include <linux/interrupt.h>
    0 \, W- L+ F* b+ T$ S
  30. #include <asm/io.h>  r+ d7 \4 w4 C8 K) n+ x
  31. #include <linux/moduleparam.h>
    2 F* `7 w: @$ s2 K) H: D. ~4 U( ]
  32. #include <linux/sysctl.h>0 p; U- g  m* g! q5 H8 ?1 J
  33. #include <linux/mm.h>  O" ~* N0 I/ n) x/ U3 Q
  34. #include <linux/dma-mapping.h>
    $ w+ ~  X2 L, q& `
  35. ! ~: d/ g1 E/ x0 Y4 S7 F$ s$ v* V, d
  36. #include <mach/memory.h>! ~- L1 u8 ~4 K
  37. #include <mach/hardware.h>
    9 l% @$ i+ z) H5 H2 @4 h% D
  38. #include <mach/irqs.h>4 }& U% m+ ]5 A" n, P
  39. #include <asm/hardware/edma.h>7 N% q  _. H" K. O  r4 \

  40. ; x% M0 J, n9 Y* Y& e/ [; d
  41. #undef EDMA3_DEBUG
    5 V: D4 j% {9 s6 J% N
  42. /*#define EDMA3_DEBUG*/* p. K. d% D# }5 d+ V

  43. / A0 ]" D- q8 @- y( g" a# M
  44. #ifdef EDMA3_DEBUG  u) @* q5 S5 P& t, u4 I1 |$ H4 d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 N5 x& b# b& ^. U8 W- o8 C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ L( j" _) q+ a/ A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + [/ k) I, ?$ `( r# a) r1 w
  48. #else
    3 c, Q% a* n" @
  49. #define DMA_PRINTK( x... )$ g$ o0 G8 @1 W1 A# _$ l* i
  50. #define DMA_FN_IN
    % b6 f3 a5 |( n! ~  N
  51. #define DMA_FN_OUT
    : F$ f, f+ j: f
  52. #endif1 ]) l, X; \. r$ @5 B- u
  53. 2 Q* w" y- S9 A" _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& W! }, O1 ~1 D4 w/ d. T
  55. #define STATIC_SHIFT                3
    - w7 L! g1 K8 P& a8 G
  56. #define TCINTEN_SHIFT               20
    $ H( _- G1 Q3 @$ y
  57. #define ITCINTEN_SHIFT              21
    # \, s: B- }. u( k7 F+ {
  58. #define TCCHEN_SHIFT                22
    + k/ b7 `8 J) o5 C) f
  59. #define ITCCHEN_SHIFT               238 ?, K% a5 e7 j

  60. * d( o( }/ U" o; X( [1 H
  61. static volatile int irqraised1 = 0;/ r+ U2 D) A' {' z0 w
  62. static volatile int irqraised2 = 0;/ f' ?) G- T  Z8 T! n0 e- K5 ]- w

  63. ; E3 B6 l; {5 W& r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: O- o! W4 w8 V" H, s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& j& `! M* G; H1 `4 i* L* |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% U, R% {) o6 \6 w6 r; C

  67. * G& l9 y9 d) g5 p
  68. dma_addr_t dmaphyssrc1 = 0;* k  E8 H" q/ S" y
  69. dma_addr_t dmaphyssrc2 = 0;
    : h: N0 Q" l2 g: C1 v
  70. dma_addr_t dmaphysdest1 = 0;6 N8 r8 b( |/ _
  71. dma_addr_t dmaphysdest2 = 0;
    / s" V9 ?+ [6 [0 U- ~, F7 e/ ~3 S- a

  72. 4 z8 i. o' P* r
  73. char *dmabufsrc1 = NULL;
    8 |2 V. w% W8 ^# \; G& Y
  74. char *dmabufsrc2 = NULL;) z, e* d3 T+ z2 Z) a& {
  75. char *dmabufdest1 = NULL;
    8 X9 e5 h% J3 k7 i6 {
  76. char *dmabufdest2 = NULL;
    # Z/ @! S: P: B0 q1 {8 p+ E

  77. $ w1 p& e) i8 ^# |2 r
  78. static int acnt = 512;: m# k* n9 H: @2 _
  79. static int bcnt = 8;; S# X3 b6 s4 V$ w  L! k
  80. static int ccnt = 8;
    : A4 X; n5 {1 }6 d, S  u& [3 X! s
  81. 9 Q5 e0 g5 ?% _& l/ ]& X& w
  82. module_param(acnt, int, S_IRUGO);
    5 T; d6 H+ x' L! A! E
  83. module_param(bcnt, int, S_IRUGO);
    % ]5 |2 f4 G$ I% y( J* x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 E& y3 A! ]1 S' d) V# I

- S$ N; B5 @1 W! j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 T4 m- E/ l5 P, l* Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# c/ w9 C% _- _* @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) H) B" H& f, J! x4 ?" E( H8 n+ X

6 |6 y2 T! E0 s3 _4 S0 {' W% g- L, S, }+ T0 n: M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-5 17:16 , Processed in 0.037223 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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