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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ m8 J5 }& ?' c. U
  1. [code]EDMA sample test application
    ' G- [6 R# T# A, k/ p6 A. O) l
  2. /*$ r' e: U9 S' W% C
  3. * edma_test.c
    - N( K* Y! D9 j4 O* M& @
  4. *
    ( F5 p: x# o( i
  5. * brief  EDMA3 Test Application
    & S" ?& [. l. h  [+ F+ j$ V0 R
  6. *
    1 S( k1 P& b, D; I" B( o+ @1 |) b
  7. *   This file contains EDMA3 Test code.+ x' q7 |" f* t, w/ x9 |! J/ }8 s% D, P
  8. *& K( C* O( o7 T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# B2 Y0 H9 a3 l) P. ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 Q2 s; {4 n: n9 Q6 O( Y
  11. *         TO CHANGE.5 B; c9 h$ l) n0 G  z% s2 f
  12. *
    3 P' J9 }1 `6 r) s; w: b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 m* P4 x6 f- @* R' ^$ ]
  14. *4 h9 A' A; o! e  r
  15. * This program is free software; you can redistribute it and/or& R9 r( Y% n* l" L# X$ q
  16. * modify it under the terms of the GNU General Public License as  [2 q$ X; q% A/ l: m6 |' E4 b
  17. * published by the Free Software Foundation version 2.0 K1 `% \; c# H. ]5 |$ Z
  18. *
    ! A- I# d1 ?+ J0 M) P# ~& L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      P# m2 f0 l, @; U4 H- D
  20. * kind, whether express or implied; without even the implied warranty& j4 N5 Z+ i! y% C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ e# z) ?8 @5 X. T
  22. * GNU General Public License for more details.7 w# S$ q. v5 |; Y
  23. */
    2 u$ v2 Y0 y8 }/ Y

  24. + f0 d# ~/ x1 @% L6 i1 D( E
  25. #include <linux/module.h>, e. p' |3 ^, q1 j3 u5 p' T
  26. #include <linux/init.h>/ P7 U& i( T% D
  27. #include <linux/errno.h>5 C6 ?9 |+ }; ?) V* f" @/ b
  28. #include <linux/types.h># c( P7 I; S+ Q7 M; J* V( l
  29. #include <linux/interrupt.h>
    " f! L9 u9 A& ]
  30. #include <asm/io.h>% o. w5 ^, ]: N% S* `) l
  31. #include <linux/moduleparam.h>* i$ t  ?9 ]% d9 u
  32. #include <linux/sysctl.h>
    ' j) I6 f" p* h; K7 Y# `0 i, s
  33. #include <linux/mm.h>
    1 ]& W. O6 q0 C
  34. #include <linux/dma-mapping.h>( G& F3 b4 V' g1 ?

  35. % T  n8 ]/ e8 ~" L" k: q
  36. #include <mach/memory.h>
    # Z' d" m( o$ P
  37. #include <mach/hardware.h>! s# Q+ m, T) F  a) K# b$ R
  38. #include <mach/irqs.h>
      O# m: E3 `7 q8 U/ q# C  ^7 w( z0 L
  39. #include <asm/hardware/edma.h>( p2 y% Y2 D+ d* V* t
  40. # b% o+ U# E2 g& w" ^
  41. #undef EDMA3_DEBUG; a) D, H' T) m, s
  42. /*#define EDMA3_DEBUG*/4 w" d# c8 M; `$ b5 O
  43. ' E# l* u5 R# C0 w
  44. #ifdef EDMA3_DEBUG
    ' V' I- [3 Z7 f: {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " }; v: ?1 z$ n/ Q7 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! Q, D$ J: K" O) a# @, P( z4 ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / E5 W% G) D; {7 ~
  48. #else
    * y# R- L" |, q; \; a2 ^
  49. #define DMA_PRINTK( x... ): s+ r5 h+ K; y$ ~8 m; E4 d1 O
  50. #define DMA_FN_IN* e2 a: x' \4 ?: m6 o
  51. #define DMA_FN_OUT
    $ i+ l9 a8 ~6 H3 S0 `: k
  52. #endif# o2 s- q8 [3 R
  53. ' I4 P. u6 T/ J* L. X7 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : {  K1 n, |7 I# |; q' y
  55. #define STATIC_SHIFT                3
    % |# q9 @4 {1 G+ k/ b6 Z/ X
  56. #define TCINTEN_SHIFT               20) t2 J, C! W& J7 n
  57. #define ITCINTEN_SHIFT              210 |, m& `% j4 S* @2 x
  58. #define TCCHEN_SHIFT                22  x3 l" F: j' o! f
  59. #define ITCCHEN_SHIFT               23
    % ?% z) z1 p+ n+ l

  60. 4 {4 f  x- M  {+ A7 m1 b
  61. static volatile int irqraised1 = 0;, E4 G8 a1 d3 Q2 u. W; Z
  62. static volatile int irqraised2 = 0;
    ; |+ u7 J1 Q' E

  63. * b' b5 o' Y% [6 b- D5 B' Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 r6 w! D7 Q: N2 V' i7 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# c" n. v3 _' C5 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 m9 u4 U! M- e( G9 Z( |" c
  67. 5 u9 M+ d  `8 g; D: N/ m
  68. dma_addr_t dmaphyssrc1 = 0;! O6 o, D0 P% \0 q( V, C
  69. dma_addr_t dmaphyssrc2 = 0;
    , j$ u% P2 m2 Q% T3 v- a/ I
  70. dma_addr_t dmaphysdest1 = 0;
    2 n! ~: \" R! m4 ^$ G/ Z$ ^$ r
  71. dma_addr_t dmaphysdest2 = 0;
    " p/ p: i$ q* \" k8 z5 f* i6 p( z

  72. & g' u, G9 x/ _, H* j
  73. char *dmabufsrc1 = NULL;
    8 {& m& w! H% W( N$ H
  74. char *dmabufsrc2 = NULL;. Y4 J6 |5 ~. `/ f& M1 I8 {
  75. char *dmabufdest1 = NULL;& g9 c6 m9 q! ~6 _( ~: _
  76. char *dmabufdest2 = NULL;  R- ^/ k; t* d$ O1 ?+ R8 Q& x' E
  77. & E  I' E4 B! l: z, }
  78. static int acnt = 512;$ i6 }% j, M( G; m) I
  79. static int bcnt = 8;( @) z( \$ E0 K. l
  80. static int ccnt = 8;
    6 D: k( t: [1 K0 a( ]. S! v% E2 D! `
  81. & p  {+ Q% a5 [. A' v
  82. module_param(acnt, int, S_IRUGO);
    " z8 S& H2 Q; U- J
  83. module_param(bcnt, int, S_IRUGO);
    * |# i5 j' \. `/ \* V5 j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ A( q1 ~" B; k3 \+ v4 [5 S7 u5 L" J! ]- V) n2 ?" ^& W5 l. N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 R/ f4 |# w7 Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 M+ [1 e) ?4 S; E. Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ p0 y! V; ^+ y
& G) n# ]. J* e7 Z6 @
2 I! b, h& x- `. @9 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 19:18 , Processed in 0.038696 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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