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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 @: `! X  {! u
  1. [code]EDMA sample test application
    " |) `! m  r' S- ]0 w) s2 B
  2. /*, f3 f, c' W3 i; }3 y& F
  3. * edma_test.c
    % z5 l9 J+ x5 L: m5 Y$ `0 F
  4. */ M, X1 N5 M1 e
  5. * brief  EDMA3 Test Application
    8 P" n4 w; y) x, z
  6. *
    # a& ?1 ^- Q8 J% |# }6 X
  7. *   This file contains EDMA3 Test code.4 X! d5 `' \# _3 `# H
  8. *8 w) p9 }. N% ^0 G, R$ |3 m2 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" L. b/ [7 f5 Z: H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* }; s$ g3 G  g$ N2 E7 }
  11. *         TO CHANGE.
    0 b) k4 N7 t) d9 L9 Z  R
  12. *  j, ]7 h0 K! O% G7 [- K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " w0 ^" P* ?$ G& Q1 F. w
  14. *, L& a5 I2 @6 J. M
  15. * This program is free software; you can redistribute it and/or2 u& w( T: Q3 j7 I8 ^; l1 M* p
  16. * modify it under the terms of the GNU General Public License as
    2 x" a: G2 c( @+ L, v
  17. * published by the Free Software Foundation version 2.
    ! Z0 k8 z/ v; O/ r
  18. *
    : R1 g' C+ H! g3 h* y# P, x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ b5 R2 s  U# N
  20. * kind, whether express or implied; without even the implied warranty" X" G$ `# }$ @, \6 K( x: a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( g7 Z% I5 N3 ~0 c' l
  22. * GNU General Public License for more details.$ r- }; G' A8 P- K7 A0 B8 q
  23. */* Z6 `7 x' Q+ Z1 U( p$ H" Q, j, H
  24. % |  j( b# [4 g4 ^9 {/ r: N4 A% ]
  25. #include <linux/module.h>( o: Q1 k1 r1 Q) p. h  }" i! I3 R
  26. #include <linux/init.h>4 s. t% T! b6 I% w/ _% D' z
  27. #include <linux/errno.h>7 w6 \2 e8 O, h5 j: C
  28. #include <linux/types.h>1 D7 N6 V! S& V/ `
  29. #include <linux/interrupt.h>
    # K/ a) p/ o/ E3 b6 V7 Z
  30. #include <asm/io.h>; P9 M7 I; t* v
  31. #include <linux/moduleparam.h>- m+ ~2 j  s- `" H) U; x* d
  32. #include <linux/sysctl.h>
    5 c5 {; T* y$ k0 [0 s5 A- ^1 U
  33. #include <linux/mm.h>
      x8 T: l: t( H; y- @1 O/ G& S" `
  34. #include <linux/dma-mapping.h>3 s! r% y& D! X) n; A9 C$ o
  35. * o/ L4 e! }0 x2 C+ g
  36. #include <mach/memory.h>
    , o' ?7 a1 c! B) j: D/ b
  37. #include <mach/hardware.h>! v6 t; f! ?% M2 b# {2 w3 ~; o6 `
  38. #include <mach/irqs.h>% _2 U$ a5 z4 S9 m
  39. #include <asm/hardware/edma.h># s  a3 @& N  A% L( C" n2 R
  40. $ j: ]) ^5 U( B' r! R. J( r8 e
  41. #undef EDMA3_DEBUG- D5 C. P7 o3 k& Q# t' U* J- X
  42. /*#define EDMA3_DEBUG*/' H2 x2 H$ E2 D# Q4 w
  43. 3 j& ^8 V+ d& ]: _
  44. #ifdef EDMA3_DEBUG
    + l/ c, D; ^+ w; Q- h7 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 T- R$ K5 d: k# y- q4 [) ~% ]9 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 k1 f8 s% {* k! j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 X7 l( R1 Q4 P$ W: c/ N
  48. #else
    0 t$ W: |6 v6 I* q, d
  49. #define DMA_PRINTK( x... )
    7 e: w& E" F) C) r! h
  50. #define DMA_FN_IN$ L( R" R, A7 r* F4 {2 G: K
  51. #define DMA_FN_OUT
    ! @  d3 M1 ]% X& N
  52. #endif
    & d( p+ a# S' h0 m% W7 g# ~/ z

  53. 6 _: Z3 ?* R" w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); O3 `* h3 G7 K
  55. #define STATIC_SHIFT                3) i5 ]" @0 x* S! y5 R
  56. #define TCINTEN_SHIFT               20
    8 p- P( }1 o2 B4 F
  57. #define ITCINTEN_SHIFT              215 ]% c( ~: o  s6 w. n
  58. #define TCCHEN_SHIFT                22( I2 J. ?( e2 `$ D, J
  59. #define ITCCHEN_SHIFT               232 l- m2 Y, m$ d# T) U+ q

  60. ; T0 i/ q' T8 h5 V4 x3 m
  61. static volatile int irqraised1 = 0;! w4 Z% X, {1 v6 R& `
  62. static volatile int irqraised2 = 0;
    4 l7 J9 T* ]2 [& r- S# q
  63. 6 e! y: |, i% d5 `3 C  e# i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& m2 K. N' b# C  X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ a( }% V: u/ h" Y1 s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - S4 G. t6 a! Y; [. P' M8 {
  67. " A( P4 H9 [- C
  68. dma_addr_t dmaphyssrc1 = 0;
    & g, N# P! |' i! R& y! P
  69. dma_addr_t dmaphyssrc2 = 0;
    ) |2 H( E, m( N9 d- e8 D
  70. dma_addr_t dmaphysdest1 = 0;
    ! ]: Q$ T* q4 a* l
  71. dma_addr_t dmaphysdest2 = 0;; h* u+ L, N- Y3 e9 w6 K8 }! d$ I

  72. & n0 x! B" \3 y0 G
  73. char *dmabufsrc1 = NULL;
    % o% }6 r7 x: L$ h) r- M% o
  74. char *dmabufsrc2 = NULL;
    & ?$ \  e% V6 i& R7 L: |
  75. char *dmabufdest1 = NULL;/ _8 Y5 {6 m3 m4 |" r( O8 z
  76. char *dmabufdest2 = NULL;6 W% ~8 D% j& L: j  [! w2 s
  77. ; b% u7 L+ D8 N1 k8 l
  78. static int acnt = 512;* _# y& A+ c" j/ P# g
  79. static int bcnt = 8;+ u4 ^% r7 `! d& e# Y
  80. static int ccnt = 8;+ \3 W  u2 S5 k! `; d

  81. + o! ?- `  P, j) e: w% I( _
  82. module_param(acnt, int, S_IRUGO);; _* S' a. q4 ?
  83. module_param(bcnt, int, S_IRUGO);
    & O$ K3 B. ^) x6 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 P2 d3 j  V" T- ~

9 Q" p4 e" ?- [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  b2 p3 a1 D6 Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( G5 l7 t9 A. B  l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 Z+ a! g* J4 a# r

# R! F( G: Y( B) W' m# x5 `; H/ Y/ _' i/ Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-15 06:27 , Processed in 0.038897 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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