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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - k/ ~7 t' l' [- j9 A
  1. [code]EDMA sample test application
    0 R+ t- R$ I" o3 q1 a/ m
  2. /*
    $ X6 m; i6 h" ^$ e# P
  3. * edma_test.c; z" h6 m$ i) B# B7 d& c
  4. *
    3 V, u$ |: L! ]5 z0 K5 t
  5. * brief  EDMA3 Test Application
    9 a* S! g& h! Z- l' y# v$ S
  6. *" k5 |; u' G0 }) F& v
  7. *   This file contains EDMA3 Test code.* A8 A0 r2 Q! Y5 a
  8. *
    & e9 A$ T8 E( }* F. U2 a8 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. Y2 j2 B& }( y6 o( J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! r5 h5 p" M7 [7 T, B( C/ }0 ~
  11. *         TO CHANGE.6 H/ y) R% J( @9 c$ C
  12. *$ T9 l: W- J1 b  m0 Q5 V) r, M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 S3 d* w; _. T2 |3 F: s+ e9 D
  14. *$ k+ E* l2 Z# E' t  u
  15. * This program is free software; you can redistribute it and/or
    7 K8 \3 l3 U- F3 Y9 ]
  16. * modify it under the terms of the GNU General Public License as
    2 {2 {* i* g, r+ ~$ s0 b, y
  17. * published by the Free Software Foundation version 2.( r5 ]8 V% b- S) w6 ^
  18. *
    8 A  y. [- F2 `" ]" C' S8 i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 o% \5 _7 h, `) f
  20. * kind, whether express or implied; without even the implied warranty
    # g( M" I3 k/ n& N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : P+ _4 M# m$ T7 y" X' a" f$ O
  22. * GNU General Public License for more details.
    4 g# ^* M. l4 B2 K, q# m$ j
  23. */
    ; g* v' w) K8 t
  24. : u8 y& r* U& `
  25. #include <linux/module.h>
    + v' c7 ?& ^! X
  26. #include <linux/init.h>3 N1 l% w" w& [/ }2 K/ H. t" c
  27. #include <linux/errno.h>; k; _  y: h2 g, \: O" A) J
  28. #include <linux/types.h>3 ^: F% O( ?! ?' p' i7 D+ @" s
  29. #include <linux/interrupt.h>% i+ {# J2 q  m+ ]( g& h+ f9 |
  30. #include <asm/io.h>7 a& B9 U- \& E/ k. M: q. _
  31. #include <linux/moduleparam.h>
    # U& @# w/ [3 k- d" `
  32. #include <linux/sysctl.h>) P4 o5 K0 n* d4 k4 g/ C2 d  ~
  33. #include <linux/mm.h>* g4 k- \! |& h
  34. #include <linux/dma-mapping.h>$ C8 `8 j! W2 \, ~5 p6 q+ [
  35. & {/ q5 {- y0 N( S( |; e. e; d
  36. #include <mach/memory.h>) F# K* j2 G1 ]* a% I8 y
  37. #include <mach/hardware.h>, G* u5 K/ M6 y8 B$ e
  38. #include <mach/irqs.h>: f/ _" s! R( v- l& Y7 @* j
  39. #include <asm/hardware/edma.h>
    0 J3 I; ?, a4 u1 b
  40. 6 S! l: W# D3 T, \! p
  41. #undef EDMA3_DEBUG
    ( s1 c, G# S; ^1 U7 I! b0 d
  42. /*#define EDMA3_DEBUG*/
    ! \# W' e+ L$ Z

  43. 9 J; ?9 P5 L. R; U1 ?' Q
  44. #ifdef EDMA3_DEBUG
      O, K' Z& @6 j& S. p: m+ o' X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 f& |6 R* O" m; q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " i# _" @! U) t& b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): h2 f9 @- M! ?( a/ N
  48. #else
    3 C# B: H: v" y" m+ H3 M
  49. #define DMA_PRINTK( x... )1 |( w5 X3 _" K0 h8 C5 R5 S2 t% Q
  50. #define DMA_FN_IN$ r% l' t: q# l8 y' Q; R# ^
  51. #define DMA_FN_OUT
    2 B: T  v; L+ f. Z2 Y7 L
  52. #endif, \/ S+ h5 _9 X3 B$ d

  53. 4 }2 A( Y6 \9 m8 x' b) I/ l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( |' ^( H; R$ j) z* Q
  55. #define STATIC_SHIFT                3' q& U+ w1 m' Z) g. f5 |: v) `
  56. #define TCINTEN_SHIFT               204 Q; |0 P' k( m# v8 m7 A
  57. #define ITCINTEN_SHIFT              213 d% U& K% q5 q9 P
  58. #define TCCHEN_SHIFT                22
    9 `2 J( N7 z, Y, c( v
  59. #define ITCCHEN_SHIFT               236 L  l8 a2 o5 q% J# p
  60. $ K$ ?1 b2 V( Y3 |+ x
  61. static volatile int irqraised1 = 0;
    & z* W, q4 L! o
  62. static volatile int irqraised2 = 0;
    & j! ]6 A+ p  j' u3 U/ a

  63.   C3 @% r: \0 [7 j* @# J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - u; B. Y% B9 o7 H# a7 D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; m' M, U2 f% m% `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' j, h6 H* x% {/ G1 p

  67. . [$ }& \2 Z# l
  68. dma_addr_t dmaphyssrc1 = 0;! d& y* l2 C7 q* S( q3 a" a
  69. dma_addr_t dmaphyssrc2 = 0;
    # O, [2 X' `9 C1 |( a
  70. dma_addr_t dmaphysdest1 = 0;8 N6 e2 z  V7 r# H+ \* i" z3 h
  71. dma_addr_t dmaphysdest2 = 0;
    , g8 r- p# z8 ?% O

  72. : N1 R8 }$ A2 X' |, r& H
  73. char *dmabufsrc1 = NULL;5 i( q* W) x3 Z
  74. char *dmabufsrc2 = NULL;- E1 z! s; i- i# |0 F
  75. char *dmabufdest1 = NULL;6 j6 O$ d6 q2 B; x- t' `* l
  76. char *dmabufdest2 = NULL;
    8 q& s" ]4 M! ?) D$ s$ F/ q2 j  W

  77. 6 ~5 V6 M4 s. W8 n4 X1 n
  78. static int acnt = 512;
    1 a  ^& Z% q% o* e% _3 m. }9 R
  79. static int bcnt = 8;
    : h" M3 p8 ~: ~9 f
  80. static int ccnt = 8;
    ! }' K) k& j9 i6 u+ g

  81. 4 p4 |( ^" m7 Q
  82. module_param(acnt, int, S_IRUGO);
    ( A9 N& W5 {  `6 {+ y5 F$ p9 j
  83. module_param(bcnt, int, S_IRUGO);2 N  M+ A. _4 ^5 {5 D4 N; C7 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. P* _2 J) [. j% _5 s& v% Z- b) L; a! Y( y/ M5 a& F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 H: k' B, J; a8 E5 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# U; j! n) M& M$ G5 v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 u. x5 D* |& K$ B& k

: V, R1 T4 Y2 y3 j
( t5 h0 \: R* w7 i5 u, t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-14 14:06 , Processed in 0.042663 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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