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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 K/ l* p0 q$ y1 U" e
  1. [code]EDMA sample test application
    0 ^) e+ W: c. h
  2. /*+ u" B$ Y) w5 s5 ~; t
  3. * edma_test.c0 \( N5 _# p6 c
  4. *
    $ K& ?( P0 g) H+ g7 q0 `
  5. * brief  EDMA3 Test Application) }* [& d0 Z0 ]: N7 k
  6. *' l7 U* t/ Q: S; G
  7. *   This file contains EDMA3 Test code.
    $ e; W' {# I+ N2 S" Z
  8. *
    ( `6 n5 k6 q2 F; P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, w, w1 E) m+ U; e6 H% b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 V/ j; Y: u; ]) [# P
  11. *         TO CHANGE.' Z, y  g$ z. c3 J/ L0 q- `
  12. ** d6 h. r9 m1 O3 X+ G- v5 ~9 _  j5 r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// \1 t8 L& v! M" O) O9 A+ Y5 p- h
  14. *
    ) b- G+ Y# H( f3 U) W' M4 P
  15. * This program is free software; you can redistribute it and/or
    ' R$ C8 _, i: \% x. Y5 K/ Z
  16. * modify it under the terms of the GNU General Public License as
    9 C7 Y8 C8 g. ^* {
  17. * published by the Free Software Foundation version 2.
    . D2 S4 r# {$ f9 @
  18. *0 m3 S3 I( {: k$ H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + v3 _/ ~6 A  I& r2 h. a, n
  20. * kind, whether express or implied; without even the implied warranty
    % U7 K. q' e+ ^' J6 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , e( @( n$ D1 K! [/ l
  22. * GNU General Public License for more details.+ H6 c1 R- D3 n5 D* S( K
  23. */7 ]3 a1 k2 \! X8 N) O7 Q

  24. ( }8 {' f! C8 B2 }; ^
  25. #include <linux/module.h>7 V1 i( o% F( v0 o9 c1 A1 b! S3 D
  26. #include <linux/init.h>
    1 _7 U, g4 `& Q/ M: v4 ~: O
  27. #include <linux/errno.h>
    & ~6 I- I( d  N( V
  28. #include <linux/types.h>/ ]. I. e/ p: T& }. `' D' O
  29. #include <linux/interrupt.h>$ E" [6 W7 V5 E. I1 e
  30. #include <asm/io.h>; r' f0 H2 k& B; b% b' J; t' [1 G
  31. #include <linux/moduleparam.h>, Q! H& M, V+ k
  32. #include <linux/sysctl.h>- R/ o# P8 H. w% ?' D! C
  33. #include <linux/mm.h>
    ) T1 a  ~  R. y* N: C- k  S) J
  34. #include <linux/dma-mapping.h>
    7 O! x: F1 _! B, S0 ?7 P5 R

  35. " I$ a$ g9 o, h  g
  36. #include <mach/memory.h>5 s2 d) d9 ^4 G6 [- A, |+ {+ I
  37. #include <mach/hardware.h>. K+ [6 q" o8 c0 s6 n
  38. #include <mach/irqs.h>
    # h  H6 S3 [5 ~: v
  39. #include <asm/hardware/edma.h>
    & U; y. ~+ G* S. U. @2 T( j$ H

  40. & S, Z  T! F; l
  41. #undef EDMA3_DEBUG5 n9 S/ a  a2 ]* ]# a6 M; u
  42. /*#define EDMA3_DEBUG*/' f! a' D$ q  |8 e- u# j3 @" m' q

  43. ( [  _( s  G( b( ^/ W+ P# e
  44. #ifdef EDMA3_DEBUG0 [9 \  C; H" q3 L6 s1 P0 E! @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , j: |7 }4 u4 \8 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 Z* t2 u0 z4 d8 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , `/ Z3 Z* q4 e
  48. #else
    * f% O4 x& n: s0 q/ A7 i2 ]
  49. #define DMA_PRINTK( x... )! ]1 R  L. |% k2 [0 V* h6 A
  50. #define DMA_FN_IN
      C9 F; x7 y, M
  51. #define DMA_FN_OUT
    ( U2 j( f! j, W& B2 V
  52. #endif. z9 r7 U6 l! P7 R1 w' y

  53. $ E( p( i" @. J8 J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! O0 e$ ~4 s% K
  55. #define STATIC_SHIFT                3. H1 N6 m3 X0 ^  H8 ^* G
  56. #define TCINTEN_SHIFT               20! ~/ A# K$ ]% F8 j/ X" ]: c. G
  57. #define ITCINTEN_SHIFT              21
    . ~- |5 U/ L1 m- D9 t5 N/ d' ]
  58. #define TCCHEN_SHIFT                22
    + u" R) F  t  l! p0 D
  59. #define ITCCHEN_SHIFT               23) ~3 \4 ]- s" [

  60. : T  ^+ u, [( @( }: R1 O/ `1 |
  61. static volatile int irqraised1 = 0;
      _6 p# i4 y9 ~
  62. static volatile int irqraised2 = 0;1 w1 f! K: K) x, H$ X% B

  63. # i' u% R  c' _0 l  Y( q9 K8 f  Z+ I1 X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 m1 h/ f; o1 Y* A1 X9 ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' A' B5 X. \6 P& Z# N, W* V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 j  J" @/ N6 J1 z/ T9 M
  67. , e% u. S4 ]) Y- ]
  68. dma_addr_t dmaphyssrc1 = 0;' I: [7 W( u& A+ n4 E: p% B* _
  69. dma_addr_t dmaphyssrc2 = 0;
    $ _# G; P7 n: p8 K  a) a: f) a
  70. dma_addr_t dmaphysdest1 = 0;
    % \0 j! M  {' y) y! G) g( |2 l
  71. dma_addr_t dmaphysdest2 = 0;8 ?2 O/ b6 m3 W8 L' L

  72. ) h6 V) T& K4 i: Z# G: ?7 @
  73. char *dmabufsrc1 = NULL;
      N" {$ z9 Y0 P; p$ y3 a  P; |. y
  74. char *dmabufsrc2 = NULL;
    0 ?) A! M+ p8 s% u4 c
  75. char *dmabufdest1 = NULL;
    6 I9 s8 [3 ~% b: d0 ]
  76. char *dmabufdest2 = NULL;/ V- r; U. k; i7 h
  77. 7 V" r6 t8 X: N# c
  78. static int acnt = 512;% G  a9 p9 E2 M
  79. static int bcnt = 8;# c, q8 ~/ ]' h. @
  80. static int ccnt = 8;) Q# U7 e" G- H' p) U& N! G# u1 d3 e
  81. ) w& M: A' ^$ z, z
  82. module_param(acnt, int, S_IRUGO);
    ; Z( k& |/ n6 I* d
  83. module_param(bcnt, int, S_IRUGO);
    # p4 \8 l; x! k; h+ A# W6 X
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 Y% k* y9 z' e6 c
  c" k* |" c; ]% M7 T( K/ Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. Z* C8 G  w& marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( Z: B/ ?1 D0 V. {6 w, X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& o: u  Q, a* x  f3 W! V) b
/ M% ~7 p+ b7 a  H1 d
( {: {, s! p; y0 z$ Z! Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 22:55 , Processed in 0.083285 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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