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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : Y7 P$ \3 S& k9 E: C
  1. [code]EDMA sample test application3 o3 c0 W, U+ T1 ~0 V3 _4 |
  2. /*
    ; ?- h1 T; U# u/ `% e& }* j4 p
  3. * edma_test.c; E' g5 l1 n) Y% R
  4. *
    ; g, k5 F1 t; d" U; G
  5. * brief  EDMA3 Test Application
    $ [6 l2 r2 q  l+ \! x( ^! J- L
  6. *
    ( \! [* A& L% K+ `& q
  7. *   This file contains EDMA3 Test code.4 z) ]  _* i% |, N: ^, B# t& S$ h
  8. */ b6 y# R. r4 L) ^' k1 q2 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* @2 ?/ G9 U. M' b8 R& k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / F: j) g7 }. ?
  11. *         TO CHANGE.+ e7 n6 _# W; Z# d# m1 P
  12. *& w3 L% x* s1 [' o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 c9 v4 u- H9 E: k! L
  14. *
    % }. ^# m% n- k% }1 }$ A- R' L
  15. * This program is free software; you can redistribute it and/or
    # Q6 D8 S% C3 W* D7 q2 S
  16. * modify it under the terms of the GNU General Public License as
    3 T9 V4 P' u* H
  17. * published by the Free Software Foundation version 2.& N: i* r2 y' e* r5 q; S7 u, Z
  18. *
    6 N7 c$ V% e1 V1 |4 |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 n# p' L/ E5 c( ]% b
  20. * kind, whether express or implied; without even the implied warranty, r, N7 {- H, v1 P; J3 h& @' y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ H2 P. B* x5 G% f' R4 x
  22. * GNU General Public License for more details.
    9 ?* C2 D# |' e7 T: t6 O' L% n4 a
  23. */
    . N/ b# F$ m3 }. Q0 t

  24. 4 N3 {$ c1 H0 G( T+ ~6 y
  25. #include <linux/module.h>* ]+ l* v) v4 t$ i& L' r
  26. #include <linux/init.h># t6 W8 Y9 ]6 a# [9 Q- m6 w
  27. #include <linux/errno.h>! ^0 T! j; I/ [( w
  28. #include <linux/types.h>
    : N/ m' t" a* T7 a. {  b
  29. #include <linux/interrupt.h>: F0 r' f" k5 y! c. r, b8 J4 J+ l
  30. #include <asm/io.h>
    0 \0 u: Q6 w& ]0 c7 s6 |
  31. #include <linux/moduleparam.h>1 r* T# y8 M0 {7 z4 A2 e3 u: y
  32. #include <linux/sysctl.h># }6 L1 _! ^. J+ Q# o
  33. #include <linux/mm.h>
    ) f+ w# M% Y8 ?$ Y
  34. #include <linux/dma-mapping.h>
    2 o: J: d6 U# @6 B& D
  35. ' R3 d% Y$ A  X0 B
  36. #include <mach/memory.h>3 a6 P2 }9 o, M3 T
  37. #include <mach/hardware.h>4 x9 o* n. r% K. _
  38. #include <mach/irqs.h>/ }3 s7 A5 H$ P) p3 N" g% ?
  39. #include <asm/hardware/edma.h>5 e0 G7 K2 X, q: L" ^* H
  40. : j2 h2 A1 O. Q0 a' L
  41. #undef EDMA3_DEBUG/ r; e' P$ ]1 f8 o- X1 v
  42. /*#define EDMA3_DEBUG*/+ \! @3 a7 h. y/ f) x: l
  43. ) l$ d% X% _' ?0 M. e
  44. #ifdef EDMA3_DEBUG
    8 j" u: X( D! T  s- x- a7 `. {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) }  B$ q4 N3 h1 y) ]+ Z/ O! d2 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- \7 h% _3 G' c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 e+ v& o. h$ |3 L% t5 U5 i
  48. #else9 {* Y9 l, @7 c1 J
  49. #define DMA_PRINTK( x... )9 k4 Y4 |& y7 O: B& G
  50. #define DMA_FN_IN' ^/ |- Z% D) L' \# o  o6 V1 T
  51. #define DMA_FN_OUT
    5 N6 t! z2 @1 X0 M9 {
  52. #endif
    1 C* J+ o: {6 ]$ Z

  53. . [4 o! l* f0 ~( Y8 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 D" v: T' ]2 R' n4 G
  55. #define STATIC_SHIFT                3
    6 U' I* ]: S1 y- Q; m
  56. #define TCINTEN_SHIFT               20$ L  ~# w$ }; c# w
  57. #define ITCINTEN_SHIFT              21
    ! C7 m& G' t/ p% Y) I2 l/ }
  58. #define TCCHEN_SHIFT                227 C  x: D: k/ p/ F6 h9 V5 J
  59. #define ITCCHEN_SHIFT               23
    8 K) U0 [9 l7 E3 C% d8 r" x  E

  60. , B5 O7 ]* P5 R7 b  b
  61. static volatile int irqraised1 = 0;
    3 v' r6 c- j" P5 K& t3 M( _2 A6 [
  62. static volatile int irqraised2 = 0;8 O* R) o- M1 w
  63.   }' D4 {2 S& N" `9 Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 X: ]( ~6 T7 {8 r" `, L6 A/ ^% c% k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . X' ?& ^/ y# ~3 Y% Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( P7 H4 ^; Y& L& D
  67. 2 P5 r, A/ O$ m+ B& P5 \
  68. dma_addr_t dmaphyssrc1 = 0;
    3 Q# Q! P* c& e. ~# n7 H; ?
  69. dma_addr_t dmaphyssrc2 = 0;
    8 t+ w" I9 n* M; h' `3 i
  70. dma_addr_t dmaphysdest1 = 0;6 c6 O3 a& f+ H; U4 @0 z' T1 U
  71. dma_addr_t dmaphysdest2 = 0;
    % F3 x- z& p4 }" L9 [

  72. 9 E% x4 p5 ?- k
  73. char *dmabufsrc1 = NULL;
    5 @9 t7 v! [/ e1 h4 q0 p
  74. char *dmabufsrc2 = NULL;" A4 j7 N- C$ S2 ]
  75. char *dmabufdest1 = NULL;
    9 e% a$ O  P; \- @, P5 A
  76. char *dmabufdest2 = NULL;
    & n& _& Y# }5 I2 l+ _$ ~
  77. 2 ^; c9 o* _9 b" g, _+ n- y8 S" }8 Y% ?
  78. static int acnt = 512;
    * p3 w6 i: q( l! ~" _- [1 C
  79. static int bcnt = 8;
    ( Q7 p1 g, i7 r* T( n9 y9 N
  80. static int ccnt = 8;
    ) K; D$ R# i1 t* g

  81. / c2 d  }/ p) k; _/ _' I7 n& ]
  82. module_param(acnt, int, S_IRUGO);
    6 S2 c. U/ ^" F% }8 o1 u
  83. module_param(bcnt, int, S_IRUGO);
    ( i" W( v7 ~" \  \& ~% Z$ V* x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" `- J- n# Y) B: H- G8 O5 D+ m3 K( x  c. S, k2 ]5 ~2 H" t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# o5 u6 I/ l# T# \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 j9 O& ^+ V" U" P* x8 ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ g7 F- N  T- o& N  R5 o" [+ T/ G" ~( N) V. G
3 Y8 `" N* ?- E( j2 k" e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-4 01:31 , Processed in 0.041559 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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