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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; l* M' C  i; Q& T# B. r7 e  o
  1. [code]EDMA sample test application" Y! B1 M) {: L! ?  i
  2. /*$ P; @2 Z" y. O8 r* f
  3. * edma_test.c5 o$ {) {$ x; r8 M
  4. *4 J9 ]+ I2 H6 [  K# P  a+ F' b
  5. * brief  EDMA3 Test Application
    0 D6 s/ _- L- E& I6 q) V' \( x$ z
  6. *5 |8 }8 f' n5 D3 G% I
  7. *   This file contains EDMA3 Test code.: s/ m9 s9 p5 }
  8. *
    ; ?  N/ p8 |* P0 S+ V, _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 c+ `/ i9 m3 L* N8 Q3 q+ v1 A! N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 X7 G, S  K- _$ m% J; ]! `
  11. *         TO CHANGE." t( E* _. S8 ^
  12. *
    - [6 ~( L  @2 s' W% E  {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 I4 A* A) @# k' ]# j
  14. *
    3 ^. T/ x2 U0 M' X5 z# n
  15. * This program is free software; you can redistribute it and/or! d, S# M# _% X5 P; A% u  N
  16. * modify it under the terms of the GNU General Public License as6 J7 @& @; H# V( i
  17. * published by the Free Software Foundation version 2.  M" b" }( l- ?& `: m1 Q. Y3 }# \! Q$ T
  18. *4 E) }& x/ h& J8 j$ @3 U; I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 I* o: d, Y: p
  20. * kind, whether express or implied; without even the implied warranty( P7 _6 }& C" ]! i" ~* B9 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . b% W9 A7 R' V* l3 d
  22. * GNU General Public License for more details., {; V7 d5 S% Z, }; A4 `
  23. */& D( N; P) K" x1 \8 i
  24. $ H. W7 V+ m# ?- J5 w' b8 ?
  25. #include <linux/module.h>
    ; s0 a8 j% _1 W  j
  26. #include <linux/init.h>
    ! c6 S" P9 a: k/ J9 v# O6 F9 `
  27. #include <linux/errno.h>
      [4 @; C6 ]  O' [7 J$ D
  28. #include <linux/types.h>; K1 p% a& [* |' c  Y+ [
  29. #include <linux/interrupt.h>( F  _# S0 D! X3 X/ z6 v6 O5 t; y
  30. #include <asm/io.h>
    7 b- o0 x: W& h
  31. #include <linux/moduleparam.h>1 Z% C9 V) l' o
  32. #include <linux/sysctl.h>
    , t6 W) \; h% T% v
  33. #include <linux/mm.h>& R, e4 W% i8 o0 G8 a2 F. ?0 a7 \) X
  34. #include <linux/dma-mapping.h>
    6 t1 s9 w8 ]( e; y7 a
  35. . B% k9 L4 c: ^  m% }! g2 m
  36. #include <mach/memory.h>
    1 M: c/ z3 E+ X( B" [1 q4 G
  37. #include <mach/hardware.h>
    7 @) Q: Q! P% ?0 y- `/ j( R
  38. #include <mach/irqs.h>
    5 K8 v5 u2 B' q" M; t! v  w
  39. #include <asm/hardware/edma.h>2 G' \; s$ P1 s

  40. + `# c8 Z: S& g8 ?0 W/ \) n  F
  41. #undef EDMA3_DEBUG4 B; n9 F* `. S. j$ z3 Z
  42. /*#define EDMA3_DEBUG*/
    ( t" }" D: J9 J5 D' R' o

  43. + D, O- M1 e3 _% d' j9 I& r
  44. #ifdef EDMA3_DEBUG
    4 B5 s, \; [6 T+ l* f. L& |4 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 e  H: n7 F  ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % X( \% y1 A3 q2 n! Y; d# K# L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / N5 j5 b6 Y: b: Y
  48. #else& j- q+ i% _8 `: S9 w- M' p
  49. #define DMA_PRINTK( x... )
    . I) l7 o: N( J$ c& w/ p( B3 K
  50. #define DMA_FN_IN$ F# ?' \- p5 G0 O5 J
  51. #define DMA_FN_OUT
    , j/ {4 G3 i; D2 F8 C
  52. #endif
    ' u$ H$ {7 v; e* Z6 F* _
  53. + P* g% ~% b7 ?, H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 Q( j' c/ z7 w0 [$ J8 X
  55. #define STATIC_SHIFT                3
    7 }& i) U% T* O% d+ ?( `- [
  56. #define TCINTEN_SHIFT               200 H6 l- h% H& r. X
  57. #define ITCINTEN_SHIFT              219 T; s. p3 i9 X; z7 c
  58. #define TCCHEN_SHIFT                22; e6 R4 ?8 n* B4 Z5 q
  59. #define ITCCHEN_SHIFT               23
    6 i& S& Z! E: ?$ @! V
  60. ) j9 X6 j3 q2 |  s% L
  61. static volatile int irqraised1 = 0;
    % V8 }9 o# x0 w' O- G
  62. static volatile int irqraised2 = 0;8 t, o+ M% m0 R' s) z

  63. 2 _9 v7 W# J$ _* g/ Q0 G. _% w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( L0 @) e3 Y: T% _+ f7 o& ~& j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " ~  }, g# W2 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + }: C  @! n7 ~" E" _+ o! `$ b0 E

  67. 6 u, F& D& }6 {2 m) V  H: G
  68. dma_addr_t dmaphyssrc1 = 0;
    + e. l% J( A2 K8 b8 d% L8 i
  69. dma_addr_t dmaphyssrc2 = 0;
    $ }4 ^6 a( t9 X/ n7 Y5 T
  70. dma_addr_t dmaphysdest1 = 0;
    & R0 @# e- O$ ~1 v& E
  71. dma_addr_t dmaphysdest2 = 0;3 B5 A' K( j! V- T. d" Z6 ?- T

  72. ! B& d3 o0 z- l" @: A
  73. char *dmabufsrc1 = NULL;
    ; v5 G9 m  Z7 C( y3 w5 b
  74. char *dmabufsrc2 = NULL;2 [* J2 S" p: Y
  75. char *dmabufdest1 = NULL;
    ; X3 i; e9 ?7 y" b$ T
  76. char *dmabufdest2 = NULL;# ?' @+ l" ^5 |1 h

  77. . Z2 @4 e9 y+ ]* D+ G; V
  78. static int acnt = 512;
    & ?& l8 B- A4 Q# C, i
  79. static int bcnt = 8;
    - R  k4 N: J' g) }
  80. static int ccnt = 8;
    8 }: \1 {# V. r8 D2 P9 k

  81. 1 p# H" v8 \! H& @0 v5 m
  82. module_param(acnt, int, S_IRUGO);  x) I6 l$ w4 T+ w& U7 X/ i" b
  83. module_param(bcnt, int, S_IRUGO);$ b1 b+ x! O1 {  v  y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. K4 g! z6 }1 X/ q" J5 [7 J2 t1 a/ i0 t3 o# z3 i9 |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 K% g! F( u% H/ z: Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' v5 i! I4 A: s8 J/ K! d/ \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 ?4 F2 S' [( t: I% E
0 [$ {- \" C8 \3 p0 ]- F* o' K# u! E) V$ V# }8 `3 n% u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-5 06:07 , Processed in 0.042773 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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