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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; h2 m3 Q9 l* n" e: L4 Q
  1. [code]EDMA sample test application+ }' m# P+ x3 B1 Y4 n
  2. /*
    6 r7 m/ ^" c5 |0 |6 `
  3. * edma_test.c
    ) Y  |) _( r. J9 c  o
  4. *
    5 g- T" @' M0 i
  5. * brief  EDMA3 Test Application3 Q) D) b/ {+ p* B$ z, D7 k, E# x5 \: l
  6. *) y% S# W; B6 D% M; r
  7. *   This file contains EDMA3 Test code.
    $ d9 b4 U# m& }. c
  8. *
    1 f3 V& U% X1 r( v5 p/ n3 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      k3 Q( [! ?' ~) H0 E" e- I- a, _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , a2 P+ A# K* q
  11. *         TO CHANGE.
    : c* m( e2 G$ q
  12. *
    ( @3 {' C( @1 l; r/ O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 v: u5 u+ K- H0 ^
  14. *2 O) W- T. H. D, z$ |+ l. s
  15. * This program is free software; you can redistribute it and/or
    7 r& A- Y9 _- a7 H; c5 h3 x
  16. * modify it under the terms of the GNU General Public License as4 S; r" n) G( X6 o, s; K' a' C
  17. * published by the Free Software Foundation version 2.% m0 @9 }$ L- j9 l+ X1 m
  18. *
    9 ^( g' o% {9 Z: k1 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) R* W4 b0 _- p* p& k: t
  20. * kind, whether express or implied; without even the implied warranty
    6 z2 x' `% a8 v1 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 Q$ w4 S, i' C$ w. {  v
  22. * GNU General Public License for more details.! o! q6 O0 ?" f9 Z! E
  23. */
    ; s) \2 Y9 r8 s  B) [6 E

  24. 9 F" r) T2 u  @# y7 C
  25. #include <linux/module.h>
    2 z2 {; V, x" \& D6 @6 x: Z0 W
  26. #include <linux/init.h>
    7 K' ^+ O/ ^6 Y" l* M) U
  27. #include <linux/errno.h>
    . e# t! j3 V( N- e4 J; B
  28. #include <linux/types.h>
    7 y8 K. C6 f8 W) K( V; U: U
  29. #include <linux/interrupt.h>
    + H7 D& }1 z: p
  30. #include <asm/io.h>: h2 w0 K" m% K0 m# g; I2 ]* r' m, |' U
  31. #include <linux/moduleparam.h>
    # I. a8 G& o* y/ r' v. q+ _4 M$ c
  32. #include <linux/sysctl.h>& z% j+ Z, V3 H) z
  33. #include <linux/mm.h>
    9 ~! U7 B5 f7 D& K1 j( g
  34. #include <linux/dma-mapping.h>5 [: ^& z* p7 K1 r/ z: r
  35. 5 e. |* H; ~6 j9 d4 r$ K
  36. #include <mach/memory.h>0 X" n) A, _9 H0 |; ~# G4 U
  37. #include <mach/hardware.h>$ w+ E2 T( K: E
  38. #include <mach/irqs.h>
    1 }. J2 z* E8 D$ ^! o
  39. #include <asm/hardware/edma.h>
    5 Z4 G* n. k( \/ L( K% v
  40. ( M& p; n1 u* B- I9 W
  41. #undef EDMA3_DEBUG
    $ J0 k( }$ Y/ D+ v2 G7 ^
  42. /*#define EDMA3_DEBUG*/2 T5 n) ]3 c! K  X4 R
  43. ' |) q1 |) \) X& T
  44. #ifdef EDMA3_DEBUG5 Z9 \* f  \% H+ |: ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 V/ x: f8 @' `* d3 n5 `" r, F0 Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): E0 V5 J/ B, K: @- v: q& B! p8 B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) |9 {0 R  v- ~# n+ I
  48. #else
      B9 Q9 n; Y7 _( W8 b/ Z1 V( z3 I
  49. #define DMA_PRINTK( x... )" Y. h: Q! K3 ?5 b
  50. #define DMA_FN_IN
    0 v4 H+ O7 v6 o( n- \! _  ?
  51. #define DMA_FN_OUT/ A2 Q% V: s! |9 `0 z
  52. #endif
    7 F% a4 _& d  N

  53. 4 x5 J) h/ [! C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * h4 d7 ?0 @* Q5 F& q
  55. #define STATIC_SHIFT                3) s4 S& M  `1 q  Z1 f
  56. #define TCINTEN_SHIFT               20
    6 X* Y5 A5 h" E5 h* m
  57. #define ITCINTEN_SHIFT              21
    9 O1 O5 r+ q5 ^7 L& G) R, A1 y
  58. #define TCCHEN_SHIFT                22
    2 l# G; F% ~+ o& i' J2 l
  59. #define ITCCHEN_SHIFT               239 c2 H' ~& h) x+ j6 ~4 r
  60. ) ]* m! c) L/ r
  61. static volatile int irqraised1 = 0;
    , Y" }: d3 v9 c4 |1 `
  62. static volatile int irqraised2 = 0;
    3 j# B. q% H8 o1 A0 |

  63. 9 z7 ]) |5 x2 k/ f( A% f) J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! ?5 G4 d% S3 W) f  B4 N) ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% J5 z  S8 _- O0 f& S- @" ?. h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ C0 [4 R9 X8 b

  67. ! ]6 Y1 Z0 `/ o5 j. ?5 Q! t& j
  68. dma_addr_t dmaphyssrc1 = 0;
    5 u9 ~* d0 q$ `
  69. dma_addr_t dmaphyssrc2 = 0;
    ( x' G$ _0 G" X( O! c
  70. dma_addr_t dmaphysdest1 = 0;  Q3 P3 s; ^  z9 _
  71. dma_addr_t dmaphysdest2 = 0;
    ; W( T* c! S% g, w* X4 \! h

  72. / k1 k' D- n# R# D7 [' o( z
  73. char *dmabufsrc1 = NULL;
    4 y1 I* Z5 B* E9 i3 K" I
  74. char *dmabufsrc2 = NULL;
    ; ^3 @3 x* U3 D* Z
  75. char *dmabufdest1 = NULL;) @7 t% @% e8 K/ V) [
  76. char *dmabufdest2 = NULL;
    3 k# F# t8 X9 U. I" n5 g
  77. 5 k( {* a/ Y: L: Q
  78. static int acnt = 512;: E6 W- U0 i+ S9 x1 R2 n
  79. static int bcnt = 8;% w: \6 m, J' ]& P/ P8 d( @
  80. static int ccnt = 8;5 x# M& s1 E9 |$ U$ t) e- q" ~

  81. ; M9 x! n: v4 |* [" ^
  82. module_param(acnt, int, S_IRUGO);
    ) V# f8 D8 G, m3 _! K9 A
  83. module_param(bcnt, int, S_IRUGO);
    ( g6 z; u' q' E+ _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ `% y! w, d7 F0 ^3 E) M+ Q
! s8 l2 o1 P9 i8 u% R! D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, h! Y4 m! t; S" G3 G( i( marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- b! O% d+ J& B8 j6 _+ z- e+ f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' b  ~$ F, V& e0 D2 O7 P. a4 y5 W, b2 Y2 M; ?6 F( \
1 h) Y, V" p; ]3 Z. V- x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-18 15:27 , Processed in 0.043513 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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