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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( E# z0 Q4 {6 ^4 R0 y. g0 c3 o
  1. [code]EDMA sample test application
    * _. \+ v5 N. O- \+ Z5 A
  2. /*5 X% D( k) W9 v; z9 g: b' G; V5 ^
  3. * edma_test.c
    " ^# M8 o1 L9 m" s4 c' G/ @0 R
  4. *: `, \8 k" l3 n# q# |0 s6 o* a
  5. * brief  EDMA3 Test Application, o. G: @8 n2 z& a
  6. */ C% z% v2 @% N) x
  7. *   This file contains EDMA3 Test code.
    1 q2 r% P, k5 x2 ]5 ]
  8. *
    7 ]2 C/ K+ e8 o" W' G& S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( C( f, h& R3 Y, ~6 {- K1 _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 ]6 q8 \8 w+ V3 }, S8 O- ~
  11. *         TO CHANGE.
    * f2 U0 q& h- j3 H0 k; @
  12. *% \0 I3 w0 S8 a2 ?) |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 B. q2 h0 M$ P$ Z# |5 \
  14. *7 E8 w0 c5 s: j$ O, u8 @
  15. * This program is free software; you can redistribute it and/or: [+ y* {# `8 i& _+ i
  16. * modify it under the terms of the GNU General Public License as
    + r4 y9 y3 m0 Z0 Q$ S
  17. * published by the Free Software Foundation version 2./ E5 A. W! X7 t9 E9 `( y
  18. */ `; h! Y- K' r& O7 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . |7 b7 E. G$ w
  20. * kind, whether express or implied; without even the implied warranty8 N# p4 Y6 L& Q. Q3 f' B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; @6 P2 W3 }$ c5 x
  22. * GNU General Public License for more details.' O, i* J( v7 Y% K& T- c
  23. */. U+ n% U1 E( H8 j* ]5 ~
  24.   n* i/ \( r% V$ x. y& A  m( K* I- u
  25. #include <linux/module.h>
    # M; q0 H9 n0 L; g
  26. #include <linux/init.h>  Q9 x, V" V+ S2 w4 W! k
  27. #include <linux/errno.h>
    " j) v( s/ |, L6 D
  28. #include <linux/types.h>: o* B+ p' Z8 F
  29. #include <linux/interrupt.h>6 T% ~5 P4 P7 b# u; t1 U3 q
  30. #include <asm/io.h>, @% P6 o- A3 v2 v
  31. #include <linux/moduleparam.h>
    7 y' g! w6 d9 N# j+ W, }
  32. #include <linux/sysctl.h>
    . ?3 Y* v, Z, n2 M/ D
  33. #include <linux/mm.h>% i" H2 \2 O0 V5 x
  34. #include <linux/dma-mapping.h>3 v$ \7 Q' q4 U: o
  35. # C. I4 a! Y7 j5 N
  36. #include <mach/memory.h># k7 w* J% ]& ^) h4 F- f9 k
  37. #include <mach/hardware.h>
    " L9 G" O; D7 N# G
  38. #include <mach/irqs.h>
    8 P# A' x& n/ Z! ?' h0 X/ M7 B
  39. #include <asm/hardware/edma.h>3 H7 A# m3 R5 m  F/ D

  40. & D& M8 ]  m4 N' }9 H+ e7 ^1 j. W
  41. #undef EDMA3_DEBUG: z( l: {, O# \' |. f
  42. /*#define EDMA3_DEBUG*/
    * N3 C3 D" s8 r- ~5 N
  43. 9 ~' {- D( Q* M: [2 L: c& Q
  44. #ifdef EDMA3_DEBUG
    # V5 f' V" H7 k3 A4 `) h( [' j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! ^% X, E+ c! l5 n5 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). w/ L& z. I1 h8 l) u, E1 y* j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " Y9 D, y0 G2 V0 ^
  48. #else! Y. K; U7 k) C# b! D9 R( [) \+ ^
  49. #define DMA_PRINTK( x... )4 s1 i5 c4 o' B/ g6 L9 m% g2 n
  50. #define DMA_FN_IN
    0 {) G+ U: s6 W; c# b! Y9 s2 R
  51. #define DMA_FN_OUT# g8 @1 C, d1 a9 L& R" T; L
  52. #endif9 S& B8 y+ @1 S; B1 d
  53. 7 ]7 `9 w) `0 b- y* ]7 [3 z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), n" R' l& P1 b$ L' T
  55. #define STATIC_SHIFT                3" @- @1 k( u/ t8 s+ g2 k1 t! {
  56. #define TCINTEN_SHIFT               20
    7 a6 L& ], {8 _
  57. #define ITCINTEN_SHIFT              21
    7 \8 J/ F. d1 z+ b7 ~
  58. #define TCCHEN_SHIFT                22, w* x' e. C# Z2 Y
  59. #define ITCCHEN_SHIFT               23
    / O( g$ v+ N8 ^
  60. 6 w) h2 u# p* e4 g( T
  61. static volatile int irqraised1 = 0;
    ) H: ~& }0 H" s+ T5 z# K
  62. static volatile int irqraised2 = 0;. R5 K0 L, d2 J9 Z2 ~2 r

  63. 0 r5 y: ~5 H2 o* K" _! p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ U4 \: u3 z' q$ }- W; M, `' X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; T0 R! K/ K3 k, w6 u' S4 m' T5 h7 L4 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + E. m% J& U$ N1 h' c, ]/ S5 }& y9 ~- f

  67. 1 n$ ?* a6 H7 V6 h1 D
  68. dma_addr_t dmaphyssrc1 = 0;$ q- X$ V6 L) E; n4 q
  69. dma_addr_t dmaphyssrc2 = 0;
    & ~9 ?; @" Z8 k( {
  70. dma_addr_t dmaphysdest1 = 0;
    ( p8 A; x$ Y5 c# S/ U6 l
  71. dma_addr_t dmaphysdest2 = 0;4 H" G. P0 N$ [
  72. : d2 [% _( v* g+ @( l
  73. char *dmabufsrc1 = NULL;/ Y" W8 n) h, r5 I) J
  74. char *dmabufsrc2 = NULL;
    ' a/ p, Q$ q5 K. W0 B* O
  75. char *dmabufdest1 = NULL;
    4 R0 i. R2 a' O' L5 T5 [
  76. char *dmabufdest2 = NULL;
      b  N  I3 i$ Z$ I; A! T# l
  77. # Y5 G: j& t0 P( Y
  78. static int acnt = 512;
      g5 R/ O# M- |& I
  79. static int bcnt = 8;
    ) @' O% f4 T& A4 j: P3 n* W% {
  80. static int ccnt = 8;% P( T5 P/ b, k, ^

  81. & O" T3 q3 D! ]0 o1 U
  82. module_param(acnt, int, S_IRUGO);6 M( ]# ?- N- C# |. v
  83. module_param(bcnt, int, S_IRUGO);
    2 w6 e8 t0 [7 N" N, G$ \" O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' h/ Z& J4 w! R0 q
" g2 ~. P) B4 c, Z% R6 {9 t9 a: c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ J1 G3 v2 o, T: y/ C" j  K4 e* g8 warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 c) Y" N: G* R: h" w8 N3 h+ |2 ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ c7 C& ^3 w% S7 g. B/ y2 D. Y
' H; k. _! O) ]) a/ B5 F
; b$ `1 c* w0 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 02:09 , Processed in 0.114780 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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