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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 L  ~) |# f; {1 u/ |. G
  1. [code]EDMA sample test application. z  X( q6 J1 D
  2. /*
    4 [" ]9 m4 @, R9 O* |0 M
  3. * edma_test.c
    # t9 V+ x8 e& z3 X4 V
  4. *0 ]. @3 w" h4 i4 e6 G8 q, h
  5. * brief  EDMA3 Test Application
    3 s: X1 a" s% G2 g* l$ ^1 O4 `* c* a
  6. *
      O; [5 w/ b3 ~( X$ X
  7. *   This file contains EDMA3 Test code.
    9 r8 o) W, T3 B4 d
  8. *
    + [* _( t" q8 Q: B2 |+ X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 D1 |  {' Y8 C7 w/ H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 q3 p) {3 U6 I8 k8 t
  11. *         TO CHANGE.  C4 }4 B3 y1 L( G5 Q3 w; Q7 q! y! N
  12. *
    1 A- W1 A+ b+ P( O; @, j2 c5 p9 t. o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + p6 h" z. @8 ?4 U6 s8 ~8 o7 r
  14. *
    ; X) [/ d- h8 A
  15. * This program is free software; you can redistribute it and/or
    + e: |7 Q" ?0 D1 k! {
  16. * modify it under the terms of the GNU General Public License as% i7 ~" M7 o+ `
  17. * published by the Free Software Foundation version 2.
    # n$ S6 }2 ?' X3 t0 w" {! ^  W' u- f! y" c
  18. *
    % t9 o$ C' T  M2 @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 l6 E' w* _3 U9 R8 I+ l7 f+ t
  20. * kind, whether express or implied; without even the implied warranty
    - W2 S* p$ V- D8 f3 w: E9 ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 U# Q) J  L7 b" s* s
  22. * GNU General Public License for more details.: F# `. x0 l& l8 R$ M  B5 P
  23. */
    ! {  A- O: [) o9 c. n5 K3 g

  24. . t% X* X4 w  b& C$ X
  25. #include <linux/module.h>, l% [& Y, Q( F. z/ F7 h7 \1 ]* g
  26. #include <linux/init.h>
    6 X" C/ O5 J  d. U& [
  27. #include <linux/errno.h>" S: e+ C: O& ]/ e3 e0 P
  28. #include <linux/types.h>
    9 l4 {3 B  K1 n  _/ J  k6 V; B
  29. #include <linux/interrupt.h>
    / N" f5 V) `# ]# X. D/ ^% ^$ i
  30. #include <asm/io.h>
    # E; q# E+ D9 `: C
  31. #include <linux/moduleparam.h>2 q  d$ K5 a0 _) G
  32. #include <linux/sysctl.h>
    2 L' p* x6 l, ]' |) j' Z
  33. #include <linux/mm.h>* j2 ?+ N0 e4 W
  34. #include <linux/dma-mapping.h>0 A3 C3 b, y$ e2 {9 z! C

  35. 5 [" }1 b5 j# g4 A6 G7 c
  36. #include <mach/memory.h>! {, p6 |! t1 v2 y
  37. #include <mach/hardware.h>2 p" [/ }1 Q3 p0 _+ y
  38. #include <mach/irqs.h>4 t$ t+ z/ i; U" }) [" b3 I
  39. #include <asm/hardware/edma.h>- ?) T. r( x  t, P& G3 ]
  40. : I6 G7 Y" L5 ~* t4 r* a
  41. #undef EDMA3_DEBUG
    1 \+ @4 L. s9 k
  42. /*#define EDMA3_DEBUG*/
    # e! P+ e; V# A3 `& q% V
  43. 4 L$ ^: X& m' ^% W' @# n5 V
  44. #ifdef EDMA3_DEBUG
    1 u- Q7 l) {" g7 d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* P' s- L9 t2 s/ n( c+ R" |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! B0 D# Z/ Y; u3 |/ A* d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 @) o7 Y! w; h5 T* S( U, ]! R
  48. #else$ H* O0 i! w+ m0 |: p" |
  49. #define DMA_PRINTK( x... )
    - F' G0 G7 z1 u# k3 t
  50. #define DMA_FN_IN
    # ^" P% z# U( F. @0 q
  51. #define DMA_FN_OUT
    * C$ B9 U& @3 J
  52. #endif# f7 V! `5 H& ~& S* v/ C; j* P
  53. 1 k- W# p% a1 S9 p; w; `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! h- o& k. y# U: w2 a$ k1 J, G
  55. #define STATIC_SHIFT                35 n/ O; I: w/ `7 M) ]; O) ~, H
  56. #define TCINTEN_SHIFT               20
    0 a% a7 z5 f, S1 x
  57. #define ITCINTEN_SHIFT              21
    0 i6 }% z+ d$ J3 q" g
  58. #define TCCHEN_SHIFT                22% r8 y. x8 L5 q  b4 i) |7 a# y( E) f
  59. #define ITCCHEN_SHIFT               23# e4 u- e+ O) Y1 l

  60.   R7 v5 R8 E- R, w5 n2 z8 ?$ L; ^
  61. static volatile int irqraised1 = 0;- Z) }! y; b2 Z) a6 U
  62. static volatile int irqraised2 = 0;3 j5 R5 e7 Y* ^+ ~& ^, L4 Z

  63. ( Q$ t5 K$ I" O& S# G+ \0 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; J$ z: ^/ z) s) {/ H8 H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! N9 D7 @( v9 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" C/ {# ?  T, t" _. L0 ?8 p

  67. & J6 G- X! j# ?% J3 \1 H/ G1 O( I
  68. dma_addr_t dmaphyssrc1 = 0;
    1 g7 t. O, m: I) X$ P7 F+ X+ F
  69. dma_addr_t dmaphyssrc2 = 0;! I$ N+ G& j0 `5 Y3 z% n  n
  70. dma_addr_t dmaphysdest1 = 0;% k1 ^: F: u% a
  71. dma_addr_t dmaphysdest2 = 0;0 t* X; {: c/ O1 T& B1 O
  72. ) f8 _0 ~: y: J% f- `, n* V7 I
  73. char *dmabufsrc1 = NULL;
    + V# A1 a4 [& c7 z& g
  74. char *dmabufsrc2 = NULL;! P$ J$ M5 z7 V
  75. char *dmabufdest1 = NULL;
    . ~( K5 B7 ~; ~' v; ~( ~
  76. char *dmabufdest2 = NULL;
    ; {' T9 C% E" X/ ^
  77. 9 `# U1 k8 U0 ]
  78. static int acnt = 512;7 T9 ?5 C4 F% l! o# x, D
  79. static int bcnt = 8;
    . m+ i( J, N# w
  80. static int ccnt = 8;
      i# J7 A2 H% |2 |& t! B

  81. , B8 L1 R, L2 V7 t) R
  82. module_param(acnt, int, S_IRUGO);
    1 M9 O6 z4 M; T1 R& {. e+ K
  83. module_param(bcnt, int, S_IRUGO);
    3 }! C& s5 B, x& x6 s: q2 d2 h
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! c0 o/ K% V* I% V$ W
4 K1 R3 }" Q- p, _: l$ T2 l, c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ V2 M& W* \5 E" J  O( B' v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* j* s" P+ B8 G# `4 P2 l" n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 {# s) i7 @, B( W) y6 ]$ g! k3 W2 W  R3 y( J
3 P& s/ f0 b( U! L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 01:54 , Processed in 0.038354 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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