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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 t$ j2 i% A* y; `& F
  1. [code]EDMA sample test application
    ( \0 w7 R+ f+ G  b% q# u
  2. /*0 L2 z: A9 |. L' M5 b
  3. * edma_test.c/ D+ N1 G$ x3 y1 C( p1 ~
  4. *
    $ b# b; D3 Z" X7 O! J. V0 l3 K% Z2 V
  5. * brief  EDMA3 Test Application
    5 o8 {$ F7 t0 W  B$ ]0 d" w: y
  6. *; H/ N8 `; u, z8 f8 }& C" |
  7. *   This file contains EDMA3 Test code.
    3 E- h* s+ P- L7 K5 O. N
  8. *( c. x! q3 R( K" l+ q  I9 b. B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ h0 t' S* W  Q" O( C( P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- N- R, [; Q" V8 [$ \) I# a
  11. *         TO CHANGE.- H" X+ n% \! a  j' Y
  12. *. s7 o$ j4 {) z6 r& y8 G0 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 t/ D0 [& t+ _( b' i0 x2 @
  14. *: x/ ^! d! }) ~+ \3 J
  15. * This program is free software; you can redistribute it and/or. ~( U3 a7 N7 i* ]. T
  16. * modify it under the terms of the GNU General Public License as
    4 ]5 X# f' r. c) T$ b4 h6 z
  17. * published by the Free Software Foundation version 2.7 Z# F. @; |! U
  18. *: L$ g' g7 o% ~4 q, n) E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 y: U$ ?* S$ ^1 Q: ]  r
  20. * kind, whether express or implied; without even the implied warranty
    ! U& k% m' i0 b) _- m+ {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 i2 O" k2 o+ U3 H0 A- o' x/ d0 O
  22. * GNU General Public License for more details.; ?( t; Z3 |8 c5 _
  23. */1 p9 o5 i: _. A0 ?) I- s

  24. ( l- }* p  }6 f1 b# K
  25. #include <linux/module.h>
    ; C$ v9 J& J* D% L/ n7 K; g
  26. #include <linux/init.h>' r/ h0 W4 X( R5 S, I* d# m, M
  27. #include <linux/errno.h>
    + _7 R. D& f2 m! _
  28. #include <linux/types.h>* }, e( U0 ?' f) I$ d# a8 e
  29. #include <linux/interrupt.h>9 s( _  i7 e* O5 R  z+ i: R
  30. #include <asm/io.h>
    8 P0 c- j* h$ _9 K4 D4 @1 ?, e
  31. #include <linux/moduleparam.h>( o# ?5 p3 R4 K6 n- \3 b4 b& I) b
  32. #include <linux/sysctl.h>
    $ p! q8 N5 {( Z0 J
  33. #include <linux/mm.h>8 r7 i3 r5 a( \+ y  f
  34. #include <linux/dma-mapping.h>
    , M, l3 Q: k4 Y
  35. 5 b/ K5 {# {. _6 x& K
  36. #include <mach/memory.h>
      t% ^! x& p6 j+ O% r- q& A$ D& y  r
  37. #include <mach/hardware.h>/ r- D' t* s: d8 y7 i' W
  38. #include <mach/irqs.h>
    - n! q4 f/ J/ i, |. @( X
  39. #include <asm/hardware/edma.h>
    + n" L3 `1 x' q6 E4 @! L
  40. : o8 ]0 M: ?+ y' N
  41. #undef EDMA3_DEBUG. g8 l/ m& V8 [' `
  42. /*#define EDMA3_DEBUG*/
    ( [) o# a! Y( p) {

  43. $ x8 l. }+ P- P: W! O
  44. #ifdef EDMA3_DEBUG
    & a" D# h- f: n. \7 I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      G% H$ E5 X, C7 q- W+ U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' H: Y, m, ?. u3 S6 @3 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 H/ I& |8 ]6 }6 B
  48. #else& i6 o" g' k6 D5 W4 N
  49. #define DMA_PRINTK( x... )
    : C  _6 J' ?2 ]4 m# g3 f8 W
  50. #define DMA_FN_IN; F. a; `5 }# r0 H8 L- t" O, e: q
  51. #define DMA_FN_OUT3 y! g" R1 q; J3 C
  52. #endif. Q$ i' O2 Y1 Y2 A" X& b% c! C

  53. ; [/ J6 i" p9 u- |( N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 t# w8 p  \5 n2 ?6 N6 `
  55. #define STATIC_SHIFT                32 W# K* g' K) N  v7 W- B$ W1 _
  56. #define TCINTEN_SHIFT               20$ D" c" z# O! ]# U9 M$ g, |
  57. #define ITCINTEN_SHIFT              21
    # |6 B1 x9 H! s9 _. z
  58. #define TCCHEN_SHIFT                22
    5 e, d) E% q4 Q
  59. #define ITCCHEN_SHIFT               23( _* Z7 T% F- Q/ x) V# }; D

  60.   l5 C6 _1 X9 _" r' l+ n
  61. static volatile int irqraised1 = 0;
    ! i: o- h0 \5 R; T% e$ R( ]  j9 \$ r
  62. static volatile int irqraised2 = 0;' p) X. s9 w8 }7 {
  63.   J1 q# E% d, a. U3 C% v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 {" [& E# |; R8 O5 F3 T8 [, g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & o# B+ p8 P9 u& M: ?) e% S# z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , G% a# _$ x$ P0 u

  67. 2 c$ G) P, W8 A, L
  68. dma_addr_t dmaphyssrc1 = 0;$ t2 s( V9 A" v, Z. K0 m2 ^/ ]
  69. dma_addr_t dmaphyssrc2 = 0;
    8 T/ Z/ M# b/ v* _7 f; z" f# @
  70. dma_addr_t dmaphysdest1 = 0;6 S" F$ j. x* ?, K
  71. dma_addr_t dmaphysdest2 = 0;
    , z2 Y7 w5 N( T: V4 T! ~# Q

  72. . U& A7 j. h3 j9 e3 [; g7 c) f- l
  73. char *dmabufsrc1 = NULL;
    6 y6 V( \6 _7 Y/ N+ J1 K3 M; F
  74. char *dmabufsrc2 = NULL;
    5 d" N# L8 L0 N! u
  75. char *dmabufdest1 = NULL;
    ' x! d* y1 F% `- n/ D& h4 s1 k
  76. char *dmabufdest2 = NULL;& y1 ]2 o; M6 y4 z
  77. 5 W. t9 s1 U' I
  78. static int acnt = 512;, V( N) ]3 R" Y4 P# y, r( W
  79. static int bcnt = 8;
    " u5 E) n. R; q
  80. static int ccnt = 8;
    ( p6 E6 i) h- l6 z% L, @
  81. 1 h+ Q! f0 L$ M6 D
  82. module_param(acnt, int, S_IRUGO);
    9 g7 X6 |6 h' ]/ R6 m' i7 N
  83. module_param(bcnt, int, S_IRUGO);8 d( A. g8 H; ]5 X6 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 b- ]' P8 h8 S! {4 L; J+ Y
' ?% d' S+ }) r' E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 c2 c. Q% p3 U% J# S# p: D6 R" G7 o1 Rarm-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' T) G( _1 Q# _  r7 E( s8 K) n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 t8 Z: o6 ^! K1 T5 Y3 g4 T

$ Y. z! F- E& n4 L
' e: v: d; X5 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 19:40 , Processed in 0.039392 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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