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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 Q+ x& y0 w* m8 D2 J3 L" j
  1. [code]EDMA sample test application
    7 Z8 m3 _% _3 E2 h9 }
  2. /*
    0 t$ l" c# [6 V  u* N
  3. * edma_test.c5 a$ ~' M4 L% y1 V5 t6 N5 ~' K
  4. *
    ) F) L% u: K8 Q5 o: ^' j" Z, E
  5. * brief  EDMA3 Test Application1 I6 Q3 o+ S8 R' i& k
  6. *
    ! J4 J+ i: x" b3 S+ m9 r) R
  7. *   This file contains EDMA3 Test code.
    7 e! `* Z. J' Q7 U! n; M! F2 u! [- K
  8. *
    0 ?' J! v3 u( S% M' j  v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, E5 F. a' _1 u& b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + o6 [, t5 y" P7 r* l
  11. *         TO CHANGE.
    6 \  Y1 T8 e& i' ^, E  ?
  12. *# [" G2 d5 V0 J* z6 p4 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : X" Q# A: K2 _) z' T% B) i
  14. *
      [! q9 G1 A0 J( i  N1 q
  15. * This program is free software; you can redistribute it and/or, ^/ m2 W7 U' C8 L/ ~# {# C
  16. * modify it under the terms of the GNU General Public License as+ j, T& E! S, @
  17. * published by the Free Software Foundation version 2.$ E# A, m2 Z+ }) K( X3 Y; Y: @* r
  18. *
    ; D9 V+ t! k/ o1 N) a. c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) c5 o1 P2 r4 f
  20. * kind, whether express or implied; without even the implied warranty
    & q0 l" a/ a5 g+ \- v  ?9 D, K6 ^# s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / g8 y- c4 d3 V) i$ \1 A9 u4 O( `& P( v
  22. * GNU General Public License for more details.
    3 T$ t, A3 x) y
  23. */; `4 e5 l* A1 V2 Q, r

  24.   ^/ ?3 y. [: {; f" Z
  25. #include <linux/module.h>2 g/ q! s7 I3 {, |
  26. #include <linux/init.h>
    7 D6 y! V! ]2 y# R( L
  27. #include <linux/errno.h>6 r8 Q' Q0 J' w3 o. N5 j# w0 n
  28. #include <linux/types.h>! Y$ o, w  v  M: p4 Z
  29. #include <linux/interrupt.h>
    9 U' U2 K8 [+ ]; K& C+ w
  30. #include <asm/io.h>7 ~( Z% J: l& E: P9 h" b
  31. #include <linux/moduleparam.h>) u  K, S8 r( S3 ^
  32. #include <linux/sysctl.h>
    % @" G* j' z* ?3 b. j
  33. #include <linux/mm.h>
    + |+ e1 T* ]9 l' f$ ?
  34. #include <linux/dma-mapping.h>
    + v; D$ G6 y2 h* n
  35. + V5 |* M3 Q- o% E6 g( |  N+ j
  36. #include <mach/memory.h>! k# `8 X+ {7 ^$ u
  37. #include <mach/hardware.h>/ }5 j, X) a6 ?6 P# ]
  38. #include <mach/irqs.h>
    9 g8 s8 q7 O. V3 B8 t- y4 [+ ^
  39. #include <asm/hardware/edma.h>
    5 j( l  M! R8 p  d; o2 k% l- l" o
  40. 2 ?2 H7 k& r* ?  A% {% g
  41. #undef EDMA3_DEBUG& o! I! r/ m3 t, G
  42. /*#define EDMA3_DEBUG*/
    - q; h9 A; m$ ~

  43. 8 y: n1 }$ p4 g/ W6 Q1 u1 F+ l, e
  44. #ifdef EDMA3_DEBUG
    # I* A! o! a9 r7 u' ~; A5 O1 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# y; Y# k) O' W1 B; i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * P/ _9 R4 C! W3 L, B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ `4 l" k' L9 p* f6 G- [
  48. #else4 x$ _3 T; ~# }2 u. m  j
  49. #define DMA_PRINTK( x... )
    , H; l3 F2 |8 `  q
  50. #define DMA_FN_IN
    , N6 {4 I, R( B( m0 u+ x
  51. #define DMA_FN_OUT/ A) X2 J, }" O% U+ v. P
  52. #endif
    9 s  V/ d3 Z; `! U" p

  53. 3 o) z1 o7 P  u- `1 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 h9 K. A& f6 {! A
  55. #define STATIC_SHIFT                3
    9 N4 a1 k  i; Q1 R  |! W4 Q( B
  56. #define TCINTEN_SHIFT               201 S+ O  g+ [! t7 M* l
  57. #define ITCINTEN_SHIFT              218 A  H3 ]& p5 X' Q, W# H
  58. #define TCCHEN_SHIFT                22( Q& P0 M2 a5 C* ~
  59. #define ITCCHEN_SHIFT               23
    ( b% I+ S* K" X/ G" a+ e; l! h& ~0 A
  60. , ?  {$ C. h* u8 V" a3 \/ k8 N
  61. static volatile int irqraised1 = 0;
    5 F# s- [7 N/ G! u9 n+ d  G
  62. static volatile int irqraised2 = 0;
    7 i8 m9 U1 _3 ^- ?' ?( U

  63. + H( p6 C! |9 f; }/ v9 V% d$ p8 O- U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* ^$ ^" ^1 d4 O! n) L# D1 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' Q2 n/ O( H+ H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 @, ]: z5 D( u) D

  67. 8 D2 A' C2 C$ B+ U7 |
  68. dma_addr_t dmaphyssrc1 = 0;
    # G* N0 `# V0 }4 \  ^
  69. dma_addr_t dmaphyssrc2 = 0;
    7 D6 V( i5 O" U+ \. [) W' u/ `
  70. dma_addr_t dmaphysdest1 = 0;
    1 W/ m3 \- [5 ~+ h1 @
  71. dma_addr_t dmaphysdest2 = 0;
    ) I8 p3 g& t$ A, G& B" ]

  72. ' I' F& ~6 H# u9 Q) t
  73. char *dmabufsrc1 = NULL;" i( Q5 e% l9 T1 ^
  74. char *dmabufsrc2 = NULL;
    , ^9 u: {% L0 K
  75. char *dmabufdest1 = NULL;
    6 _, L, G  k) E! J
  76. char *dmabufdest2 = NULL;
    & Y  H! e( N4 Z# R# j1 b+ ?! U

  77. ) `3 _+ q% ^4 L! v: l
  78. static int acnt = 512;
    ' b! H+ z3 a8 r& w$ X
  79. static int bcnt = 8;4 g# Z$ ^8 O$ ~2 ]( q# _4 G# J
  80. static int ccnt = 8;! O4 G1 _/ ?9 d4 t
  81. ' ]8 [. B4 D6 q/ x! M3 ]
  82. module_param(acnt, int, S_IRUGO);
    ) n& ~2 L; J, g& i
  83. module_param(bcnt, int, S_IRUGO);/ g$ D0 M6 g  h* r* H7 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ D# u# |; M) @- G8 a0 b) v4 V% m$ m& P) H5 ?( z* M( t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 b- m4 b1 g- q6 h2 v; Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 l9 S! \6 R- [' T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 {: |, A- w) |( ]- p0 K; X) x) `
. Y4 Y3 l1 {$ C( m% p; Q3 e

( O; w+ ~9 ]( I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-22 15:48 , Processed in 0.040456 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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