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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 c# i& z4 u  x( R7 i! g& g, t1 N
  1. [code]EDMA sample test application% g6 q5 A* H# C4 t3 T; [8 t
  2. /*8 e+ x0 a& \) l3 g3 _& a
  3. * edma_test.c
    ! P7 P+ _6 a$ i$ Q" F
  4. *
    ( ]5 ]: e4 l) d( x6 f( G0 a
  5. * brief  EDMA3 Test Application" u8 P4 E2 p5 H( }
  6. *; f' P5 ^1 P" |' e; l+ V3 I# ^
  7. *   This file contains EDMA3 Test code.
      M; S* A7 F/ i, _: |4 f2 T
  8. *
    / R1 g, r2 K* F  ]& S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( e! s) B+ y; W( G  ]( {; s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ w4 Y. y4 y9 N
  11. *         TO CHANGE.( u+ j( N, l7 H. M- r4 h4 ]* V
  12. *" W2 ~8 B* W8 m- c" M- C( d/ v, Z/ O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      Q. T! Y$ \; b6 q' q2 m$ @2 L
  14. *
    ' T+ w2 c+ R1 X# j3 B7 s( n
  15. * This program is free software; you can redistribute it and/or
    $ [4 g! ~3 J% x- |+ V3 V8 b
  16. * modify it under the terms of the GNU General Public License as
    0 l* e- G. Y2 m0 U: S* c: V6 U
  17. * published by the Free Software Foundation version 2.! G( [5 `- h3 |# j. h! g" ]
  18. *
    * M2 n9 {7 P: v( q9 K+ W6 M3 |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 W; {$ ?& g1 e8 C# r
  20. * kind, whether express or implied; without even the implied warranty: y* y9 o# m0 V# I" o: k+ p. P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % y0 U7 B. _( Z  U# j0 l0 L/ a
  22. * GNU General Public License for more details.
    2 E+ C  p- c; X' }3 Y
  23. */
    % t% n1 v7 K: l% D6 b1 `

  24. & b" ~( S. A6 |- u
  25. #include <linux/module.h>
    - L7 ^& b! F2 B  o
  26. #include <linux/init.h>
    2 c0 l. }1 W) z* D' M- R
  27. #include <linux/errno.h>
    0 g7 C$ R* e; V  p+ z. [
  28. #include <linux/types.h>
    $ U8 ]) ~( _5 F) D$ x) n
  29. #include <linux/interrupt.h>! _) E) x/ i7 P( q. U0 ]
  30. #include <asm/io.h>0 t5 N% M& B6 x; y6 {" V
  31. #include <linux/moduleparam.h>) M  f6 K5 E) i# H
  32. #include <linux/sysctl.h>- g! J- Y4 M9 a  F0 x8 [
  33. #include <linux/mm.h>3 i$ ~( r  I) U8 n. J
  34. #include <linux/dma-mapping.h>
    5 p; |8 `; G  }4 Q( |; @

  35. 9 x! D: E+ h2 i. c% v- u
  36. #include <mach/memory.h>
    6 p& u4 r  Y9 G3 e- |2 F& A5 H. W
  37. #include <mach/hardware.h>
    5 |6 w' f& Z% o7 b6 h" m% N& J
  38. #include <mach/irqs.h>/ d3 L) j0 T: U! c8 ~
  39. #include <asm/hardware/edma.h>$ K9 \7 w1 S4 Y1 R: V' a0 g) V
  40. % Q# h7 W/ l# j0 f# ]& g) T- c' S- c$ T
  41. #undef EDMA3_DEBUG
    , h: \! ]  d  t& g/ _- ~7 |
  42. /*#define EDMA3_DEBUG*/6 U% q+ [" ^6 _" V$ W' x' v
  43. ' p2 l0 W$ ^) F0 B
  44. #ifdef EDMA3_DEBUG
    6 y) h+ V% r% p4 w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), b: \: h, \7 g6 l" ~; o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" V; {5 q) G: a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ }" x3 ^. E, ~; Y
  48. #else
      t0 ^9 t) r5 j5 q, n) _2 [
  49. #define DMA_PRINTK( x... )
    3 S: V- R# @7 y  z& }. `
  50. #define DMA_FN_IN' M8 V# m5 q- |8 |+ g1 R
  51. #define DMA_FN_OUT$ N- R- v2 O5 ?, Z% h) ?
  52. #endif7 j* e( o/ F( G2 w- i0 z! X% i
  53. # P' S( }  O+ L, @: _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  {3 [1 f7 I& h! I) K
  55. #define STATIC_SHIFT                3$ E# s& t$ M! l) t+ p. I
  56. #define TCINTEN_SHIFT               20
    3 Z2 ~; |8 o; D: f! {
  57. #define ITCINTEN_SHIFT              21
    5 _3 R: w8 n0 W0 o
  58. #define TCCHEN_SHIFT                221 m, s7 _7 H2 K
  59. #define ITCCHEN_SHIFT               234 ^3 v$ h: F) c% v* ]

  60. - z1 d( p5 `  B
  61. static volatile int irqraised1 = 0;
    % L  |: _# W" X5 W; ^$ u3 \3 O
  62. static volatile int irqraised2 = 0;
    7 x1 L/ v) P( }" h: m/ [& t: V, |  T& W
  63. 3 u' S  ?* F& M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* s3 u, A; p1 J" [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; H7 R1 h+ `% \. l" u  d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 j' z; S) U9 a

  67. $ |1 }0 p$ D5 n
  68. dma_addr_t dmaphyssrc1 = 0;
    ) c( s) x, Q2 Q2 Y: g3 F! u2 t
  69. dma_addr_t dmaphyssrc2 = 0;
    . L& \7 W% R+ t# K/ D1 Q0 [
  70. dma_addr_t dmaphysdest1 = 0;0 W3 Z, N: R0 n
  71. dma_addr_t dmaphysdest2 = 0;: `' ?) N# \, H2 J: g
  72. # E# u8 Z0 C9 |% J& d+ D
  73. char *dmabufsrc1 = NULL;8 m/ Z- T) a& S/ l8 E* T
  74. char *dmabufsrc2 = NULL;
    % R; @8 g' v: |' b: L9 Q" g$ |
  75. char *dmabufdest1 = NULL;1 J& W& g/ U( U- X* ~- r* k
  76. char *dmabufdest2 = NULL;( N2 g) R6 \/ k0 w1 b+ ~1 H

  77. 8 ?) m5 H  w$ t
  78. static int acnt = 512;
    $ K9 A4 f: I& q1 O8 c
  79. static int bcnt = 8;
    , m* ]; c, Q' V
  80. static int ccnt = 8;
    5 N, _# y$ X- D8 o* m( J3 g

  81. : b; e7 A- M' P! J  A( h3 U
  82. module_param(acnt, int, S_IRUGO);
    , ~8 G; q! \7 D" b- M$ x2 ~
  83. module_param(bcnt, int, S_IRUGO);
    - ?2 k7 ?. p( f+ t: _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' o' V8 @  J- }( z6 i( U9 R- f% k
/ ]2 i& w+ M% N' o! s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ U3 \2 N# G# E1 m8 k$ _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 @$ C8 P& p6 K1 d  o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' i& x/ s" |0 ^6 I7 Q
! n3 p! p  D; c1 p3 ?( e

# C7 E% z- h- Q* L- u7 W! s2 }; v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 05:04 , Processed in 0.041936 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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