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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 M) Y* C+ k) A: G; d9 v6 A0 [
  1. [code]EDMA sample test application' ?7 X- A1 z4 c( X# l" R
  2. /*
      a# E& E( V6 R. ~6 s
  3. * edma_test.c0 E( H4 ~) r/ [1 l
  4. *
    ! }, _& A$ a) C4 s& q* W$ ?
  5. * brief  EDMA3 Test Application5 B9 I( q8 ~5 _" \7 ~
  6. *
    1 g+ [( {8 L: e' A- w
  7. *   This file contains EDMA3 Test code.
    4 h: ?. F; I. y$ @5 r
  8. *" N0 ^( a% U/ t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) m  _8 L9 s% B# I  v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 y1 d* E% b0 |( C" @( Y
  11. *         TO CHANGE.
      u0 E) E7 }" f, F! {4 l2 M
  12. *
    0 h4 A. K2 A* E6 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 C( J' {3 i4 C% L1 M# x
  14. *3 Z3 y: [1 d- B# J% t7 a
  15. * This program is free software; you can redistribute it and/or
    ; o! K: a  o0 z2 S- o2 \
  16. * modify it under the terms of the GNU General Public License as( I0 p; z: @2 |! @8 V4 w* R- _
  17. * published by the Free Software Foundation version 2.
    ( O1 {- U# _9 M0 q& p' B
  18. *( _# M' `2 C. F0 j4 b% f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 V, j- C6 ]8 O3 Y( a4 c# D  D: t
  20. * kind, whether express or implied; without even the implied warranty
    ( W2 m6 L4 v4 J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" }. n/ a9 n- v0 {: P- |
  22. * GNU General Public License for more details.  J9 F; V. K8 |" ]) ~
  23. */
    ; y! B6 R+ j( s4 S9 h

  24. 6 a3 Y4 a: u" k6 @8 W9 l, J
  25. #include <linux/module.h>5 z; U  G' E% g8 k1 d
  26. #include <linux/init.h>* a. `4 h  u& X2 Z7 U: M- h( b0 H+ h9 F
  27. #include <linux/errno.h>) S* \# ^* N+ ~
  28. #include <linux/types.h>9 `# D" u# P- F: Y: c4 x( H4 F
  29. #include <linux/interrupt.h>
    ; r7 S3 f$ U2 _3 g, o5 y6 R
  30. #include <asm/io.h>/ g; Y+ d5 _/ Z- E. n0 \  u% o
  31. #include <linux/moduleparam.h>+ K: W: k: E2 `8 u$ E% C- M- P6 S3 {. f
  32. #include <linux/sysctl.h>: B( e6 l8 d  n! p" }/ j! r& ^
  33. #include <linux/mm.h>
    / n4 |' V; b  F( M8 j1 _+ R& w
  34. #include <linux/dma-mapping.h>4 j* w9 G# I/ C, Z, |( C0 T

  35. - v7 e1 l8 l2 D3 o! s# y3 R+ n/ c
  36. #include <mach/memory.h>/ B* C( _1 w) A8 t$ V0 \5 q! d
  37. #include <mach/hardware.h>- X0 o" c& N: m6 A) G$ X
  38. #include <mach/irqs.h>7 j; w  {! ~) O$ v: b& v
  39. #include <asm/hardware/edma.h>4 `6 F# ?3 {; f( h

  40. + ]! H5 I: H9 c4 h" K
  41. #undef EDMA3_DEBUG8 @. {4 z% l1 x7 p9 f: \
  42. /*#define EDMA3_DEBUG*/
    2 J1 I0 j2 d$ B+ o6 c! J) f
  43. 6 O, k; w6 Y5 x; S$ K6 V
  44. #ifdef EDMA3_DEBUG6 F& L0 C! \" z* c0 r  g" [) V, L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " W- W% J# U1 i( X1 [6 p2 ]# a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ Y1 J2 H; n1 A; d. I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # B- H7 K" \/ o& X. D9 i
  48. #else/ }. l$ S$ y# q( L+ v- d
  49. #define DMA_PRINTK( x... )
    ! j; A/ B. L) c: V) I
  50. #define DMA_FN_IN
    $ Z2 o& ]9 c4 J* ^
  51. #define DMA_FN_OUT+ M+ _  v- l8 B8 R  @; ~; M- n5 P
  52. #endif
    9 f: H' F' F  f2 h- F

  53. 0 X! t' m# p5 Y) w$ s$ p, I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & W4 a: E  `* B3 L8 A* G- y
  55. #define STATIC_SHIFT                3
    . C7 \# B; {0 A+ a
  56. #define TCINTEN_SHIFT               206 _: w- n# @+ Q$ Q0 A* M* k
  57. #define ITCINTEN_SHIFT              213 O' E# d+ f! M6 t- I- I. X
  58. #define TCCHEN_SHIFT                22
    2 Y( S  p: L4 ?4 j# K: R
  59. #define ITCCHEN_SHIFT               23- W4 L  u5 w: ?  d9 W
  60. 5 i8 _5 }2 j7 N0 j9 w
  61. static volatile int irqraised1 = 0;, W6 a$ S/ W+ t9 P! T9 L
  62. static volatile int irqraised2 = 0;$ b" k, v% `4 n

  63. ; K+ B. f( c% H& U+ P. g, ~) }1 P  R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% Z6 o% z% K5 g+ i3 b: r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 P1 {8 O' a/ U" \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 N  Z) [3 t) a+ B9 K& c( U3 p" V
  67. & t) r, e. L3 W+ f( a( j- k
  68. dma_addr_t dmaphyssrc1 = 0;# a0 U- ~. Y6 V
  69. dma_addr_t dmaphyssrc2 = 0;1 K  g: i7 O; h+ B! O! i
  70. dma_addr_t dmaphysdest1 = 0;9 \& y4 k, d# j2 s% K& T
  71. dma_addr_t dmaphysdest2 = 0;
    7 w: ~7 S- q  W  S; l( q" t" w+ s3 y
  72. - f' ?' c  n! d! b
  73. char *dmabufsrc1 = NULL;
    $ `+ a+ I, O/ s$ t$ S4 R8 M& F. I
  74. char *dmabufsrc2 = NULL;9 Q. j+ Q5 ]1 ]$ I# d' w9 b
  75. char *dmabufdest1 = NULL;) M/ F2 g8 _9 L! a- j3 N
  76. char *dmabufdest2 = NULL;
    & u( X% O, T" ]& x- M# U: }) E
  77. " m# N" C# Z  G0 J9 G5 D
  78. static int acnt = 512;: s- J2 K& b* s9 S
  79. static int bcnt = 8;# O2 \  \$ S, W& m* n6 u$ ~% Y
  80. static int ccnt = 8;
    - \9 G  k% X# W6 Z0 P

  81. 8 l' d& S7 ?4 ]2 ?
  82. module_param(acnt, int, S_IRUGO);
    ' ^$ K3 X2 A& r, X9 b
  83. module_param(bcnt, int, S_IRUGO);3 ]  O7 c5 _- W* i6 k# k5 H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 a; B) P+ b1 t& S: J! m6 c6 }* s* O: ^( @% }/ M8 B4 g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 W% l/ Z5 T( y. S2 R5 v& K1 ?: H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  H9 @, C+ x7 ~/ N( w( J2 R7 }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& v/ u$ _  b9 M3 r- k( F7 Z

% m0 T4 R$ ^1 g
% @* {& y  S; d3 B" p7 g  x0 r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-6 13:46 , Processed in 0.041192 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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