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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " z1 i  @0 f. l; c" X  U, N6 ~4 |: Q0 j
  1. [code]EDMA sample test application
    2 V& N3 f& r  q; O- m9 t& w
  2. /*, Q* R; m& ~" M+ d" R, I4 d
  3. * edma_test.c+ m' [% L  E3 g, K) O
  4. *$ u* m% p9 o4 N" o- d/ Y& ~* w
  5. * brief  EDMA3 Test Application3 c& {, E* i/ _6 l. z2 K' b7 F
  6. *
    + Y6 r' Y1 ~, i4 O
  7. *   This file contains EDMA3 Test code.- k3 G" j; |; C, d  q$ O3 b
  8. *% p5 Y. t  o1 V5 z% {6 h; t$ n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * F' L3 A: z4 {* [" T7 _% P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( i4 N3 ^7 }! }8 H' e
  11. *         TO CHANGE.6 @, v; a: E* g- f+ B
  12. *
    # }6 S4 s) n- {1 {- W9 O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 G' l# j3 f4 G5 i, x
  14. *
    $ l1 J% ~, ]- U* G: O2 l
  15. * This program is free software; you can redistribute it and/or
    / k# Y; f5 {% P# v. P% e; ?$ e
  16. * modify it under the terms of the GNU General Public License as
      \& \: x# v3 B! @9 q# e9 q. {# h
  17. * published by the Free Software Foundation version 2.' x* P" @1 b. o
  18. *
    7 s) D; d. R  U2 ^/ \/ J, m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 T4 d; x" L$ ^, Y) F
  20. * kind, whether express or implied; without even the implied warranty% Z+ J1 Z( B: B& ]# {! R  l% k. g( m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 c/ u( t, Q! S/ w8 M+ `6 L
  22. * GNU General Public License for more details.
    0 s& k! Y+ ?) F# ^# ]. T6 |
  23. */
    5 o9 F% V9 o/ k9 M6 ]
  24. # a. c# q0 d2 M
  25. #include <linux/module.h>3 ~1 g. ^& y6 @7 E
  26. #include <linux/init.h>
    9 ^8 o( t. o* C
  27. #include <linux/errno.h>
    0 B  `2 Z) v4 v. F6 X2 m/ r
  28. #include <linux/types.h>
    5 i5 a0 j2 M0 v' v" H
  29. #include <linux/interrupt.h>
    $ W* Y( T3 R! k) j% B
  30. #include <asm/io.h>
    8 ]3 t3 s% `- ?0 t
  31. #include <linux/moduleparam.h>
    1 k' U5 g* A  ~  e0 I
  32. #include <linux/sysctl.h>
    4 N6 J  H7 \  `3 i
  33. #include <linux/mm.h># X1 r$ w$ B# S  |0 E: g1 z
  34. #include <linux/dma-mapping.h>8 v2 F: ?- I+ F; n" Z( W0 `! R* e9 V

  35. / y$ V& K+ L+ M- v6 Y
  36. #include <mach/memory.h>7 e, W1 E& h6 V7 ~0 ]
  37. #include <mach/hardware.h>
    . u6 G- u' {- S$ G
  38. #include <mach/irqs.h>
    1 F, N  R6 d4 s9 U
  39. #include <asm/hardware/edma.h>7 u' [4 V$ f3 t5 [2 R
  40. 1 g* U, w+ P6 K& ~
  41. #undef EDMA3_DEBUG/ c3 z7 Q- U5 H0 p
  42. /*#define EDMA3_DEBUG*/
    $ q2 b$ p; }+ Z- l9 E) q( D

  43. 7 ^. W1 j' G2 l) s
  44. #ifdef EDMA3_DEBUG
    $ z  H: q0 H, j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 f4 W- r5 W+ |: p7 E3 m9 a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 l8 {$ ]; x/ B& C4 ]0 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 j3 n# c7 E/ k
  48. #else
    8 a7 C1 V( B5 T$ }1 m/ _, H
  49. #define DMA_PRINTK( x... )
    , V# Q4 R+ ~* ~2 s2 y3 b; p
  50. #define DMA_FN_IN+ o; Y) L  H( I# a$ T3 w% Y' i+ o8 f
  51. #define DMA_FN_OUT+ `( }9 z# [# Q7 n
  52. #endif
    ' S3 k  ~# I; O) B* B% t& R
  53. ' R0 h: n0 n8 J2 q% n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      l, g/ n0 A: s! a4 o
  55. #define STATIC_SHIFT                3
    5 |: w5 p2 `' v& l6 P! v6 J
  56. #define TCINTEN_SHIFT               20- \' N  j$ R( f. a+ D3 q) v* z
  57. #define ITCINTEN_SHIFT              21
    8 a/ \1 T4 X/ T! d' o  C3 p
  58. #define TCCHEN_SHIFT                22
    4 m& k: W$ r+ b1 u
  59. #define ITCCHEN_SHIFT               235 [8 R3 b& x3 Q+ ?9 P

  60. 0 X+ F5 n0 {, k2 b2 [) @
  61. static volatile int irqraised1 = 0;
    ) w3 N7 y; {# u( r, f1 @/ `& ^8 c
  62. static volatile int irqraised2 = 0;6 B0 |8 T+ H' P& e2 I) A" d

  63. . s5 h2 E& T$ r! ^; U& ]" f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 m5 l2 `+ G0 M9 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # s% w% E% x0 |) w; T1 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 q3 V+ Q$ F+ M$ S2 y+ K8 G! H; q

  67. ; Y( q8 g! _7 _( x2 j
  68. dma_addr_t dmaphyssrc1 = 0;4 [$ X; I; w8 P8 v" C9 S
  69. dma_addr_t dmaphyssrc2 = 0;
    " g0 i$ d, ?2 X
  70. dma_addr_t dmaphysdest1 = 0;/ U2 _. q  w/ _0 _2 \& K
  71. dma_addr_t dmaphysdest2 = 0;0 G: `6 }3 F, U; G$ Y( a
  72. 8 B6 O' \* P4 S+ S
  73. char *dmabufsrc1 = NULL;
    ) J; g$ Q9 K! j* y1 t9 m' ^
  74. char *dmabufsrc2 = NULL;
    5 f. D$ @# k  A
  75. char *dmabufdest1 = NULL;
    + J! v% o, _0 F: q; u
  76. char *dmabufdest2 = NULL;
    ) }& \& D  R1 i3 z- a

  77.   h: [+ G3 ?. J# K- o  O4 A. q0 W
  78. static int acnt = 512;
    * T6 a6 r- X2 Q( _$ G" L. c: h
  79. static int bcnt = 8;+ w' Y6 Y/ @9 E6 c9 u- a, L' L6 p
  80. static int ccnt = 8;' r# J  b5 D5 [1 I7 O
  81. $ D: J. l0 k/ w, T/ y
  82. module_param(acnt, int, S_IRUGO);
    8 d6 O4 P) ]; ]/ j& W2 l5 s$ Z
  83. module_param(bcnt, int, S_IRUGO);
    . m. ~9 Z- u: h( `7 z7 x; v5 \$ H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 X5 {+ L( J* ?0 |# S, d1 }  `  E; g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( ]( x) e8 V. F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 ~3 m' R1 t6 |8 \; B: ~3 R3 d& P! f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ C: \3 Q. d& M( f2 v$ Q7 f8 K( e9 r  p) D

) h" |% }- X5 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-21 16:31 , Processed in 0.047529 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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