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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & b* Z9 M2 Q) g+ W
  1. [code]EDMA sample test application
    4 [* H8 O5 f& n: F5 z; Z2 ~: Z
  2. /*  m" Y. P' @9 c& ^1 S- C
  3. * edma_test.c+ T( Y7 t6 H1 X+ q- X% \( b
  4. *
    , ?( o% z* o- i! x3 |; c
  5. * brief  EDMA3 Test Application7 c, j' n9 f3 }( u! L+ m) j
  6. *
    ! ?$ Q* {- {1 C6 H7 B; e% j
  7. *   This file contains EDMA3 Test code.2 E- q8 Z6 |: z+ W! [& C, Y4 v
  8. *# ^+ _; b" e: R5 s5 z% z, ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * n) V/ G# s# S  [2 v  p1 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 {; B. g+ j, t: E/ N
  11. *         TO CHANGE.
    ; s' q9 V4 C0 G( @
  12. *
      ?" w0 U0 ?7 L4 M+ O1 L! ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 j3 V( B7 S: N2 E3 {( P
  14. *; m! p9 O) i( x  t- k! m' D
  15. * This program is free software; you can redistribute it and/or
    ! w- U8 j5 Z. ]! g7 p( p
  16. * modify it under the terms of the GNU General Public License as  j+ ~4 o, [* m. [, G: ?
  17. * published by the Free Software Foundation version 2.8 i$ |1 C5 K1 D1 L/ U. x
  18. *' J& }, S! ?2 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 z4 E. D2 u9 L4 y1 Q) R
  20. * kind, whether express or implied; without even the implied warranty
    8 u2 y$ o- [- j$ c- E' p  ?' A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& _" w/ n: v* R; E" P. i! \% Z( Q
  22. * GNU General Public License for more details.! w$ X7 a" A/ c; E7 b" f4 k8 c/ F
  23. */# p" q; c4 V4 ~# P. t
  24. ) K- t, F8 ]# ?0 V: M% r
  25. #include <linux/module.h>1 x  |9 x/ m6 R
  26. #include <linux/init.h>
    / X# K% A: h  f# Q3 Z
  27. #include <linux/errno.h>
    % M1 c& N: @! W: I& T9 X9 G7 j3 E$ ?
  28. #include <linux/types.h>
    2 l, w8 R$ @6 ~3 x! R; ^
  29. #include <linux/interrupt.h>
    6 n6 l1 c( ]8 j, G( E2 G' i" d
  30. #include <asm/io.h>( R# C* b. V+ O' H: N$ ^3 T- X
  31. #include <linux/moduleparam.h>
    % T5 J! c' g+ U9 O
  32. #include <linux/sysctl.h>( p* g4 z) O- d
  33. #include <linux/mm.h>
    / j  q' m" R* ?. u% k
  34. #include <linux/dma-mapping.h>
    ( f7 C$ J. j5 i5 J$ E" E" p& U

  35. / D9 P$ f. c  I8 t
  36. #include <mach/memory.h>7 a9 K, {* O! I/ ~% v
  37. #include <mach/hardware.h>
    % q" c: ^5 R+ z- u1 O/ x* k- Q* Y! e& e
  38. #include <mach/irqs.h>
    . f! a* S- Y. i. H8 g. \; w+ G
  39. #include <asm/hardware/edma.h>5 q8 @( I% c6 K3 D, o, [' {7 }

  40. - I' w8 J9 U; \2 J! R+ h' ?2 c8 y
  41. #undef EDMA3_DEBUG: _3 f3 E: q0 W' m' A  E
  42. /*#define EDMA3_DEBUG*/
    - F$ T) P' K. `" y

  43. $ }5 M5 X7 d: o# F+ k* |1 W
  44. #ifdef EDMA3_DEBUG
    0 d- D$ R& [7 Q" f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; r) U& D! s* S+ y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 B7 f5 G* L' C$ ^! W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& z7 u1 w8 U* S3 L* O9 B% H5 O
  48. #else
    / V8 G6 T4 ~) h( |; Y: M
  49. #define DMA_PRINTK( x... ): \) Z0 q- x% o& U6 o
  50. #define DMA_FN_IN
    0 V% C/ T8 B  K
  51. #define DMA_FN_OUT
    5 ?$ ]$ {# ]5 y4 `' E% q8 f
  52. #endif
    . O7 W# a3 E0 i' b& C0 H3 z# i
  53. 6 c, K- {! \, ~% s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 s0 B+ \2 x. _% b  u
  55. #define STATIC_SHIFT                3, u2 _+ X5 c$ R  C
  56. #define TCINTEN_SHIFT               20
    ( b# A6 \5 S% ^3 U$ k. I
  57. #define ITCINTEN_SHIFT              21- f4 l9 N0 g; G1 Z: e. Q+ y# b
  58. #define TCCHEN_SHIFT                22+ C2 I5 Z" o' \: X7 ]% S7 A1 |
  59. #define ITCCHEN_SHIFT               23, Y. X9 |# R8 r# U$ \0 c5 \

  60. 8 H9 c9 k! k: s; }! f6 a
  61. static volatile int irqraised1 = 0;5 _$ n# m. r, \# `- B
  62. static volatile int irqraised2 = 0;! e4 O' b3 e- c! v9 P5 L* t* K

  63. 2 l6 }! d9 ~1 L) |' ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " o& v  r5 ~$ _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( I0 ^. a5 ~% _6 @1 O( |3 n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 i6 {& e1 Y3 a5 v& b7 I! C- m
  67. 2 w2 U  G1 L5 R2 W5 y3 i. v3 h" s
  68. dma_addr_t dmaphyssrc1 = 0;9 A* a) I* T* c, u4 E9 }* c
  69. dma_addr_t dmaphyssrc2 = 0;  _7 {6 J+ B( K  x. X% B2 v) \7 }
  70. dma_addr_t dmaphysdest1 = 0;
    * L% w! I" f5 f8 G
  71. dma_addr_t dmaphysdest2 = 0;
    6 @% S8 y" D% a4 C. g

  72. # A' j" s5 \2 T1 D7 V+ O. D
  73. char *dmabufsrc1 = NULL;
    & W" W% P0 q3 S; |
  74. char *dmabufsrc2 = NULL;8 ?* k' v. o, m0 w* [* y
  75. char *dmabufdest1 = NULL;) N- Z4 r! y5 @( p- @4 b- M; b
  76. char *dmabufdest2 = NULL;" Y0 c: r! U' c4 E' k  V
  77. % m- w6 i$ a- B
  78. static int acnt = 512;2 A% t0 j% @! f" M; q
  79. static int bcnt = 8;. g3 ]3 u% r) l$ {
  80. static int ccnt = 8;
    5 H: N# e# a" k3 \
  81. 1 i$ o/ h0 e, i4 k0 a; R
  82. module_param(acnt, int, S_IRUGO);
    ' K! N7 E1 I- j. r* W5 k# v
  83. module_param(bcnt, int, S_IRUGO);8 j, ~. A6 y/ d) j6 M& R9 R, C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 J8 N, O/ {7 x( l
+ C* z3 }. y$ P* f# F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 `: C6 W0 ?- [& u* E& ]. }- a3 t  v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' [( U+ T# z- `  _" E7 n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- |/ k5 K7 u& B4 h, b; m
) t$ T; o1 k% w# R  B, H: o# ^

: q9 B4 g( W7 z1 D" D$ d( S% f+ ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 02:22 , Processed in 0.042057 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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