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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 e/ K0 I6 H3 f8 j3 [4 m$ Q
  1. [code]EDMA sample test application0 N5 p$ V5 M2 y# s, z
  2. /*
    4 `' ?) N  H8 j* J/ {
  3. * edma_test.c, @: A4 l! p( B) ]% g# Z2 g4 b
  4. *
    : P7 t/ x2 _% r. s) j
  5. * brief  EDMA3 Test Application* i5 e' z- y. X: m" ~' o$ s3 O
  6. *$ h0 M% ]# r# k, z( ~% A
  7. *   This file contains EDMA3 Test code.
    & O2 {4 O" I$ K
  8. *1 y0 ?4 Q9 _+ f  m$ d( @0 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / c0 f- s: S# ^4 Q# a3 g8 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * d6 W5 L9 r1 i  E: l! ^6 x
  11. *         TO CHANGE./ n7 e) Z5 n2 H
  12. *4 S" |. W0 K  D5 y% n+ X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 T: _* f8 R" X
  14. *
    ) N. }0 c3 N" V0 `7 V. E  @8 Y
  15. * This program is free software; you can redistribute it and/or
    9 b+ E  }- b. s, I- p+ d
  16. * modify it under the terms of the GNU General Public License as
    % H8 N2 B- T4 c5 v8 V" C  h+ {1 E
  17. * published by the Free Software Foundation version 2.: i& ^5 X1 X: ~' W2 Q
  18. *! s1 B3 [3 R* C3 P9 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& v; @2 i) Q7 L% ?4 y" E; d, }' j- U
  20. * kind, whether express or implied; without even the implied warranty7 M) B& ^# W( s9 n# }5 G% k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: K  \( ^8 |$ L, P- i: B
  22. * GNU General Public License for more details.8 O& w6 \: u5 ^% w2 ?0 w# y( M
  23. */" |- v  ~# R$ o$ X3 a
  24. 9 H1 B( u+ ~( H3 W
  25. #include <linux/module.h>
    ) ^% n8 l: c8 |! Z4 j$ o: o
  26. #include <linux/init.h>/ v  E$ `7 d- R2 K( i
  27. #include <linux/errno.h>% l* k( l4 g5 r1 D; y; ^
  28. #include <linux/types.h>
      h- F8 l5 D5 X9 P) y; k( `
  29. #include <linux/interrupt.h>
    # T; n' k4 }) d! D3 u& x
  30. #include <asm/io.h>
    3 J; |" v1 d( t. R2 F# @: X% K
  31. #include <linux/moduleparam.h>
    2 Q% }5 H5 q, J' Q+ j1 M; ~) h
  32. #include <linux/sysctl.h>* j; J% q1 c2 c9 W
  33. #include <linux/mm.h>& x4 Y4 j) Z7 u
  34. #include <linux/dma-mapping.h>
    / V( o- T8 s9 a/ T
  35. 1 |" c! `" k. S- B/ k; l
  36. #include <mach/memory.h>
      h: P8 Y% \3 M% a4 I) e# r+ K/ _
  37. #include <mach/hardware.h>
    6 D( [- \7 h! B- L/ ~( ^
  38. #include <mach/irqs.h>
    + g1 n$ F. t) o; j* Z
  39. #include <asm/hardware/edma.h>
    3 @, @% g7 [; p# Y& j2 ]6 q

  40. : ~# W& v1 o+ F4 C, P( u& A3 s# g
  41. #undef EDMA3_DEBUG
    ) l1 J; j/ F6 d9 y; m1 ~
  42. /*#define EDMA3_DEBUG*/
    % \  ^0 W. |0 _' a
  43. * X' x; h- D1 ]( T1 Q
  44. #ifdef EDMA3_DEBUG
    0 ^7 ]8 s5 y3 i7 [1 K: }4 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- s) D1 [7 j* [4 l* W( v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ `/ N# T. W) [4 q/ A8 c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) ^/ G1 E2 I* V- a$ y5 I
  48. #else
    * y, q; d, X6 N2 u
  49. #define DMA_PRINTK( x... )
    1 G* w6 p( S9 x2 C/ t8 C
  50. #define DMA_FN_IN1 h1 }2 r9 v; t/ d; a
  51. #define DMA_FN_OUT$ w- y; _3 y* v- \+ s6 a6 s! B4 J) E
  52. #endif
    2 ^$ W4 `. O5 U$ y* J

  53. 8 r3 v( z+ c0 `" p7 x; A. T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 z1 f  y: B0 x$ Z* s% F: _+ ?
  55. #define STATIC_SHIFT                3
    & D/ y( n. m, X
  56. #define TCINTEN_SHIFT               20
    * F. X1 u" g. d- ]7 q
  57. #define ITCINTEN_SHIFT              21/ N1 n6 e) o& f; O
  58. #define TCCHEN_SHIFT                22
    " f, w/ B4 V+ U- ^* x
  59. #define ITCCHEN_SHIFT               232 P( z0 U7 Y2 g& p, p' E1 {
  60. 9 f0 w: X" I4 E. N9 C
  61. static volatile int irqraised1 = 0;
    6 z- [2 g5 S) \
  62. static volatile int irqraised2 = 0;
    + M" ]  V; `7 \" ?* a) u  x

  63. 0 v% J) {$ H; G+ S# R0 m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ Y; L! ~, M5 N2 {* O" [0 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* H% ?, m/ c: t, b0 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 }% q$ \$ m' G# U% M' T
  67. 3 d) U! C! G3 R, Q3 J
  68. dma_addr_t dmaphyssrc1 = 0;
    ( V: k* l5 W; b0 v
  69. dma_addr_t dmaphyssrc2 = 0;
    6 A$ r6 J( O" q- E, ?( w
  70. dma_addr_t dmaphysdest1 = 0;; o+ f5 K* F' H. \# a4 b( ~
  71. dma_addr_t dmaphysdest2 = 0;4 M7 ]3 {9 }' \$ m: J
  72. 2 C; T# y2 m- j: R# h6 @5 v
  73. char *dmabufsrc1 = NULL;, H' ]' J# S7 X+ S
  74. char *dmabufsrc2 = NULL;
    ; B" [1 X$ e) ?2 j' S7 J1 w$ T
  75. char *dmabufdest1 = NULL;
    ' `( w4 T( X! l% r( W4 `/ S. m
  76. char *dmabufdest2 = NULL;& g: f) e0 N4 x* }4 h. [/ x
  77. 8 D2 h; T. i) ?( q  k* i
  78. static int acnt = 512;
    * j3 c2 o4 c; ]4 ~$ s. R, {
  79. static int bcnt = 8;3 \, H& y7 M) u: ]+ t
  80. static int ccnt = 8;8 O( n6 ^& D2 t, ~* S

  81. 9 P& `- S# Q/ ^) w! ^
  82. module_param(acnt, int, S_IRUGO);# O% C% Z+ f. {9 C& C# c7 e: D9 t
  83. module_param(bcnt, int, S_IRUGO);
      r, U2 `$ H" Q" q$ `2 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 o& V* \! F- [+ W0 N1 S; o! N! a, e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* A2 l+ Z2 _0 W/ p3 i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 u- ]9 l9 F3 y5 D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 A6 [8 T6 J( k% G

, {) I8 i6 H4 `% v9 \: B& O# X3 b( j" Q7 ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-25 04:19 , Processed in 0.040988 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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