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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; R8 L6 j3 z; ?
  1. [code]EDMA sample test application: C+ z; _  O( H3 m" M8 _
  2. /*
      Y' b% F( l: N) g
  3. * edma_test.c, ~" ^2 X& A" k+ {% t
  4. *  j/ y1 |4 Y/ w) Q) i1 g
  5. * brief  EDMA3 Test Application
    , {2 r$ j; @. s5 g
  6. *
    8 V+ Z* ^2 p1 c# s; u
  7. *   This file contains EDMA3 Test code.. k& t8 a$ Z0 k6 C
  8. *
    ; Z( |7 n. ^. }! ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; t) U2 }* T) s! ~% m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 e/ t+ z) x  @1 y  z
  11. *         TO CHANGE.; [& }2 n' s% c
  12. *
    ! I& R; R, `, f& F; }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: x& ], q4 c' h, ~7 Y9 c7 s, o. W
  14. *! j3 A- q; ?3 b; v# _  g. t: [! r. M- ?$ T
  15. * This program is free software; you can redistribute it and/or
    % m, F4 h) I8 V! k: x; |/ {" D( t
  16. * modify it under the terms of the GNU General Public License as
    ' H4 J# _' D# h8 E& K
  17. * published by the Free Software Foundation version 2.
    5 F  U/ H/ t/ R* i  t
  18. ** Y5 X; v- p, N, f: E: T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / [1 C# f- O7 j: I. M4 r  m
  20. * kind, whether express or implied; without even the implied warranty
    % r( P- N8 k" u! N/ z7 v% c5 u2 |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ m1 n9 u& F# |/ }* b7 P( ^, N" P
  22. * GNU General Public License for more details.( d/ \# N  X  P$ N6 \
  23. */) M# A$ I  R" U! O' Y! a- {
  24. / I9 ~$ D! C7 B
  25. #include <linux/module.h>! ~; g5 b7 @0 |1 c5 M! D
  26. #include <linux/init.h>7 g* p' z3 s" |5 L  A" e
  27. #include <linux/errno.h>
    1 k, ~4 F. O3 m  d$ m0 ^& E
  28. #include <linux/types.h>
    3 w1 h  k( C; ^0 q- U! n. T
  29. #include <linux/interrupt.h>. I. ?% O# z* Q2 A$ M! [
  30. #include <asm/io.h>' w4 R3 L' u; C- K
  31. #include <linux/moduleparam.h>
    1 |5 ?- `, U- X" d5 ]  P& X! z- v
  32. #include <linux/sysctl.h>$ c7 L' R/ {! b2 N/ r
  33. #include <linux/mm.h>
    8 ?* O4 J5 ]: }2 _- J7 D
  34. #include <linux/dma-mapping.h>5 O- M# u) o5 v. H$ }

  35. + r' S, ^  m$ R7 w
  36. #include <mach/memory.h>6 I, z0 H( y/ L9 F6 x
  37. #include <mach/hardware.h>
    . ^& m7 }: R7 `9 V5 ^* p2 j& y
  38. #include <mach/irqs.h>
    + O( p/ ~3 C# X, L# i" j
  39. #include <asm/hardware/edma.h>
    # q: ?' D. u3 {* M& F3 H" _

  40. 2 T$ q3 h6 D& i) \
  41. #undef EDMA3_DEBUG% E6 N8 |# u, u" ~
  42. /*#define EDMA3_DEBUG*/
    7 f0 O# r- S' A+ \2 S

  43. " S) |$ c* ]  J5 }6 t# Q
  44. #ifdef EDMA3_DEBUG
    # O) z1 T" z3 I) f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); H2 f0 y, M7 }7 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ F8 Y' E/ b5 U: D. {8 ]9 _8 [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* g) I5 S. m/ O6 g! a1 s$ ?+ c
  48. #else6 \: ]9 [# U% m# _- d2 r
  49. #define DMA_PRINTK( x... )
    0 {0 g: E! u% H4 X
  50. #define DMA_FN_IN
    ' i; q% {, i! N9 Y  s7 v
  51. #define DMA_FN_OUT
    4 L" _' H* v* r% a; L
  52. #endif
    0 x- Y5 I  V) `3 q
  53. ( Z; \: I8 H; E2 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 M4 j- J- @! b; o. U2 m
  55. #define STATIC_SHIFT                32 \( x) K6 h+ M6 c
  56. #define TCINTEN_SHIFT               20
    # c5 G( Q, v/ `4 o- W
  57. #define ITCINTEN_SHIFT              21
      o2 b0 @2 ]- @% A  L6 ?% ]' D" X
  58. #define TCCHEN_SHIFT                22/ L/ V8 U$ M6 G0 x2 q
  59. #define ITCCHEN_SHIFT               23
    7 X+ B# f9 \- T# k9 H5 Y% f6 D

  60. 8 L$ j+ i" ^1 {1 c2 L0 P* w2 w, |
  61. static volatile int irqraised1 = 0;/ _8 f; `. c- b  c0 E' j
  62. static volatile int irqraised2 = 0;
    4 B; A# |: [% O. V8 ]3 i
  63. ! [9 H3 _% m6 r5 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 }* D1 H+ ~- d0 `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " H3 N0 ^: @. N6 u7 l  u% m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* `" D- f5 T% I0 [# w" S' M2 S
  67. + H0 m* G( D  X: A* @
  68. dma_addr_t dmaphyssrc1 = 0;: B/ f0 k2 q, W. s
  69. dma_addr_t dmaphyssrc2 = 0;, N3 S  z7 B1 G5 c. B7 w9 I# s
  70. dma_addr_t dmaphysdest1 = 0;
    2 O9 K/ _( h0 Q( S+ x+ e
  71. dma_addr_t dmaphysdest2 = 0;. n4 S4 n! q7 {- J4 |
  72. ) L( L  i6 F5 m0 U; J" F2 H
  73. char *dmabufsrc1 = NULL;4 J& R5 Y' q. s6 U- ~
  74. char *dmabufsrc2 = NULL;
    7 G& s! b' v- U& I
  75. char *dmabufdest1 = NULL;# x7 }  R1 b4 r6 d" J
  76. char *dmabufdest2 = NULL;2 @0 V; v4 _; U3 T* o

  77. 9 a7 b; S& P8 W7 O3 I
  78. static int acnt = 512;
    , F$ S! P* I5 S0 j$ g- K
  79. static int bcnt = 8;/ [# [9 n  D0 p7 Y$ z/ ^3 @, \
  80. static int ccnt = 8;
    6 \: Y- E5 v* t; i  ]9 F0 l+ |
  81. : F4 a0 Z2 Z% w2 m$ D4 }# u$ }
  82. module_param(acnt, int, S_IRUGO);+ J6 ~; ^9 E* s0 X& q3 s% Z% j$ \5 M
  83. module_param(bcnt, int, S_IRUGO);. n/ y4 p3 \8 m! W$ `( R+ G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 N) @3 i* w5 k% l! Y3 c6 x
* E* L9 m8 h6 C* O3 {
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 [8 j8 z7 M6 S# c6 r' Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 R9 G# Z7 }2 m. @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; {+ a1 B% P+ L9 E/ m! q2 i4 i

6 `& [- m7 V! X4 {$ \# Z; c" O8 }
" _( R/ ^1 T3 Q5 U4 V- z( q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-14 16:57 , Processed in 0.038003 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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