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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + ?  s: `) L- B7 D/ a: f! E' b0 k
  1. [code]EDMA sample test application) y0 |& R+ W8 X8 O
  2. /*1 q1 ~- j, C' T
  3. * edma_test.c
    / w. E2 u) c0 C$ l. j/ f
  4. *
    8 Q2 d/ d2 r  r+ b6 U
  5. * brief  EDMA3 Test Application3 N" V; u- S* m  r, ]. A& B1 W
  6. *
    & [2 T3 _; p' R+ x% O6 `6 j
  7. *   This file contains EDMA3 Test code.3 v4 \" H+ S0 T% E- B( c0 ^
  8. *
    % V& ?% P6 P* p! h; C: z/ F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% C" y7 `: K6 k; R5 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! _1 J  T. m/ R) }1 B6 z
  11. *         TO CHANGE./ |& _! A4 i) C: P$ Y$ {4 y, I
  12. *6 E! W! [2 R$ W% A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 |: a; n0 A1 B
  14. *- B# H$ n# V& F# k% Z$ E+ z) q: l
  15. * This program is free software; you can redistribute it and/or
    - l3 I2 B$ g: I+ C0 W% N4 u6 q
  16. * modify it under the terms of the GNU General Public License as
    % n) U+ w; c& W
  17. * published by the Free Software Foundation version 2.4 l, I: u: N* d% [) P+ P
  18. *6 D; C2 j/ _  Z! i9 m: t$ ^* F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ u' A, c& e. R4 g3 c2 W
  20. * kind, whether express or implied; without even the implied warranty
    0 H2 _# r" f/ J6 m* r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 r. q3 e# a  d- `
  22. * GNU General Public License for more details.
    7 s, K/ l" @4 W0 L# j; L
  23. */5 S+ s; M: r. N
  24. 0 B, G- D$ P1 w, P; x3 r8 n1 Z
  25. #include <linux/module.h>
    # i- S+ C* d" c
  26. #include <linux/init.h>
    / y$ C# u( }7 v  O6 U( j
  27. #include <linux/errno.h>
    1 s0 O9 n! K" z, Q3 {- r, i# ^
  28. #include <linux/types.h>* b9 J4 T3 c  \
  29. #include <linux/interrupt.h>
    ( c$ w7 [) B. \5 V: @- C* n
  30. #include <asm/io.h>
    ( a6 z; v! N; d, w
  31. #include <linux/moduleparam.h>1 l1 l7 ~9 M5 x. ~% O( C
  32. #include <linux/sysctl.h>
    % N7 k5 X6 Y. C5 B
  33. #include <linux/mm.h>
    , I4 c/ o8 H  m! P
  34. #include <linux/dma-mapping.h>
    : u0 G6 @7 b2 \
  35. 0 J0 z: T1 H. a6 z/ w) @* |
  36. #include <mach/memory.h>$ e7 |3 o5 g1 ~& I
  37. #include <mach/hardware.h>
    3 A' v% j1 O' W& [. o6 {+ \; `
  38. #include <mach/irqs.h>
    1 w( Z, y  c( T/ x2 P. b
  39. #include <asm/hardware/edma.h>
    1 T% v% R8 `" L, g6 Y5 I

  40. 7 e2 K) B; Y- \
  41. #undef EDMA3_DEBUG3 }; m! I, J1 ?: l( \8 \
  42. /*#define EDMA3_DEBUG*/
    2 C) b$ q6 i: G, }9 l; v3 W( M
  43. ! ?. G# V  l7 X) i. A: e( X
  44. #ifdef EDMA3_DEBUG
    ; l& q# v- k) x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 k( n& R$ w( A- [& t; C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 o8 q0 l! }7 D9 M# v9 i  b# X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ G  Y. ~3 ?4 x; @% i' J
  48. #else
    9 C- ^0 L3 z1 e
  49. #define DMA_PRINTK( x... )
    2 U1 t; v, X- k# i
  50. #define DMA_FN_IN( W4 H! P+ n. z- m3 s! t
  51. #define DMA_FN_OUT
    - |; x3 c% n4 D" @/ f" {6 {
  52. #endif
    ) H" Q# B( V3 L% A8 v( g

  53. / A; _8 r& m: Z! ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 x& q2 V, g# H! @
  55. #define STATIC_SHIFT                32 @+ `& v: C) t( L
  56. #define TCINTEN_SHIFT               20
    0 _% Z2 ], A6 }
  57. #define ITCINTEN_SHIFT              215 ^' n* b& V: `) Z2 O
  58. #define TCCHEN_SHIFT                22
    5 R( _2 _- ~# a$ t; `4 M' f
  59. #define ITCCHEN_SHIFT               23( }  Z9 O; |8 x' u% G. d% \
  60. 6 H# t6 c! `: A2 W4 H  [0 a
  61. static volatile int irqraised1 = 0;0 s5 \6 x4 J, O+ e) [
  62. static volatile int irqraised2 = 0;
    , R1 H) ?; @9 x+ H$ Q% q* n
  63. ' h9 K5 t, L! e% B+ I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! |5 q% s# [" r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ g, G9 Z$ O$ C" ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# d6 w6 O/ w* H
  67. . W/ ~& m, ~/ a" W/ _+ V' M: _
  68. dma_addr_t dmaphyssrc1 = 0;$ J. v: p' T3 f! }! V
  69. dma_addr_t dmaphyssrc2 = 0;
    & Z; W3 l+ j0 S
  70. dma_addr_t dmaphysdest1 = 0;2 ?2 |9 Q  V- b& C# [, ^; @
  71. dma_addr_t dmaphysdest2 = 0;
    9 J% s7 |, l8 [8 @7 b) n- z: R
  72. - N4 U  U* g) Y7 n. r# O2 y# D" n
  73. char *dmabufsrc1 = NULL;  `, `$ l6 N! y# M9 a$ f/ N: N
  74. char *dmabufsrc2 = NULL;5 S- |8 n1 Q' C  [8 }4 L
  75. char *dmabufdest1 = NULL;  }9 P7 O* c+ N! ?' j! h* a! N% d# t8 `
  76. char *dmabufdest2 = NULL;
    " M. G& B8 B) f+ M

  77. 9 T. R% J* b- t% Y- N
  78. static int acnt = 512;2 l1 g+ e4 Y- r9 v# C
  79. static int bcnt = 8;6 M- r) m0 d: H! U, E) q$ Q+ `
  80. static int ccnt = 8;9 t+ W6 O6 W0 C9 k8 B
  81. % A* Z5 u4 A6 k8 F! j
  82. module_param(acnt, int, S_IRUGO);) e0 L5 @; r' V  H. R
  83. module_param(bcnt, int, S_IRUGO);
    6 t8 L: g0 ?0 A: l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 B0 y' w0 V1 B( E. T) z! h
5 W1 a6 m5 b' |/ D. n0 G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 H7 J8 U( Q+ J7 y3 \& _3 y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& E. S' y2 a2 f: d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 X+ y' O; Z" |3 F/ o
( I( O9 s: F& G- N) G
" T# F  @1 B' c) O" j1 J2 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-23 08:49 , Processed in 0.036047 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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