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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) H4 m2 U# W) V4 r1 I' L3 a' |
  1. [code]EDMA sample test application
    % L6 y; P7 V7 O0 A* |) T% b& e7 [
  2. /*
    % A* U" Y0 J. p3 H$ z
  3. * edma_test.c
    , R1 ?5 R) A" R. u
  4. *
    $ A$ f/ c) o. e7 b2 e' E8 ?; K
  5. * brief  EDMA3 Test Application/ l: L- q! ?4 Y7 }3 [3 ~- S) w
  6. *
    # v2 ?/ r4 d. L; T, D% y3 k) d0 d. w
  7. *   This file contains EDMA3 Test code.6 y6 p% E$ Z$ D" d  g1 K
  8. *
    1 a/ E8 Z7 a4 B# k& x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" P5 A* b: M% a) X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: \. V3 L" S7 T7 S) N9 z
  11. *         TO CHANGE.8 q! ]% ^3 T* A5 w9 F
  12. *
    1 }: t0 a$ T# h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 j: T. t- L' s, U4 j; B. W5 s0 L7 w
  14. *0 }8 X# Q1 a2 ~$ V
  15. * This program is free software; you can redistribute it and/or& ]$ M2 T& @: m
  16. * modify it under the terms of the GNU General Public License as$ O5 h* _  @. T: V1 {0 v0 ~' y- W
  17. * published by the Free Software Foundation version 2.% u$ ^# d; G& ?: u: G: Z
  18. *5 k. t. q3 D& c* C- ~1 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) V) ]# H+ M; O8 Z3 f" u
  20. * kind, whether express or implied; without even the implied warranty
    + N: l0 Q. V" C& a+ D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' i3 Y3 G$ g) c" t) }
  22. * GNU General Public License for more details.
    / Z* z' z( J$ i/ y( j5 U0 H
  23. */
    / G- }  r: r' g% ^' N

  24. 7 I, ^! O5 h# R' ]# F
  25. #include <linux/module.h>9 G3 r  E$ W2 w8 E5 E- N2 c- h* ^
  26. #include <linux/init.h>
    8 r" @# q: G7 X) j( f- G0 _
  27. #include <linux/errno.h>
      ^8 ]$ w  B- S& ^; j- p+ e0 |9 R
  28. #include <linux/types.h>/ n+ V3 r/ T0 L& Y# N# \. B
  29. #include <linux/interrupt.h>
    . Q3 J7 [' a% k8 r. i3 L# b) s  j1 c
  30. #include <asm/io.h>
    " ?1 t  t& T% e! B: o
  31. #include <linux/moduleparam.h>
    . Y% ^6 O9 |! {: Q4 S
  32. #include <linux/sysctl.h>
    % |- M1 u: ~4 p/ i
  33. #include <linux/mm.h>$ E9 M1 l, {  ?7 G: o. Q8 A
  34. #include <linux/dma-mapping.h>& _* z- l+ Q& P# Q* Z

  35. 2 x  u+ }- S9 U( Q- v  o% D# s
  36. #include <mach/memory.h>; U- r+ s. S/ V! _2 }+ q( Y
  37. #include <mach/hardware.h>
    6 u9 ]' U8 r2 J( @
  38. #include <mach/irqs.h>
    " o. b( R- {8 L. E
  39. #include <asm/hardware/edma.h>/ D  L2 e$ f0 ?4 y" L+ C& |0 |; l0 P

  40. ) @( d7 {) M" |2 @6 l
  41. #undef EDMA3_DEBUG
    6 v& U9 m+ I/ p6 r; B, _
  42. /*#define EDMA3_DEBUG*/
    6 `# s% t& o) r3 F7 [& d2 I  u

  43. ! o' Y1 [* Y+ H7 w
  44. #ifdef EDMA3_DEBUG7 ^$ x# n8 F" ^) I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 D2 W! A% Q( b1 p7 z) d  g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 O7 g6 ^1 V( m7 O8 @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ b0 e8 B7 `7 d# {$ W& Y
  48. #else% u( o8 Z% U# b$ o9 @) ~' x$ m
  49. #define DMA_PRINTK( x... )
    7 u( n: n) ^' x) i& Q
  50. #define DMA_FN_IN4 `1 s, T0 L1 J+ i: j1 o5 o
  51. #define DMA_FN_OUT
    ( f: f7 q1 `2 D: j3 n
  52. #endif2 n/ \" u! r$ D* C

  53. ! F8 F% A" J* ^  w& e) o) c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 d& ^5 ^* B- I- t: A
  55. #define STATIC_SHIFT                3/ v7 Q9 N0 v, I% C' J6 T$ j
  56. #define TCINTEN_SHIFT               20/ e1 ~: a4 q% U5 Y" l# B. t
  57. #define ITCINTEN_SHIFT              21- q% U& B7 G  c
  58. #define TCCHEN_SHIFT                229 k. ~% _* @1 q0 f
  59. #define ITCCHEN_SHIFT               238 u. }/ }1 Z9 j, T9 e5 R# S7 B; z

  60. 8 \# a) [! ?$ J9 ]. o
  61. static volatile int irqraised1 = 0;5 L# L5 `; J5 r+ P) A: A6 u
  62. static volatile int irqraised2 = 0;
    - q) A% {, T# J/ b) [& a
  63. 7 J, L/ o; e' [1 \3 @3 M" p& F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ }* p! Z+ F0 a  N& f# D& P' W* y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ t. j0 X% a: [. t; S& x& j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / [, q9 s/ b* }! e' v5 D- M
  67. , T3 y2 e! |! d8 |0 I/ I, e
  68. dma_addr_t dmaphyssrc1 = 0;
    " u- H' v0 b. l# }
  69. dma_addr_t dmaphyssrc2 = 0;2 g" N. w" D$ q2 B
  70. dma_addr_t dmaphysdest1 = 0;
      \* F) _$ F* _; A
  71. dma_addr_t dmaphysdest2 = 0;
      h5 w6 z( t+ w/ F* ]$ q  ~. m: Q! H3 g

  72. & a+ \- V$ t& a6 o6 M
  73. char *dmabufsrc1 = NULL;
    ) r$ `; x# y( r; R* e' w
  74. char *dmabufsrc2 = NULL;1 Q0 Q: v8 m- F* n7 [
  75. char *dmabufdest1 = NULL;/ }% b( x* r1 k0 ~$ }
  76. char *dmabufdest2 = NULL;2 T5 j  h8 V9 N5 r/ ~4 o) g% s

  77. 1 U7 E# E- v: m7 v6 l
  78. static int acnt = 512;
    ; t! X" S2 w  O% B# l, @- F
  79. static int bcnt = 8;) O) I0 ]6 s! I1 ]& K
  80. static int ccnt = 8;7 ]- v# A3 A# j6 r) [/ v

  81. 3 K( x. O' d6 z
  82. module_param(acnt, int, S_IRUGO);
      {, u- @  Q. y1 Z1 U$ f
  83. module_param(bcnt, int, S_IRUGO);" O2 a: E  `, L8 ~  q# b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  X7 `: ]8 T4 `5 c$ d' g. }% z
4 K) h6 A. B+ N$ \: E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; C8 ^$ ^3 X2 ^* ^: D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 I) c1 l, n2 W+ c4 L+ ^1 @4 [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 `/ n  L# C. n- R9 W

, i( `) t( ?( v$ W: t$ [
: ~2 T* M. Y3 y) ]+ T7 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 11:52 , Processed in 0.037531 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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