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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + e3 }6 M% R3 j7 P
  1. [code]EDMA sample test application
    4 k  [  v5 q+ A0 `$ i7 x+ T
  2. /*
    ; x3 v$ q& o7 ?0 M) D  }1 _) z
  3. * edma_test.c
    ) I" b2 d2 K) m: X
  4. *
    & k/ d. w8 I- _/ P
  5. * brief  EDMA3 Test Application
      F/ Z. k$ V- L$ M- h
  6. *" V6 j& x; A; S$ O5 [' s3 R' `# f
  7. *   This file contains EDMA3 Test code.8 d- s2 t: |  p% I: E6 E
  8. *: w7 `- X7 `5 B- a/ p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( B2 o: C( z2 E' s7 {2 F, f6 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& C( \; d* z) k5 ~
  11. *         TO CHANGE./ _/ r0 v; @" P( k9 Q
  12. *& z% h# [6 \6 e1 r7 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. _, Y  P% ^& Z# m' e
  14. *
    ; n5 H! \2 I4 Y! c+ O
  15. * This program is free software; you can redistribute it and/or
    3 f' V4 |$ c' P6 {: R( O
  16. * modify it under the terms of the GNU General Public License as+ p% z- P, \  B2 _1 U- g( c9 |3 ^
  17. * published by the Free Software Foundation version 2.3 I! Y& g0 O% w/ Q6 p7 |9 R  N
  18. *+ b: l  b9 `; w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 ^: [& \7 I6 k
  20. * kind, whether express or implied; without even the implied warranty% @9 W0 @( [8 c. `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 W. t1 M% v) T
  22. * GNU General Public License for more details.
    1 N5 _! j+ M0 P6 x1 r3 e' O' y; T, [
  23. */
    . K0 E$ @9 P  O) }8 X! e
  24. / `  t/ F4 I" M; e4 A: \0 Q4 o
  25. #include <linux/module.h>) P2 ]& V) U% E9 p
  26. #include <linux/init.h>
    ) L& l/ U- j; @2 }$ t
  27. #include <linux/errno.h>" b9 ^( X1 c9 ]6 S0 t* a8 h
  28. #include <linux/types.h>- L* C% V0 z: T
  29. #include <linux/interrupt.h>
    ' [- G% e4 L# }+ T6 C
  30. #include <asm/io.h>3 K, K; C* Z0 N7 ^& x$ @% P9 z7 g
  31. #include <linux/moduleparam.h>
    6 S1 i" v, k" C* {3 W, O7 O
  32. #include <linux/sysctl.h>5 a5 q" I" S/ N' P9 H8 z
  33. #include <linux/mm.h>4 n! y$ g3 @: c) c6 \" z3 V
  34. #include <linux/dma-mapping.h>
    & Q7 S3 \7 m, l' {9 V+ _& i' r
  35. ) e% i  _  S: v) M
  36. #include <mach/memory.h>( S  w$ n2 H3 O) ^; ~' G- s! s& D: }
  37. #include <mach/hardware.h>
    6 o" O2 w3 P- z' \+ _# L& k
  38. #include <mach/irqs.h>
    1 _6 J' L! h1 D7 u* w
  39. #include <asm/hardware/edma.h>% {1 Z8 G6 J- o. P$ |

  40. 4 r7 v6 y0 I# ]3 s1 G* S
  41. #undef EDMA3_DEBUG
    5 [' R5 t2 p' h* e. s
  42. /*#define EDMA3_DEBUG*/) g# u# L) [' Q! _8 T0 p
  43. - \; Y$ H/ s0 P
  44. #ifdef EDMA3_DEBUG$ u. a  v$ m" d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 u9 M* Y8 r9 u; c; v3 @, V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      d" I3 P5 |6 a3 l2 W8 B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 }' _& @) m$ w
  48. #else7 `" @9 b# ^) `% a2 Z1 S
  49. #define DMA_PRINTK( x... )
    % d/ H# e1 V$ `3 [3 R
  50. #define DMA_FN_IN% D8 S7 Z  D- e0 o8 B/ |' W
  51. #define DMA_FN_OUT
    * M/ d- L; o2 ~( A: a+ a" s
  52. #endif
    + [5 v/ r$ q6 U+ _8 o$ k* y
  53. 6 `. p( ]" H6 D: x0 Y+ q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( L1 n7 b! ?) w$ Y+ s
  55. #define STATIC_SHIFT                3
    8 G) m* D# H( g2 p% F: B
  56. #define TCINTEN_SHIFT               208 @$ B  c9 Q( M! k
  57. #define ITCINTEN_SHIFT              21
    & Z' D: T3 X% _! V1 Y" ^$ s
  58. #define TCCHEN_SHIFT                22
    - I" q' W: v4 c/ e* p
  59. #define ITCCHEN_SHIFT               23' V7 }0 R4 R* |' W% R8 G

  60. / m' f7 O* k" i4 ^, l, A
  61. static volatile int irqraised1 = 0;
    ' b' [. b0 J- A0 w
  62. static volatile int irqraised2 = 0;
    - a% _7 Y( w/ Z1 W3 R( U
  63. 1 x2 [% g  \% l& s( g2 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* |+ X2 {% O  N7 [+ f9 q1 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 @+ e/ @, y3 Q: B5 v' w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% \4 |; `5 h! |' [* _) V' X. ~% \
  67. , y' F' E: I  ?( v
  68. dma_addr_t dmaphyssrc1 = 0;$ Y9 z5 y4 @9 d
  69. dma_addr_t dmaphyssrc2 = 0;3 ~, s# a: z4 B% Z. x! j  m1 k
  70. dma_addr_t dmaphysdest1 = 0;
    3 [$ O, z% G' c
  71. dma_addr_t dmaphysdest2 = 0;
    0 O. |# E" g6 A7 l+ ]8 s" i

  72. ( s5 q9 m$ {* I9 I
  73. char *dmabufsrc1 = NULL;
    4 e: _# O( H" l( c) ]5 F: T& ~: ]5 G/ l
  74. char *dmabufsrc2 = NULL;5 l! Y2 @% D  Y: j4 s! D1 J  N
  75. char *dmabufdest1 = NULL;
    , H6 |& I9 y0 x3 r$ I
  76. char *dmabufdest2 = NULL;
    / w" w5 \5 P9 a& O& R6 W1 ?, {  q

  77. . _9 ?+ q' Z1 r# J6 C
  78. static int acnt = 512;# F' N2 j/ }9 P7 R% [- e' q
  79. static int bcnt = 8;
    1 `* d- ~" J7 M) \; f+ R! [
  80. static int ccnt = 8;
    % @) D- [" z- f7 i1 I' ~
  81. : t% ^# o1 R$ n. \% O  \: B
  82. module_param(acnt, int, S_IRUGO);
    7 F* O' c+ E/ W) h
  83. module_param(bcnt, int, S_IRUGO);
    3 P6 s  A" V, D( J. u& i$ t7 ]8 P& q/ f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* I2 g) N+ w5 a0 W

5 K6 [0 F4 c. k* `/ {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& z+ q( G2 }0 N, e/ q& {! S6 s$ H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 Z* s; T7 W8 U: f  `8 p2 \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 I+ Q% s+ h( q2 w: V: K5 u. A& L4 O' @" v0 h" {0 X. j, @' t
9 u" }3 R! g0 R  L$ x( q3 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-24 17:43 , Processed in 0.038676 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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