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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- g" s3 X4 g3 e) k
  1. [code]EDMA sample test application
    $ U) ~: ]" d" G, h
  2. /*
    # A) u+ q: x9 [4 B
  3. * edma_test.c, P: g& w2 H# `/ |' A  B* ~
  4. *
    0 j7 s; d& {" X0 H1 ?) B, E
  5. * brief  EDMA3 Test Application
    + q1 y6 x, m+ ]
  6. *
    7 P+ ~0 O( l+ C
  7. *   This file contains EDMA3 Test code.8 s5 g5 Z8 Z+ E8 X$ [
  8. *2 J* z9 H& P( c) N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 ~( n5 J& l9 H' X+ ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ S' Z+ ?3 U# b1 n) A4 I
  11. *         TO CHANGE.2 `8 Y- N7 O% @# Q" v2 B
  12. *
    3 h3 o6 B$ i4 a; v, ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / w$ C& l' b$ @
  14. */ M, U9 z: m7 [0 @# \
  15. * This program is free software; you can redistribute it and/or
    9 v$ H4 @& d- r7 e9 V5 u$ [# C
  16. * modify it under the terms of the GNU General Public License as! t* C( F+ I! w3 y9 T: r. L
  17. * published by the Free Software Foundation version 2.1 f* S( {, ^! V' a$ `
  18. *
    - r: P1 a* R2 n& W# E! O: G$ T9 z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ _0 ?5 m  @8 n; f
  20. * kind, whether express or implied; without even the implied warranty$ ?! `- {6 N. ]9 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. m9 X" {4 j* S: F( }
  22. * GNU General Public License for more details.
    * {6 M" U/ W- P  j4 r
  23. */
    1 ?1 g  ]/ @: F3 u+ `

  24. 4 z8 v) R/ M0 t) c! `5 J
  25. #include <linux/module.h>% r6 M3 z$ J% E/ r5 V5 D, i
  26. #include <linux/init.h>
    - H: T" f9 S4 x+ o1 S* Z
  27. #include <linux/errno.h>/ t$ _2 G& H% J
  28. #include <linux/types.h>
    8 X* D3 @) ~8 n! L' z
  29. #include <linux/interrupt.h>" l1 n7 z# i% s
  30. #include <asm/io.h>1 E& q( J9 J% |4 e% x
  31. #include <linux/moduleparam.h>! ~: F9 x$ N: W- m1 X) s6 n/ {% i
  32. #include <linux/sysctl.h>
    6 B8 h* p3 Y; l. h1 z' C0 b
  33. #include <linux/mm.h>" m  m" i' X+ i5 K. m/ j' a
  34. #include <linux/dma-mapping.h>
    * q. k) P* x, N. `: ~

  35. & P, S0 `8 \! S7 q6 d
  36. #include <mach/memory.h>
    $ r5 Z2 B0 c: D9 a1 v6 g( U0 p
  37. #include <mach/hardware.h>
    ( ~* V: E( w6 w% e! b. y
  38. #include <mach/irqs.h>
      O. A1 I2 F0 C+ K! k' M$ m' i1 |
  39. #include <asm/hardware/edma.h>
    $ A0 F% Z0 a# S9 \3 t7 l0 p
  40. , A( `% j9 A8 x
  41. #undef EDMA3_DEBUG
    6 _1 m) U. ]% F3 B* Y1 A
  42. /*#define EDMA3_DEBUG*/
    7 O5 ]4 V: D# k
  43. 3 C; W, t& [1 U9 `" ^
  44. #ifdef EDMA3_DEBUG( R8 k, ]5 n5 q4 ^$ o- u- T% R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . h$ i7 u3 E9 z- s/ N+ A, L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- `$ a: Z, N( z+ M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # |# h' g( j& E( c* P! Z+ x2 X0 I5 l, {
  48. #else
    , \" I% S4 ^4 Q* }6 C; O
  49. #define DMA_PRINTK( x... )
    7 i* h! H8 U1 A3 I# `
  50. #define DMA_FN_IN) [8 }$ A. Q3 H5 x" B& y
  51. #define DMA_FN_OUT9 z7 p/ q, N" ~4 f
  52. #endif
    5 W& a0 _1 g; C

  53. 8 C" o! F4 X; s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 T: H0 f3 N, T4 {4 i2 O
  55. #define STATIC_SHIFT                3
    / k3 O+ y! Z" z+ B' R+ l1 f
  56. #define TCINTEN_SHIFT               20% ~: ~1 y- p7 l8 I0 m" h  b0 a( a
  57. #define ITCINTEN_SHIFT              217 q, @' }1 e9 N* B* Y  N# o
  58. #define TCCHEN_SHIFT                22
    & e$ k0 R1 a7 C  c
  59. #define ITCCHEN_SHIFT               23
    2 x) Z  @  y- T; C7 n0 z8 t

  60. " L) U) L" F' K9 `! m
  61. static volatile int irqraised1 = 0;
    " b& J" `1 R: M( @
  62. static volatile int irqraised2 = 0;
    * m8 v0 B+ Y9 n; X( I

  63. " H. P8 j4 |# Y  Z* w6 I9 z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; D! `" i, [5 c# E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ K7 I/ W$ I& M5 S, k* ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" D6 `: U8 m4 {- B) A+ @( v9 W" x/ q

  67.   u7 Q  I& n! f2 ~
  68. dma_addr_t dmaphyssrc1 = 0;/ [3 n4 g) ~& r- E1 ?( y2 b4 [
  69. dma_addr_t dmaphyssrc2 = 0;! o9 b/ y$ O, }7 t: ^
  70. dma_addr_t dmaphysdest1 = 0;6 A6 f, k+ j, U" g, J( S8 j
  71. dma_addr_t dmaphysdest2 = 0;
    . z+ e+ v2 E7 m9 M; |
  72.   I* Q; |* Z% }. C% B0 ^( |, q2 @, P
  73. char *dmabufsrc1 = NULL;6 N  D: a1 D. ?% E! e
  74. char *dmabufsrc2 = NULL;" g0 i9 O6 ]" z! o7 `/ W
  75. char *dmabufdest1 = NULL;
    & M0 `# a- [% L3 }' u* u& B
  76. char *dmabufdest2 = NULL;
    $ }+ B9 I: T7 C+ B
  77. , O6 n/ m/ V1 W$ H3 R$ h
  78. static int acnt = 512;
    : P2 k" q8 L' `: ^
  79. static int bcnt = 8;/ J% w8 h& I$ [) g
  80. static int ccnt = 8;$ \5 J/ C9 B# V8 k5 X
  81. $ c3 ?4 O* d4 W
  82. module_param(acnt, int, S_IRUGO);
    ) @  g! P( O2 h2 S$ y2 J0 x
  83. module_param(bcnt, int, S_IRUGO);
      U* G1 `5 t4 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( j" N$ u$ X3 ?+ K9 O
( |, N. u. |0 b9 w1 u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 |1 S: h2 k/ E3 C; Z2 @- d9 H. iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ F( v4 Q3 F- K9 ~8 h2 A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  s4 D, ?& [9 x6 n+ K+ }# V8 Y

4 `  U" E, ~- N7 u* J
  ~7 e6 Z4 w5 ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-13 09:20 , Processed in 0.048478 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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