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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 ^: {) |: g! h5 q
  1. [code]EDMA sample test application
    ( X& a6 g# ?0 o$ N  ?; I* G3 t- R
  2. /*
    5 O. i8 \/ U+ w4 I0 Z! p3 I
  3. * edma_test.c
    1 ^/ V; G: c$ H- \& F2 ]" Y( J5 I0 y
  4. *; g4 H; j% m) ]" |# C* e& R
  5. * brief  EDMA3 Test Application
    9 N6 d& h/ O) E5 I3 I" D. b' b
  6. *0 A9 Z) s& w9 \+ y8 z: n
  7. *   This file contains EDMA3 Test code.* K# S5 k4 X5 n! L
  8. *
    5 r) u" U3 s0 r6 v  H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 H. h. i+ `. V9 q' D: d1 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 @  [6 t5 ]5 k) l( N4 c
  11. *         TO CHANGE.
    0 Z! l& p/ Q6 _  Y* R+ r3 D1 }. b3 A
  12. *
    ' T: q* i# a! I/ ^6 G; [; w* m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  a( O" L! ?& E. I# ^
  14. *
    ) }3 m8 E5 O! v# v5 Y
  15. * This program is free software; you can redistribute it and/or& U! ~0 J3 [9 c0 ]; W
  16. * modify it under the terms of the GNU General Public License as
    3 w4 _, k" ?- x' P% i) e
  17. * published by the Free Software Foundation version 2.
    ) s- _" R8 R5 F1 ^0 Z
  18. *
    $ a" l( W3 ~: i7 G9 {8 K3 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 n2 p5 f- T! f/ t7 ]3 o
  20. * kind, whether express or implied; without even the implied warranty
    2 }; r( @( l. {( A( h6 {* E% _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . F* f& S# }8 C) k
  22. * GNU General Public License for more details.
    ' Z0 K# f$ O* L$ p: U' U
  23. */, x  @% M7 N$ b
  24. ; g4 o, ^" F6 V, m* x& ]
  25. #include <linux/module.h>( g9 H4 H5 C. d  S" o8 F
  26. #include <linux/init.h>/ ^( S( J) q- W+ j
  27. #include <linux/errno.h>: N. R; C2 ?' Q7 @% L0 D
  28. #include <linux/types.h>: }2 n) x" [9 \- L  j4 x  h
  29. #include <linux/interrupt.h>
    " U7 ^& r% p6 `9 o$ {9 Y+ a, k" W2 A! u
  30. #include <asm/io.h>; T+ B4 f( H1 @! A% l5 Z
  31. #include <linux/moduleparam.h>
    5 }6 U1 E$ ~8 v5 c; c" w( A; A
  32. #include <linux/sysctl.h>3 V9 b) Q) i- \; m: k
  33. #include <linux/mm.h>
    & V) b& X9 g: `7 _; y0 Z8 o
  34. #include <linux/dma-mapping.h>
    ' {% N* Y' Y9 E  Z, }& m& O
  35. ' r- k$ f! u3 j! X  t) U" B  T
  36. #include <mach/memory.h>$ L8 K; a- z* t  x2 {) Z
  37. #include <mach/hardware.h>
    " R% l5 t2 e* T& [: M- z6 B2 o
  38. #include <mach/irqs.h>3 ~8 Z: b/ `4 V
  39. #include <asm/hardware/edma.h>; L& W1 `- B) Q  [" d0 H; d/ }5 W

  40. # C# K+ [5 j6 r# X) x( n
  41. #undef EDMA3_DEBUG* ]: A8 E$ @* m! s7 ~. y9 m
  42. /*#define EDMA3_DEBUG*/
    2 E, {$ O1 B5 E/ R) H' h8 ~1 b2 q
  43. 2 Q2 l. @* [1 ?
  44. #ifdef EDMA3_DEBUG) Z) M6 Z' r+ I) A2 ]. T6 q3 x3 p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; [8 p) r: Z, S  ^" Q3 v. t; W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! `4 I) P) ]( R0 w; z3 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 P- W( l6 T+ e9 n+ I( n, m! l! w
  48. #else0 y7 H7 R/ L% M8 h8 U
  49. #define DMA_PRINTK( x... ); y" @# ~3 `: T8 f' o
  50. #define DMA_FN_IN
    / e" D. d8 |3 w9 \9 W" n% d& X6 {
  51. #define DMA_FN_OUT
    0 h" F' T' [' C% S7 j3 m
  52. #endif" ^# b: P5 b& `: r. r

  53. : @' X  ~. v, m* Q- O* P+ K( Z. u# h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 i, k5 G( y3 b; ~1 R
  55. #define STATIC_SHIFT                34 T& k, F' f/ D6 H& q
  56. #define TCINTEN_SHIFT               20
    ' F& p. x& U3 ^4 C" G* z" i
  57. #define ITCINTEN_SHIFT              21
    / F# J5 y! l$ D3 {
  58. #define TCCHEN_SHIFT                220 D) s3 a8 f  c/ d1 X% A) d/ n: F& x
  59. #define ITCCHEN_SHIFT               23
    . H! N3 Z) U$ P( p3 k! D
  60. ( P" q+ L" h. N  h. i- C
  61. static volatile int irqraised1 = 0;
    5 @3 u2 u. F1 c; b+ U: `- l
  62. static volatile int irqraised2 = 0;
      T1 x9 \) P8 O6 I2 z! |! K
  63. ( q, A/ V* `1 v; h, b5 y3 Y" P5 W1 g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 d1 Y" U4 v9 k6 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ g- S8 b3 u2 Z4 l: U5 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - G* F+ K+ y" `# R/ B, ~7 _

  67. 1 b5 A7 n  j7 i$ K% Q( e$ O0 h
  68. dma_addr_t dmaphyssrc1 = 0;  t! Z3 R+ y4 S) A- s/ s& S/ v
  69. dma_addr_t dmaphyssrc2 = 0;
    - E& ^- U: w: z" V7 r
  70. dma_addr_t dmaphysdest1 = 0;
    7 a/ k- {& U) A/ a+ r/ x4 P! T
  71. dma_addr_t dmaphysdest2 = 0;
    1 O1 l2 ?: o3 T  y9 s* J( H

  72.   @8 c* U8 H% ~# C* |0 ~
  73. char *dmabufsrc1 = NULL;: X5 X: N, G* Y; g% N
  74. char *dmabufsrc2 = NULL;
    7 m; f$ c: @0 W5 {9 w6 `# M
  75. char *dmabufdest1 = NULL;
    ) i+ o8 o9 z5 G9 `
  76. char *dmabufdest2 = NULL;# E" S, V' v5 [3 B

  77. ; k1 K' ~* g5 q4 Q9 F
  78. static int acnt = 512;  ^% }) K3 }7 W) ]( w6 W& ~
  79. static int bcnt = 8;/ O) z7 ~- g* B2 a" K: Z
  80. static int ccnt = 8;
    % w' D/ T4 ?+ B$ e( @" P
  81. 1 q4 Z- ?8 v  |1 C
  82. module_param(acnt, int, S_IRUGO);, y  S+ M: G$ X1 m6 `* Y+ h5 j
  83. module_param(bcnt, int, S_IRUGO);
    . F, C; e# S% T' K  F2 o3 ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. t8 S% I6 X; e2 N9 `

2 `$ H& o! x' n: _1 ~% N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: Q# Q% b9 [- L8 A& v/ \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: X5 W2 ?! U  g" F3 d, d7 P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 b  y  r) L0 Q% G' F2 \. [

) |% Q8 Z; p/ `' h$ B9 l+ ~/ i, r+ R/ E9 {% u" [7 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 04:16 , Processed in 0.044560 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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