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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; D, c1 H, `( o' Q1 L: n
  1. [code]EDMA sample test application
    0 z/ r% _( i1 I& M$ u  }" q( ]$ z! }: a
  2. /*
    2 I" Y5 c, h. g( V, ~
  3. * edma_test.c
    7 b# o1 u+ e7 U  i  B6 m9 Y
  4. *
    ) Q9 c+ t) F- d* [( X4 K+ T) z+ \
  5. * brief  EDMA3 Test Application
    8 i6 p* a% u9 p& A
  6. *1 B# [: l0 c; ?
  7. *   This file contains EDMA3 Test code.$ M- G; {- H4 w+ h8 T6 H
  8. *+ h  j" c$ w) d6 P/ W1 \! l9 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' P; \- u* |, @8 Y/ F2 R1 n, n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 N. v3 u/ W# x3 D5 x
  11. *         TO CHANGE., E( P6 W  X0 b; H- ?* x4 w  p
  12. *
    # \" ^) ?! F* s5 e# X6 |  [  y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 M/ l0 Y' Z8 a2 A! R2 f$ |
  14. *
    + C$ w! P! a; Q7 e, W2 [$ v( n
  15. * This program is free software; you can redistribute it and/or
    0 P- T& D6 D$ ?& ]2 H
  16. * modify it under the terms of the GNU General Public License as( L+ B. u& c1 a* ?- F% K
  17. * published by the Free Software Foundation version 2.
    ; u) y3 e/ v8 D3 ~! X9 }  D
  18. *  b- ~* B- u2 V2 Y9 f1 l: r. S' S8 ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& Z: F" e3 ]7 Q0 H5 q
  20. * kind, whether express or implied; without even the implied warranty" `# Z: t+ G1 l4 J2 Y8 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 {3 z  x, O, E- K# b4 I. K* i
  22. * GNU General Public License for more details.9 o1 v2 C+ L. f$ r( s3 _& c9 m
  23. */
    . D! q; p' M2 ?5 _& A% i. k
  24. # a' ?' D* M+ a" r# A
  25. #include <linux/module.h>
    ( i6 Q& V1 `  s; @' ?7 `* s
  26. #include <linux/init.h>5 V1 o# ]/ Y1 b8 x3 g3 q
  27. #include <linux/errno.h>
    $ H4 X8 b; G5 e! v* {& A
  28. #include <linux/types.h>
    # r6 Z" ]7 v7 \. o  o! g
  29. #include <linux/interrupt.h>8 s( p4 r# D, d6 F
  30. #include <asm/io.h>
    % `+ k  {5 s& h: N+ d" y+ i
  31. #include <linux/moduleparam.h>
    % o* ^, `: L0 Q, n
  32. #include <linux/sysctl.h>
    ( k4 J1 ]& t, d( c! N- G# n
  33. #include <linux/mm.h>
    / J! u/ J6 i8 P: F4 w8 n
  34. #include <linux/dma-mapping.h>9 L; m0 Z$ J6 W& `+ F

  35. 1 U4 W% @" E& [* Q
  36. #include <mach/memory.h>
    + f' H7 Y0 E5 F7 R
  37. #include <mach/hardware.h>' S" M( R. ~' D. m: s( m& i
  38. #include <mach/irqs.h>2 |, K) h) D3 i  f$ g3 c3 Y% Z
  39. #include <asm/hardware/edma.h>
    9 r3 I& m: [' ?3 n( U' _

  40. ' P* E8 Y) R8 F1 a
  41. #undef EDMA3_DEBUG
    ) z, p/ f7 r7 C
  42. /*#define EDMA3_DEBUG*/+ L5 \' W$ l' D  [9 y0 Q
  43. ; J7 x( C  m" K. v1 @
  44. #ifdef EDMA3_DEBUG
    * g; P" O% f3 d  _3 R1 H+ N: Q1 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). T2 q, p$ j" x  c* l$ j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): |, A# a6 o! D* m5 H# d# a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# A0 N2 c/ @6 {0 j1 g
  48. #else
    0 ^* \) |, w$ O: ?" m) T& C" E& F
  49. #define DMA_PRINTK( x... )4 X* T2 `) i; |
  50. #define DMA_FN_IN) P  a- x' a( B' {5 s
  51. #define DMA_FN_OUT0 ^6 I$ D; b1 w; G/ J6 h
  52. #endif
    6 T$ K0 }/ e4 X! ], h8 ~

  53. 5 Q" n6 N) E" c+ A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - t: b0 o: d9 e
  55. #define STATIC_SHIFT                3
      g4 s+ Q  j( A# {
  56. #define TCINTEN_SHIFT               20) J/ h& X, a. |! O2 P
  57. #define ITCINTEN_SHIFT              21
    - f" a4 c6 L9 h( x. h) e
  58. #define TCCHEN_SHIFT                22
    & x7 V; \' S0 `/ Q/ H1 \
  59. #define ITCCHEN_SHIFT               23- o# I3 }' o3 E5 `
  60. 3 v+ G' V' }/ h' W' }
  61. static volatile int irqraised1 = 0;+ y+ b2 B! q- ]4 @
  62. static volatile int irqraised2 = 0;+ P' |% C: D# h' r& m- [

  63. 3 s& R+ U$ d5 v) m1 C: l7 b! w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' L, g' G- @/ p/ ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ ^# J/ S: Y- v9 k- `5 i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! h) C; Z, R5 A) Y
  67. 4 H+ k# @! ^! t2 a" Z4 M
  68. dma_addr_t dmaphyssrc1 = 0;- n4 i& }' ^% d
  69. dma_addr_t dmaphyssrc2 = 0;
    0 Y+ e6 ]/ f4 ?6 q" O: [
  70. dma_addr_t dmaphysdest1 = 0;
      i2 @. I! F* c' `& U
  71. dma_addr_t dmaphysdest2 = 0;& ]. Q% g% n3 m& d  }, ~2 k; v- P
  72. # L# F, p. g  ^& g0 W
  73. char *dmabufsrc1 = NULL;9 c! v& w2 T7 m
  74. char *dmabufsrc2 = NULL;& d+ g3 E' p, i5 h" c3 ~, D
  75. char *dmabufdest1 = NULL;
    7 g2 v. a" `9 j0 ^7 }5 q% a
  76. char *dmabufdest2 = NULL;
    ' `/ G7 J0 B1 Q7 u! ?
  77. : Z- a2 F+ J% s& H! z
  78. static int acnt = 512;
    & V1 \4 A; o% u! r9 Q  F' d3 P# W
  79. static int bcnt = 8;7 Y7 x9 F3 t, Z9 L% n1 x" x5 a
  80. static int ccnt = 8;5 k6 l  y2 k! ?& P$ E# a, M: e
  81. ; l7 p6 |. T/ Z; j6 J
  82. module_param(acnt, int, S_IRUGO);
    - }0 @2 ^5 M  w3 |4 |- ~
  83. module_param(bcnt, int, S_IRUGO);' W+ R$ _8 L/ [/ A  O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: o2 g* i1 Q% A2 }5 d; v* k

, ]7 C5 ?* N3 {) x4 x# W( N5 `1 l$ x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& Y$ P, t' \7 Jarm-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* |6 S+ K7 q4 O1 e9 Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ Z4 D& t+ J2 m( C# q6 a/ [6 K/ R, ~# d

$ y4 ?! O8 M$ s% F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-29 06:00 , Processed in 0.037641 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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