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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; m, c0 A  O+ ]% X+ C( K8 I
  1. [code]EDMA sample test application# ?' }1 h3 ]' K5 m2 k9 X# y7 \
  2. /*$ j; m* z, E- d
  3. * edma_test.c
    8 E+ n$ b, B: @- E1 p# Q
  4. *
    ( }" l, T$ {( v: q, }2 `
  5. * brief  EDMA3 Test Application+ X& n3 n& g! a% f+ V
  6. *
    4 j# I1 d4 J7 M! |( [5 f
  7. *   This file contains EDMA3 Test code.
    . [& S: ]1 G4 U* g
  8. *: F$ [9 f6 A8 d5 |: G9 Z3 r3 U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " B& [5 u# W( H1 b: j4 j! G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 ?, [& o3 |% A( f$ v2 s
  11. *         TO CHANGE.& a1 F5 A  `$ e  J/ r
  12. *
    3 k6 ?) Q9 e5 M) z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& m( A: X6 z- C6 g7 v) S
  14. *
    ' [# f" @9 X, A- S; n* N- G  R
  15. * This program is free software; you can redistribute it and/or
    " `; ^2 I6 K0 A" |# [: J4 o' o
  16. * modify it under the terms of the GNU General Public License as
    - Z; P5 R1 q# ^5 t  Y% `- h
  17. * published by the Free Software Foundation version 2.
    2 [4 U  H" k/ D% |# v) {, t5 s' I
  18. *9 Q% R6 R( q+ p7 }# z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / n# i( _- U; k) r* Z. _$ J
  20. * kind, whether express or implied; without even the implied warranty" A$ l+ h* @' H( x; T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# S3 A" f0 X4 `8 W- O8 h
  22. * GNU General Public License for more details.
    3 E/ N$ \5 |& K
  23. */  ?) x+ Z) E/ k$ K9 L
  24. 7 ^* Y" y( M/ K# u8 Z
  25. #include <linux/module.h>
    9 d( m; s; F# y+ W
  26. #include <linux/init.h>0 d- }! M# x! W8 m) A+ T
  27. #include <linux/errno.h>
    5 G9 @. ?% a* s7 ^
  28. #include <linux/types.h>( @4 _$ x5 Z' R' e4 P& `" e0 `
  29. #include <linux/interrupt.h>
    . Z0 f+ Z3 i! {
  30. #include <asm/io.h>
    / p' Q; h3 N6 D) C  I
  31. #include <linux/moduleparam.h>. ]1 u* F3 y0 d3 a0 u+ B
  32. #include <linux/sysctl.h>5 @4 F; F  m" Z; u/ ]
  33. #include <linux/mm.h>8 W  P; p* L: t+ i  X; C6 X8 `
  34. #include <linux/dma-mapping.h>
    & o6 ?! j* U7 Q
  35. 4 V' m& t5 D  k5 F' J4 n
  36. #include <mach/memory.h>4 w# g7 x" K0 D, J% E$ L
  37. #include <mach/hardware.h>) }0 z# [/ \! L& g2 i' x* ?
  38. #include <mach/irqs.h>* @+ k  ?) R6 l/ p' I& B+ [4 [1 F
  39. #include <asm/hardware/edma.h>; `, ]( R* e" A; E0 ^% c
  40. " i5 O/ i  D% i- Y, W  [' h
  41. #undef EDMA3_DEBUG
    % V, D2 U  L( h" x+ x1 f+ k; B$ x
  42. /*#define EDMA3_DEBUG*/, N. X7 S; m. B

  43. . r" c4 h! F* ~# ]# ]9 J+ B" O( \- ]/ x
  44. #ifdef EDMA3_DEBUG+ I$ P  L: R$ h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ H7 p; K9 n  M* ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 K6 V1 R% `5 D/ {2 @1 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - N" P' H2 ^! W6 [
  48. #else
    2 B0 }4 K6 C8 z
  49. #define DMA_PRINTK( x... )1 w7 ], o% O( o1 w, `- B7 G, |
  50. #define DMA_FN_IN
    ' D3 r: _3 k# h7 Z
  51. #define DMA_FN_OUT
    ! b; }8 |3 Y3 F7 l. S
  52. #endif
    9 l( e$ Q+ w6 ~! U+ L) z
  53. 0 v- M6 g  U3 a+ q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; t) G7 n; t5 ]1 v1 P
  55. #define STATIC_SHIFT                3+ P  T" o! v: k0 Y/ v, T% L- u# g3 j
  56. #define TCINTEN_SHIFT               20
    / a4 X: u" P1 A) Q
  57. #define ITCINTEN_SHIFT              21
    ) G. _% _6 q0 h: y; O
  58. #define TCCHEN_SHIFT                22. \0 m) L4 y7 s: G4 P
  59. #define ITCCHEN_SHIFT               23' o. R  g1 w# Q! s0 I2 p* W3 J
  60. / W+ p; A( S2 G$ Z
  61. static volatile int irqraised1 = 0;- p1 `) s% J' P; d, F& C0 Z3 N
  62. static volatile int irqraised2 = 0;
    1 a* v5 G6 J4 o
  63. 1 V# H5 A! c3 x5 F9 q' O4 a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ J: `' Y/ B/ n1 E( Y; ~9 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Q; ]) ]' V$ {$ ~" p/ b: d6 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - {/ t4 x/ I7 P3 X) g

  67. $ m" `$ A8 [- Y
  68. dma_addr_t dmaphyssrc1 = 0;% }1 \& @- L( Y( K' q1 a
  69. dma_addr_t dmaphyssrc2 = 0;
    / l+ x" W! O. \# Y6 K
  70. dma_addr_t dmaphysdest1 = 0;% S  R5 E+ r4 y6 `
  71. dma_addr_t dmaphysdest2 = 0;/ N* T! b. W# p2 m4 K
  72.   h0 r1 n+ ]4 U& j; z/ _1 e
  73. char *dmabufsrc1 = NULL;- r" {: W7 J; k* N* t1 f' }1 L
  74. char *dmabufsrc2 = NULL;9 k/ _( t* u) m
  75. char *dmabufdest1 = NULL;/ Y. v  ~  A* P5 I( f2 J
  76. char *dmabufdest2 = NULL;' J7 t+ \/ b7 G% g& u. \
  77. . S$ |/ \, L' C: |5 Y  }
  78. static int acnt = 512;3 w& v7 H( M$ Z! u1 d
  79. static int bcnt = 8;
    4 d$ a! ~5 w! _% N5 a7 P  |
  80. static int ccnt = 8;
    % l1 F; g9 ~  x9 R& `/ O( ]
  81. # ~8 e8 @, I: z
  82. module_param(acnt, int, S_IRUGO);
    7 B6 {: O  \9 L
  83. module_param(bcnt, int, S_IRUGO);
    5 g9 c' N+ {- R' x9 P0 p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 k) v- U7 k$ J* {

, m' g, J% |* B; g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ ?3 R! L8 S3 J6 O- @' ^6 q' R: Y+ q1 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: r' i2 {# n6 G9 a; V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' m1 K+ H: |- ?3 ^) q
+ J/ E% ]# U2 w

& H3 n& q% ^5 t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-18 02:39 , Processed in 0.046590 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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