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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # b# u" b. [! G  ^8 w& ?
  1. [code]EDMA sample test application* Z: T# ~8 v  A. V6 q+ V4 U
  2. /*
    2 G% e7 `- {7 `2 A! W+ b9 X
  3. * edma_test.c
    ! Y0 R# P! j, r# h# v$ x- ^
  4. *0 y' b+ c6 R' q% I
  5. * brief  EDMA3 Test Application
    - k* C5 N( `* A8 C
  6. *6 [, s! s. ?+ P. \0 l" d7 k" n
  7. *   This file contains EDMA3 Test code.! L$ d! l; o. Y0 v: z8 J
  8. *
    ; G/ w- z- a8 ^' d( N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & t% D8 h; ]: p0 U! u$ |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 g8 H) C2 o- B1 R, d+ f
  11. *         TO CHANGE.8 A0 o* V$ f% G; Z, _- z9 v) X6 x
  12. *
    1 Q/ X$ E. ?3 x8 ^" M# t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % F) D& l0 Z5 ~8 |
  14. *
    , |. N5 h$ ]" e% n3 z
  15. * This program is free software; you can redistribute it and/or/ y6 A* [8 @0 X+ C
  16. * modify it under the terms of the GNU General Public License as
    / T" c( u: e+ \, c  C4 O4 a
  17. * published by the Free Software Foundation version 2.
    ! O6 U- M7 X2 ?# a1 X
  18. *" `! k4 R# W& `, R3 m% j8 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  D5 j# S  Q% A2 j
  20. * kind, whether express or implied; without even the implied warranty
      N& y( Q) F1 o9 {* a7 h2 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 k0 p6 q( z1 h3 x0 a. V
  22. * GNU General Public License for more details.
    + P# l( n+ e. l5 ~
  23. */
    9 @- C1 J) Q* m* V  \* m+ f, [
  24. & g9 @! r6 a; r* M! ]4 T7 J1 O
  25. #include <linux/module.h>
    1 R. ]- j: k+ L9 @4 d) t5 O
  26. #include <linux/init.h>0 q9 t7 Z' I' Z
  27. #include <linux/errno.h>
    , c* k3 D3 x+ a6 V1 x% _8 r" ]
  28. #include <linux/types.h>7 [7 n7 K5 F' C! i' P! ~
  29. #include <linux/interrupt.h>
    , B  u# K, T  D" w' l( m1 h
  30. #include <asm/io.h>
    7 L+ W/ A1 l, @4 A/ m5 G' g
  31. #include <linux/moduleparam.h>4 p" n4 `6 Y. f4 F3 d- k, z& S
  32. #include <linux/sysctl.h>& _0 Z" E* H6 R- n5 c8 B9 U3 S
  33. #include <linux/mm.h>6 T; e" w; G2 s' i
  34. #include <linux/dma-mapping.h>
    ' Q4 q% F( G( K/ L$ W, |; M2 `. M

  35. % ?8 r* L: I, c! g. V2 Z$ Q
  36. #include <mach/memory.h>9 \$ @5 x( o) d9 Q+ z4 i/ Y' X
  37. #include <mach/hardware.h>1 B  s' k. Z. [! b& N/ f
  38. #include <mach/irqs.h>
    9 x: i9 n: t" R: y' u$ p
  39. #include <asm/hardware/edma.h>
    : y) H9 x2 i" |1 s

  40. 6 Q# \3 _$ t4 h$ o) K/ l7 H& s5 j
  41. #undef EDMA3_DEBUG$ I+ `& c( U( v, n# H  c9 r
  42. /*#define EDMA3_DEBUG*/* _7 H& e9 P$ ^% @" i
  43. 4 x7 y- ?8 k& Z4 a1 K9 @! J! w/ t
  44. #ifdef EDMA3_DEBUG! i- E# M5 Y4 R' V( G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      V7 U' r+ ^5 d: `* f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 N  r1 T8 D/ ]- g: A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% V" Q3 X; N# |% R
  48. #else
      [9 K& s" Z7 U2 N; n" M% n
  49. #define DMA_PRINTK( x... )! p4 `# c- S: f1 N8 U
  50. #define DMA_FN_IN
    - {1 Q- ^8 z) _7 n' V% G
  51. #define DMA_FN_OUT6 q6 W- {. o( ], ^
  52. #endif
    1 k3 Q( g; _8 J, x
  53. 0 g; }  y  N2 d! |' b- }" w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 U+ T! }% q* f6 n& V
  55. #define STATIC_SHIFT                36 q' ^! U: l; i9 Z8 a
  56. #define TCINTEN_SHIFT               20
    1 U# `* \, c8 T* w* n% m1 P  |  q
  57. #define ITCINTEN_SHIFT              212 g+ N/ R0 z* X3 j! ?* N
  58. #define TCCHEN_SHIFT                22
    1 A/ s* C0 i3 o8 }$ n$ n, j- ^1 f2 X
  59. #define ITCCHEN_SHIFT               23
    9 ^* c6 e1 A# M$ q- ]* q
  60. 4 R; I) s8 W1 _! \: u6 X6 q% `
  61. static volatile int irqraised1 = 0;% Z9 _0 R( X7 n- Q3 w
  62. static volatile int irqraised2 = 0;
    " f8 X5 E4 l2 u) \& K3 F$ p
  63. . f7 U6 P/ L% o" n/ [/ s8 s' t- W  {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 n2 |' ~: S/ Q- B6 Z) S1 V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ _+ i( x9 b* g$ _4 i9 [8 z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' e) f+ V9 u: k# C  i8 \7 X2 u' K
  67. 0 b$ X; A1 s% d0 X2 o& ^- r6 j
  68. dma_addr_t dmaphyssrc1 = 0;( \# c5 x# Q$ T9 Z0 a( n
  69. dma_addr_t dmaphyssrc2 = 0;
    . B* Q4 \% C1 @  Y8 i' \7 b2 S7 q5 u
  70. dma_addr_t dmaphysdest1 = 0;3 A4 T6 V) i4 B6 ?
  71. dma_addr_t dmaphysdest2 = 0;( l, h4 l0 {& }7 g. l
  72. 3 a: d' \0 c4 D- w) I1 f: r
  73. char *dmabufsrc1 = NULL;  e9 F8 `  A5 I- d9 N5 y
  74. char *dmabufsrc2 = NULL;# U# w( r' f1 \# a% c7 q
  75. char *dmabufdest1 = NULL;
    ( m; `$ S9 W) L: r& W$ y
  76. char *dmabufdest2 = NULL;: ^. b: L/ I& q$ {# m! n% i. _
  77. 5 q3 j/ X" |1 C- i- |2 |
  78. static int acnt = 512;# {8 J  R  E; K: c; K7 v* ^
  79. static int bcnt = 8;
    0 N/ ?+ h+ U* v+ o7 n; ?! [
  80. static int ccnt = 8;
    : r& A5 v; B% x1 s5 M) N
  81. : {( D3 H( h' w  e$ O( N
  82. module_param(acnt, int, S_IRUGO);
    : ]" q2 {$ f) h6 S
  83. module_param(bcnt, int, S_IRUGO);& x" I7 F' R# @0 |& b1 c8 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. \7 H( Q% ~. q5 I. G' O4 U/ E/ H; V! w. K& j( F. I- V2 w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; L" W0 B7 v+ ~  Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% i3 y. `5 s/ g- B8 y0 Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 [' o( i) `+ ^* _% u% |/ b7 r/ w1 E2 F8 ~& g- {
# ^7 D% \- s- g& N4 R1 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-1 17:21 , Processed in 0.039212 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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