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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' P) ?; b4 B9 D  N
  1. [code]EDMA sample test application
    ( c- Z9 ~) k' Z
  2. /*
    . S8 _# q& m- A5 `: y, X
  3. * edma_test.c
    + K1 a) M6 v# a) V$ F& `
  4. *% x& d3 v# W- \( o% I
  5. * brief  EDMA3 Test Application
    % b; m; o: t! ~8 o8 `; ~
  6. *: e2 p6 Q; M( v' X" \
  7. *   This file contains EDMA3 Test code., ]- ?1 q# N" Q5 P/ |
  8. *  G3 Y5 n  g2 x7 X! r7 B: B# v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 f; W% V  G! x+ `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 B. q& g" I4 j5 u
  11. *         TO CHANGE., d. I  R+ J& T" r# c- [- k
  12. *
      j- [- B' D1 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( _7 q- @5 h2 L' {9 f0 ~( N
  14. *
    7 R! b/ w3 M) U0 k8 l) A: e8 q
  15. * This program is free software; you can redistribute it and/or' j6 x4 |# l' y6 J' C7 {3 ?
  16. * modify it under the terms of the GNU General Public License as" k8 l9 g- b. @. }$ j+ h: U. v
  17. * published by the Free Software Foundation version 2.4 O* V: i4 _% L: [1 o- d. i6 E
  18. *6 Y, i9 l0 o+ u! d* x4 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 S/ K. U5 h" M; g1 ?
  20. * kind, whether express or implied; without even the implied warranty, W) w7 @( i6 Z" m0 {1 O8 L1 ?) |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) P1 ^) `) D1 {1 Z; V  {
  22. * GNU General Public License for more details.
    " J; @, ?- _4 z( T( O- g
  23. */& N" I5 u. Y- a% B( ]' A$ J+ R9 M  h
  24. , n9 i! n8 o3 i2 h) `
  25. #include <linux/module.h>
    9 |- d, Z% i/ x6 h' o. N8 `4 T
  26. #include <linux/init.h>
    5 g1 L2 @, g: ], T, V/ Q
  27. #include <linux/errno.h>
    ( P7 k" t' E, U- \' M' f
  28. #include <linux/types.h>: U# `, _( p" q! @
  29. #include <linux/interrupt.h>7 j! `  y$ e" A+ Y
  30. #include <asm/io.h>& F4 T& b1 O2 v
  31. #include <linux/moduleparam.h>
    ( L' |* Q( l. ?3 G/ g' c
  32. #include <linux/sysctl.h>  f& T( e9 M$ j2 L/ X) R
  33. #include <linux/mm.h>! d2 I& ~/ O! w" q( n& c& b2 k
  34. #include <linux/dma-mapping.h>) ?3 s- w  H* x" Y7 ~4 ?

  35. $ o1 E) \  I9 c0 f7 t! f2 |3 ?
  36. #include <mach/memory.h>
    4 F: n1 V. w& L; B
  37. #include <mach/hardware.h>
    ) h2 f; t5 Q7 \' T
  38. #include <mach/irqs.h>6 h& Z4 i0 _: K9 u
  39. #include <asm/hardware/edma.h>
    / e* `% T3 a1 U
  40. ; c; |" g7 E9 }7 g3 V8 Z- p
  41. #undef EDMA3_DEBUG
    1 q9 k" v+ S. y8 z8 i6 a7 p+ Z
  42. /*#define EDMA3_DEBUG*/* E2 E* ~# M% T0 E+ {& n) ]
  43. 4 \- L9 |3 b* X; ^; F$ j9 U) t
  44. #ifdef EDMA3_DEBUG
    & ?. b/ v: @! `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & Z+ B) u; C1 |& E7 f% `5 C- p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # Q9 b/ m( E( e/ E* s* m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ m+ N0 y3 e; N0 B- |
  48. #else
    8 ?2 H8 w7 w  U
  49. #define DMA_PRINTK( x... )
    6 V8 a) F5 m! U
  50. #define DMA_FN_IN
    $ v0 e: [, [! I4 n& d$ w. q3 W
  51. #define DMA_FN_OUT' l( L; |  E* y3 |0 |3 i" f; R
  52. #endif
    . c1 U) g3 X0 ]# q' q. q- m7 W
  53. # F! Z$ J5 f/ M8 p5 D- v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 @- e, w; w& a& G5 |
  55. #define STATIC_SHIFT                3% ?2 D8 W5 t. U; `; E* \
  56. #define TCINTEN_SHIFT               20
    9 S* [. Q2 ^9 Y4 b3 \# g
  57. #define ITCINTEN_SHIFT              21
    * `& f6 x( @( K! p1 U# P! ^2 h
  58. #define TCCHEN_SHIFT                22
    * o5 r) Z4 n5 ]6 M  W9 ?7 M
  59. #define ITCCHEN_SHIFT               23
    5 b. w; M% b1 N( X9 M) `3 {6 K7 R

  60. & e! M- T) @  ~% z1 C8 ?
  61. static volatile int irqraised1 = 0;
    , h; D7 l* u& h, F" G7 x2 B' a
  62. static volatile int irqraised2 = 0;7 \7 n. c) W9 {2 U8 T, }
  63. 9 L4 P0 }% k( w. J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 N4 C" W9 ?5 e0 I* m3 T* `3 V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 z4 M: i# I/ {* X5 }. m2 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' B, q5 w3 M) x3 h6 @
  67. . W  h: W% z3 F" Y
  68. dma_addr_t dmaphyssrc1 = 0;! l( r2 G- b: k& N2 A2 e
  69. dma_addr_t dmaphyssrc2 = 0;
    . R7 p3 ]8 U: \9 w! @
  70. dma_addr_t dmaphysdest1 = 0;
    + g! s/ P5 j* _; O. f4 h3 y
  71. dma_addr_t dmaphysdest2 = 0;+ F$ w; V5 j& U- y; W1 C- A9 c
  72. " _! F, U0 R1 x9 z+ }/ d, y
  73. char *dmabufsrc1 = NULL;2 s5 F( n1 Y1 n' l4 l
  74. char *dmabufsrc2 = NULL;6 P, ^6 `. m" v) @. ~! H2 ?- e
  75. char *dmabufdest1 = NULL;; S0 n& T# r. ~  w
  76. char *dmabufdest2 = NULL;
    6 F& h# U3 B0 X) _7 l
  77. 4 S  P& h8 W& w. r$ D1 N1 ?* R# c
  78. static int acnt = 512;2 b$ |4 Q! p. ~% c1 X' H
  79. static int bcnt = 8;
    / d/ c$ G9 V# S7 w. ]
  80. static int ccnt = 8;
    + z9 }- G2 p- w7 q# j

  81. 4 ~- R7 d4 D1 v
  82. module_param(acnt, int, S_IRUGO);
    ; Q6 R; P  J6 Y( V( F
  83. module_param(bcnt, int, S_IRUGO);
    + u; C" T4 S' `& W5 y# S7 }
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 X. V) W. z1 u& n6 L. j" v* |- ?! @/ q5 |- _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! v, X% d  u5 \& W8 j! c8 R' Y# k/ v% f7 zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 y3 [. o* Z) z3 s. }  F9 U8 X1 |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% _! ~7 {, K& {, H; X6 `( t7 |9 h5 V" n/ h0 S
4 ~4 |$ o0 s: J8 e, c7 t7 }8 J9 q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-12 14:26 , Processed in 0.042041 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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