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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; L* S# x: M; B4 g8 U0 V
  1. [code]EDMA sample test application5 b! n6 ~7 y2 `$ H# Q# P' p9 c* K
  2. /*
    . I0 c! ]. z" R8 C% G
  3. * edma_test.c3 V- K5 {2 g/ ]6 Q
  4. *
    6 F, S3 ?. u: O
  5. * brief  EDMA3 Test Application
    / b2 ]8 m0 r+ a
  6. *
    6 w, t1 ]" i7 n! Q, H8 N8 p
  7. *   This file contains EDMA3 Test code./ Q" i: L2 y+ ?0 ?( w+ @+ e7 W
  8. *8 \( Z1 V# Y5 C3 w6 U: ]4 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 L# s0 g+ ^, s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) @( n' Y# x/ s& N
  11. *         TO CHANGE.
    5 `( h( M2 @* a
  12. *% M4 X2 o( k, P7 [5 c% g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* E" d+ N8 L8 Z8 n( _* q! q
  14. *. |* i" x% P6 U+ U
  15. * This program is free software; you can redistribute it and/or; \0 J" k2 ]5 q7 E% v& ?# ]
  16. * modify it under the terms of the GNU General Public License as8 y& l. i# z2 b
  17. * published by the Free Software Foundation version 2.9 i) K6 t8 S/ l" @) N
  18. *9 Q3 V& o* T1 U2 N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" S+ r2 T2 P4 Q( }! ^& G9 D& ^, \
  20. * kind, whether express or implied; without even the implied warranty
    0 m- s& k: W4 `2 a. Y3 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ i% m$ k( Q8 f) q
  22. * GNU General Public License for more details.$ b* t/ w6 O% d7 W
  23. */
    : K. g% o" T* u6 }3 ?

  24.   X0 Q, p* t+ Q& P+ @, d) l* g$ t
  25. #include <linux/module.h>6 d6 z# D) p# [0 t. i, H
  26. #include <linux/init.h>
    ; N3 }6 ]0 n- ?! U" ?
  27. #include <linux/errno.h>
    % O! s6 }7 T& @. `* T- G
  28. #include <linux/types.h>
    & H1 Z& U4 `2 {: F* S9 f
  29. #include <linux/interrupt.h>' C* m. `% o! ~  o
  30. #include <asm/io.h>3 n( u( J% e/ C; q# y
  31. #include <linux/moduleparam.h>
    1 q$ z7 o5 ]/ |1 v+ V6 I8 o/ l
  32. #include <linux/sysctl.h>
    ) x4 {7 J$ L3 Z# r' H( j: S
  33. #include <linux/mm.h>- z, g- F9 v* W- a7 h
  34. #include <linux/dma-mapping.h>
    ' a# l! q0 Y# d- E8 \2 e
  35. : }3 M& G* z- q1 ]7 ?# _
  36. #include <mach/memory.h>
    9 b3 C) L6 o8 ?( r. w9 }* |
  37. #include <mach/hardware.h>- j4 x( Q" E% `& }3 g
  38. #include <mach/irqs.h>' M( I( E! ]  L  H/ G3 q
  39. #include <asm/hardware/edma.h>. A( X1 K3 M- X# O( ^

  40. ) C  ~7 ~. R# x+ B7 v/ r
  41. #undef EDMA3_DEBUG- I( F) Q* ]% A" m7 {5 I6 w
  42. /*#define EDMA3_DEBUG*/
    : s7 S4 Y* a( y1 M7 ]) X, Y
  43. 8 F  q2 S/ O' Z
  44. #ifdef EDMA3_DEBUG: h8 R7 o5 M& i, Q6 }/ t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). E5 l( Y$ E0 O: q: F& J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- S, G# C& R0 ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * \- b9 s! s8 d5 V" h
  48. #else4 W# z% r! n4 [
  49. #define DMA_PRINTK( x... )
    3 B0 w+ G& L4 W8 P# U
  50. #define DMA_FN_IN
    % @  |, v7 F3 b% W8 m% d
  51. #define DMA_FN_OUT7 g  D' ^$ E  E. d
  52. #endif
    2 F3 d; @! ^+ V9 p2 M
  53. : v, u0 t4 X* O* \, M1 {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); p- a) s) ~1 s+ V# c, `- f
  55. #define STATIC_SHIFT                3
      Y7 `  P' Z2 K. a1 d
  56. #define TCINTEN_SHIFT               208 v" x1 o" g* a' }
  57. #define ITCINTEN_SHIFT              21
    ' m& H: N% O0 h; \7 L1 |9 q
  58. #define TCCHEN_SHIFT                22
    & v- W3 N- f/ C6 u
  59. #define ITCCHEN_SHIFT               239 ]/ ?. U7 \8 k# D6 a
  60. ) E- s/ H0 F. V8 w- \
  61. static volatile int irqraised1 = 0;. N  w6 J1 B# h# ~/ B' U
  62. static volatile int irqraised2 = 0;
    / w3 ^* n* y! g( I. @+ i: N

  63. 1 m1 }( ]( ^9 l- Q* Q" l# m4 n  h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 L5 g6 ]" x; J/ h, a8 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 a# o7 n; L' p" {# T3 W6 z' Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 b1 \1 \1 H1 ?( h+ i2 i

  67. . H9 ^# m; M; ]3 b
  68. dma_addr_t dmaphyssrc1 = 0;4 J! E- r7 f- V6 K5 Z4 J
  69. dma_addr_t dmaphyssrc2 = 0;( k( C+ R! X6 c5 Z1 {
  70. dma_addr_t dmaphysdest1 = 0;
    : q% h1 {  T) l- N8 C
  71. dma_addr_t dmaphysdest2 = 0;
    ( p+ c3 d  s% R: K( q
  72. ) N; T  V" U# V) y( T
  73. char *dmabufsrc1 = NULL;
    1 W( B, a' b" V2 `! l+ t0 @$ R
  74. char *dmabufsrc2 = NULL;) }0 D( f& b' a8 \9 f% F: v
  75. char *dmabufdest1 = NULL;" y6 p4 T+ X, u+ {% Z
  76. char *dmabufdest2 = NULL;8 W) @# @5 L7 _4 d; X5 k

  77. . W5 e8 w. ^, [3 V  m/ Y
  78. static int acnt = 512;- i: }  S) Z9 ^# F/ Z0 I! [
  79. static int bcnt = 8;! v3 g; l  b1 w' d
  80. static int ccnt = 8;5 z( Y2 |$ }* l# a" ]- b
  81. " t- M. b# x. q4 M( h
  82. module_param(acnt, int, S_IRUGO);
    0 E; }. r* g  r" t  P3 u
  83. module_param(bcnt, int, S_IRUGO);* R! V" I: ~8 \0 ?' ^% ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) g4 h8 d) V- a9 C7 B

5 w: l% v7 o+ H! R      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 Q3 M- J4 R0 c/ g2 x2 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! x3 L/ v3 k% Q' T! Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 ?8 w  T4 ]4 g( z9 Q, N

7 z+ ~: n7 I0 {% F# w' T% E8 ^# u5 X$ T3 H2 a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-13 14:07 , Processed in 0.064228 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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