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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" h& X* O1 x7 [2 U
  1. [code]EDMA sample test application
    $ w/ {( k( [5 m9 J- z- g
  2. /*
    ) l& I0 y4 G$ R; N
  3. * edma_test.c
    , Z& X. [! W' r! C
  4. *
    . d9 x: E' P1 h; V
  5. * brief  EDMA3 Test Application* i; w- s. i2 f& Q% l
  6. *
      `* J$ a  ?- P, a* ]2 F
  7. *   This file contains EDMA3 Test code.
    / T9 Z/ A5 i: m. s% j
  8. *# I, f! W! g, M- I2 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 d4 J0 h0 w0 t# p4 H: a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 a( V- G) Z. o" }- [; m
  11. *         TO CHANGE.
    , U+ q/ p# e9 W, S% J  z) ]
  12. *
    ( U& x' `" H6 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; C8 b$ h  f: \7 L* v+ c. e
  14. *
    / k2 s$ G8 n. s. T, g/ k) h
  15. * This program is free software; you can redistribute it and/or
    ! H4 D1 H4 K  s, C0 W
  16. * modify it under the terms of the GNU General Public License as4 t; L: p2 u+ @8 _6 C
  17. * published by the Free Software Foundation version 2./ L  V5 i* F2 E# H+ ]$ E" D: ~% e
  18. *
    1 _" |7 h0 m: E9 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 ^0 p( W8 w9 U/ q9 D& d) Q3 K
  20. * kind, whether express or implied; without even the implied warranty) ~+ P% `. ]" b: q2 J+ R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 V9 |) f( x7 _& R5 V/ d
  22. * GNU General Public License for more details.
    9 `* q- j1 Z: I
  23. */
    3 [3 D) G# k( v6 o# @9 L4 H
  24. 9 B% T3 ~, G7 c$ B% M
  25. #include <linux/module.h>
      _7 c) {2 F5 p6 G$ @$ j0 G- B/ n
  26. #include <linux/init.h>8 F  A  d1 A9 q. _
  27. #include <linux/errno.h>  G( l4 _, g! x, r! k8 ~/ H
  28. #include <linux/types.h>. d9 m2 l  L4 {: \7 Q: j* A; j
  29. #include <linux/interrupt.h>
    ! h# D9 P5 G& ^: L9 o
  30. #include <asm/io.h>* ~% c, W1 q4 f. e3 f
  31. #include <linux/moduleparam.h>6 S4 D& m; z! b7 _+ i* U& d! b
  32. #include <linux/sysctl.h>2 y2 ]! B5 r/ o: \5 _- L, x* {
  33. #include <linux/mm.h>
    # x6 c2 s: w6 M# O- ~
  34. #include <linux/dma-mapping.h>
    ! G1 Z3 t) O/ `+ ]* k
  35. . r9 H9 G- e; \, O3 ]9 ~8 k
  36. #include <mach/memory.h>
    0 P: P9 m! E& T/ W
  37. #include <mach/hardware.h>% X% k" p' a- x* `
  38. #include <mach/irqs.h>
    ) B  P9 B6 ]# }7 H% n. ~$ o9 ~( F
  39. #include <asm/hardware/edma.h>% e+ M( c! j# r# d
  40. : b4 m) A3 n5 w- b- o; @+ h" q
  41. #undef EDMA3_DEBUG
    3 _; @, `  m- g9 M  c5 A! ]
  42. /*#define EDMA3_DEBUG*/& v' y8 K6 F* _( @8 C
  43. 3 m: ~. Z" R( j5 u9 l+ e' T* J
  44. #ifdef EDMA3_DEBUG7 E2 o8 L8 u& j% Y) t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 {7 U4 s6 k: B% `, s0 @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 }5 m5 c( ]1 H* p$ L3 v9 z/ k: {9 _$ P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , m& y+ ~" {9 C$ u- o) C' T
  48. #else  i/ e+ L1 g( S; {, i; r9 J* w
  49. #define DMA_PRINTK( x... )
    * R7 {  P4 I( ^# m( i0 K
  50. #define DMA_FN_IN
    : w* l! S2 ?& c- N$ [% [
  51. #define DMA_FN_OUT
    ! \7 {5 }" a2 _0 f
  52. #endif4 Y$ g* }) t( w9 O, Q" g

  53. " H9 O+ c2 P7 J6 F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 I/ `" U* `3 V6 T& C
  55. #define STATIC_SHIFT                3: n- a6 J  H9 f6 l* W! \9 Y  r
  56. #define TCINTEN_SHIFT               206 u1 `: E$ c' L  j7 ^+ y
  57. #define ITCINTEN_SHIFT              21
    ! ^2 |! m! E% u
  58. #define TCCHEN_SHIFT                22
    0 ~0 c" Q- B$ d! s' G- Q
  59. #define ITCCHEN_SHIFT               23
    ( u) {& ~4 {. _: f' {

  60. 9 D3 X8 h; |. o
  61. static volatile int irqraised1 = 0;; a1 K" X; a' X+ j
  62. static volatile int irqraised2 = 0;
    $ E* X! \: \  u9 R9 F& F0 L

  63. , {; v5 j7 F( N9 w& }) i1 c5 W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ }+ e# w8 q$ j4 [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , H0 ~* ?/ y; |: a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * @+ S& W: A5 E4 W

  67.   Y7 h) _+ z2 v- D
  68. dma_addr_t dmaphyssrc1 = 0;
    5 }7 P% }; r9 H" J2 K" g6 E# }
  69. dma_addr_t dmaphyssrc2 = 0;) Y% n8 ~* C  O. V
  70. dma_addr_t dmaphysdest1 = 0;) ?+ H, B0 @! \, G1 {6 L
  71. dma_addr_t dmaphysdest2 = 0;# O( B) C6 d1 v5 e' `
  72. 4 `# w" m) C. S# P& \, B9 `
  73. char *dmabufsrc1 = NULL;
    6 ?! ~6 C, c; a9 N2 N
  74. char *dmabufsrc2 = NULL;
    2 w' C. Z" N9 c/ |
  75. char *dmabufdest1 = NULL;; m8 w5 K, w" S. e9 _" [
  76. char *dmabufdest2 = NULL;3 q8 q9 y* ?5 {9 `

  77. - {) k- ^1 o: q
  78. static int acnt = 512;- Q$ c! Z; V& l- ~6 D' m
  79. static int bcnt = 8;1 x* H0 _) ^. A! J- y' ]
  80. static int ccnt = 8;2 l+ j: u* G9 B5 T6 U; b' J9 w5 f2 J
  81. & V7 d6 d6 x8 z
  82. module_param(acnt, int, S_IRUGO);
    2 w$ \: j; A& k) k
  83. module_param(bcnt, int, S_IRUGO);
    ' z7 {! [4 Q4 _9 b# o
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" C0 l) s) u! J' y0 e
% W" |( Z! n, q5 z: G) |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( {$ c0 J( A3 Q1 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 k& D/ K/ r8 o/ k* n/ k: g, |3 s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ f1 J9 b4 E% R8 a
9 N# A; f% W+ k. I# `8 j

, h! }! ?3 D5 @8 ?% e2 x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 19:42 , Processed in 0.040960 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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