OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' E, m0 U3 B3 ^
  1. [code]EDMA sample test application! Q) g' P5 n" V
  2. /*
    ' u+ ?' D8 m. S& }
  3. * edma_test.c- k+ l+ L! P) u6 h& Q8 [
  4. *
    8 f0 |# x; A# \
  5. * brief  EDMA3 Test Application9 w( b: o7 d. T
  6. *
    6 M' y6 F* @% p) I( u/ U
  7. *   This file contains EDMA3 Test code.
    $ B6 v" U  M/ F6 P4 [
  8. *
    ( a, i. U9 }6 z, K, h# S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ }0 d6 A& f; E3 U& T* I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' s1 c, {' a& \+ P
  11. *         TO CHANGE.4 Q* h$ Q8 t! o( H- q& @. u; e
  12. *, }! _! C+ f* Y9 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 \$ b1 P/ m5 h, c! ]7 t
  14. *: J" y7 j: D) A% \2 n  R* B/ A
  15. * This program is free software; you can redistribute it and/or9 f5 ?6 v" A; l7 P  d9 D
  16. * modify it under the terms of the GNU General Public License as9 J' y' N: G0 O6 t% o3 U; `7 C
  17. * published by the Free Software Foundation version 2.; G/ ~7 _$ X( j. I' h) V2 o
  18. *
    $ [& c0 d% _+ C3 v: Q8 a3 U+ ~: |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 p6 D# @, S& ]- M9 u
  20. * kind, whether express or implied; without even the implied warranty
    0 V! v/ Y5 i5 Z/ P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 o. A6 @8 i" h0 X+ N
  22. * GNU General Public License for more details.7 V5 H0 Q: I7 S% |1 O
  23. */
    7 _/ x& d0 ]$ b+ i; o  V( {& J

  24. / p+ P/ f+ o% y" y1 [& i$ B: q
  25. #include <linux/module.h>
    0 b+ m4 e5 F: B1 m- T8 A- n
  26. #include <linux/init.h>
    % u4 D. S$ G6 z; J  b' p; h
  27. #include <linux/errno.h>; w5 S8 o# b# c! H5 P4 t' i
  28. #include <linux/types.h>' _/ n0 j7 a7 E- Z' o( ^8 A
  29. #include <linux/interrupt.h>
    # `' b# g! H, V5 R  [+ x" R! q/ s5 @
  30. #include <asm/io.h>9 W" N+ t0 Y. Z1 i# ?
  31. #include <linux/moduleparam.h># ~& i0 V( _* u$ I9 E
  32. #include <linux/sysctl.h>
    9 k8 s/ E7 ~9 C, v/ j2 w. n
  33. #include <linux/mm.h>
    , f  B' \/ \7 H$ m
  34. #include <linux/dma-mapping.h>1 M9 B' N. ~) B$ }! g* }( R

  35. * W3 X9 }# B: z" z" s( N3 v
  36. #include <mach/memory.h>  v* h$ F& l% J. N, D( r- @5 a  U5 d
  37. #include <mach/hardware.h>! ~9 U  E" `- U/ {1 c5 n
  38. #include <mach/irqs.h># @) Z* R: |: I. s# C! Z
  39. #include <asm/hardware/edma.h>- L( Q4 q# D2 a
  40. - b; f4 A; `$ y
  41. #undef EDMA3_DEBUG
    : }. S" K' ~4 ^3 G* c
  42. /*#define EDMA3_DEBUG*/' W4 ?7 j$ q% G

  43. 5 M' \( t' M; ^# k2 a5 u
  44. #ifdef EDMA3_DEBUG% }% }& N& ~- H9 R* `* f* D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 `0 G" [# K+ K* e7 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' I, Q" g/ U: i; R" M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * U* K- r, i# _- S! `
  48. #else
    0 u# X) ]9 N7 R1 w
  49. #define DMA_PRINTK( x... )0 a+ T8 _7 O* B  d
  50. #define DMA_FN_IN
    ! V- @5 ?& }' ^; {+ D5 V
  51. #define DMA_FN_OUT
    , [4 F8 [! V4 L9 H( m; F
  52. #endif7 V" v- j# z3 v! Z

  53. 9 B; n" E+ f& u2 m$ o3 @" y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% m. r8 P' O+ F4 _  H
  55. #define STATIC_SHIFT                3
    - ?) c1 F6 f: w
  56. #define TCINTEN_SHIFT               20% A* u) m6 Q% H* R
  57. #define ITCINTEN_SHIFT              21* c% k" J: l" h9 c. m, }7 g% r2 ]
  58. #define TCCHEN_SHIFT                222 h3 ^9 k/ A& _& R8 m; p6 G; ~% p! J8 _
  59. #define ITCCHEN_SHIFT               231 i2 d" P) M% K! Y+ @
  60. 9 p/ P, ]- B, ^. x% C( T& \0 S6 h3 Q
  61. static volatile int irqraised1 = 0;/ u: |2 d. A% o$ x# E2 r3 t
  62. static volatile int irqraised2 = 0;% ?) a! P- F0 S/ A# V

  63. * l5 s& v( K. d6 F2 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; u, v4 v! X  F5 E3 p% ~& C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; v! C+ k) ^/ N" t0 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 B2 o6 }0 ^/ ?) {, _$ s. B$ R
  67. 7 `/ w$ b& K; p' }" I% e/ F
  68. dma_addr_t dmaphyssrc1 = 0;& ^! K, v" t' D1 Y2 `
  69. dma_addr_t dmaphyssrc2 = 0;3 Q; E! Q. V8 Y4 G- }1 S9 m
  70. dma_addr_t dmaphysdest1 = 0;
    3 N% K' E* D9 \1 [
  71. dma_addr_t dmaphysdest2 = 0;. O9 C; C# A- v2 l+ ~7 b( m

  72. & i- |' m9 v# C( b$ ]! ]
  73. char *dmabufsrc1 = NULL;
    ! Y  l# e* N! _. E) \4 e& ]7 ?
  74. char *dmabufsrc2 = NULL;
    8 `& F  l4 R, x0 z; x
  75. char *dmabufdest1 = NULL;2 N3 m4 _- \3 U& J# U: R- f
  76. char *dmabufdest2 = NULL;
    - v( p+ x% F% w* F7 i# c% w. C
  77. ! a2 e) V$ f8 B, S4 S2 c: S
  78. static int acnt = 512;; W; h! V1 r" v) r
  79. static int bcnt = 8;4 y; i: h) n' v4 w$ c- L& e
  80. static int ccnt = 8;
    + ^: z3 D& d* ]& V% o

  81. 5 N8 n7 U" J& B7 r
  82. module_param(acnt, int, S_IRUGO);
    $ n3 @5 ?# K! R/ J1 S
  83. module_param(bcnt, int, S_IRUGO);( n8 [5 u: [+ X) h" G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, C5 L+ ?: n  s3 z" f; }
7 P0 v" o. ?. k- [% ?3 \' m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 {- K. y8 z" g0 earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; W8 M5 f: b2 |2 z( t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# M; [5 n4 _5 v# I

0 P+ @3 t% l2 R' o' a# J1 [) [# y, F& o5 @2 B4 h* g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 23:29 , Processed in 0.038778 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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