OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # d! }: j, g# g# o" \! F) c
  1. [code]EDMA sample test application
    / i3 M# B1 ^  p3 D
  2. /*. j* K$ t/ Z: f4 g$ g; J& K5 q' l
  3. * edma_test.c
    $ v9 C6 M2 C+ P5 b& C
  4. *! e9 n2 o; ]! o& |9 k
  5. * brief  EDMA3 Test Application7 D  X# I, U: u. `4 j
  6. *6 O# s- U' U2 ^- w6 E- G
  7. *   This file contains EDMA3 Test code.
    % U4 _% I% Z. b
  8. *
    0 p& |' U: v4 b1 N  `) h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  Y7 z0 `* a/ D$ v" b  i: p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 b9 W: i. `9 f  @  _$ l
  11. *         TO CHANGE.3 y* J2 J+ k5 T% d  o
  12. *
    $ R* i2 P: f3 w+ ~( u/ ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! o8 s( X# |3 e; Y: i
  14. *" v) e8 z, C% Q. O) [
  15. * This program is free software; you can redistribute it and/or1 }3 ^8 i6 N# W/ W6 V6 K0 _
  16. * modify it under the terms of the GNU General Public License as  w# r' @# X, w6 T7 |0 Q
  17. * published by the Free Software Foundation version 2.
    # _& C8 N, C9 }
  18. *$ T) g2 K& R5 c6 Q4 W: s2 x0 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : S, ~+ i! z2 V' L6 f' i3 z, o
  20. * kind, whether express or implied; without even the implied warranty" b2 q& r8 H* f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 q  {; A7 j5 o$ w6 o1 ^5 U
  22. * GNU General Public License for more details.( h$ t! k) ]( q# l* i9 ?2 _
  23. */
    $ Z9 Z) Y8 \( ]# Q0 C
  24. & B- L# Z* l6 z
  25. #include <linux/module.h>
    ; l- I& B  g  p: z
  26. #include <linux/init.h>
    9 ?9 O! a4 b" M( `7 f* ^' N" |
  27. #include <linux/errno.h>
    8 h# C/ f( |7 a
  28. #include <linux/types.h>
    / _5 r; f8 p. q9 t& ^6 d' Y8 o
  29. #include <linux/interrupt.h>0 N2 ?, z9 U3 T% u5 d
  30. #include <asm/io.h>4 w6 G( ]6 s: \
  31. #include <linux/moduleparam.h>
    - O8 \1 E6 t9 J) c& y, U. ?
  32. #include <linux/sysctl.h>
    / b* z. T& O& K  l, y1 F
  33. #include <linux/mm.h>2 U# u# g2 ^" R" N3 c, b+ n
  34. #include <linux/dma-mapping.h>) f+ Z3 @3 M0 J) b* ]

  35. ' z+ a6 B3 a: h% G: _5 d
  36. #include <mach/memory.h>& }7 u. N+ N$ o' q9 m1 x( T/ r
  37. #include <mach/hardware.h>6 X9 J! D8 m! q0 |: D& g
  38. #include <mach/irqs.h>. I  K  J& G, g) H2 {
  39. #include <asm/hardware/edma.h>
    9 f+ |: O. N3 O+ A" S' G3 q% ~

  40. ( }3 i$ H$ M7 T3 h% `
  41. #undef EDMA3_DEBUG2 Y& H2 @1 s0 Y
  42. /*#define EDMA3_DEBUG*/0 N7 U1 G- d! `2 j- P' i+ W
  43. . K6 L2 \$ E( b6 Y
  44. #ifdef EDMA3_DEBUG
    * b! C: M6 c  ~( L$ T/ ~" n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + o; O9 M$ E- @& }+ {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! X6 [: f4 p1 i  E$ _' h# ?2 a! t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 V( h1 q. l* a
  48. #else8 a9 `3 p6 t" ^) {- m( c
  49. #define DMA_PRINTK( x... )+ v- l; {/ @( O& R' v  G1 h
  50. #define DMA_FN_IN
    6 N$ p2 x" Z( J9 n( T' e
  51. #define DMA_FN_OUT- P+ K$ e5 P& `; J1 ]" z( R
  52. #endif, h' G% E, |- n4 o6 `9 V
  53. , K9 N2 {8 u; h9 C! b8 n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 w! U( C( |- O* A3 c1 |' @
  55. #define STATIC_SHIFT                35 g/ `: d2 h* @0 I
  56. #define TCINTEN_SHIFT               20+ \# T5 W# @9 ^; L
  57. #define ITCINTEN_SHIFT              21% o0 A$ S, y: Y) n1 `" A! S# E
  58. #define TCCHEN_SHIFT                22* S" |- L+ ~$ o9 h" S/ N
  59. #define ITCCHEN_SHIFT               23# K2 J. P, G' _& R# v2 b# h( \

  60. . C3 T- O8 }" |, t- A" s, `" q' W: k
  61. static volatile int irqraised1 = 0;
    - e1 d( {) U7 B) a+ U$ c' I1 d4 f
  62. static volatile int irqraised2 = 0;) ?$ e# \  b, j0 |% n' v! C( `

  63. & E1 P8 A' i# B9 i2 `' h! {5 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, t% H1 R' x8 M* \/ I# E7 l8 W+ f% P8 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      S$ v/ @3 g. d. I2 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' J  H, r0 G1 ]6 {. h) ^* B

  67. / k  W. j# [1 K' a4 ~, u: c! A
  68. dma_addr_t dmaphyssrc1 = 0;& k$ V, j- [2 b2 x7 |4 U
  69. dma_addr_t dmaphyssrc2 = 0;6 S$ o1 L6 m; W7 j8 ~$ o" Y
  70. dma_addr_t dmaphysdest1 = 0;
    1 Q$ P- a' c7 `9 }
  71. dma_addr_t dmaphysdest2 = 0;
    : h/ y" Z- [* B7 `( V
  72. - O% V; t( k, C$ e: z  b) ~- }6 k1 v
  73. char *dmabufsrc1 = NULL;
    # `5 h8 l1 F  F, X* w  V/ F7 i
  74. char *dmabufsrc2 = NULL;* v8 m! K. v" |9 M1 C. ]0 `; ]
  75. char *dmabufdest1 = NULL;
    ; a; B, e, X' F- m6 C
  76. char *dmabufdest2 = NULL;
    ' @0 I4 w* a8 I6 ^( o& P5 ^

  77. - Q% m/ k( N' N) D0 \4 ?0 C
  78. static int acnt = 512;; b4 r+ N; S- A7 }6 a% K5 o+ G
  79. static int bcnt = 8;
    5 G9 @; [% \: O1 L* _
  80. static int ccnt = 8;% h8 n/ D: S0 k
  81. 5 P& P3 u3 \! Z0 ^8 h4 Y
  82. module_param(acnt, int, S_IRUGO);( f& i% O3 ?9 x6 W1 w& W- g/ H& [, V
  83. module_param(bcnt, int, S_IRUGO);) w0 l9 H/ p  c% y; U+ F5 [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  ~) m7 B4 e7 [' r5 w6 m( E

4 `2 H+ N1 W( x, v9 C, }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. J! a: [! i6 X8 }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& \3 d3 _1 J* V3 P' |; G; c! u$ I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! C, J% P  W+ O6 V+ p& ~+ w/ y. a7 P; ^$ Z, q
3 O: {) G% {1 w" b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-21 13:36 , Processed in 0.040986 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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