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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. `  \# u* X; m; L9 k
  1. [code]EDMA sample test application
    9 {! P& Z7 w% P$ O* d
  2. /*3 v7 i1 N  o8 _$ H8 i: M- d
  3. * edma_test.c
    * a( Z7 K( q" l; _% E4 ]
  4. *
    8 w, D9 B* y0 a4 N# n7 B1 t8 N
  5. * brief  EDMA3 Test Application
    / g3 k9 A: _/ u5 z
  6. *9 h" r9 f! O) d/ l' B" t" F
  7. *   This file contains EDMA3 Test code.
    2 {& x$ U8 G% O
  8. *
    5 M( a+ |0 I5 w" S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' e& b7 A, p) d4 y) w- K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      E8 ?: n$ Z4 S( W3 N& P8 P6 t  Y
  11. *         TO CHANGE.
    : A( M6 E- ?+ E1 [; R$ a( @
  12. *
    7 [. i% Q1 E2 P7 f$ K6 O. I# j1 r% Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! K$ @- ?/ G+ Y8 a" ~
  14. *8 T, [' n$ m2 D% f( B5 X
  15. * This program is free software; you can redistribute it and/or/ u0 l' s" G8 i( R
  16. * modify it under the terms of the GNU General Public License as
    1 b3 W, @+ x8 e, k
  17. * published by the Free Software Foundation version 2.$ Y0 J2 N" Z2 o/ y
  18. *
    : O9 ^+ A6 t4 R( W$ j- {+ c0 Z/ s: n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 e% T- O. S9 P; Z
  20. * kind, whether express or implied; without even the implied warranty
    0 L2 H2 f7 e- t! R5 ^4 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 }, {+ }/ h2 K6 I0 o
  22. * GNU General Public License for more details.3 \" o6 ^; J" N7 S* Z# v7 S, C
  23. */
    ! u/ [4 j( p3 S( {
  24. : v- J4 q5 ?; J: f  V5 j$ Y
  25. #include <linux/module.h>4 ?% k0 k# I( A- N0 f% f% o' a5 D" }
  26. #include <linux/init.h>
    $ ~! N/ T+ b4 U
  27. #include <linux/errno.h>1 a0 ?) e3 F* E. o' V1 l4 b5 s
  28. #include <linux/types.h>
    8 Q5 T- D( Q! \- J
  29. #include <linux/interrupt.h>+ Q8 D) Z3 j- X1 R2 r3 A
  30. #include <asm/io.h>
    & x9 P  A; S1 x% v
  31. #include <linux/moduleparam.h># H$ i) {  U) d( U
  32. #include <linux/sysctl.h>1 R" v) V+ l7 U4 |
  33. #include <linux/mm.h>1 F7 }5 |# x6 T8 t( G6 N# f: I
  34. #include <linux/dma-mapping.h>3 F* G9 O6 Y" N$ b6 q! G9 x2 P
  35. % S+ I: d! G6 I7 b
  36. #include <mach/memory.h>6 s. H, t1 O7 V! N5 i2 ~  [" A; F' ^
  37. #include <mach/hardware.h>( k3 t9 Q4 s$ B, t. s% `; W3 N6 b
  38. #include <mach/irqs.h>% f9 n, k+ K5 V# a1 Y
  39. #include <asm/hardware/edma.h>
    . y* e, M( s4 i( r& q4 S' j# b; a, \; \

  40. $ A5 D0 A8 i5 c
  41. #undef EDMA3_DEBUG
    3 X( u1 J# O$ p) r& ^, K
  42. /*#define EDMA3_DEBUG*/
    * w/ T- w( }& F2 o1 \: Y- L
  43. 3 D5 v6 m# k/ }6 H5 C
  44. #ifdef EDMA3_DEBUG
      \2 D, P& x) n% A3 I  D0 |2 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! y& F; b* H- U4 O/ w2 ~0 w+ g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 N5 ^$ R/ [4 B$ _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( B- n& ~$ m# i5 w' L
  48. #else
    # f4 q5 r/ e5 H; q2 D9 v' c
  49. #define DMA_PRINTK( x... )
      l# ~- }7 J" Z; Z
  50. #define DMA_FN_IN' [2 G8 ]1 q% q# g9 P! Z
  51. #define DMA_FN_OUT, r/ G6 E  M/ S8 v0 A
  52. #endif  d4 @% g- ?2 s; N& c

  53. 5 h" x! m% I) M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 u. y! a, H( `4 {
  55. #define STATIC_SHIFT                3
    6 j' G! I* Y" g, \; a$ z
  56. #define TCINTEN_SHIFT               20
    2 x( V6 T2 Z' I( E& F2 L
  57. #define ITCINTEN_SHIFT              21
    / e' h- r5 v1 ?& j  Q
  58. #define TCCHEN_SHIFT                22
    8 Q6 T$ D8 y+ ~1 w2 n
  59. #define ITCCHEN_SHIFT               23
    - V+ z# Q1 p' W) i

  60. 9 e) ?' k4 U% l( z3 m' i
  61. static volatile int irqraised1 = 0;
    ! P5 Q: C1 T5 @! v* ]  g. F
  62. static volatile int irqraised2 = 0;8 Z) n5 }7 B  H) a7 y

  63. * R( M" |* D8 p  N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ~$ a! v1 R/ q$ D# l7 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # D5 z( Q' m$ M" ]8 l: r, {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 V$ Z$ N. q, e' Y6 e2 f4 _

  67. / C0 [. _+ L1 _! i5 ^0 B
  68. dma_addr_t dmaphyssrc1 = 0;7 A3 y% T* q$ j
  69. dma_addr_t dmaphyssrc2 = 0;
    2 z8 X7 Q& ?, E
  70. dma_addr_t dmaphysdest1 = 0;% v( ^% |" z8 u* @) g+ t
  71. dma_addr_t dmaphysdest2 = 0;/ O& A- V" K0 X$ h

  72. * _% ]  c0 T2 V
  73. char *dmabufsrc1 = NULL;) Q1 x5 x4 T- e
  74. char *dmabufsrc2 = NULL;
    . U- m+ Q6 b  X/ Q
  75. char *dmabufdest1 = NULL;1 I* F8 M2 K6 _, I& I! ~; S  M3 }
  76. char *dmabufdest2 = NULL;
    ; F5 ?7 X4 G( E  e5 O; a
  77. 0 t! ^( n+ I6 D" |6 g- S' t! H
  78. static int acnt = 512;$ h& p: N5 A$ Q! `
  79. static int bcnt = 8;
    # |  Z3 T; [  P; @# L
  80. static int ccnt = 8;
    7 q& K  ?1 R# ?* l
  81. 4 P4 H- x4 v$ C( S0 v
  82. module_param(acnt, int, S_IRUGO);
    7 J- r7 f# V. Z' {3 [
  83. module_param(bcnt, int, S_IRUGO);
    6 t$ {* s! G  m+ ^! Q. t  p5 ~9 r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( V# A. v0 m8 B* B. F3 s6 R8 O7 U1 n
, V& v5 c! [1 W! r# r( \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ e, j6 k! ~& Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- _, y: Y. V" a* |/ ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: ?8 `" ?4 A2 M9 n1 M' {% A+ w+ _/ e! {$ s2 ^) q$ [
2 }- @+ L: n3 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 11:32 , Processed in 0.039652 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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