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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : a1 ?3 a% y. b- ^8 o
  1. [code]EDMA sample test application; |: s* k+ t) _+ c- `1 r, s& g, i
  2. /*
    - o& E, k. c1 Z) h
  3. * edma_test.c. o* n5 r) v; r( ^4 C
  4. *' g$ R1 G+ F  g
  5. * brief  EDMA3 Test Application1 k+ O. m; X2 A8 K& [' T1 Y
  6. *
    3 o& [) x! q! @$ o2 [
  7. *   This file contains EDMA3 Test code.
    1 J' J0 G2 _1 T& L/ p
  8. *
    ! G. P/ j/ u) l5 O% y0 T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 u$ n0 o% }& T- ]* v& @6 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* O" i/ Y$ t6 H. G, k
  11. *         TO CHANGE.. O, o1 P& b( \& L0 S8 E
  12. *( S2 l: Z) `7 y; y, g) c7 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . R5 g# A, _6 X! K
  14. *' L2 l9 t7 j5 g9 B% W1 a2 O) J
  15. * This program is free software; you can redistribute it and/or
    * s1 N$ J8 J: g9 ?' C
  16. * modify it under the terms of the GNU General Public License as
    6 m! p% \1 w8 z2 V; f* z" ?8 c
  17. * published by the Free Software Foundation version 2.
    & b( H1 H/ _# I: |
  18. *$ H5 V$ Z) Y3 `: K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 [, r% i' F2 u5 \" |) O
  20. * kind, whether express or implied; without even the implied warranty8 p3 }, @9 R- h4 B7 H9 f$ Q6 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 ^" V3 y. b5 [2 I; T) s
  22. * GNU General Public License for more details.: a% Y- ~6 c' ~
  23. */5 l1 [7 q2 a8 L. t7 ~% l3 s
  24. 6 Y: f3 Z% n* u1 b( x3 J
  25. #include <linux/module.h>
    & S! R8 ?( L" Z. X/ ~! l! a
  26. #include <linux/init.h>
    , n3 K! L1 i& U! B9 }" P
  27. #include <linux/errno.h>$ k) ~- I/ n" w' N
  28. #include <linux/types.h>
    : N7 ?0 n4 P! i1 G0 R
  29. #include <linux/interrupt.h>
    ) B9 P* W, [- L- Y' y
  30. #include <asm/io.h>
    ' ]$ ?2 ^5 k& p! s3 G
  31. #include <linux/moduleparam.h>
    : _1 |7 Z  T) f6 x! F
  32. #include <linux/sysctl.h>$ @5 }( N- g# y/ |, G
  33. #include <linux/mm.h>- k4 y2 \- k0 |2 D4 U  u# i+ o. L
  34. #include <linux/dma-mapping.h>
    . H( t7 K3 [/ I- h' [, H6 C

  35. ' J7 E( [! J& u5 \* P* d; _
  36. #include <mach/memory.h>1 r  b2 |. b4 J1 V% y
  37. #include <mach/hardware.h>/ {3 S, m; v* L! f; l: `
  38. #include <mach/irqs.h>  f; r+ G, V1 w; }0 w
  39. #include <asm/hardware/edma.h>
      H. N6 m& R0 r/ P! p& i

  40. " j3 \& }1 y6 K2 ]: t# C" v
  41. #undef EDMA3_DEBUG
    5 j8 e% S" v: @3 ^, f
  42. /*#define EDMA3_DEBUG*/
    % ~* `6 F) s  C  d- W
  43. 2 U8 Y* I% q( A9 n  Z& _
  44. #ifdef EDMA3_DEBUG) A; u  x& k% D- A" i( C5 [# F1 f. o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + s! M5 H5 b4 h% q7 e- d" Z$ ?, u# D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& v3 t/ Q. k( |9 `- ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 X  D% P. L- ]5 j+ Z0 A
  48. #else* Z* `! m7 q2 u7 K( H& B
  49. #define DMA_PRINTK( x... )! C6 H+ S7 ~  h
  50. #define DMA_FN_IN
    2 t9 c- G' K) G. c# Y+ r) N
  51. #define DMA_FN_OUT3 u8 b! }% O! k2 @
  52. #endif
    % j5 K/ v* H% c8 |, S9 d% b* Q

  53. ' k/ |; P/ J4 @! v! D* G8 `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% g# X2 E; B" k
  55. #define STATIC_SHIFT                3
    ! C) [/ U, r8 i# l. B2 }  B4 p
  56. #define TCINTEN_SHIFT               20: k8 O3 m* s2 t( n
  57. #define ITCINTEN_SHIFT              21
    % `! d2 y$ i* c; L) E- O) [
  58. #define TCCHEN_SHIFT                22
    / a/ f0 ]; c$ a: u# c
  59. #define ITCCHEN_SHIFT               237 Z# q7 e  {! P- U9 s! I/ M
  60. 1 G6 x4 R1 u# a7 Q) ^  P8 V( Y
  61. static volatile int irqraised1 = 0;
    . k$ E2 M, ^, R
  62. static volatile int irqraised2 = 0;
    7 p$ T4 z0 \8 s5 i/ [

  63. ; w+ o. @# M9 L# l# t& L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ v2 a$ q  U4 H/ ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . O4 b- ~3 E" c" J! g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ T4 U3 J0 ~1 V/ O/ a5 T

  67. 7 v3 Q6 ]# v% _9 |4 E
  68. dma_addr_t dmaphyssrc1 = 0;
    : B) K! U' O& `! h
  69. dma_addr_t dmaphyssrc2 = 0;
    - S# a+ J: A. M* Y5 r3 a
  70. dma_addr_t dmaphysdest1 = 0;
      N; ?. C( c) P  Q0 e8 e3 j
  71. dma_addr_t dmaphysdest2 = 0;
    ) t1 g+ e( E: m. [8 Y6 U1 j

  72. 4 O) C7 {& G# ]
  73. char *dmabufsrc1 = NULL;3 F& b( A- e- u/ l' l% _0 z
  74. char *dmabufsrc2 = NULL;
    " K& O+ ]7 @& Y! P2 N
  75. char *dmabufdest1 = NULL;2 @8 U/ Q! p- S. v
  76. char *dmabufdest2 = NULL;4 s; Q/ \# E5 i
  77. * i# @1 {3 z8 J
  78. static int acnt = 512;
    % g7 U0 H$ K* M/ v+ w& E
  79. static int bcnt = 8;# `( s( `  ~! ~& y
  80. static int ccnt = 8;
    / b2 q0 f' D2 b9 b5 a( H+ b

  81. - N) [/ D% q( x
  82. module_param(acnt, int, S_IRUGO);& h3 m  Y0 e4 i7 ^  t' _8 S' G; g4 Y8 X
  83. module_param(bcnt, int, S_IRUGO);
    + v& T. O1 G% o+ ?" `3 h% v8 W$ ?  r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( L) r0 N3 f, s! n  ^) x
8 y# n0 ~1 s3 N" ?$ E8 D, a0 L) R; v  _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. _8 S1 @+ Q1 P' {! ?4 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: ~5 ]  K$ p, y, n; Q$ v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  a6 G# b7 `# }6 q8 P4 z' O
  l, B. ]4 _& |/ c1 E3 R5 I0 P8 k
5 v: \" F& E& I$ j* V  v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 01:24 , Processed in 0.040106 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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