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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . E6 M; U5 \; t/ @+ n% t& m; M
  1. [code]EDMA sample test application- [* l' @& r* G7 ^
  2. /*& d6 ^# k" t/ r1 Z
  3. * edma_test.c# L1 T( `/ x2 y3 X& u! Z  c0 I
  4. *: I5 C, J- k/ C: i. g& w
  5. * brief  EDMA3 Test Application( F- |! ]: y, Z3 O5 y- F6 Q- q
  6. *5 r7 l; L4 u  p# ]
  7. *   This file contains EDMA3 Test code.
    ! `, y" ^' V# {6 O. D3 I
  8. */ b% J+ l) a, K* h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ E, n; U" A) _5 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) g/ Y/ K8 Q, v* W5 ~$ V  N
  11. *         TO CHANGE.( \- P: V9 {+ V+ [6 Z! [
  12. *
    $ A& M4 V, G2 J3 E# `0 W3 }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 E7 M% A( s$ q' q- ]) q4 @) y
  14. ** c. W4 J1 Q) u, W: I- P
  15. * This program is free software; you can redistribute it and/or
    3 c% h3 O+ x7 k/ h
  16. * modify it under the terms of the GNU General Public License as
    / g, J* [+ Y3 ^
  17. * published by the Free Software Foundation version 2.
    ! r) @# g( v/ _0 N8 C
  18. *0 V6 e+ l. [6 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& y6 I: m5 W0 Y+ y6 d; W
  20. * kind, whether express or implied; without even the implied warranty3 N5 ?- X, d9 Q5 b- M! X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 F0 \) \- V7 W) V$ g; d/ }3 {+ F
  22. * GNU General Public License for more details.8 l6 a9 `" v, X: E( A  |
  23. */
    + c. N* @7 s7 P; Y' b
  24. * j# B/ b! p: v7 y3 V: Y4 E
  25. #include <linux/module.h># f$ E( U% s0 l4 q
  26. #include <linux/init.h>  G% f" h7 p3 s  v2 P# w$ U8 X
  27. #include <linux/errno.h>. p" Q6 P- k$ y1 p
  28. #include <linux/types.h>
    ( ]9 G3 N# T) N5 x. l! W7 K& C
  29. #include <linux/interrupt.h>. ~  K# U1 u) i1 I* N+ c2 t1 Z
  30. #include <asm/io.h>
    : ~$ m0 z( |; u# ~0 {$ @" D/ O" |# O4 A
  31. #include <linux/moduleparam.h>4 C( R$ x0 l% D) F
  32. #include <linux/sysctl.h>' a7 X  ~7 V+ u0 l3 B3 ?) e
  33. #include <linux/mm.h>7 K" A) k; u5 ^. c6 X
  34. #include <linux/dma-mapping.h>
      G4 g. X% ?! M& X- ^# A$ \
  35. 8 r0 J$ z& f; b, R+ p5 ^. c. f
  36. #include <mach/memory.h>
    3 v5 c) X1 W# ]/ c9 h) m: W
  37. #include <mach/hardware.h>
    $ o6 ?% {& u  Y& a7 E! ^
  38. #include <mach/irqs.h>
    3 z3 G+ k! |9 ^& {5 Q- q) d
  39. #include <asm/hardware/edma.h>
    ! B# Q2 Q9 H$ j) K% F5 f

  40. 1 G" Z) o! l0 W$ m' u; N
  41. #undef EDMA3_DEBUG
    + Y6 e8 Q6 L! f; v
  42. /*#define EDMA3_DEBUG*/
    ' A) d  Z  e! T$ [
  43. $ J" x- ~; I0 h* O2 v+ C+ X
  44. #ifdef EDMA3_DEBUG
    / \' O5 g2 @  |( p, S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 H) r- k' b8 h4 y& i* [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 ?" Q$ C% z, I6 B2 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( A! M( `# k: [6 f" J: q: v
  48. #else7 E/ a3 {+ j5 h6 ?6 G
  49. #define DMA_PRINTK( x... )
    * k/ U& u# f0 f. l2 W
  50. #define DMA_FN_IN9 v$ ~7 M2 W* h1 U+ g" o, b. m; C
  51. #define DMA_FN_OUT
    ( V& I) n3 n$ Q/ ]
  52. #endif
    $ U* E9 M# X4 s/ W" i( ^

  53. ' k/ e- E- d# B7 x: v* A, W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " L( h6 [. X7 W$ }8 e
  55. #define STATIC_SHIFT                3
    2 H7 M! V$ Z* G9 I" S
  56. #define TCINTEN_SHIFT               204 f& j1 z/ C1 {" H/ A7 e
  57. #define ITCINTEN_SHIFT              21$ O- b/ ^" E% B4 W9 |( ?
  58. #define TCCHEN_SHIFT                22
    6 x! P5 t2 ^  i6 H8 W  E$ Z& e  a
  59. #define ITCCHEN_SHIFT               23
    $ o  a) R1 S, R, y$ }

  60. 5 i( w: E! v: {% o! c/ K- v
  61. static volatile int irqraised1 = 0;
    . w6 S, B( Z) x% Z9 @3 n( q: \
  62. static volatile int irqraised2 = 0;
    5 R/ l- [' v. H- i# V
  63. ; ?! n6 Q( M# n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& T/ E4 i  G. c. L7 h. w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 ^! [5 R$ q% q. z2 f& @0 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' A4 v" Y7 J/ m' l/ P/ f( _" I

  67. , f. S& Q7 y2 z4 J/ i
  68. dma_addr_t dmaphyssrc1 = 0;% Z- r+ J0 O' Z! ]* W# \& C& n
  69. dma_addr_t dmaphyssrc2 = 0;
    : O; `1 Z/ |. ~* e8 K, m
  70. dma_addr_t dmaphysdest1 = 0;# m. D5 m9 L& t$ I! Z  [
  71. dma_addr_t dmaphysdest2 = 0;# i+ o& D+ M' B1 `/ e" {& k. E
  72. + C2 \, g0 [: h! R) f6 e+ ?; }3 k
  73. char *dmabufsrc1 = NULL;, y9 G& K$ g- u% L1 c) ^( w
  74. char *dmabufsrc2 = NULL;7 u( ?; L* X9 H) p. `
  75. char *dmabufdest1 = NULL;
    " l1 g; w8 y+ s
  76. char *dmabufdest2 = NULL;2 }- P9 w- A" p" P  D$ \  {+ U3 R

  77. 5 I4 a- I  R( h: W4 z
  78. static int acnt = 512;
    . I% ]9 N$ ]  l' r
  79. static int bcnt = 8;2 ]# C' o  \" d" j/ }
  80. static int ccnt = 8;$ L; l- A+ w7 h7 {+ V$ l9 s
  81. 7 r4 `- o: U$ h" k' w& ^
  82. module_param(acnt, int, S_IRUGO);
    ) b& ]6 R2 T3 R. f- w- G
  83. module_param(bcnt, int, S_IRUGO);3 u( E0 o$ ]/ O2 U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 }9 i( |4 A+ [3 K0 @0 @
6 j& C2 h$ l# [7 ]! y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 [( }8 W& Z* K5 r) L* }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( P) c. f" v% c( E9 H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; A% {: O: T7 q3 g; u  y2 ]4 _  H* y3 l

$ `: ]! w6 g5 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 23:47 , Processed in 0.044824 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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