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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 \- e' k1 h" b. V* a/ ~
  1. [code]EDMA sample test application
    ) X* ~% q+ ]8 y% ~1 W2 a) y' E  Z
  2. /*
    7 J$ L& S$ G4 T& {9 E' o  E. |- ~
  3. * edma_test.c
    : ^. B7 t) M& v0 [6 J, }! k
  4. *5 f* G" J8 V3 z
  5. * brief  EDMA3 Test Application. ~6 ]( z* u5 q. ^
  6. *
    3 n. e( ]' B4 S3 f
  7. *   This file contains EDMA3 Test code.4 M# Y' Q9 o1 J8 ?+ m& ]7 n
  8. *
    3 [2 v$ {8 |5 _3 [7 k+ v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& j4 P4 ^; s. c7 n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 |- ]2 y( e( p0 W4 l7 t: a
  11. *         TO CHANGE.
    9 p/ u! L$ E4 z6 Q% ?7 M
  12. *
    - X  X; V6 u% `+ s" _/ u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ B9 E+ B0 R- {  E
  14. *
    4 |3 p/ U3 Z) f9 e) t0 R! Z2 j
  15. * This program is free software; you can redistribute it and/or
    & m9 [) Q- ]' |. s: c" I
  16. * modify it under the terms of the GNU General Public License as6 {1 u# ?" m% T6 @% S, Y& {& F
  17. * published by the Free Software Foundation version 2.
    $ \" T9 Q2 h- k7 T
  18. *, g. X  R! y0 e1 ~# Z) S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + h( v; l/ F2 Y1 c  ?6 L
  20. * kind, whether express or implied; without even the implied warranty. H3 }  G* B  C+ N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ J& }/ A  I# H! W
  22. * GNU General Public License for more details./ e6 j+ E; A, F, \( j
  23. */' B$ |8 ?1 u" s( D: b( a

  24. 5 @- x' s& W8 q
  25. #include <linux/module.h>* a  |. r* z5 d* b" A2 o+ i3 A
  26. #include <linux/init.h>
    0 A( B; P. L0 i3 e# Q( [7 i
  27. #include <linux/errno.h>
    . _; m. u# @& O! {' A, v
  28. #include <linux/types.h>
    + v4 s) s5 F1 t6 f. v: K. h
  29. #include <linux/interrupt.h>
    9 ?' |1 O" v) w) p0 I
  30. #include <asm/io.h>
    ( _+ ]- ^/ a3 V. y3 h
  31. #include <linux/moduleparam.h>. N3 a# w( M( x: l4 I* g
  32. #include <linux/sysctl.h>
    1 S5 @2 I) r) ~2 A5 J/ ~2 G
  33. #include <linux/mm.h>
    0 E' i5 `" \9 Z, a
  34. #include <linux/dma-mapping.h>- g7 Q- @2 T: v

  35. ! a+ s5 V! q7 E7 M  A% l' Q) `
  36. #include <mach/memory.h>
    ( d& s% E2 T: t0 C8 C6 h  _
  37. #include <mach/hardware.h>$ f/ }7 h7 t; i) c6 D
  38. #include <mach/irqs.h>( K; D7 R$ e! p% O5 l" \; {( u0 q
  39. #include <asm/hardware/edma.h>
    / R4 ^) i$ ~$ |3 j7 B  Q: R
  40. 7 `$ D0 j: _* k6 U0 `, S* `' U
  41. #undef EDMA3_DEBUG
    - E5 g: x# n; _1 q
  42. /*#define EDMA3_DEBUG*/
    5 X/ z1 U# ~% e; s( _5 Y" p% [

  43. 1 H. x2 ^& y$ k; R: y1 E" |
  44. #ifdef EDMA3_DEBUG6 J" E: `! l' ]. e! f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 K8 |/ v' [7 R, p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 i1 ], V9 H. A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# [0 k+ M/ E, M1 Z
  48. #else. I! H+ T  {! b; B0 g' C0 i. u' ?
  49. #define DMA_PRINTK( x... )
    0 U; I! e5 D1 f- t- N2 y
  50. #define DMA_FN_IN
    3 X* L* C3 h& L" c$ `
  51. #define DMA_FN_OUT! h; L; |& l2 x! K
  52. #endif' o0 X5 G" N  F3 Y; M( W$ p( ]" K7 @
  53. 4 M0 m2 ?' j& g9 M" c/ O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & V9 i# e5 d3 l- y# M$ G, n
  55. #define STATIC_SHIFT                3" b5 n# T+ V! P$ c
  56. #define TCINTEN_SHIFT               20
    % Z$ [8 x3 A1 [% w& U! P1 t
  57. #define ITCINTEN_SHIFT              21
    ( j4 K& m8 I) P
  58. #define TCCHEN_SHIFT                22
    + G' G7 m# u$ p7 C! d7 i) Z
  59. #define ITCCHEN_SHIFT               23
    4 K$ g' r$ K2 a% }2 h
  60. , g- X  N4 j6 V3 |# e
  61. static volatile int irqraised1 = 0;. b. U) |3 y' p  ~8 q9 k( \: Z7 x. @
  62. static volatile int irqraised2 = 0;
    0 ^: [" D' ]9 t: Y1 C  L- f

  63. 6 m# q9 Q) |& o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ W$ I7 e# k. P0 H, O9 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 Q. _4 {7 X- Q% c% m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: f4 P% {" T+ ^2 p/ J  I& G! Q0 b

  67. 8 o) A& l5 }: M1 t4 ]
  68. dma_addr_t dmaphyssrc1 = 0;
    6 l6 u* A3 P0 ^6 a; [* V1 q
  69. dma_addr_t dmaphyssrc2 = 0;
    - D0 F4 [  Z" }2 X2 e7 `  o5 c  f
  70. dma_addr_t dmaphysdest1 = 0;6 m, ~' Q  Y/ k
  71. dma_addr_t dmaphysdest2 = 0;& x5 f' z7 W! P

  72. + A9 p* c! G! j
  73. char *dmabufsrc1 = NULL;
    6 y' D0 G$ d# T* R% H% `
  74. char *dmabufsrc2 = NULL;
    * d7 ^) I4 j$ E3 I- o6 w
  75. char *dmabufdest1 = NULL;6 m/ J% h5 G& J! q* `9 y5 ]' d" s4 A6 W
  76. char *dmabufdest2 = NULL;# l9 k0 B2 j+ v1 Y0 I, Y

  77. , N  c2 o& u! z5 B- ~' Y( d
  78. static int acnt = 512;
    / Y4 P6 E- S, B' k6 X; m7 L0 j
  79. static int bcnt = 8;
    ( P& z: m, V7 @" w8 K# J# ^, c
  80. static int ccnt = 8;5 h$ d, P8 ~" B$ @5 f* [- M3 ]
  81. ) s3 z$ i  r! c6 [. `) e  T
  82. module_param(acnt, int, S_IRUGO);
    1 f" b: a  f. Q* q5 n& {9 A& m) Q
  83. module_param(bcnt, int, S_IRUGO);, M6 p+ ^% y6 n5 Y5 B# T7 g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, F+ B- D$ G! [! G* Q
0 }: b9 s* L. U- C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ u2 X' f5 ]4 ~$ y  p) g' Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; B- a, C$ }, y8 o" P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) m( S: A! m, K8 W  n, ^3 n8 ^8 H- f8 N1 ?+ f
- Z; R# ]9 P& D% u$ v3 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 06:34 , Processed in 0.036842 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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