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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" l$ \5 v* n, U- g7 y
  1. [code]EDMA sample test application6 x) t5 j" s# X& C/ ?8 G
  2. /*
    ' I: k" T, Y# o
  3. * edma_test.c4 n' D1 [% V- t
  4. *
    ( b3 q- h/ R0 t+ g: g, t3 }
  5. * brief  EDMA3 Test Application" J2 ~8 k1 D9 g0 N: |6 \
  6. *: {2 @7 _$ s' P8 ?$ U0 i3 `$ V
  7. *   This file contains EDMA3 Test code.
    , K- e, K- Z  a$ ~4 ~
  8. *
      h+ B. n* S( f& |' I9 T% `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( |- D; D0 V: O2 h/ D4 H$ a  E2 X9 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( ?6 j! [; d: q) C, X% @( y! T; ^( {) k1 a
  11. *         TO CHANGE.+ g2 z' M+ i1 v1 _
  12. *5 T) k) v; q8 S8 s) n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* X* W# `5 I9 i" ^1 [0 k
  14. *! C; Z9 J2 C/ {) C) t8 Q& \' Y+ U
  15. * This program is free software; you can redistribute it and/or
    # J7 T& p  E. Y) f, }& f
  16. * modify it under the terms of the GNU General Public License as5 u# E4 R9 G/ R8 P& x- W' p
  17. * published by the Free Software Foundation version 2.8 K. Z" V% u/ r  q) t
  18. *4 z7 V3 }6 ]  s) S* A+ ~( @  s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 o, Z. A$ E7 f8 H* Q7 D! a
  20. * kind, whether express or implied; without even the implied warranty
    2 `2 G! I( X& h+ j7 O2 {4 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; i7 C% n: F, |$ S' e9 G% w4 J1 d& L
  22. * GNU General Public License for more details.4 @+ z) a! @. p; H9 `3 |
  23. */* t/ c# @' F! ~" {+ D7 G, W
  24. ; K, M( d! x* t2 ^' T9 E9 o5 w
  25. #include <linux/module.h>' o  y8 G$ s2 d9 |- g' ]
  26. #include <linux/init.h>7 N8 m& o  n! R) G5 C9 K2 S4 s& i2 T
  27. #include <linux/errno.h>1 d. E' j, m; c
  28. #include <linux/types.h>
    " i3 W7 }* I4 ?4 R' {
  29. #include <linux/interrupt.h>9 H4 A$ [# I! v: W. W; d
  30. #include <asm/io.h>
    ! |% W) ]- x) F4 u
  31. #include <linux/moduleparam.h>
    4 X, Q/ a' o# ?! O* a
  32. #include <linux/sysctl.h>- X9 G) C* v  M4 ?6 |' V
  33. #include <linux/mm.h>" G! y& d0 V  B+ c. Q' o. b
  34. #include <linux/dma-mapping.h>7 C& b; X9 @6 W3 j+ r4 C% K
  35. / ]6 ~. m& L( e6 w$ n+ H0 _  n9 e
  36. #include <mach/memory.h>/ A4 N5 V, P1 h6 f
  37. #include <mach/hardware.h>6 D  z% x! W; p6 ~! Y% \
  38. #include <mach/irqs.h>
    $ `; g0 j/ N6 T2 F# ]
  39. #include <asm/hardware/edma.h>( e& p/ @6 ]% R( c; Y5 n
  40. ' ]9 G8 e* F, z, U! h. ?8 _
  41. #undef EDMA3_DEBUG
    ' P* x1 |; f: |7 p
  42. /*#define EDMA3_DEBUG*/
    ) c$ [- L! d- M

  43. 0 g. O4 S* W% L& h$ o1 K. G
  44. #ifdef EDMA3_DEBUG; v1 N2 g3 o/ \- F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): N% W" d; L5 s$ a5 v0 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 L! z, p9 }9 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / S) O# J' e9 `# |( Q
  48. #else  l; v3 r8 i0 ?2 t
  49. #define DMA_PRINTK( x... )
    ' _: p# D; i' Q' l6 |" N
  50. #define DMA_FN_IN
    4 W! i4 t/ T: X+ G
  51. #define DMA_FN_OUT4 w: ~. z3 k- R/ o1 Q" P( y
  52. #endif
    * |. \3 o0 |6 E4 t& h5 O$ h+ [
  53. 2 F8 V; o. s/ n. T0 r' v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 K: r: Q/ u, g; _: o* D
  55. #define STATIC_SHIFT                3
    : W0 |, b/ W$ X% O% Y
  56. #define TCINTEN_SHIFT               20# r) c0 `! J6 V; r4 e0 c
  57. #define ITCINTEN_SHIFT              21
    ) y; A! q$ U8 Q) h6 r
  58. #define TCCHEN_SHIFT                229 a( s9 I$ N. j* j7 S, K1 V' P! \
  59. #define ITCCHEN_SHIFT               23. H7 V8 Z. A8 @) u
  60. - d6 C3 @/ c; o3 Q' B( j6 p
  61. static volatile int irqraised1 = 0;+ R# M% W5 Y- S) D
  62. static volatile int irqraised2 = 0;
    4 m: @$ r5 \3 ?" Q

  63. 9 {. C# V5 D$ o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 A4 c5 I; m+ l& Q3 ?/ J1 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. z/ V8 g5 }) }7 F% r9 T5 w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( T1 w9 h( I# h
  67. ' n: [0 k0 c! ~- |$ I
  68. dma_addr_t dmaphyssrc1 = 0;" P$ K9 j. m) Z* x: B4 A2 k
  69. dma_addr_t dmaphyssrc2 = 0;# @7 \* C, U7 N0 }+ W* v' A
  70. dma_addr_t dmaphysdest1 = 0;: D! g1 _2 r; G
  71. dma_addr_t dmaphysdest2 = 0;  R( v7 W. K- q8 J

  72. 7 T3 y; y' }5 [3 A+ M' {
  73. char *dmabufsrc1 = NULL;6 M7 Y& `# Q# P8 y' o+ t& k4 n# \
  74. char *dmabufsrc2 = NULL;6 X/ w' c! |( A+ J/ C
  75. char *dmabufdest1 = NULL;! B2 u2 Z; k, b# V" L  {
  76. char *dmabufdest2 = NULL;  e* E9 `2 y( I, u8 W: `& S" s

  77. 4 ~. H' C, f8 V+ t
  78. static int acnt = 512;& ?" i% ?* C3 k! N
  79. static int bcnt = 8;* T) l" H7 W+ O/ y; \9 l
  80. static int ccnt = 8;
    4 S0 c4 w7 \, M8 h. T7 ~9 Y

  81. # v) k% g7 v' d. C# ~0 E
  82. module_param(acnt, int, S_IRUGO);: c) `: s: d% K
  83. module_param(bcnt, int, S_IRUGO);3 k; t1 t- B! d$ g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 B4 N8 e0 T7 d3 f* z! `8 V+ b0 d- V: R5 s  r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. @6 R- l- x* R- X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: h; k9 n) G% d! x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' [& b+ [( |0 R- j: K9 x
* h2 ~  W% f- j* W6 V: ~$ E
9 ~6 m# y$ L% N* u9 l9 Q( y+ z. E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 14:50 , Processed in 0.044459 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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