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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 F; b2 O* `; `
  1. [code]EDMA sample test application
    + I7 ?/ j6 J5 R/ ?* f
  2. /*
    0 l& V) Y& {9 d3 D5 _7 l
  3. * edma_test.c
    ' S- Z( R$ N6 Y; A  q* ]5 X4 [
  4. *
    5 F6 M- L: p) W, `
  5. * brief  EDMA3 Test Application
    0 Y  Z  G5 B: q( W7 u. M+ f
  6. *
    4 i. Z% N4 a% c& _  N' L1 U
  7. *   This file contains EDMA3 Test code.
    & s6 J7 P8 I& ^+ \+ B
  8. *
    # q/ u$ R# v9 Y/ G" A3 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% ^7 F4 L% w, e' G" i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- t# @8 Q! D1 I' \* s$ ?6 b' Q3 P
  11. *         TO CHANGE.
    " V: f& H! k$ t  R1 ^7 u
  12. *
    ) S! @, N- q6 ^- x0 t/ ]9 Z# t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 ]& T) W3 c2 i; T
  14. */ x5 p" d; [7 |4 i: U/ I# W
  15. * This program is free software; you can redistribute it and/or
    1 W* d# B2 q7 m* [% m: ]3 n
  16. * modify it under the terms of the GNU General Public License as8 s% J2 F$ A( }0 ~/ Q; |/ Y" r
  17. * published by the Free Software Foundation version 2.$ L5 b1 }0 v/ n) a+ c0 H2 W" I$ o% t$ ^, R
  18. *
    * Z2 H* z  ^) {$ o7 G4 R. r9 j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - p7 Y1 I2 R2 N& h5 c
  20. * kind, whether express or implied; without even the implied warranty* {8 }3 g7 Y- z1 c, Y: G9 r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  n7 y( m' y; P* \+ V+ ]' a
  22. * GNU General Public License for more details.& A. l0 w( I  u. b+ P: I6 r- ]
  23. */$ }, R* I* i8 \! a4 [7 ?

  24. 3 S+ K& ~4 F0 `) A
  25. #include <linux/module.h>/ {! d: C# k1 c6 d) [+ ^# o5 ]
  26. #include <linux/init.h>2 M' t0 q* ]8 j& J
  27. #include <linux/errno.h>8 _5 c( y3 O& E8 y# e( q
  28. #include <linux/types.h>
    9 W. [2 _6 _% o+ j2 ^4 P
  29. #include <linux/interrupt.h># u* Q! j; P* c1 u  {% ]$ [8 _
  30. #include <asm/io.h>+ ?7 V9 c; M0 V' n
  31. #include <linux/moduleparam.h>- c& n) W% A% k! E
  32. #include <linux/sysctl.h>, l; W% S" S' l
  33. #include <linux/mm.h>3 ]+ A% p7 I: H& {
  34. #include <linux/dma-mapping.h>& \4 `% R9 j7 c2 u3 X+ o5 Q8 G2 e

  35. : W$ E7 `( p& g; T6 X9 O$ ?( }
  36. #include <mach/memory.h>! f" b' X1 k- G9 R) p( J( G. n+ K/ b
  37. #include <mach/hardware.h>, c; U/ l0 a7 T5 V3 K& [; s
  38. #include <mach/irqs.h>- U. ]  k# j* z
  39. #include <asm/hardware/edma.h>
    . [& S' P7 {. z- T$ ^

  40. & F  t9 c( l. w1 L4 v
  41. #undef EDMA3_DEBUG$ u: [. @7 X- E1 l; t$ d) _3 z4 c
  42. /*#define EDMA3_DEBUG*/1 U  N+ T5 n- B2 x

  43. ) k2 \% Q3 b4 [4 s' P" \
  44. #ifdef EDMA3_DEBUG( ^9 h# P, z9 A* O5 B5 J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + m/ {: L8 U' f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # V3 J& K3 I; h3 y1 }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ y- U7 ~/ `- l8 D
  48. #else
      F' Y' b' v% u& L" X$ @0 x
  49. #define DMA_PRINTK( x... )
    6 t# R$ B- ~! X
  50. #define DMA_FN_IN
    $ ^  B8 R* |& w0 b3 Z! ?
  51. #define DMA_FN_OUT2 X# ?0 |# B% F4 l
  52. #endif4 t* W( e9 Q* }' h& E" t

  53. $ R' W; D: p1 f5 s" H' ^6 N: v) L& D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 Q6 F: p1 T6 Z4 o  B/ p
  55. #define STATIC_SHIFT                3- E- X1 M2 j: p: H& U
  56. #define TCINTEN_SHIFT               20
    # _0 ?, g# H; I* @5 }
  57. #define ITCINTEN_SHIFT              215 O$ g* g: j: ]
  58. #define TCCHEN_SHIFT                22
    / u1 s* c$ I( \: z4 }+ c4 @  P
  59. #define ITCCHEN_SHIFT               230 b: f( Y8 T2 w+ r. y. ]7 f- t

  60. % G, j& Y. D# `2 g' K
  61. static volatile int irqraised1 = 0;+ w2 e2 q( j' L0 b/ y
  62. static volatile int irqraised2 = 0;8 _0 q. p# s6 A& K4 E* y3 s* k

  63. 4 Y' n3 S8 ^% S' n: q# B: B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 {1 x) L- I% _5 ~( y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 O/ [! v8 k. e# q! L3 @) k+ ]  D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; \9 s/ [- Z+ U0 l+ j; T

  67. ) m- C) D: b. V0 D4 y% \+ o  ^7 E
  68. dma_addr_t dmaphyssrc1 = 0;
    ' ^5 F$ b6 p) \. b& m
  69. dma_addr_t dmaphyssrc2 = 0;' O& E, ^+ R" R, g0 q
  70. dma_addr_t dmaphysdest1 = 0;! ^( g% L* _: X% H% f
  71. dma_addr_t dmaphysdest2 = 0;. G! j: n1 W- P, p& H7 a8 W4 S
  72. 6 M, Z& |- y2 a* t& P
  73. char *dmabufsrc1 = NULL;
    * i2 A$ P" q' q- N: H& G
  74. char *dmabufsrc2 = NULL;5 ]. w6 T  C( _$ a" C) w
  75. char *dmabufdest1 = NULL;5 K* g9 R: q7 F6 H: H
  76. char *dmabufdest2 = NULL;; f4 N5 v) z$ Z
  77. ( Q0 m. U, a3 o( p/ J( C' ?
  78. static int acnt = 512;& o; I) _# k! H( m% J5 `
  79. static int bcnt = 8;7 q2 _9 x& e1 x
  80. static int ccnt = 8;  h6 v7 f# Y# i0 C5 D( ?: [& E" D

  81. ; A$ R: ?$ |. K* e7 f$ n3 x
  82. module_param(acnt, int, S_IRUGO);: a6 o$ d( c7 X; m
  83. module_param(bcnt, int, S_IRUGO);
    ( }) |8 s" |+ g0 y2 g6 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ K2 Q; s* _2 ?" Y5 t2 B5 A

/ K$ R! K5 L% c4 I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 ]  e' ~5 D+ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ g1 k* l8 w4 u9 P) ^% r+ Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) \' j9 v: n  ~8 V1 G) P$ [7 p
" f( \  Z' W5 o
1 u% l  m: R( m1 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-8 07:08 , Processed in 0.043241 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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