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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! [0 G. `" X1 f, I
  1. [code]EDMA sample test application. i: T# W$ r2 N+ t
  2. /*8 L2 O- |+ a7 k. l. ~( Z* q8 f
  3. * edma_test.c
    2 f6 u, v$ m9 ^8 a, [
  4. *8 r! }! g9 x9 C5 l
  5. * brief  EDMA3 Test Application" z) @% k0 f) V
  6. *" V9 v- r0 p! ^1 V6 s" i5 `3 f
  7. *   This file contains EDMA3 Test code.+ m5 \: h3 i' y- w! ]
  8. *
    ' t9 M. }/ L! {! k2 U, i1 ^3 V8 n  w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 u, }9 j* A$ d0 Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 v' Y; ^( K9 p3 _4 V
  11. *         TO CHANGE.' w& `0 c' o$ X+ C; d  i, o
  12. *
    , d, b. n6 |, q1 I) w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% l: W* a2 U1 o
  14. *1 a! N6 j7 Y7 \9 ]% M1 q" L6 i
  15. * This program is free software; you can redistribute it and/or" K7 {' e; J1 X: a
  16. * modify it under the terms of the GNU General Public License as1 n; N( V4 j! ]3 C( ?. e! }
  17. * published by the Free Software Foundation version 2.
    % P  c$ Q. b" d7 J) w5 {; y
  18. *
    7 `% c# E6 g* [$ G; [+ d1 ]6 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: e" g( z4 `1 U) G: o
  20. * kind, whether express or implied; without even the implied warranty! B2 y$ o# j6 m- j) n1 q8 L, d3 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & t2 k6 i, |$ n) O' P: {
  22. * GNU General Public License for more details.
    6 b- O4 P( q) O6 }- K7 X" S
  23. */1 O% V% i) g& B7 X

  24. : y$ t* }' e- B6 d# K
  25. #include <linux/module.h>
    : {+ Q/ m+ `+ P5 h. X
  26. #include <linux/init.h>" r! b7 `! d4 _! F2 i
  27. #include <linux/errno.h>
    $ D# j' m# @  K. n3 T6 X9 m
  28. #include <linux/types.h>
    8 m/ L( M; s5 l- O! C
  29. #include <linux/interrupt.h># L4 c/ ^7 }1 a% Y
  30. #include <asm/io.h>
    # i9 Y- C* f5 b) H) f4 r
  31. #include <linux/moduleparam.h>" g: p( A9 Q% ^0 H
  32. #include <linux/sysctl.h>$ ]% _7 `& H1 ]( }. ^8 Z! d" Z- ]
  33. #include <linux/mm.h>
    4 u! b: D3 a0 w# L7 }) A6 s
  34. #include <linux/dma-mapping.h>0 {6 t) G: `3 K' k) Z$ b3 G6 M2 Q

  35. 5 j9 F# F, f2 b! K* q$ h* h4 y- p$ H
  36. #include <mach/memory.h>
    # x2 ^1 G* s( H7 A2 T/ D. a) [0 I
  37. #include <mach/hardware.h>
    ( R* W! ~0 `( Z/ z  @
  38. #include <mach/irqs.h>
    ) Y3 e1 |. ]/ c- A
  39. #include <asm/hardware/edma.h>6 S! k, x) b8 s) a0 f( Z1 ^8 j8 u

  40. 5 R0 X$ [% ~2 m4 B+ w. r
  41. #undef EDMA3_DEBUG. f3 R, x1 M1 ^6 A1 Y( d
  42. /*#define EDMA3_DEBUG*/
    - v7 B( x9 U# R0 Y; u5 S

  43. / |8 E' M- K: o: {0 D
  44. #ifdef EDMA3_DEBUG& S3 H$ m! C- z6 t+ O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : q' y) m9 r6 Z9 }+ B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * d# R5 {2 `! Y" M- l: d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 _' X; S+ F3 @6 r/ B3 x1 H
  48. #else# J) g: D! [. E5 r7 h
  49. #define DMA_PRINTK( x... )
    * _- M( L8 }) a  d) j6 l8 ^! S
  50. #define DMA_FN_IN+ }2 T2 y1 ~3 x: k8 c9 ~! P
  51. #define DMA_FN_OUT; j8 f) P# Q# b, c) ~+ O
  52. #endif+ I. K0 M5 \) p( ^7 d
  53. * A6 l1 p8 t' b% K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): N1 w8 Q; m$ M9 w
  55. #define STATIC_SHIFT                3
    ' [$ V' T& o7 ?2 B* p
  56. #define TCINTEN_SHIFT               20
    - O% x- ?0 t- o4 j" f. y7 x
  57. #define ITCINTEN_SHIFT              21
    2 X5 i7 l  ]# |6 |! H! s6 ~
  58. #define TCCHEN_SHIFT                22
    # F0 [& T9 t# b& Y' \
  59. #define ITCCHEN_SHIFT               231 O7 q+ ]  X  A& e' K

  60. . e8 D$ M% g5 r2 B& U/ _
  61. static volatile int irqraised1 = 0;
      M+ C1 i8 ]' l( V
  62. static volatile int irqraised2 = 0;' z$ z3 E+ `% x3 p& n. t8 E- n
  63. & @- `2 t1 v6 d4 R7 A8 ^" t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- J; z, U3 C& ?6 U# T. T/ ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* b/ h. g( q+ f* _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 A8 r8 l5 r5 |+ p2 d
  67. # w7 G  c/ b( V9 W) k
  68. dma_addr_t dmaphyssrc1 = 0;
    5 b- ]0 O7 h5 Z( R
  69. dma_addr_t dmaphyssrc2 = 0;
    : _, H  }' r: ]+ l8 ~9 U6 O+ s! d
  70. dma_addr_t dmaphysdest1 = 0;
    + ]; @7 y( `4 D3 ]+ _
  71. dma_addr_t dmaphysdest2 = 0;
    $ j+ ]# r2 u; N% L* ]* u
  72. # }5 r0 @& h8 ?
  73. char *dmabufsrc1 = NULL;
    3 P$ X5 n; ~+ R" z* |  g
  74. char *dmabufsrc2 = NULL;0 |% r2 M: D8 g
  75. char *dmabufdest1 = NULL;8 v* a& m2 y& y- T# G5 Q) W
  76. char *dmabufdest2 = NULL;
    - i6 s( S& k. X0 M. x$ B* m

  77. ( r+ S. O) x- a7 N. f# c
  78. static int acnt = 512;3 y; G, n  I4 t2 A7 i% t
  79. static int bcnt = 8;/ A4 _& z  C: j7 b# w
  80. static int ccnt = 8;
      r/ [( B0 J+ x0 F
  81. # N. Q$ ~! N6 k% f/ A% ~. L
  82. module_param(acnt, int, S_IRUGO);2 O8 t: Q( N0 ^% ^- |
  83. module_param(bcnt, int, S_IRUGO);
    0 A" D1 o+ ^! j% {6 D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& Q! v: X5 }* G. o' n- b9 n

5 ~( Z0 D4 n' }1 ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 R, O7 e8 [3 _2 A; Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 W2 K. f. e8 g0 G/ E# z- C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 u; ~2 l/ _) i7 N1 l8 f. \" b/ o
. A9 j8 Z: p4 R- U

* v& k* a2 E$ `: I  a  F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-19 13:38 , Processed in 0.045425 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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