OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 f" s. H- u0 x" ]( c
  1. [code]EDMA sample test application7 a$ K+ S. \! o- u3 M  a' B; h8 U
  2. /*4 ~% _, D& I+ x5 F0 m) b  _
  3. * edma_test.c
    6 A# A" {! j& {: T- f/ y+ H6 U& F
  4. *: U& w. \+ ~  C# v( R/ V) L. V0 m. d
  5. * brief  EDMA3 Test Application7 r: t2 u: {! [% v
  6. *0 e. {) j1 q* R2 G; E5 g$ A
  7. *   This file contains EDMA3 Test code.3 q/ P4 Q# s: D, ~9 t4 q! I( f/ O- h
  8. *
      @! ]2 n" H: N- T3 u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 ]. C9 S) r) ^2 |3 q3 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 Z4 t: ?& q4 q+ M# w. G
  11. *         TO CHANGE.' @0 r2 F" B# ~
  12. *% F+ g! v" Z) z7 x$ x, T. m+ p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 h& O: g- }% c* U- a
  14. ** u4 q! `1 N' |  O" ^( p% r3 g
  15. * This program is free software; you can redistribute it and/or
    ) Q2 @( i  S5 t, o
  16. * modify it under the terms of the GNU General Public License as
    7 L& Q/ R3 p: a9 s' p
  17. * published by the Free Software Foundation version 2.3 F; i" e+ C$ \8 L  F4 y
  18. *, w( J# h4 Y( K' F9 c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! U& E) a8 b. l) B/ W6 o4 x1 }
  20. * kind, whether express or implied; without even the implied warranty! _: \% d' Q: C9 C1 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( N9 L" I" @3 E' |7 n
  22. * GNU General Public License for more details.
    ' D: i8 |( B3 x
  23. */
    / q. E& Q! A6 \, E
  24. + E1 a0 T7 R3 s: i+ N) x( o  j
  25. #include <linux/module.h>: D% M7 c2 p5 J$ r: C
  26. #include <linux/init.h>
    7 o) D/ u+ p) k) P; H9 n
  27. #include <linux/errno.h>
    & |' i2 m! W3 `* X* ~) f
  28. #include <linux/types.h>
    5 K( p; [) i( q3 x7 s
  29. #include <linux/interrupt.h>) p: G! S3 r) u( D4 R( a$ e
  30. #include <asm/io.h>
    4 t4 A5 R/ a. |. X- E
  31. #include <linux/moduleparam.h>
    5 ~( L$ P& R/ R7 U0 ?$ u1 j8 {4 k* {; l
  32. #include <linux/sysctl.h>
    + o" s' p1 r5 P3 W& h+ S
  33. #include <linux/mm.h>" A+ J- z  F2 S$ w
  34. #include <linux/dma-mapping.h>' l2 ~; f# O' U+ n; w/ f) N
  35. / ~8 Y! @& Y8 i& B1 N
  36. #include <mach/memory.h>: v1 @7 w5 g' q* Y
  37. #include <mach/hardware.h>" I+ b  g' @, f. p, s& p% V1 b
  38. #include <mach/irqs.h>
    0 J+ G. S4 `. |, p- @$ }
  39. #include <asm/hardware/edma.h>
    ; D$ j6 k! u  \) v' y$ S

  40. $ w7 [& Z; q9 |' u6 v/ i" W! `  k
  41. #undef EDMA3_DEBUG
    ; a  a: u* J0 M4 f# F5 g2 r% \
  42. /*#define EDMA3_DEBUG*/8 R2 Y8 b/ D& Q- e# G1 {: i
  43. # Q+ L, M* y( _8 ^' u9 l
  44. #ifdef EDMA3_DEBUG2 G) K# q/ p: ]5 _: Q  \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ V4 U' r1 Y$ A( H' m1 O# k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      ~9 a& f  ^' u7 `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  F6 }) R# N; q0 o
  48. #else
    5 Z% b/ p$ e& c
  49. #define DMA_PRINTK( x... ). A2 C& M9 t% b' z6 Z; I
  50. #define DMA_FN_IN
    0 y3 m- q2 u/ P; @0 m+ H
  51. #define DMA_FN_OUT, `* C+ \4 D, O( c+ Y+ Y5 @" H
  52. #endif3 F4 t; e; y, t8 P  S9 h$ s

  53. . F$ g1 Q3 R8 R" ?8 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" h7 q3 d9 u, h% Z: `
  55. #define STATIC_SHIFT                3% u# n) G: w. v1 V8 `) ~8 `
  56. #define TCINTEN_SHIFT               20
    0 o9 l* ?1 ?5 W2 p6 K/ }
  57. #define ITCINTEN_SHIFT              21
    ) G" W, T( j( x2 z7 x3 a& {
  58. #define TCCHEN_SHIFT                22/ k* j! M0 D8 \7 r1 K
  59. #define ITCCHEN_SHIFT               23& V3 i2 J+ N$ Q% g% u

  60. . d- z/ `: i, E! R; S
  61. static volatile int irqraised1 = 0;
    9 p6 {2 u2 |. ~; Y, \
  62. static volatile int irqraised2 = 0;
    $ v) q" N# H7 m5 l0 `( p2 `

  63. / X% `9 m; _2 m1 S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( ~3 c' b1 V& o+ w- _. f' {0 ~0 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * Y' h0 X. h: m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) m  J0 u9 A$ ~: z6 a/ k8 v  T9 t& h

  67. . E7 F; M$ `( [4 r: F: w
  68. dma_addr_t dmaphyssrc1 = 0;6 E) j& a" J5 f7 q6 _6 q
  69. dma_addr_t dmaphyssrc2 = 0;
    3 t6 |, @( w9 S+ e* E% r' [$ w, c
  70. dma_addr_t dmaphysdest1 = 0;: U/ u- n/ Z9 ~' T# I
  71. dma_addr_t dmaphysdest2 = 0;
    & E0 Z/ ~; ^) A) m' \

  72. / t2 j( G/ g1 z- s4 k$ O7 `' I3 E
  73. char *dmabufsrc1 = NULL;4 f( u2 [; s9 ?
  74. char *dmabufsrc2 = NULL;
    " b: X8 }# m* r- ?( W  @
  75. char *dmabufdest1 = NULL;# a7 [; D/ t! g% ~( C- H
  76. char *dmabufdest2 = NULL;: X5 F# b8 B5 g, Y1 S
  77. ! x) W. g0 X) h+ J3 P$ a+ A5 J
  78. static int acnt = 512;
    1 ?4 J: z* s3 P7 o& v
  79. static int bcnt = 8;# |4 K6 w7 x8 X2 s
  80. static int ccnt = 8;
    8 X7 l6 w& ]1 i& s* s1 i; C

  81. 6 f6 |/ v6 |% b% L
  82. module_param(acnt, int, S_IRUGO);  a' j/ k& w* O% p
  83. module_param(bcnt, int, S_IRUGO);# }; [" T% K: `* Z9 |
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ I; @- W7 O6 M$ V5 A) j. [
+ `3 }- K& y$ e# G: L; k  F+ V6 u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 l2 Q1 o- j; U3 G% t" D  l$ N# o
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 F& K( k* o8 l( i  M  k4 h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 U5 b! O+ G/ Q2 e7 J% J

7 d. W+ ]5 u0 n. q8 ~% I7 I, y, P6 }* H1 j0 P) M5 P- j! x. f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-28 19:09 , Processed in 0.035375 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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