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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( {2 m& G7 a9 Y: c2 Q) R% e( f
  1. [code]EDMA sample test application7 ^" u4 l6 Z$ ]( L& V9 {4 ]4 V
  2. /*
    # D" D' B2 o7 p
  3. * edma_test.c1 o; _( e' |& R% M
  4. *
    6 }# e5 r, s) T. S
  5. * brief  EDMA3 Test Application
    ! b) C* @% s* f/ p1 ]$ j! O, z
  6. *
    0 j: n& R. B- l, ?. b; s0 m4 m
  7. *   This file contains EDMA3 Test code.6 w- y# M9 a  L, ^: R8 v5 m) q
  8. *! I& O3 B' B; R% C+ T& S: U; u, I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + z3 p  b) P! {! {3 ~  n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 O, r* ~& M% W. M4 a
  11. *         TO CHANGE.
    8 h* c  B) t5 ^
  12. *
    ; w1 N; s/ r) `* _& I% Q- N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , }" L  n, n; w/ _& s/ k% s1 O
  14. *
    % d! m6 A9 V7 ~7 [$ i5 b
  15. * This program is free software; you can redistribute it and/or; P+ B$ v! C; ], _
  16. * modify it under the terms of the GNU General Public License as, j' t7 W7 `. d: I
  17. * published by the Free Software Foundation version 2.
    8 u0 V) V9 o& _9 ?# K) k% S  X
  18. *: Z0 E$ h0 w3 ]" m/ A: {( L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ s* w+ Q7 f) @' m
  20. * kind, whether express or implied; without even the implied warranty. ]( n; o6 ?- c5 G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' V6 Q1 W0 i1 ]; {. ^+ r
  22. * GNU General Public License for more details.
    ' p- ?/ B7 `  z& M8 [
  23. */# \) S8 d8 G! N9 L- T

  24.   J+ T9 ^( n2 P, Q5 u  p
  25. #include <linux/module.h>
    6 }1 x  m& d$ D5 p# k9 F
  26. #include <linux/init.h>% B  E0 A4 K$ [( v( X8 `7 M
  27. #include <linux/errno.h>
    * {0 \# x- W- G4 H
  28. #include <linux/types.h>
    $ w$ G: E1 l5 B$ O, A0 V8 H6 Z8 v
  29. #include <linux/interrupt.h>+ s' r! V' m# n  c9 {
  30. #include <asm/io.h>
    2 a. P% e8 @. X$ L( B4 \& [
  31. #include <linux/moduleparam.h>
    8 I4 f0 ^% c; B1 q7 i, M
  32. #include <linux/sysctl.h>
    + X! y" |5 |- W
  33. #include <linux/mm.h>
    / C( a6 q$ ?' o; `
  34. #include <linux/dma-mapping.h>
    ' m6 O" f3 _6 u* [( R

  35.   o5 E. \2 n, J( U; }* N. d
  36. #include <mach/memory.h>; T, b+ F# d2 v6 Z2 S! d
  37. #include <mach/hardware.h>* u4 p' I& v$ s3 j
  38. #include <mach/irqs.h>
    4 f) V/ M- Y2 h" g% d7 b
  39. #include <asm/hardware/edma.h>
    & E- a! M2 B5 t3 q" F# |
  40. % t# N6 J5 D8 M: `( k2 v/ |
  41. #undef EDMA3_DEBUG' j3 L# K. e1 G2 |* h- I9 a! N
  42. /*#define EDMA3_DEBUG*/
    0 T. o7 V) J0 l
  43. : Y; u& t; q' t/ r
  44. #ifdef EDMA3_DEBUG8 m+ W# O1 O: a- V7 r$ W3 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 G. `% e7 o1 s$ i" D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) Z6 H' m/ p( A: B0 D1 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 X2 l  I4 k! ?2 S/ Z& Q- R6 i7 X
  48. #else  w+ r3 Y% l7 d, z/ M
  49. #define DMA_PRINTK( x... )
    # ?  w  K$ T9 m+ N4 p  Q
  50. #define DMA_FN_IN
    : ^! L; B# r/ w. f: Y
  51. #define DMA_FN_OUT
    ; `! w5 s8 r2 U4 G, A
  52. #endif+ y' f2 q; R" a. q. t5 l

  53. , |; Q6 _! S- k& K4 F# z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 x/ q; H7 ^( n
  55. #define STATIC_SHIFT                3
    ! g+ n* }- H5 v! \: h# o9 E9 Y
  56. #define TCINTEN_SHIFT               20) h8 ?4 e! a4 B: L
  57. #define ITCINTEN_SHIFT              21
    " \0 c6 v; j. I+ B  h, M
  58. #define TCCHEN_SHIFT                22
    1 O8 r$ x, D4 C2 |, D
  59. #define ITCCHEN_SHIFT               23! C; D, }# J1 E2 F- d

  60. " O% @' \: T5 p, Q4 F* t3 o4 h
  61. static volatile int irqraised1 = 0;* j# z! m6 ]2 ]  [2 W5 W
  62. static volatile int irqraised2 = 0;0 b. o+ }/ z1 k
  63. 3 b# h7 G! `; k" q8 V  q) }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + W& R% N2 _5 ~- l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 x4 Y4 j# ]# E# D- t3 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 j" I) D* ]) N

  67. & J& f& b1 R- g) N
  68. dma_addr_t dmaphyssrc1 = 0;" K. ~& D5 E, g
  69. dma_addr_t dmaphyssrc2 = 0;7 m# f& M% M  {
  70. dma_addr_t dmaphysdest1 = 0;
    $ \2 a2 Y% G$ N' p8 S. c
  71. dma_addr_t dmaphysdest2 = 0;9 \+ u) h; ]$ [; l9 \

  72. . m( g8 M- }& |  H& s& L  H) Z
  73. char *dmabufsrc1 = NULL;
    * {' ]+ W0 Q6 W/ W5 g
  74. char *dmabufsrc2 = NULL;7 `" ?* w  u  j! X) X
  75. char *dmabufdest1 = NULL;; z2 y# K& d6 E+ [+ s
  76. char *dmabufdest2 = NULL;: ], @' \7 D3 _
  77. 7 n$ k) m+ H: _+ {) v7 G$ w& e
  78. static int acnt = 512;7 @! m: t  _8 b- h
  79. static int bcnt = 8;/ Q1 Z2 ?9 F) F% z( s$ e
  80. static int ccnt = 8;
    4 P# f9 R9 t/ a" s5 D& z+ c
  81. 8 S/ k, N! v4 e& E- h0 s
  82. module_param(acnt, int, S_IRUGO);) ^0 q8 `6 N; p6 a) |% k
  83. module_param(bcnt, int, S_IRUGO);
    7 B5 Y# B; p$ `+ p) I4 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  e& L* r2 v% ]5 e) f& c
- i4 {- ]$ d; O- M" ~  _9 d4 ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! i2 i" h6 g/ `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' B. L; Q- K7 W, A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 I! D2 y5 g7 l5 d2 H8 C, C! b: ^5 ?4 k
. E: _( }$ V+ x, h5 m5 @& R& O: x. u0 _  s9 \! f3 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-8 18:50 , Processed in 0.039296 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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