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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  D2 N2 |0 ?$ Q! k
  1. [code]EDMA sample test application
      V% @- F2 G! P2 {& p( o: k
  2. /*7 x) @* ^1 N9 u! Z5 G9 H# q$ F
  3. * edma_test.c5 p. v6 r9 p  H$ F3 ?
  4. *
    , G0 D2 y( G& p+ i. J" {2 l
  5. * brief  EDMA3 Test Application
    & t8 Y( L. @5 k& `" l
  6. *0 E, j4 P$ l! x5 @. v& z
  7. *   This file contains EDMA3 Test code.
    ! I3 X6 c  O8 I8 l8 S5 a5 J
  8. *. [  z: p( X: K* _2 F4 H7 V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; Q  v8 {: _) x* u1 L2 h- g3 Z7 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 W" h" _; s+ s/ }9 k* U% x  ]+ y
  11. *         TO CHANGE.7 G) N' Q6 @/ U
  12. *9 j/ {0 |8 w7 _, ?# l8 e' N% d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 \' [* g( R2 ?- g) G# P: ~9 Z
  14. *
    - W  B$ Q7 C: D- @4 ?" }' C# F
  15. * This program is free software; you can redistribute it and/or
      M+ H+ t  ?2 R7 x+ |! ^
  16. * modify it under the terms of the GNU General Public License as
      g; ]0 L& Q  F3 y5 D, u
  17. * published by the Free Software Foundation version 2.
      `7 @; a  Q* `( r$ ^- o. m4 W
  18. *" q* _9 N+ m4 l. d, X, ]6 g* ^$ V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) ?9 N. z6 v: a' ~2 l
  20. * kind, whether express or implied; without even the implied warranty
    1 ]& ?. F! t- q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      [! H0 m, X9 H9 z. T" Z( @
  22. * GNU General Public License for more details.
    + \( H0 a4 c, q' D- k# N. O
  23. */- O% g8 ~( J, t5 F/ t, k" }% G+ N3 g
  24. 8 S" u1 e! C: B- ]7 {8 J7 L
  25. #include <linux/module.h>3 X1 j- M; w& J2 l7 ~" o: s" z, x
  26. #include <linux/init.h>  f8 U5 [" Y& t2 I; X' x+ N( p1 w/ p
  27. #include <linux/errno.h>: |0 O* G" S) n( o5 l$ X$ D- }
  28. #include <linux/types.h>
    ; E7 |+ C0 h( c, {! T) O
  29. #include <linux/interrupt.h>& a2 s% `! h0 O8 y' o4 r, j/ l2 ^, U
  30. #include <asm/io.h>
    6 y# U! r( G; J; F6 c2 E& K% @" Z
  31. #include <linux/moduleparam.h>: e9 c. \' F- B) v
  32. #include <linux/sysctl.h>! X1 c6 ~2 |# W& ]5 y$ _
  33. #include <linux/mm.h>
    0 K$ E% z" U/ M2 R& g5 v" g  J
  34. #include <linux/dma-mapping.h>
    6 L, |! P% H4 o: w  y

  35. $ \/ l2 V" f1 C
  36. #include <mach/memory.h>* ^  ]8 r5 b7 \4 A9 N) B
  37. #include <mach/hardware.h>; X- u) [2 Z/ I: w" w0 V* t
  38. #include <mach/irqs.h>& G: L7 o! M) x$ Y+ Q: V
  39. #include <asm/hardware/edma.h>
    + r; q# }/ j. W/ J

  40. 8 G+ a& r: ?$ q8 h0 ]# \
  41. #undef EDMA3_DEBUG3 r! D$ s1 ]7 ^1 w6 t
  42. /*#define EDMA3_DEBUG*/
    * `- u$ R, e" g3 y* Z' F$ Q0 I
  43. * p! \( g8 ?( M" d$ j/ h
  44. #ifdef EDMA3_DEBUG
    / {! k3 {! R; R3 H2 ?( p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% ~9 g* m# {  M8 v5 S# Q% A) w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). U. m  x7 ^2 b( k6 ~" {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 w( K' }  H' Z1 U1 H4 s4 |1 |
  48. #else4 Z( k6 M# P! M* H
  49. #define DMA_PRINTK( x... )
    . S, `+ _& Q# H7 t# r
  50. #define DMA_FN_IN
    - I  O7 O0 s% O9 U/ F: I- V. l( k
  51. #define DMA_FN_OUT
    6 B% ^2 L; B( C: v! b6 l6 |/ B+ a) u
  52. #endif
    " V  b1 z- Y' v6 h8 U  C, S1 B& I

  53. % g& L+ z2 `5 W* \$ P# P. q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ }: Z7 U/ @0 q1 I/ s/ o* z" ^4 E
  55. #define STATIC_SHIFT                3
    % N/ B, D3 h$ J5 x: `4 e
  56. #define TCINTEN_SHIFT               20
    5 d- g4 Z% Z3 w5 c  K
  57. #define ITCINTEN_SHIFT              210 z0 L) ]* Y, w6 E
  58. #define TCCHEN_SHIFT                22
    5 F$ k6 F+ p5 }4 k
  59. #define ITCCHEN_SHIFT               23- Q2 |4 @4 ^4 `8 |' J+ U- g: K

  60. % ~/ x1 h7 p) I9 o5 p) L+ `2 q" X0 t
  61. static volatile int irqraised1 = 0;0 m# h9 b! ?( l9 t# S* R8 M5 o
  62. static volatile int irqraised2 = 0;
    ( \9 y" ~, e. G' x- x+ y
  63. 2 `2 s; O% L% o/ g" j. H! B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" l+ P, O6 m& b0 D# O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 ~, \. F3 f1 u, J2 d/ L# Q2 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- v# X# E0 E( m* _
  67.   P: L8 C" p, L# R% N( v6 {
  68. dma_addr_t dmaphyssrc1 = 0;
    . \1 Y/ f0 r/ G1 ^) D
  69. dma_addr_t dmaphyssrc2 = 0;
    * h: M) U0 ~9 k
  70. dma_addr_t dmaphysdest1 = 0;4 |% a# y4 u9 K# T5 W
  71. dma_addr_t dmaphysdest2 = 0;9 x( M# F7 p7 o6 M

  72. . {+ N6 V2 @2 W
  73. char *dmabufsrc1 = NULL;1 G7 o: K7 B. \; x+ n5 f' `" e9 v
  74. char *dmabufsrc2 = NULL;' L! `/ ^0 X- o* n
  75. char *dmabufdest1 = NULL;
    " O1 w: Q8 ~0 W0 {4 P8 z, Q
  76. char *dmabufdest2 = NULL;' |( f5 I/ ~) R4 h- H2 P

  77. & v2 G5 V0 Y& ]$ S
  78. static int acnt = 512;
    0 [* a6 `6 a; Y. ~0 q  S
  79. static int bcnt = 8;# L& q8 M/ |( ?/ P. ^
  80. static int ccnt = 8;1 z; A& d7 n- h& F, @' |/ ?2 ~9 k
  81.   O2 }  _, j! b2 z, A. H5 ~8 T5 y
  82. module_param(acnt, int, S_IRUGO);7 O8 T, H5 G& I
  83. module_param(bcnt, int, S_IRUGO);
    $ \7 ^* h3 k+ b3 Q( U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, n6 W" D5 m5 F& ~" N/ Q# `) J! a

) a/ b1 z/ s" c+ H  W4 s" |" ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 I1 p9 v/ L4 b' Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 j+ T! F4 F- T) e8 W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 Z; M& x; T# I& X; ?
! J* |# G% M' `/ L& c" y
1 d- c: G; ^- s/ g! V; o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 21:48 , Processed in 0.050937 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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