OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- D$ Z: w7 P4 w0 F
  1. [code]EDMA sample test application
    ; D, S  u, f8 q# Q2 r
  2. /*
    7 f5 ?; q; w: d+ X6 F, g
  3. * edma_test.c# ]) F* ]- @5 s% _( a* d
  4. *4 k, i" m( X- B$ Q( N
  5. * brief  EDMA3 Test Application
    9 Y3 R5 b2 x! C" R9 W& K" |! o5 l
  6. *
    3 f7 j& {' ^2 Y- P
  7. *   This file contains EDMA3 Test code.* r' [& Y$ R: U# ^. U1 ]
  8. *
    8 n9 W4 D- ]; Q5 B! f- O& P/ s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 t9 o( W+ K: e" e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 Y/ F; J3 ^# {0 Q# |4 j7 k& F
  11. *         TO CHANGE.
    5 y7 z0 t& U9 I' j6 j0 Z# A6 B% X
  12. */ g6 q1 h! z& C# N* b  I. o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! H+ m7 G1 C& n; o
  14. *$ G  a! y8 E- D! ^/ L( K+ \
  15. * This program is free software; you can redistribute it and/or0 F; h2 z/ d' R) H
  16. * modify it under the terms of the GNU General Public License as
    / W5 K9 R* m! z+ |4 S3 l
  17. * published by the Free Software Foundation version 2.& T1 Z3 ~# {4 e. g6 r" c- I
  18. *
    * t  {) P4 v6 ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 i8 ^: }0 s9 b+ j  n# p& H" i! e% R8 h
  20. * kind, whether express or implied; without even the implied warranty0 q/ C" g# y% l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 f+ |+ P' G3 U# t
  22. * GNU General Public License for more details.) t3 |9 q$ Y6 v
  23. */
    ( d& j" w7 O) A  N" S: C+ e2 n

  24. ( R, o8 q# @  `3 a, J% K- l
  25. #include <linux/module.h>9 a$ Q0 F% S  w1 T# Y
  26. #include <linux/init.h>( M# D! f' x( ]; R
  27. #include <linux/errno.h>
    % a8 h  c' x& E! J
  28. #include <linux/types.h>/ e$ H& j! Y; U
  29. #include <linux/interrupt.h>
    # S! s# ~" y9 [- X) `
  30. #include <asm/io.h>
    - Q2 ~+ B" ?& h1 B) s
  31. #include <linux/moduleparam.h>
    # D9 `+ N- p3 i5 h; e: V/ D. s
  32. #include <linux/sysctl.h>
    ( z! [# H4 t( L! i3 s& \, |
  33. #include <linux/mm.h>( p- o( ?4 z6 g' p6 L& l
  34. #include <linux/dma-mapping.h>
    4 r0 z" c, @8 n1 M, ^, n' E

  35. 1 k1 A# h( N' y% P. k8 S$ w& j
  36. #include <mach/memory.h>% G$ p) ~& N6 s) @5 x
  37. #include <mach/hardware.h># n& u! Q$ ?% Z( N+ r% U" O# |
  38. #include <mach/irqs.h>
    ) K0 B$ E% R' [) d1 }
  39. #include <asm/hardware/edma.h>
    2 @% U: |* O+ G! m/ _4 z5 q
  40. " j+ m! y/ }$ y6 H) N' E& M! u
  41. #undef EDMA3_DEBUG
    ; m& D% Q8 q( ?3 ]6 C+ D$ Z
  42. /*#define EDMA3_DEBUG*/
    , G7 P9 J! g9 P$ a0 w, z- W

  43. # |+ j# a& _8 r; \( r) g
  44. #ifdef EDMA3_DEBUG* i# ^' M% V* S: L6 Z. E+ \5 o* @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" x; x! s  z9 X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ B" C4 i; R, v8 V% w5 B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " P/ ~1 N6 t. y$ L6 r( S
  48. #else
      X7 h# x0 n9 B1 W1 j' T* S; \9 ~( ]9 y
  49. #define DMA_PRINTK( x... )
    1 b' b1 V" L% D% `1 g
  50. #define DMA_FN_IN: o. A& a8 R$ q( O
  51. #define DMA_FN_OUT
    8 |. g; c; }0 [! q# o5 i
  52. #endif# J0 s* W# Y; I  J( o8 s
  53. " H* ?% W6 I' `1 d( K+ p, h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " i  M7 |. K% e$ `
  55. #define STATIC_SHIFT                33 U- {$ W) H% \
  56. #define TCINTEN_SHIFT               20! G0 w5 ~) A0 \, o/ e# I5 @' @; R6 S0 M
  57. #define ITCINTEN_SHIFT              21
    % y/ D  x0 Q! Y, _8 v3 Z
  58. #define TCCHEN_SHIFT                221 T; N6 e4 n' w9 N5 {- `! e% s
  59. #define ITCCHEN_SHIFT               23
    3 U7 A% l' g" R9 W
  60. " v2 o& B  {, l; C- I
  61. static volatile int irqraised1 = 0;
    $ g; k" }4 X. N0 C; G0 Y
  62. static volatile int irqraised2 = 0;
    2 k" X6 G: W3 ]! m
  63. 6 X( @4 @, W2 l( i! w$ N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 C6 A$ b  }6 T! A$ W- `7 Q+ [! T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * Q+ j: d+ u' {2 o" q3 l$ e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; s" b+ Y( t# n8 f* c

  67. 7 x+ \, w' W3 H$ u( \. X/ g& G/ N
  68. dma_addr_t dmaphyssrc1 = 0;2 w, G( n# V* r! Y$ W
  69. dma_addr_t dmaphyssrc2 = 0;
    % m8 S+ N! [+ P! J; {5 w# f4 }$ e9 A
  70. dma_addr_t dmaphysdest1 = 0;
    , v  v7 W0 n8 r
  71. dma_addr_t dmaphysdest2 = 0;
    , [( k3 m( n" A  U( I, O8 H
  72. % g+ q! r3 S# U$ l1 L
  73. char *dmabufsrc1 = NULL;
    ' k6 u0 x1 @$ a! H
  74. char *dmabufsrc2 = NULL;
    0 U. n0 P  z$ h, K! o; r
  75. char *dmabufdest1 = NULL;8 k  j* G. U/ y4 u  C) v
  76. char *dmabufdest2 = NULL;
    1 t) R3 E) ]# P- [; m
  77. 6 u/ J" G& O$ E3 e
  78. static int acnt = 512;
    ; ^) U  _' n1 n* o: @
  79. static int bcnt = 8;2 u" W# g' k8 k# i1 O4 ?
  80. static int ccnt = 8;
    5 {, ]6 I/ N9 _
  81. % |  \2 O- o. S3 z
  82. module_param(acnt, int, S_IRUGO);
    " X. x5 m$ I0 n- Q
  83. module_param(bcnt, int, S_IRUGO);
    , p9 g0 ?5 {/ ?" D1 P1 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" Z6 t7 Z) O' |8 z

6 f0 h, c" X9 t0 O: C6 @/ G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 p) R7 b2 C! v& P, f9 ^% e5 Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 s+ Y5 e1 V* p
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. k8 J7 L0 B- [2 e) E* Y7 O( j
( O' N1 P( E1 d
. R' e- e9 P0 [  i3 [0 x0 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-1-27 21:17 , Processed in 0.040382 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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