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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 E: w& u9 \7 f2 w* z
  1. [code]EDMA sample test application
    6 H" O/ j- Y2 `7 I, l$ s
  2. /*
    0 r: @7 s4 h% b" r
  3. * edma_test.c7 v4 r$ I" O, \0 W, Z6 K
  4. *$ J. L  `3 T1 v# t- z1 i
  5. * brief  EDMA3 Test Application7 V/ U$ ]$ ]! p
  6. *
    ' R4 t4 K$ z, H7 B9 H, s: W0 a
  7. *   This file contains EDMA3 Test code.  O- X, X0 F' }7 O
  8. *
      A3 Z( S7 K# O/ Y" C6 Z% M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( F& Y2 O# f! b! v1 O9 ]$ b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% g" H* v1 ]. R. X
  11. *         TO CHANGE.8 j- l3 J0 Z) ]6 j" B, ?' G- m" t
  12. *
    7 K: R: n8 _$ c2 H$ H, e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % b& I# a& B+ J" F1 q7 V
  14. *( J6 W4 k0 n% l0 {% I. O
  15. * This program is free software; you can redistribute it and/or  x/ j" M& v& y1 N/ e) _- m4 h# S
  16. * modify it under the terms of the GNU General Public License as
    & H; Z( V! Q4 w7 v) ^6 m2 h
  17. * published by the Free Software Foundation version 2.
    8 W1 L( K+ T, j  |& W# w
  18. *
    ( W3 G, c. `  C7 a0 R, i) Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) V% c! Q: _  @% s5 v
  20. * kind, whether express or implied; without even the implied warranty
    $ t9 V+ ]3 E5 E3 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 H% M5 c; A7 u1 ]& P& K: D/ S
  22. * GNU General Public License for more details.
    1 w& O9 }- K2 n% B+ I* r
  23. */
    9 E0 d4 K5 N! i1 f- `8 F

  24. 9 e  r" Q$ l7 D# G
  25. #include <linux/module.h>9 _5 Y5 n) x" o" @
  26. #include <linux/init.h>
    9 a* I. e; M3 {8 j
  27. #include <linux/errno.h>; `7 N3 C9 x6 [- U; }( `! z, l
  28. #include <linux/types.h>8 Z% A3 U; [" p
  29. #include <linux/interrupt.h>
    ( z, k4 z( h$ X' q; s3 t
  30. #include <asm/io.h>, _! y; f& Z$ D& G; F" V
  31. #include <linux/moduleparam.h>
    1 @2 A1 ]7 h0 J: \
  32. #include <linux/sysctl.h>4 k- _( ]0 Y5 J, o1 [
  33. #include <linux/mm.h>! W5 T3 |% }6 M1 w0 b7 M( J
  34. #include <linux/dma-mapping.h>5 w$ V) J) p: b" r" V

  35. 8 ^/ o2 w7 V5 f* _& x6 z
  36. #include <mach/memory.h>
    , N! T8 Y( i& T: v' n
  37. #include <mach/hardware.h>0 O# `8 V! d7 ]& m7 e3 G
  38. #include <mach/irqs.h>4 z9 V1 Y& e" }. e
  39. #include <asm/hardware/edma.h>- ~% ]/ f5 A: p' b8 G7 y

  40. ; c" ~; v* S, I% o+ P
  41. #undef EDMA3_DEBUG
    3 ]. }: u7 v3 r  K) H% L/ Q
  42. /*#define EDMA3_DEBUG*/$ [: A2 j4 a' w$ l* y  A% T
  43. # d0 X. {7 f; Z  f. k7 @+ f
  44. #ifdef EDMA3_DEBUG/ J0 T2 I. E. `0 z" c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( L5 z, J! f4 I# m% h, S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 z8 k; j3 @: X2 f6 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): P3 d* r9 I! c, q0 c
  48. #else) I0 T* ?- t& c* ~" A
  49. #define DMA_PRINTK( x... )
    5 A' t* _4 D' v% e* O% k
  50. #define DMA_FN_IN$ @+ b+ S! o9 }7 E; N1 G+ R& g
  51. #define DMA_FN_OUT! E3 d9 u% n# ]. s) P. W
  52. #endif
    1 A0 _# r- h$ P

  53. : K, G: g! K1 Z0 ?* m% @/ U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  E* d$ o& E. _; U
  55. #define STATIC_SHIFT                3
    5 e2 ?9 a" Z7 ^. ?
  56. #define TCINTEN_SHIFT               204 C2 @* A6 U3 p( q' ~  `8 W
  57. #define ITCINTEN_SHIFT              211 ?4 d, |2 A- `2 A$ s- y
  58. #define TCCHEN_SHIFT                22
    ' I4 |  V5 B5 g; t5 F* O$ o# m3 I
  59. #define ITCCHEN_SHIFT               238 ?6 u" q6 k- o/ p

  60. ; Y; f; X8 S6 Z* `  m7 F- U
  61. static volatile int irqraised1 = 0;
    ( U; e+ o7 a! U; l$ x. l" J, B! J" g' M
  62. static volatile int irqraised2 = 0;
    # \; r, [) ^0 ?) a9 E. Y2 T' e8 j6 u

  63. - L/ {7 Z) R# q4 Q5 z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' f4 U4 c/ l1 T- i1 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , \9 q' E& |$ X* z2 ]" }  R2 L6 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ J" x7 Z9 j1 g4 ^" P' L: c9 V; ~& V

  67. % V( T& {5 _3 B4 I) r$ ^: y5 J- H& G$ p
  68. dma_addr_t dmaphyssrc1 = 0;
    . P  N( H; {$ h( d$ u/ a) T* z
  69. dma_addr_t dmaphyssrc2 = 0;
    3 B- f  [5 w% H8 J+ a! |
  70. dma_addr_t dmaphysdest1 = 0;
    ( Y- K% ?: \3 R2 a
  71. dma_addr_t dmaphysdest2 = 0;
    , E8 u$ l# P6 A+ ~1 ^7 \" ?6 R" n- N
  72. + {/ \; Y! z% u, c7 e7 A, H
  73. char *dmabufsrc1 = NULL;
    5 l$ e0 o( f' X% E1 ^6 ~
  74. char *dmabufsrc2 = NULL;3 a! y* r6 C( p9 Y+ L5 u! w
  75. char *dmabufdest1 = NULL;: C8 ^4 O3 i: H) W* e* M# d
  76. char *dmabufdest2 = NULL;2 o; r+ E2 P1 N2 w, O' Q
  77. 7 u& o) M5 ^/ c* d' h
  78. static int acnt = 512;
    + l% s, |: G& P7 x! `* x/ N1 h/ @# N
  79. static int bcnt = 8;4 E' w1 q5 r  M+ a
  80. static int ccnt = 8;7 _  J# A* u. o! o" g. d1 M$ I

  81. 5 o5 l7 A' Q5 E' U0 |/ i
  82. module_param(acnt, int, S_IRUGO);7 B1 U2 _: o( Q7 C& U, a
  83. module_param(bcnt, int, S_IRUGO);
    ; A  ]$ m: I) C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& K% H" a- c  h1 G
( m# |: f+ P2 g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) T: v' p; g# a8 x5 P1 ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& t; E  q/ D/ g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ k$ Q; ]2 a# Z# [
6 N* e/ b' L1 P4 V' _) Q- t9 u) d0 V$ h/ |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 22:30 , Processed in 0.039952 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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