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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % G; F( R3 P+ Q  K
  1. [code]EDMA sample test application
    $ q1 q( C: `! Y9 N  d8 _1 O* D" V
  2. /*
    , A2 T3 r' e" U- m
  3. * edma_test.c
    6 T& Y1 V( A, ?7 o+ [
  4. *
    # U& A* ~% Y0 O' }
  5. * brief  EDMA3 Test Application
    . X1 t9 l) t# V+ G/ k* {" i
  6. *
    . H7 e6 i9 f3 I+ D! n" N( ^
  7. *   This file contains EDMA3 Test code.
    5 R4 }* v& m8 |- [8 e2 T
  8. *
      |. V' e0 K9 X5 h  I4 o, F! i( z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' v- h5 W- n7 Y& r$ U" N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + W+ `# T4 a& O5 B% ^$ c/ K
  11. *         TO CHANGE.
    . c1 \2 W% ]! O0 y" {; H9 @" F+ ?
  12. *
    2 ~4 u4 ^* E; M: Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 Y( u4 ?- o, t6 L
  14. *: p# B1 b, V: g5 V0 y. N
  15. * This program is free software; you can redistribute it and/or' v4 ]; F% W& x
  16. * modify it under the terms of the GNU General Public License as
    6 Z) Q& }- K5 R  _" ~6 z* L! ^
  17. * published by the Free Software Foundation version 2.
    ! F1 [' _( m# Q6 g' D9 E9 n8 U5 ~: w+ [
  18. *
    ) j6 z" L- s1 k1 C; U) K8 p* B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 Q: \* _: P8 C3 p
  20. * kind, whether express or implied; without even the implied warranty
    ' j- s/ y; y8 M. w) D0 f0 u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) n. \9 |2 J) j) ~2 t
  22. * GNU General Public License for more details.3 T6 k& w! H+ R* W1 C  G; C2 }
  23. */
    0 ]- t0 T% B( G& C8 L
  24. 5 E  h/ z! K1 f  w- o
  25. #include <linux/module.h>
    8 J  g1 t  b3 G! p4 S5 N
  26. #include <linux/init.h>
    , B: v6 {/ v+ b9 V5 y5 s
  27. #include <linux/errno.h>. ?; B( G8 r/ s. n: ^
  28. #include <linux/types.h>
    $ t' `) f+ o' k8 m. K% B
  29. #include <linux/interrupt.h>
    , ~# t& B  n3 }( U
  30. #include <asm/io.h>1 @9 J, J+ w" g. W  M- l' w
  31. #include <linux/moduleparam.h>
    # D4 ?9 b- b7 s$ k, M5 B+ e9 [5 n$ F
  32. #include <linux/sysctl.h>3 T0 e7 T, e7 m$ O) M  X5 ?8 `
  33. #include <linux/mm.h>/ [/ r( Z7 }$ m- W2 V
  34. #include <linux/dma-mapping.h>* q8 b" z0 }0 A, ~# E: J& {
  35. + h, j9 c% u' i% m
  36. #include <mach/memory.h>
      X8 J) p1 t! o( ]! F
  37. #include <mach/hardware.h>" O1 ?0 ^9 u7 ?* x
  38. #include <mach/irqs.h>
    ; i' M( [& n9 Y! R& W% I5 a
  39. #include <asm/hardware/edma.h>
    + n3 l2 D8 O1 Z! D' K
  40. 4 x+ K3 l- J) y5 F: D
  41. #undef EDMA3_DEBUG% ?- Y7 Q- H. V, l
  42. /*#define EDMA3_DEBUG*/
    ; q5 S3 M- Q" \. U. T
  43. 0 X* ^- F0 Y& x* n% c1 S2 I
  44. #ifdef EDMA3_DEBUG  S! z1 w& }6 K1 y% @3 C- x4 I6 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 ]  L: c! z  Y+ j& f- u* y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); l/ e0 j2 D9 R' S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 k. B2 c8 h2 R; y# |
  48. #else/ |/ y0 N3 a0 F' i4 P
  49. #define DMA_PRINTK( x... )/ |- u  ~! V* R1 i0 y$ N
  50. #define DMA_FN_IN0 V  j; @/ J0 e4 E: i0 j
  51. #define DMA_FN_OUT8 i1 {* H! X% G+ s' }0 v7 t" Q
  52. #endif" Y* U0 ~- h! S5 O
  53. ( Q5 r6 D* |5 p$ B, ^) C$ A1 A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : ^* }& D. m! A$ O1 Y0 @/ }6 s4 M
  55. #define STATIC_SHIFT                3& V" O: r& Q; Z, U) u
  56. #define TCINTEN_SHIFT               20$ u8 q5 f# A5 G) {1 v/ i
  57. #define ITCINTEN_SHIFT              21
    1 G3 R) ^3 _7 ]: j' d
  58. #define TCCHEN_SHIFT                22. `! N1 i3 [- w* o+ R: |
  59. #define ITCCHEN_SHIFT               23
    * D7 @, X/ Y' |6 u- @  H; u
  60. 9 `3 G$ L0 ]; x4 c( K0 {' W. P
  61. static volatile int irqraised1 = 0;
    & V" Y5 z- n1 E7 ^& f- O9 b6 @; I5 Z
  62. static volatile int irqraised2 = 0;/ f. y) b1 G  h3 ^* P
  63. 7 N, W0 S6 ~8 J/ x8 e8 h4 D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& W2 m* T/ a: j, t2 ]  L: A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Z7 ?! j. A. P% K% @8 F* I( R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* b3 K/ e0 c6 H" T
  67. , ?9 [) j& L! \4 a/ o
  68. dma_addr_t dmaphyssrc1 = 0;# L' k7 G3 _: O$ n, _
  69. dma_addr_t dmaphyssrc2 = 0;
    2 t9 t' G/ Y& |
  70. dma_addr_t dmaphysdest1 = 0;  f6 c( W' Y5 a! a5 p% g
  71. dma_addr_t dmaphysdest2 = 0;
    2 K4 l7 A  m. l+ P" Z) l/ t% Z4 z

  72. + z+ e, ^! w( n- H" }
  73. char *dmabufsrc1 = NULL;
    : T+ v/ b0 S4 P' M  ]1 _) A9 O
  74. char *dmabufsrc2 = NULL;
    ( f1 z7 E/ B) o0 P% o! K  O( `5 K
  75. char *dmabufdest1 = NULL;  t. m  \, B$ H- s
  76. char *dmabufdest2 = NULL;
    0 \" ^8 H* t" W) Q! }

  77. 4 n# u- J# B3 S( ~3 K8 Z
  78. static int acnt = 512;& {' T" ?7 D' p" u7 A
  79. static int bcnt = 8;+ |$ t5 q! |9 `  w
  80. static int ccnt = 8;8 x8 Q) Y8 r. F: s, v

  81. / j/ i& a$ I& K. ]+ v
  82. module_param(acnt, int, S_IRUGO);
    , d9 R7 @3 y' f
  83. module_param(bcnt, int, S_IRUGO);- R% m5 H9 V5 q% Q0 }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) Y  ]0 O- ?2 q3 H. A

4 r7 d; b: T+ |+ D2 q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) F8 t8 }# x, [' v! ?$ u2 W6 `
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 M* V' R/ s$ W4 j# i( T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 n$ s& E; H% i4 E' @

9 S3 W# _% v& O- \0 M: X0 g6 Y+ a% `3 @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 06:43 , Processed in 0.042089 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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