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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( {+ M$ R' f1 {$ v' q
  1. [code]EDMA sample test application  Q* i3 O1 G: j
  2. /*
    $ O' }2 n0 L5 [$ Q! L+ T7 C
  3. * edma_test.c
    4 c, t/ ]2 u5 [
  4. *' t1 K. X6 C, _. H( [" A1 I
  5. * brief  EDMA3 Test Application
    ! a" S2 N4 D" F
  6. *% I: f/ h$ s0 q- E  a1 Y
  7. *   This file contains EDMA3 Test code.7 w' t# s; k- t/ T5 e3 N! T
  8. *+ p- O, b8 N. f/ i2 b& y' ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 ~: |, Q- j! s& s: m5 {2 v% G& K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ V* f6 O8 [1 I+ b' P: C5 F
  11. *         TO CHANGE.
    7 J% i0 B+ O0 ^0 u* v, V# J4 f
  12. *$ ?. E  R5 @& W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; P( f$ A2 f5 o3 c  Y) V) Z5 R
  14. *& |& v. F. |3 I4 ?
  15. * This program is free software; you can redistribute it and/or
    ' E! d' R1 W$ L4 y% q+ D7 T1 F4 S1 W
  16. * modify it under the terms of the GNU General Public License as
    8 q( n/ \2 E; z- _& Q- N
  17. * published by the Free Software Foundation version 2.
    & V3 d! i$ e- b2 m/ N2 P7 M
  18. *8 L& e7 V. s% N& t1 [7 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* \; |. ~, S! Z
  20. * kind, whether express or implied; without even the implied warranty
    7 b& C# G! K& R$ s5 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      B( y0 [2 U4 [
  22. * GNU General Public License for more details.# U: h6 k4 k' T7 }, G
  23. */% p9 S$ W+ W% v0 P

  24. 9 o. e4 M0 `% k; S
  25. #include <linux/module.h>
    4 m/ B* o9 U, @- J
  26. #include <linux/init.h>
    - a9 W* k5 y, \9 G1 h
  27. #include <linux/errno.h>* A9 K0 S+ q, G% ?! t
  28. #include <linux/types.h>- w. c# q% e" o3 E
  29. #include <linux/interrupt.h>
    ! G& z6 f8 \, C
  30. #include <asm/io.h># }, k$ f7 }& ~8 m& q0 ^; u; N
  31. #include <linux/moduleparam.h>! X& B. t' l5 d3 e4 R; }
  32. #include <linux/sysctl.h>5 H3 d7 }2 b8 L* M2 z9 I& g3 c
  33. #include <linux/mm.h>0 U! J1 |$ I7 A: u  d& s
  34. #include <linux/dma-mapping.h>
      T- A% H) i( N4 c1 v4 k) z! |

  35. ! y% p$ p" f" m  D' X7 u& O
  36. #include <mach/memory.h>5 L& ^& y( S7 _0 O
  37. #include <mach/hardware.h>( i- a, i. q3 d0 u7 c
  38. #include <mach/irqs.h>/ K5 k+ k' h: [+ I& A9 p
  39. #include <asm/hardware/edma.h>2 Z1 M) {1 \! d$ Y$ ]$ Q8 O+ F

  40. 3 r: }/ O7 U8 \- g' ^0 a- j
  41. #undef EDMA3_DEBUG  _* s- t' j( B; ]$ v
  42. /*#define EDMA3_DEBUG*// q. m8 R1 R8 A1 ?& k  K* n6 G6 n9 q
  43. 8 [; C# t2 L# |4 s
  44. #ifdef EDMA3_DEBUG
    4 k8 F7 V0 z# N  k9 W' O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , I- s! _# i0 L7 _8 T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; M4 ~* G+ m3 Z0 j/ R: o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! q1 P$ N$ c& g9 N0 e7 k% n- e
  48. #else" }' Y, i/ W2 a
  49. #define DMA_PRINTK( x... )
    % T0 j) B9 I. e% F" v" S2 n  }
  50. #define DMA_FN_IN
    2 t' b/ v4 n, k* Q7 F
  51. #define DMA_FN_OUT; E* H8 }! x9 e. ~8 x
  52. #endif
    1 z+ ~1 [! x3 d9 `5 e

  53. 2 m8 g. g6 B* [( b5 [' q6 p* ^  i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : Z( y2 }9 ?. M7 |, u% l7 v6 t
  55. #define STATIC_SHIFT                3
    6 y" o2 n' g( {$ m1 r& ~
  56. #define TCINTEN_SHIFT               20; M2 K7 y( C* D4 J
  57. #define ITCINTEN_SHIFT              21
    % S2 f) @6 \4 O: L9 }
  58. #define TCCHEN_SHIFT                22
    . H7 T6 m) k+ w+ {
  59. #define ITCCHEN_SHIFT               23
    8 \. ^8 L3 }9 L$ C

  60. * c$ @! i) m; m3 g) T
  61. static volatile int irqraised1 = 0;% {6 \8 h! w, i! z; a$ T8 q& S7 T1 S
  62. static volatile int irqraised2 = 0;
    4 `5 M- s; M+ O" _; ?) d
  63. 7 p7 `3 r1 z6 \0 h) G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 c1 S- r5 D1 l0 C% t( O% }4 i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; L. l* N" E% S3 B. Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, P" K8 {) `1 [4 x
  67. ! ~$ f4 f: l& Q1 T* q9 @, e
  68. dma_addr_t dmaphyssrc1 = 0;# y1 g2 m) A, k9 f6 j
  69. dma_addr_t dmaphyssrc2 = 0;
    0 J* B3 E8 O  t  Q  ~
  70. dma_addr_t dmaphysdest1 = 0;
    ( _# ~. n9 N" l
  71. dma_addr_t dmaphysdest2 = 0;
    & D8 s4 C' `0 E9 u4 T
  72. : P4 E1 ~9 T( }# G4 _6 U: R; X
  73. char *dmabufsrc1 = NULL;8 ]+ Z6 I! f/ q3 t- j* u$ D3 W
  74. char *dmabufsrc2 = NULL;
    ' J$ L/ w1 r* ~9 I0 H( j
  75. char *dmabufdest1 = NULL;$ G, h& z% D2 t0 R2 O2 R1 d
  76. char *dmabufdest2 = NULL;: A5 Y, n6 D5 U# K6 p
  77. $ b0 t8 ^' ?+ @6 k4 C
  78. static int acnt = 512;# K" {  A& y  r/ ?# @% ]" ?  r& A9 U
  79. static int bcnt = 8;
    0 c. `: [* [6 ?5 {. U6 z! x& `$ q) M  S
  80. static int ccnt = 8;
    2 ^0 I; i7 P, S: X+ o1 |7 ?

  81. 9 x! K; W* i0 \  U& O/ A0 @
  82. module_param(acnt, int, S_IRUGO);
    9 H6 J6 x! J9 ?5 }" q
  83. module_param(bcnt, int, S_IRUGO);) x- E, S1 t: F/ `4 H$ F- ]8 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 y2 H/ Q5 I) `8 E5 k( }) c4 H! I& m) G- K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' m3 e' d  X3 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 \( K$ M& a" c; Z0 P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! W* O4 v1 a9 a: y( r

9 i# q5 {- Q2 P- s2 U
* H: X/ Q+ S/ Y9 k: X0 y: h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 06:26 , Processed in 0.040372 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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