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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 t' Q7 E# v$ w% x9 `0 k  |1 n
  1. [code]EDMA sample test application0 C7 L8 \2 u  l0 O* P
  2. /*
    $ K: L5 t8 E- p1 ^: \! E
  3. * edma_test.c$ \3 B3 h8 l5 t4 q
  4. *5 j4 Z0 q. V( l3 H3 w2 ?
  5. * brief  EDMA3 Test Application
    ( l5 @% @3 U+ ]# {$ P, \& L
  6. *0 L+ D' G/ l/ V4 H! e- L/ n
  7. *   This file contains EDMA3 Test code." h# D6 I. N1 g' v. ^7 t
  8. *
    ( j/ b: v7 }8 p- B* [  S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 o7 h% D$ y8 K& A+ u. S, b* W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + {9 N" L; ]& l) j, K
  11. *         TO CHANGE.
    & J6 D: s" P2 D5 u, `/ `% X( l
  12. *
      N3 v( c4 y" n1 P3 Y6 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  K2 S9 `4 k& \* ~! P% Q
  14. *
    9 A; v& F- e0 f% M6 b; [
  15. * This program is free software; you can redistribute it and/or
    . N+ Z+ ]; x+ l- f+ W  }8 L
  16. * modify it under the terms of the GNU General Public License as6 i) `  F8 F" I% \
  17. * published by the Free Software Foundation version 2.- T. Y9 ]5 p0 x2 h7 l# T* d
  18. *
    ( D( u( `  M# ]! Q: k  v& }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 h- `, \) I% E
  20. * kind, whether express or implied; without even the implied warranty1 v# C- V2 \9 Z7 Z3 E/ {3 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  E6 Z' R% o6 S3 J7 W& b" @! T
  22. * GNU General Public License for more details.
    $ K" U% o/ g3 |& B4 I
  23. *// ]: @/ H4 q8 M) g$ ?2 h8 x

  24. & s% p0 t! [, @/ l
  25. #include <linux/module.h>6 m- a1 u. W; D; h6 C1 ?* D! f
  26. #include <linux/init.h>
    6 L) l7 }; L4 ^1 Q
  27. #include <linux/errno.h>9 r" D: Y% ^, h/ R+ y  \
  28. #include <linux/types.h># [) g5 v- R, v( e1 c; u3 I
  29. #include <linux/interrupt.h>  z8 L+ e: F3 u
  30. #include <asm/io.h>$ z; I# r' Q' A2 h/ b9 Q, g
  31. #include <linux/moduleparam.h>
    ; @% S0 l9 {/ V' E
  32. #include <linux/sysctl.h>
    3 ?! N" ]3 b5 V. ~
  33. #include <linux/mm.h>
    - o) k! Y. ^% y) |0 s! q! `& I
  34. #include <linux/dma-mapping.h>( f* |3 E# i$ U, p& T% \( I

  35. $ F5 o4 m% g+ _5 n4 z. w- x6 O( d
  36. #include <mach/memory.h>. F6 S: l0 O  x& d2 a
  37. #include <mach/hardware.h>6 i$ o9 |8 B, `0 j( I
  38. #include <mach/irqs.h>$ Y; M" v5 e# T
  39. #include <asm/hardware/edma.h>
    ' Z6 G( g6 b( g- E2 M* _$ d
  40. , b  A# r/ n7 ^  a
  41. #undef EDMA3_DEBUG
    : [) _9 e3 K4 ^, G' h" w+ |
  42. /*#define EDMA3_DEBUG*/
    , f6 o9 y! B* f8 ^) h* ?
  43. ( G* }6 D  Z7 \: o0 r
  44. #ifdef EDMA3_DEBUG, ?1 {& [- @! n2 i7 S% a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 V: s# m" g/ z! P* y& V$ R4 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % m$ Y% t3 u9 w: c' t& }" d) ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! U; S  c9 S) T3 }! d: B6 I
  48. #else
    . x7 N4 f. T8 I4 X# f
  49. #define DMA_PRINTK( x... )
    ; J' z( r4 g6 C8 L. L
  50. #define DMA_FN_IN& K6 ]/ F7 Q* d# ^9 s& ?
  51. #define DMA_FN_OUT2 h/ @4 K0 ]% x' R- P
  52. #endif6 h1 k$ E5 x4 L8 d4 |( W

  53. 3 _% ?- H/ \+ {: k/ e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! `* E. G7 i4 j
  55. #define STATIC_SHIFT                3
    5 L4 A, ^6 B4 l, @/ F3 Q
  56. #define TCINTEN_SHIFT               20
    9 m5 ?/ H+ f, V( m& l# Z  N8 L, @7 {# {
  57. #define ITCINTEN_SHIFT              21+ p! _9 j( X7 m% m* ^6 Q
  58. #define TCCHEN_SHIFT                22  |7 w3 [0 u( e4 T* `- ]* T
  59. #define ITCCHEN_SHIFT               234 H8 Y, C) M# L* P
  60. * ]% t* P/ u! x. P" c& ]. z
  61. static volatile int irqraised1 = 0;0 i& O3 I. Q( ]. y4 |
  62. static volatile int irqraised2 = 0;
    0 Y8 J1 n% f3 X( X" L+ d6 \) V4 u% S
  63. , v& b. i8 h5 m8 c% {+ I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' y! Z, {' t  c4 M, s, T* T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ R/ Z& u+ S1 A6 n, p( L# i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 p* V" c8 p& u! t- Y6 o

  67. 3 J0 h  r, s3 _8 D6 i+ H
  68. dma_addr_t dmaphyssrc1 = 0;+ g/ Q+ `) M+ N  F% D
  69. dma_addr_t dmaphyssrc2 = 0;
    * W6 d; a7 l3 |8 L% E7 G
  70. dma_addr_t dmaphysdest1 = 0;0 r$ Z: B: o% _3 L- y
  71. dma_addr_t dmaphysdest2 = 0;
    , V8 X5 [3 z! r/ f5 K

  72. 7 _1 e" |9 g& @. r* l4 r2 @) j0 Z/ J
  73. char *dmabufsrc1 = NULL;
      R% l* F# t) e7 @: @! a( ~
  74. char *dmabufsrc2 = NULL;
    8 L! }6 Q0 Y0 s; t: y$ H" P1 b
  75. char *dmabufdest1 = NULL;
    / m; Z" ~/ z8 `6 j5 o; Z4 M" P
  76. char *dmabufdest2 = NULL;% e1 u1 [; d) D6 f. Q5 a

  77. ( N+ v" l. H2 M/ t7 c1 G
  78. static int acnt = 512;7 h' c) M4 H, a  q) I
  79. static int bcnt = 8;
    8 |4 ^  y% C# J, d9 }/ c% w3 M9 f
  80. static int ccnt = 8;
    ' R- t1 C4 w6 _0 q' c

  81. / Q( g* u+ V/ ^# I( o7 R
  82. module_param(acnt, int, S_IRUGO);
    : b; g, u7 H$ Y  B, S0 C
  83. module_param(bcnt, int, S_IRUGO);
    & S4 A! i5 V; L$ N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! A3 G# i% N- w1 E, j$ |+ o( e+ ]+ x# a/ Y0 j& @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' M4 n# j! ~  v4 x2 P) v
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 x1 ]# D3 _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ B; o, j0 ]8 m% M# D
; |" u" G" e3 G0 d; A6 n3 J& N" H& j' F0 d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 17:58 , Processed in 0.039682 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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