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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   o5 _6 P1 l/ E$ u
  1. [code]EDMA sample test application$ R, T3 N' R" s$ D- m  t7 G- L8 G
  2. /*
    6 W5 E0 O$ m+ n: ?- |
  3. * edma_test.c" V% U  d3 V; S  B0 G. l
  4. *
    3 A7 K( x* I& G+ x3 r  f4 e+ d
  5. * brief  EDMA3 Test Application
    # q  T; H+ s1 K" G3 [
  6. *7 n4 y1 @  s6 s
  7. *   This file contains EDMA3 Test code.! f3 d2 i3 k4 S5 o: u+ ?" H7 M4 Y
  8. *
    ; P* s# @, N8 a) h9 @2 U4 ^- g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 b  l. E2 m* j' c/ n' o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . n5 f9 s2 j$ _. x! Q7 T
  11. *         TO CHANGE.! A1 u( f' ^) N$ R
  12. *# ^- \9 v& o$ C- W) j" \/ y1 k& M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 X6 K5 E6 H5 B
  14. *
    - _5 l0 T6 r; p" a
  15. * This program is free software; you can redistribute it and/or
    , m5 E! \# m) J8 `! e; ~7 v; Z
  16. * modify it under the terms of the GNU General Public License as: n: @/ K% S$ W0 M4 e
  17. * published by the Free Software Foundation version 2.
    0 B" E% b9 u% Y6 C* T; r& @
  18. *
    4 j4 T$ u! c2 X8 t' E; s5 q7 Q* c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" q4 d* ]: ?9 _& Y
  20. * kind, whether express or implied; without even the implied warranty* w3 w/ A- i. c: C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ F* p6 ]1 O5 H/ d  _
  22. * GNU General Public License for more details.  ~  [) b, ?; Y! a! }0 T, g! ~
  23. */
    2 }% J# k5 e- s1 J5 p
  24. 9 h" k6 f- O/ g3 e5 |8 q  {. }3 ?
  25. #include <linux/module.h>
    . K, O; Y# d' y
  26. #include <linux/init.h>& `; V" v% |' Z4 J1 D7 I' [
  27. #include <linux/errno.h>
    & T  J; |& Q0 \2 q  w- N3 I2 V
  28. #include <linux/types.h>/ g  e6 v2 K' b
  29. #include <linux/interrupt.h>$ Z4 k. |  E, b$ r5 W( h* C" }( _
  30. #include <asm/io.h>
    2 P' G  T. |  X8 a) m) v
  31. #include <linux/moduleparam.h>
    ; L  L% A8 `* \3 f9 t) a& o
  32. #include <linux/sysctl.h>
    4 i5 o+ B: G% X- c& X  Q8 P. ~  t
  33. #include <linux/mm.h>
    ( ~$ I1 G9 H- |
  34. #include <linux/dma-mapping.h>
    ) f/ O  O9 G; |' c

  35. % L: D( ?, B0 Y1 W
  36. #include <mach/memory.h>9 l: B  n; m( T# q3 T
  37. #include <mach/hardware.h>
    ' {) _8 [" w  c2 S/ k
  38. #include <mach/irqs.h>& h2 L: T% f8 Y1 k% _# D
  39. #include <asm/hardware/edma.h>
    7 h1 ^" ^- j- e( _. ~! h
  40. 8 l+ i, E" w) j  d/ D/ X: P& O$ Y6 u
  41. #undef EDMA3_DEBUG! i' j6 N1 {) M1 j. U+ W3 D
  42. /*#define EDMA3_DEBUG*/2 H+ e" N. x% p6 F/ Y1 M
  43. " I$ d/ v! L: ?) n/ f% c  {2 E
  44. #ifdef EDMA3_DEBUG
    9 S  G) S; g! D3 I6 o$ f' u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , }+ O- E0 I( a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' ?, `. j* ?0 k4 T7 [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 h( \. H& w& E" ^# s
  48. #else  ?+ A" T6 A  l  j# A
  49. #define DMA_PRINTK( x... )
    ; R% u2 [- {0 F; r; c- U& @9 j
  50. #define DMA_FN_IN+ P) b$ p+ a5 W- n
  51. #define DMA_FN_OUT
    ; S( @  Y% ?5 g6 ^- d2 S: O
  52. #endif
    - z" {+ N. m* m3 a
  53. 0 P! z. d: U; _. C% I$ y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); i: p- B& a, u% R
  55. #define STATIC_SHIFT                3
    8 l( P( V8 X- d7 A/ @: M5 f
  56. #define TCINTEN_SHIFT               20  u: u$ X; x! M" z5 N6 s
  57. #define ITCINTEN_SHIFT              213 S1 N4 |7 {5 X' H0 a
  58. #define TCCHEN_SHIFT                22
    / \& w) W& N2 m- S5 n  }+ j5 H3 s
  59. #define ITCCHEN_SHIFT               23, O/ L. |- t3 z' q8 ?- G
  60. ! {9 l" H: J/ M6 M5 v
  61. static volatile int irqraised1 = 0;
    ) k; b' G# @( I: |" O
  62. static volatile int irqraised2 = 0;
    2 `9 R( Q3 o6 R  C$ M- [
  63. 6 U0 K2 i0 H7 Z+ X; X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - `2 N( W$ V0 q, P2 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' f2 ^) x$ ?5 U4 c3 @0 n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! J. w( F% |0 j! _

  67. 3 P, h9 J4 _7 n
  68. dma_addr_t dmaphyssrc1 = 0;: L* M4 G6 z- }+ r$ j. s0 ~% G5 l
  69. dma_addr_t dmaphyssrc2 = 0;
    2 x) X4 F4 ]! v9 ^& j4 H6 T' a! h! @# m5 W
  70. dma_addr_t dmaphysdest1 = 0;
    . j* V3 {9 }) J( `7 k! z, S* N
  71. dma_addr_t dmaphysdest2 = 0;& O+ p+ I: H! n

  72. " v6 W1 @! \- [/ ^/ b9 p1 y
  73. char *dmabufsrc1 = NULL;
    - b2 T( S5 @4 O" f7 M
  74. char *dmabufsrc2 = NULL;4 {8 o% Y7 j+ ?
  75. char *dmabufdest1 = NULL;2 r# g* ]4 Y" w. B
  76. char *dmabufdest2 = NULL;
    0 @" Q5 j/ @- }- \* H0 O( {; @
  77. 8 {& l1 A$ r/ Y$ t7 K
  78. static int acnt = 512;
    / P4 q# ~- n" N, b# L
  79. static int bcnt = 8;
    8 ]# ~' T* C+ X! p$ t+ Z
  80. static int ccnt = 8;
    / v  M7 g9 d* O) e
  81. : p% ]8 n: l- g- @0 ?" W9 u
  82. module_param(acnt, int, S_IRUGO);7 w5 j% W$ U# Y* ^; ~- V6 s
  83. module_param(bcnt, int, S_IRUGO);
      I, w! R0 h- [$ T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' U% j$ d. L/ e/ w4 d# p0 i6 p' s% P% V8 x% n, u: V2 P3 s+ {" S9 Z( z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 w" X+ b6 m1 _8 G9 o: w" L* o( warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% g2 k$ D& ~# Z! m, ~. \/ n5 _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 l! x! Z0 J$ r" x4 n5 @5 d
+ h+ h1 {# V! n

% ^, Q, n3 b, i+ `8 X. G0 R$ a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 17:38 , Processed in 0.041598 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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