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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 u, m6 d: D& f% s
  1. [code]EDMA sample test application
    $ l" g  t! ~8 `, v
  2. /*" L# q3 B" W, C* T  m7 y
  3. * edma_test.c
    9 ~% W% K( H7 ?
  4. *1 p, \! y0 t  G6 F( Y
  5. * brief  EDMA3 Test Application
    ' T9 M$ H4 [& q8 V( K% o  r
  6. *! l; J6 ?0 D% ]* o# n3 K
  7. *   This file contains EDMA3 Test code.
    3 O* N  i4 [* G2 C% [
  8. *
    # w. C% \. t* M1 S/ i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 K( g$ g, U8 q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % \! E1 a% V' E: ~6 T8 \! I: i5 a
  11. *         TO CHANGE.2 f1 A; V5 z2 {% Q1 J# I2 ~& Q! q1 S
  12. *
    ! J6 \. o  O+ X0 P8 |  i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// V+ }/ \% W8 i. d, F
  14. *
    5 P# F0 V( @" f: D' e
  15. * This program is free software; you can redistribute it and/or0 K* g# ~9 r2 L5 L, r5 B* L, r
  16. * modify it under the terms of the GNU General Public License as
    + h' z% @' ^* j6 V% m
  17. * published by the Free Software Foundation version 2.
    4 ]9 C  n0 C% V1 |5 i3 c
  18. *
    3 M3 B* V# j/ h. n0 ]# O1 S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / T6 {. O+ b, A
  20. * kind, whether express or implied; without even the implied warranty1 G& t& |+ c; ~0 L8 a5 w( k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( A) G* a& x$ F9 k! C% ~- c* a
  22. * GNU General Public License for more details.+ i7 n8 G# z# Q3 q# n
  23. */; I! ?5 q  l0 x: b; s; h5 b1 r
  24.   ?$ Y3 I$ L/ }0 v4 S
  25. #include <linux/module.h>3 A7 ~4 z) B2 Q1 q% j4 P& }
  26. #include <linux/init.h>
    $ W  \7 x. L/ A
  27. #include <linux/errno.h>
    $ Q- T* ?: h& V. C4 V. e- U: }! O
  28. #include <linux/types.h>
    " x  H0 V1 m& C9 u
  29. #include <linux/interrupt.h>
    5 V, O8 O- j, t  Z
  30. #include <asm/io.h>/ u$ U" c0 J) b, x
  31. #include <linux/moduleparam.h>' D  k! K+ \. [, @1 I$ `- Z
  32. #include <linux/sysctl.h>
    8 }& H; p( ?. X' l& _" w
  33. #include <linux/mm.h>
    , _6 j6 Z. }) h; z# A
  34. #include <linux/dma-mapping.h>( ?+ s- o; B5 X, K( b0 ]

  35. 2 ]! ?) N! S% d0 ~7 s7 T1 z
  36. #include <mach/memory.h>
    7 p, X5 V2 ~6 T/ p
  37. #include <mach/hardware.h>; Q/ s& p9 [  \' J
  38. #include <mach/irqs.h>
    : t$ R8 O- R% m* C8 s
  39. #include <asm/hardware/edma.h># T1 T7 {& g  x0 t

  40. 8 n! I$ F5 `& G- B
  41. #undef EDMA3_DEBUG4 i* U" C4 e2 l( Y2 D/ s
  42. /*#define EDMA3_DEBUG*/* S0 H0 V, }" H/ c0 s& p
  43. * f# w. b8 D0 `7 g& X' P8 q+ y$ D
  44. #ifdef EDMA3_DEBUG* K- N4 m5 I: I5 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 B( ~- u5 T& ]- z8 }/ q! i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% v# u  e7 \/ |6 g. c- i. n# q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      ^- ]5 `% D4 ~. T# V  T/ M$ P
  48. #else3 F1 k" Q( |' y8 K
  49. #define DMA_PRINTK( x... )1 q3 t* Y) c; v& ~3 b! K
  50. #define DMA_FN_IN
    & t; k. ^/ j3 o8 U& b4 B. @
  51. #define DMA_FN_OUT
    0 a0 }3 l6 t1 b
  52. #endif
    4 D) W; X. f( O2 T
  53. ( o* M& M- D5 S$ r. |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      q1 Q7 h8 b. x; r5 N2 s
  55. #define STATIC_SHIFT                3" M$ B, K* b( Z% j
  56. #define TCINTEN_SHIFT               20: L6 K2 A+ L+ E5 |" b. g9 B9 Q
  57. #define ITCINTEN_SHIFT              21) @4 d7 Q. q+ A( t+ {3 k4 V
  58. #define TCCHEN_SHIFT                22
    & Y7 |/ e: \  @+ S
  59. #define ITCCHEN_SHIFT               23; i, ]) ]# o: c, u
  60. ( e/ i, k0 ?! w' l
  61. static volatile int irqraised1 = 0;7 C% J2 R0 m- q. K+ y
  62. static volatile int irqraised2 = 0;
    - L5 s' i  a8 z* y

  63. 3 ]2 ~: t3 W0 _& m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ X$ L! D8 F4 Z& U- i/ j0 m8 ^0 A/ b& @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 d: K/ r! d) h  F8 q7 j: B8 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 v5 q9 l5 ]; X  I

  67. 2 j( u2 n7 Q/ \2 q6 l
  68. dma_addr_t dmaphyssrc1 = 0;
    * v- y2 o/ w8 o  [
  69. dma_addr_t dmaphyssrc2 = 0;
    ) n  w" `  m4 b2 ]% |, p
  70. dma_addr_t dmaphysdest1 = 0;
    4 _% }" e8 |. e% y9 w
  71. dma_addr_t dmaphysdest2 = 0;
    6 g+ v$ t/ `- r2 H! O
  72. 6 O1 _! J$ Q, e/ m
  73. char *dmabufsrc1 = NULL;2 ^: T% H( n$ N
  74. char *dmabufsrc2 = NULL;
    1 c+ \1 i; i  D) H
  75. char *dmabufdest1 = NULL;
    4 K. `( r& k$ ~) q
  76. char *dmabufdest2 = NULL;' B. X# Y& n0 f! z) L, }; x

  77. : Q9 q! T, [; o, H. W2 s) S6 ?& B
  78. static int acnt = 512;
    1 f0 L9 k7 ^( D7 l8 p0 I( ]- X6 X
  79. static int bcnt = 8;4 Y+ D% T& d5 [
  80. static int ccnt = 8;
    2 @1 f/ C: s( A" r; z8 \- G

  81. ' C: [$ t6 u* ^/ A/ U5 K
  82. module_param(acnt, int, S_IRUGO);
      \; y4 t  |- F# U; S+ ]; R% K1 r
  83. module_param(bcnt, int, S_IRUGO);5 k$ O& x7 U8 D7 F1 G& T$ ]. I7 e% J9 q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 o+ `7 I8 y1 k' h5 U
3 \0 c, T$ h% ~4 g3 A( d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- ~& f0 I6 \9 ~: xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, I( e# ~( {$ @4 a- r( x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 p; D  y6 P5 J* N

$ t- X( K" s) q- D3 b# n7 ^
* |3 a( A; E. \8 {/ |3 c& i. O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-25 15:13 , Processed in 0.037856 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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