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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - P$ D/ m3 d9 q* R- @; L
  1. [code]EDMA sample test application7 z% y, L6 U9 q+ P9 ^* B1 d
  2. /*
    3 b& C+ u/ O% J  r/ V- c' `
  3. * edma_test.c
    7 {5 `* A/ ?5 I5 Y( I) u7 K: A% q
  4. *3 l) y8 m. Q# e$ D0 z6 H
  5. * brief  EDMA3 Test Application
    ' Z$ a8 n" m6 K8 D$ `) x  u0 u. s" \
  6. *
    * Y2 V" N- I! e- y) W& c
  7. *   This file contains EDMA3 Test code.( Y% n* x7 S( z, S( U6 K
  8. *
    ' w, |2 Y9 Y+ g% j3 b8 L( ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + o8 k9 M5 f0 `1 S$ f1 K) e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 Z- U! Z1 `4 g5 x6 N7 p% a
  11. *         TO CHANGE.  w$ j* L* ~. [' d' B
  12. *- E9 y. P" a8 z+ a/ I" W, r- o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 C9 L* w6 O/ U5 p5 b9 B3 s
  14. *' x& k8 B8 ?7 z, y: g+ e: _: w
  15. * This program is free software; you can redistribute it and/or
    6 K7 G* |. N' \4 A0 Y( [$ t
  16. * modify it under the terms of the GNU General Public License as, A4 O: M- ~& ]6 q( K
  17. * published by the Free Software Foundation version 2.
    7 ^5 |5 p3 G2 |! x3 `2 j
  18. *
    $ u6 N# F3 z0 y7 S4 s2 X5 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' v7 L; C" ~; A" J# S! |8 J
  20. * kind, whether express or implied; without even the implied warranty$ ^# n9 I  n) [% f( n/ w. C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& g3 l: ]5 O; T& N& P0 p. A9 ]  t
  22. * GNU General Public License for more details.
    * h  @& r( z5 A& I: }
  23. */4 U" i7 q8 ?0 n/ n

  24.   T7 Q( a7 O6 K5 e9 w' t$ N
  25. #include <linux/module.h>
    % R: I8 _0 E: b
  26. #include <linux/init.h>$ n  }; W5 N3 O  w$ k
  27. #include <linux/errno.h>+ j5 E) M+ Z2 B" Y6 i) Y+ h
  28. #include <linux/types.h>. N% U) {$ W1 ^8 H. e: P; [
  29. #include <linux/interrupt.h>
    + j# z( i/ @6 f% R
  30. #include <asm/io.h>) D  E, ~* f  w) A4 b3 M
  31. #include <linux/moduleparam.h>
    - W3 c$ Q- C1 G; q3 J6 X- \# j
  32. #include <linux/sysctl.h>
    , _$ g7 n! [- l9 q& H
  33. #include <linux/mm.h>* L, x7 [! g" E0 {. d
  34. #include <linux/dma-mapping.h>- A7 e: S$ x7 D6 @: ?. }
  35. 5 {4 E5 i! n7 v, q' ]
  36. #include <mach/memory.h>
    ! Z, n; \) d4 b5 y/ s0 P
  37. #include <mach/hardware.h>
    ! N0 Z# d/ w5 ?% ]" b4 q
  38. #include <mach/irqs.h>
    5 n: P# s, w6 m+ j3 L! O& m
  39. #include <asm/hardware/edma.h>3 w& l5 D% t% a9 W/ E

  40. 6 I; q: H! @$ M# _
  41. #undef EDMA3_DEBUG2 A& W( s# m( x% D) N
  42. /*#define EDMA3_DEBUG*/5 I' X# x$ t" x8 z% |
  43. 6 Y( x; |- h+ \
  44. #ifdef EDMA3_DEBUG3 X' n3 {( w. D: x& Q! E- v& j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 L  j+ O) \2 _' W- V. a7 c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 c  g" n2 m  }5 n' B4 U1 j- s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! |6 ^( T- b+ \: h/ ~
  48. #else& u) w+ O, s, {* I0 u9 I
  49. #define DMA_PRINTK( x... )
    ! ?& T# n) @5 x
  50. #define DMA_FN_IN7 o  u4 ]5 r0 q& ?) g& {
  51. #define DMA_FN_OUT
    , V) I2 f, \' c2 z
  52. #endif
    8 n+ d4 `0 J4 r7 t
  53. . X1 w# T3 Q. Y: m8 C+ |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      {6 T2 p0 l' X9 j4 F/ t1 }
  55. #define STATIC_SHIFT                3
    , k( }3 `3 t9 P) c6 `4 i8 v9 Z/ u8 w
  56. #define TCINTEN_SHIFT               208 @8 n1 ]7 f' [$ |: [$ r+ O- n
  57. #define ITCINTEN_SHIFT              21
    & A4 M" B# g% S# |  l
  58. #define TCCHEN_SHIFT                22' o% ]$ r6 Z$ `( Y* Z1 e4 N( k
  59. #define ITCCHEN_SHIFT               23& y0 ]4 [4 V: L
  60. 3 ~( P2 M0 W- G( x8 t; A% Y2 p
  61. static volatile int irqraised1 = 0;2 f; u+ L: Y4 Q+ \3 _
  62. static volatile int irqraised2 = 0;% D& A5 |$ L. g% }
  63. 2 s+ D' \% o4 M' s' q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # R. `) c9 S' |- q( b1 |  |5 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; i2 Q$ Z0 J4 y! H( _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 F# P1 [8 ^3 P$ h7 s# B

  67. % u$ S' C* z$ P. F
  68. dma_addr_t dmaphyssrc1 = 0;
    3 D2 o( _4 {5 O) `
  69. dma_addr_t dmaphyssrc2 = 0;3 |5 w5 L5 u" B1 J3 d0 _
  70. dma_addr_t dmaphysdest1 = 0;
    6 T8 @& \, |* H( J4 J6 N
  71. dma_addr_t dmaphysdest2 = 0;
    ' n8 n* o' n" D2 N, Y$ E( o5 B
  72. : \/ d1 q" @' R. T( P) a
  73. char *dmabufsrc1 = NULL;
    2 L8 ]# G5 n- Y
  74. char *dmabufsrc2 = NULL;- L9 g8 k% |) U8 \# P" B2 e7 o
  75. char *dmabufdest1 = NULL;2 X4 g1 F6 m# s5 n( W) O( Z
  76. char *dmabufdest2 = NULL;, {  v9 b* c/ E$ n* v! a/ V" X
  77. 5 z" c% H4 ?6 p: p
  78. static int acnt = 512;8 S# [( t# u9 M% T# e
  79. static int bcnt = 8;
    + d  \) l" U9 O5 @
  80. static int ccnt = 8;# f/ \' V* I/ h# q* O7 q
  81. ( C2 Z; O! E( U
  82. module_param(acnt, int, S_IRUGO);
    $ V# A- C3 ]0 E$ _0 Y/ u! y
  83. module_param(bcnt, int, S_IRUGO);1 h) l. r% {! ]1 h! P7 o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# s& \2 k, t- r1 p' Q

) v  L+ Y/ o6 `) T8 E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 w! k: T: T$ e) x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 ^) h0 j7 p4 o& ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 i' v! ^; c7 \& f/ y' M% F
4 b' w1 c' u& n+ G' o1 F8 j' w
- c( u2 L/ @+ k2 q) O6 b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 13:25 , Processed in 0.036220 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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