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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) O6 X- G$ \; r% L  E' {* c3 G' D
  1. [code]EDMA sample test application
    * Z' ]- H& G! e0 d
  2. /*
    + X. T# H8 S4 r! F
  3. * edma_test.c
    8 D0 e; Z6 e: S# H0 c1 n, V
  4. *$ Y' u( z# y2 t' f' y
  5. * brief  EDMA3 Test Application
    ( d2 r- z8 l# u: F3 c
  6. *
    ' Y3 j. b7 q, W; V8 }6 ]
  7. *   This file contains EDMA3 Test code.
    ( E% E- F/ u& _1 `2 X1 e6 Y
  8. *
    0 L  w8 s) q. N1 {7 T2 g$ [7 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 }1 C7 o5 @& L4 p6 P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / r3 g0 m) i6 e1 N7 O* c% b. c
  11. *         TO CHANGE.
    % @: \# h9 J0 S+ w2 E% I
  12. *
    0 F; q9 t* O0 f' c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * d; S7 h* H* j4 c
  14. *% O) E6 a# ?9 t; V/ G, p8 W
  15. * This program is free software; you can redistribute it and/or
    6 h% W* D9 r! a8 W' A. a
  16. * modify it under the terms of the GNU General Public License as
    5 U4 A3 z! c1 g4 G1 U
  17. * published by the Free Software Foundation version 2.3 x' x" Z/ Y9 b. O% l- ]7 T
  18. *, b% ^$ J5 x) J1 Y( g2 U1 }5 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 ]1 o2 e$ |0 a+ G; M
  20. * kind, whether express or implied; without even the implied warranty
    & b) s0 _: C+ ~9 f; V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 v3 f- w+ @. C6 m1 D
  22. * GNU General Public License for more details.) C7 R2 J. m. Z- P# ]2 J
  23. */
    5 G- \5 s5 H. l7 ?
  24. 0 x' G9 R! a- ^1 @; d6 _/ q
  25. #include <linux/module.h>
    8 z" k5 O" y- X4 J
  26. #include <linux/init.h>
    $ g& Z$ x& U' V7 Z- d; u, W
  27. #include <linux/errno.h>/ y1 P0 w% {+ n" {
  28. #include <linux/types.h>$ |5 t; v# t- j7 Q, \- ^
  29. #include <linux/interrupt.h>/ t! T% j3 K& v% G4 |* h
  30. #include <asm/io.h>- g; H3 z5 B5 g. v& [9 h
  31. #include <linux/moduleparam.h>
    2 _3 D& p+ s3 l. y" O' g  P9 X3 e
  32. #include <linux/sysctl.h>+ q2 {! G. W5 ?
  33. #include <linux/mm.h>
      C2 a# V5 l  y; W
  34. #include <linux/dma-mapping.h>
    : C  b. Q! y( |# D

  35. 1 s1 O, L# }6 d( @3 C0 V" V
  36. #include <mach/memory.h>( a& ^8 R4 {2 {) b, v6 k
  37. #include <mach/hardware.h>
    8 N- A8 Z0 \5 b) \4 ^# q
  38. #include <mach/irqs.h>
    5 S& {1 }. B& n5 V+ m  O. l+ n4 p9 I' [, Z
  39. #include <asm/hardware/edma.h>
    ! a4 i, Q  H! `+ z7 |

  40. ; ?1 i6 _$ V; n% _+ r4 J
  41. #undef EDMA3_DEBUG
    ; h5 C! z: t, V  f' H- X! o
  42. /*#define EDMA3_DEBUG*/1 y) b: X! w+ V& `$ }8 k

  43. % J6 h& m3 C; S( y/ ^
  44. #ifdef EDMA3_DEBUG* W6 y, {: r- e7 x4 I! |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% c3 g$ h/ g6 o6 \% c+ U4 h1 V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 }- `9 A4 a8 T5 }4 o% r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 P. Z, ^9 @7 M' r& R
  48. #else
    % E; B( V/ z! n5 n" p/ ~
  49. #define DMA_PRINTK( x... )
    / W& D7 ?  f! p  X) M! ]0 }
  50. #define DMA_FN_IN3 E+ `  K# E0 @# V- J0 u2 }; o
  51. #define DMA_FN_OUT
    + j8 |7 K, G3 Z9 a  r; q
  52. #endif
    / |! R8 a9 _2 P% W/ l

  53. 9 \4 Y# |+ m0 \: f+ T& \" _3 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ D0 B0 X' |4 `8 z8 X1 v
  55. #define STATIC_SHIFT                3
    ) c9 W+ ^' C4 U  P( d! l' h, J, _
  56. #define TCINTEN_SHIFT               20
    8 Y5 b: f  S2 w
  57. #define ITCINTEN_SHIFT              21/ u( [5 t  J1 j8 N
  58. #define TCCHEN_SHIFT                22
    " {4 W0 n0 D, J1 g& S  U/ P4 a
  59. #define ITCCHEN_SHIFT               23, E, G) I, u: \3 J4 t

  60. 3 e  Q& ~2 K/ T
  61. static volatile int irqraised1 = 0;. Z4 r" W3 s6 R' H5 d  w
  62. static volatile int irqraised2 = 0;
    4 _- B5 N* n1 _; m9 \( K% L" c) x
  63. , V6 k! X2 N- |6 m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 F# k" }- c/ e" W$ Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Z' n( p( u- @) h- y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ a, d. K* u- o1 f! E
  67. 5 f) R4 k. r$ D) M, |7 T' \
  68. dma_addr_t dmaphyssrc1 = 0;- C2 E5 _; J* {1 v$ |' S- j
  69. dma_addr_t dmaphyssrc2 = 0;
    2 n- L8 P) R' R9 L  X2 p  Q- A/ b
  70. dma_addr_t dmaphysdest1 = 0;6 s6 Q" X- l8 q) K: w
  71. dma_addr_t dmaphysdest2 = 0;
    ; ~! I) A8 R0 k$ J# P+ s3 \

  72. 8 P- d! m' G' M# ]) z$ m
  73. char *dmabufsrc1 = NULL;
    # C8 _3 o4 \% H' \
  74. char *dmabufsrc2 = NULL;
    3 B, Q- X- }, [8 Q, e
  75. char *dmabufdest1 = NULL;
    - ~  f3 j0 F. p4 H4 N; d
  76. char *dmabufdest2 = NULL;; a" |* h. F6 w3 G" G
  77. ) T) D6 x7 Y" E, V& u; R7 p$ ~
  78. static int acnt = 512;/ Z) _8 p$ T. g6 [# i+ ]* `! g% r2 Q
  79. static int bcnt = 8;
    $ t/ \! V6 K' Y; t" a% B
  80. static int ccnt = 8;
    # s: |8 k* o% j$ m8 n" x

  81. / B) h! X/ N. p
  82. module_param(acnt, int, S_IRUGO);3 u. n- o0 o* W+ Y; E
  83. module_param(bcnt, int, S_IRUGO);8 I7 k: i* S* g+ H% p. e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 R% ~- i; [& j! f2 n! `
& y5 \. t" R/ g8 ^" f2 O8 t# ?9 F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 z* l1 ~/ P) Z4 A6 i) U' N$ iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 `! J: A# D7 C; H6 t( }& V  v8 t4 G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' W% B+ f* F$ H+ m

/ d& g2 F1 S, z" `9 h( D5 Z& s5 C3 `# m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 03:29 , Processed in 0.048277 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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