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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " o% h8 m3 P. I9 H# ~! P
  1. [code]EDMA sample test application
    & b9 d2 W2 e# _3 L7 X8 }
  2. /*
    8 E% z, Q% ?( ]  d" n$ N" {
  3. * edma_test.c/ M3 I* D, C* ~3 o
  4. *
    1 T+ z5 v$ b. U" x
  5. * brief  EDMA3 Test Application
    & {! [. |' _- C$ ?0 m
  6. *
    ( k% A. H# d" j* C" [/ `
  7. *   This file contains EDMA3 Test code.3 W: w' C4 g6 m7 j* m4 M: b
  8. *
    6 h' U$ w! G* A+ ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! n+ F, Y* s1 Q4 |+ a/ w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# V, h& A4 Y9 w* u
  11. *         TO CHANGE.% N8 X7 K( @) _3 B- l- _3 ?1 u
  12. *
    4 Z/ ~( L2 l9 M' z' g- l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 a- D0 m9 p' f0 Q% v
  14. *, V. i! W8 }# _  \* u
  15. * This program is free software; you can redistribute it and/or- l& h4 I& T( n' k3 P& o
  16. * modify it under the terms of the GNU General Public License as
    % J, G* z; Q; u1 @7 A
  17. * published by the Free Software Foundation version 2.$ S' y8 \- b8 l9 X
  18. *( z. P3 m, g, ?! \8 ^. c! T4 [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * \: G) b+ N8 l; p
  20. * kind, whether express or implied; without even the implied warranty
    ( P. o! |' i% Z7 w, @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 C& a2 L, o( J, o% v
  22. * GNU General Public License for more details.$ Q6 `$ T/ E0 z2 ~: w6 A# h
  23. */
    9 Q" z& K8 ?+ y6 v+ Z

  24.   v5 k& e/ C. y+ a4 k9 V4 j
  25. #include <linux/module.h>
    2 r& v5 t" r( I9 y& Z
  26. #include <linux/init.h>
    % b) }; \- O- Q! _! R
  27. #include <linux/errno.h>
    3 e: ?+ Z; x1 _! L8 ~" o
  28. #include <linux/types.h>
    1 O+ h4 l! p0 K1 v" H
  29. #include <linux/interrupt.h>
    , L% Z$ t( L7 P" {
  30. #include <asm/io.h>( d- O+ ]& |& s1 N
  31. #include <linux/moduleparam.h>
    6 S% v+ S8 j# L
  32. #include <linux/sysctl.h>: _# h4 u: I" g
  33. #include <linux/mm.h>
    / H6 n" y' `( [# c# y
  34. #include <linux/dma-mapping.h>
    % B; w, r1 u7 J
  35. 0 }! W3 {( z+ G: @# P: G9 M: L: m
  36. #include <mach/memory.h>
    / @' e6 T6 i' T9 w
  37. #include <mach/hardware.h>
    # d4 A) {5 b4 h6 m
  38. #include <mach/irqs.h>- s$ Y* @6 I! X8 C
  39. #include <asm/hardware/edma.h>
    - C6 |" V3 e1 u- r; `6 X4 M
  40. - @+ i5 ?7 z7 u8 B8 D# _( t
  41. #undef EDMA3_DEBUG, }5 P- y7 n# S' z
  42. /*#define EDMA3_DEBUG*/
    8 a6 f$ N  P4 s- Q  H
  43. ' b2 V; x: \% R, i! {; R" \' B
  44. #ifdef EDMA3_DEBUG) V+ |/ ^6 Z1 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ N5 P( O  Z8 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ f1 i- F' b: q( d& o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! f: s. B% E1 Q/ R1 K8 T6 q
  48. #else' f& W) d# h2 l+ s7 K7 `
  49. #define DMA_PRINTK( x... )
    $ J' B+ W" I. R$ t) ]
  50. #define DMA_FN_IN
    : J- Q( d( C% w) H9 j# Q# v8 ?) a
  51. #define DMA_FN_OUT
    # n! A. L1 K6 p% j- j8 \9 ~
  52. #endif1 @  w7 m6 y" Y2 P; C

  53. , f- Z" q3 ^$ r' w- K& `* k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ V/ R; {2 ]; O9 t6 m
  55. #define STATIC_SHIFT                3
    * j8 e: D2 i( d/ `: p
  56. #define TCINTEN_SHIFT               209 p/ \" u1 s( i) w6 x% s
  57. #define ITCINTEN_SHIFT              21
    * u. o# D; n. i8 \
  58. #define TCCHEN_SHIFT                22
    # p; ?& n# ]5 k7 w* g$ _
  59. #define ITCCHEN_SHIFT               23
    & y' y' ~: `( c3 I: h

  60. % v3 r0 [9 K; D; F9 S
  61. static volatile int irqraised1 = 0;: \* B) t# A! v) Z% V0 U8 x
  62. static volatile int irqraised2 = 0;9 k2 `' u# M' V# w1 g

  63. 3 ~4 I* T; e' f, p! T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& q, {% u8 G( i- C( J; K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 Q' W! l; }$ M" j# C" c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  Z. h$ m* P) P, J5 M
  67. 1 N+ o* x7 p5 e, O  O
  68. dma_addr_t dmaphyssrc1 = 0;3 A4 t+ `  r- R# L: x
  69. dma_addr_t dmaphyssrc2 = 0;
    : A0 A4 X- k+ H( Q! i
  70. dma_addr_t dmaphysdest1 = 0;* a, f, M0 Y) i5 U8 J
  71. dma_addr_t dmaphysdest2 = 0;
    6 s: h7 x0 t0 c) g1 D. A! Z

  72. ) j$ g0 r8 x9 [/ E
  73. char *dmabufsrc1 = NULL;
    7 j2 V0 \: I: ~2 _
  74. char *dmabufsrc2 = NULL;
    % i/ h/ t1 \5 }; y+ w; e
  75. char *dmabufdest1 = NULL;
    4 B# }/ J7 t) ~5 o
  76. char *dmabufdest2 = NULL;
    * }& K: n( |% n

  77. : q8 W6 O" H; T6 m" G4 L( l
  78. static int acnt = 512;& E5 w8 h' L4 O6 L7 C
  79. static int bcnt = 8;
      `% ~- j' P( v& {" X
  80. static int ccnt = 8;
    ! b' v% B  ?9 R/ R+ }1 d2 |2 Z( r

  81. 9 n% w$ o7 |" R8 {0 _
  82. module_param(acnt, int, S_IRUGO);
    . F$ W$ {0 v# |% F0 e/ p3 g/ _
  83. module_param(bcnt, int, S_IRUGO);2 p( d4 j( W6 e$ a. C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( O$ r- X! m" G" R4 ]; a* E: I9 `, ?0 _; G* y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 C$ O/ F5 u. Z, Z3 rarm-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 W% Q: s. j& C: z3 _, h) C; L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 j* p- s# a$ s. F5 ^
% \7 B6 U! V) c3 y: ^- R* h; I) g+ p3 G4 g; l1 Z, M1 n( m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 02:26 , Processed in 0.038745 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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