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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' x3 _- k9 g; j& W4 R! k
  1. [code]EDMA sample test application! X( v+ V' D3 ~7 T0 r
  2. /*
    # A6 j" Q+ N, A3 v
  3. * edma_test.c; r  s+ Z5 M6 O! z
  4. *
    6 ^1 v* w' V7 h% L# v0 |9 v) s, f
  5. * brief  EDMA3 Test Application+ q) I6 u: P6 u9 A. f
  6. */ n5 m" F! |4 P% t- x/ k* U0 p
  7. *   This file contains EDMA3 Test code.; v8 S/ w) N, }: i% {6 o% Q4 `
  8. *
    , ]. d' |+ L7 q" A6 }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ N, S0 \, v& }: }2 s. D. T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 u% a5 [8 p7 A5 T8 c- l
  11. *         TO CHANGE.7 C& Y6 c. p: u: e( ]; T5 A! Z
  12. *  U/ K2 \% M/ b% b+ h, o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 `4 `5 }! A" u7 }5 V
  14. *
    & \0 D3 v- O' p
  15. * This program is free software; you can redistribute it and/or( ]( \/ n9 p( E' |2 g, l: E" t6 F  W8 ~
  16. * modify it under the terms of the GNU General Public License as5 T! O. x/ H* A" h7 r
  17. * published by the Free Software Foundation version 2.
    7 h$ L" z* p2 G
  18. *1 A9 W+ l3 ^/ M/ ~+ @& L% |7 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 q4 Y0 X! Q( T1 @  c
  20. * kind, whether express or implied; without even the implied warranty- [' a5 n9 Z2 C$ A* C$ X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. Y3 F: G; c- q* S8 l$ m
  22. * GNU General Public License for more details./ U0 b" Q; a! v
  23. */0 e, p' `; n+ X3 [

  24. : S% R- u8 Z8 _1 b$ r8 q
  25. #include <linux/module.h>
    ; o+ S1 j' \5 q( h
  26. #include <linux/init.h># ~( ?0 o, F( t  h) m
  27. #include <linux/errno.h>+ x" ?( C& f3 E4 t; S& x/ z. u
  28. #include <linux/types.h>
    / p( ], E! p  N5 X; P/ \- h# q$ V
  29. #include <linux/interrupt.h>4 \" \" T4 i, H& R
  30. #include <asm/io.h>, q8 Q/ F, {  [2 _9 ?, B  x
  31. #include <linux/moduleparam.h>: o- }+ r: o$ u( e3 [+ L
  32. #include <linux/sysctl.h>. ]# R, S% T/ m8 t7 w0 E4 d9 F; B, p
  33. #include <linux/mm.h>  s; s& J' u, C. _0 b. ?* a" w$ ^
  34. #include <linux/dma-mapping.h>6 T( Y/ }1 [+ d7 j2 N

  35. 5 U( Q. c9 A( p: k( u1 r1 K
  36. #include <mach/memory.h>
    2 j; v' L  I3 H" O0 }$ a
  37. #include <mach/hardware.h>
    % }  j& `# a: F: f
  38. #include <mach/irqs.h>) j% q/ U, B* R: D. u2 v8 q" Y9 f
  39. #include <asm/hardware/edma.h>
    7 d. i* A) E8 m' c& E
  40. ! O  e, k6 L* S, ]8 b. r
  41. #undef EDMA3_DEBUG
    2 L5 T( w9 s0 r; {2 U7 `$ \4 ^0 M( @
  42. /*#define EDMA3_DEBUG*/. B4 q& f. T) n) F) H  a4 G; j
  43. , p$ j3 h' D/ P. K6 d
  44. #ifdef EDMA3_DEBUG4 q9 \! \( B/ p" l2 H3 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 ^: a7 M5 e$ H! ?3 S6 b6 O& o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# ~# J% P0 v1 M& P1 O6 m- S8 M) _8 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + g% N: x! n) @( c: f
  48. #else/ ^  y6 A7 N& @* C4 V
  49. #define DMA_PRINTK( x... )8 p  X1 w5 L9 e
  50. #define DMA_FN_IN8 o, x( F  [) c( ^# Q# j) z$ Y
  51. #define DMA_FN_OUT
    / _) H9 b6 Q; f2 J
  52. #endif
    4 m: v: e' j+ R. v' q( G. Q- ]
  53. - o, _; y+ ?8 A. Q# O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : [* r" D4 M7 G) A
  55. #define STATIC_SHIFT                3: S. w+ g) q! w. r
  56. #define TCINTEN_SHIFT               205 m! X, a+ j$ X7 q9 ?8 Z
  57. #define ITCINTEN_SHIFT              219 |" D$ g! X# V0 W
  58. #define TCCHEN_SHIFT                22
    + X0 t( `; ~5 p7 @- s" x& |: J
  59. #define ITCCHEN_SHIFT               23; T- F2 H) w; ^
  60. 5 v0 f% N: F! ?, r$ E
  61. static volatile int irqraised1 = 0;
    : f2 R" B3 Z% W- e
  62. static volatile int irqraised2 = 0;9 x/ m$ n7 P0 t6 r$ I) `8 l$ d; I0 l  n

  63. / S( l4 [& v, H6 i5 O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 ]9 L) X( ~- o, n$ F( X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( ]* g) s6 {$ V0 K0 L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # s5 ]! R, T( u) F" H  |

  67. & P! j3 h0 u" V0 c/ V8 [
  68. dma_addr_t dmaphyssrc1 = 0;
      o7 ]4 Q6 {/ |, \% `
  69. dma_addr_t dmaphyssrc2 = 0;
    * q* ]+ i. s, J0 E" Y/ ?  \
  70. dma_addr_t dmaphysdest1 = 0;
    : |& r7 N+ R' [: e  G
  71. dma_addr_t dmaphysdest2 = 0;# U% V2 l* v4 V0 Y& D- _' V# C
  72. ! Z( Z9 X2 ~* G
  73. char *dmabufsrc1 = NULL;
      t3 w* B7 r2 N4 ?! c
  74. char *dmabufsrc2 = NULL;
    ! ^, W' T" C6 Z
  75. char *dmabufdest1 = NULL;
    / r# i$ {  N$ y+ _
  76. char *dmabufdest2 = NULL;3 n) q: X! C( L( n" Q) j
  77. ) k- C+ ]+ o! u0 P
  78. static int acnt = 512;' O/ S' E4 S3 w' b9 [6 G. H
  79. static int bcnt = 8;- q; Y1 f: F9 T
  80. static int ccnt = 8;
    5 O) V# Z/ f8 F  E! X
  81. 3 A- {2 M& p4 M& G9 G0 g
  82. module_param(acnt, int, S_IRUGO);
    . {, s( Z" V$ i. {, f% m/ n/ z% r
  83. module_param(bcnt, int, S_IRUGO);
    6 @& r0 {0 o5 k5 U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, z- K3 p( U/ \  C3 S9 ]' _* U. f- H
. B& B4 _6 s( J2 u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ N& c! h1 q* L' T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& I" m3 |+ {- _9 |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 p2 g) J$ o8 W- R: e' [* R- Y( X3 Q3 b1 S

* z/ G1 o1 Z5 L' r* r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 20:30 , Processed in 0.045028 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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