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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! z! ?( ?/ Z( m! |7 E3 X
  1. [code]EDMA sample test application
    3 e2 _% i. n  D5 m6 r' V$ ]
  2. /*) x$ H8 ?' ]) Q6 e& O' h
  3. * edma_test.c
    + |' l" j* G5 W0 w) y0 X! J; N
  4. *- T8 `; _" e/ w0 @
  5. * brief  EDMA3 Test Application
    # ^, L" W: X0 a! e8 O0 u1 V- }% v
  6. *
    1 o- g+ Q6 X4 {7 q5 x9 U0 F6 K+ r
  7. *   This file contains EDMA3 Test code.4 d) ~# p/ U) T( F
  8. */ E1 ^; Z" C1 ~% @7 H- {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' ]5 h3 t" B" s2 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( u$ M( x+ h2 k
  11. *         TO CHANGE.
    6 e$ m/ h# l0 b7 [  m; C5 N5 s
  12. *
    ! X7 u8 b  E# H9 D8 Q! R( z3 R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 c9 O( G, T# s
  14. *
    6 r: i( ?. A) i- ^! X' {1 K/ ?
  15. * This program is free software; you can redistribute it and/or# b* U) Y$ ~; ?9 ^: V
  16. * modify it under the terms of the GNU General Public License as
      a0 h# g8 |5 Z7 a% y8 t
  17. * published by the Free Software Foundation version 2.( j& [, t& t) B+ [1 S
  18. *& R- y' M; m3 @9 `$ o7 o" \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# S( ~* s8 s5 a% q& V& \* v$ d( }
  20. * kind, whether express or implied; without even the implied warranty
    ) R. F- l8 B& L3 j. Y/ m4 b! u8 F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* }# d0 ]" ~$ R2 L0 i4 ~
  22. * GNU General Public License for more details.
    ( p, U+ x$ K7 _( C7 m4 u- e$ h
  23. */
    5 v; ^& Z" [' E1 ^

  24. " r( Z9 ^5 }% L8 G/ M
  25. #include <linux/module.h>
    ( t+ k2 y$ T& M, g0 c6 E; |
  26. #include <linux/init.h>& U1 p+ \6 W" n+ S
  27. #include <linux/errno.h>6 q- Z" ^* F8 J. R. [8 h0 o
  28. #include <linux/types.h>! V6 ]2 t: p4 S0 q
  29. #include <linux/interrupt.h>4 @+ @, r) |7 [
  30. #include <asm/io.h>4 ]6 t0 N& B$ g( a' @" C
  31. #include <linux/moduleparam.h>
      z1 B; N, K4 k/ c
  32. #include <linux/sysctl.h>
    1 P$ Z6 w* x! u. k- l2 G/ _& z
  33. #include <linux/mm.h>
    : y2 E5 P1 y  t$ a6 }/ ]7 z: c
  34. #include <linux/dma-mapping.h>% _$ F3 d7 e4 z
  35. . v% ]- B7 ^3 j; J+ \* F5 _
  36. #include <mach/memory.h>* @) _6 s/ h5 V, |5 }4 o
  37. #include <mach/hardware.h>% ^5 m' Z$ x3 F7 n4 ]8 u; y+ B5 A
  38. #include <mach/irqs.h>
    9 p0 C% n' U% Z! H  T+ Z
  39. #include <asm/hardware/edma.h>
    ; s, ?: s# s' j9 J* V* H. b
  40. ; ?; S. E- b& i/ k3 _% [
  41. #undef EDMA3_DEBUG
    ) v9 L. m$ q" G# J1 E
  42. /*#define EDMA3_DEBUG*/) }+ O2 V+ }+ `/ u5 q

  43. / U0 C& S0 d% u% b" R
  44. #ifdef EDMA3_DEBUG7 n" D+ l' l' q% f7 c8 d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! S: |" ]/ c5 b& V3 D7 S4 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" R8 {1 y1 u+ Q* r' F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : O* U) }0 [. v# x4 O
  48. #else' m: k: Z) R+ [+ P' |5 R
  49. #define DMA_PRINTK( x... )
    8 h; a: A- t/ v. ^$ ^# g; h
  50. #define DMA_FN_IN9 ^! M2 M$ _- a5 j' Q" d' \3 e7 t
  51. #define DMA_FN_OUT
    3 T8 e5 h4 g( U) i; Z% G
  52. #endif
    " B  G' k/ |- j5 G0 v7 }

  53. 0 J2 P/ }" R4 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) ?9 z$ U& m9 k# b0 f2 U" K
  55. #define STATIC_SHIFT                3
    ' [/ H3 H$ Z3 ^& E% N$ u
  56. #define TCINTEN_SHIFT               20
    9 i+ h8 h( j6 V
  57. #define ITCINTEN_SHIFT              21/ t- y; @7 _; i/ ~
  58. #define TCCHEN_SHIFT                22; q" A2 l$ a& [! h' i
  59. #define ITCCHEN_SHIFT               23
    / Y* C  ]. s" I( O1 z

  60. + e- P* L% ~) e
  61. static volatile int irqraised1 = 0;
    & C3 D0 i# l* G& D% r
  62. static volatile int irqraised2 = 0;
    & U, O3 t% d6 ~( J

  63. 4 o2 {* h" X6 Y# ?/ `5 B# U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' ^3 d8 r- j1 F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 s/ O8 U! q; U' z2 R3 L$ X) f; e7 V- X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) @" Z7 W6 b# Y5 ~2 s

  67. : g( i, t4 `- ~& b; {! {# y" P* s1 p
  68. dma_addr_t dmaphyssrc1 = 0;2 h5 S2 r$ V- X% M7 l- L
  69. dma_addr_t dmaphyssrc2 = 0;& U- f0 ^: `% X) O2 p. N: y  |; I
  70. dma_addr_t dmaphysdest1 = 0;( N' E+ H$ }" j
  71. dma_addr_t dmaphysdest2 = 0;0 ^7 R& e8 c- h5 e6 L
  72. + _  X- P) J. w6 ?% E
  73. char *dmabufsrc1 = NULL;
      Q+ E, l' W, F2 j6 ?
  74. char *dmabufsrc2 = NULL;
    : K" g8 }! r6 K: T
  75. char *dmabufdest1 = NULL;
    , v. w7 ]" W5 ^8 l; |
  76. char *dmabufdest2 = NULL;9 G! C8 f6 }( A( @9 _6 x  l
  77. 9 @  ?" R- c# M) w- ]/ u) F
  78. static int acnt = 512;
    7 [+ i' x% l. i8 x+ u. }
  79. static int bcnt = 8;
    3 C& @+ h0 l4 Y& F) c9 a, q
  80. static int ccnt = 8;
    * U: B" M- L. g; J! `4 F

  81. & d6 z9 n. C, B$ U3 B' r
  82. module_param(acnt, int, S_IRUGO);6 F/ [' `6 y- d1 u% h1 v5 S; k! n
  83. module_param(bcnt, int, S_IRUGO);
    " {5 I6 k/ q- @8 V; I9 n* R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# f5 a+ `: J* [1 A( V! q4 h$ _* ~/ ?4 e/ o! e: r1 K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' z- Y( h" S' Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 R( v" N$ x  }5 @. O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 g. j) V0 z9 ^$ }5 z3 J5 A8 |0 `$ y. K/ Z! b( g5 R! a  U
8 j+ [% R7 e% j$ t* d0 @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-2 15:58 , Processed in 0.039036 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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