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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 K4 o+ ~3 N: S+ A* q0 g
  1. [code]EDMA sample test application) Y  g; G/ g3 l8 n+ L; F/ Z4 X& x3 Q! N
  2. /*! j/ \& A7 g3 U8 k
  3. * edma_test.c4 R4 K6 n6 D- S8 @# I
  4. *1 z9 b% L4 N9 m+ N
  5. * brief  EDMA3 Test Application+ K5 r' l5 {3 H' r( B3 V( m
  6. *
    4 F: D" n6 O: E
  7. *   This file contains EDMA3 Test code.* q+ S0 \! x5 z. c! H# Q. `+ y
  8. *
    : u  ?" Z$ r5 A  G6 l& @) A1 J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( s# h. {( g' E, d$ L! w6 b& e; l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 g* n: E9 O/ Q3 A
  11. *         TO CHANGE.3 H( `! n' a. l0 E+ q: d
  12. *
    3 f3 q) J' S( M. d7 Y( ]1 R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " r2 i- S: ?( m, E  z4 e1 C
  14. *
    : p3 T( d! a; g* F+ _
  15. * This program is free software; you can redistribute it and/or$ z1 z0 C! S, _/ y7 Y8 ^
  16. * modify it under the terms of the GNU General Public License as3 z( w) h/ y* ~6 x. a6 N. j
  17. * published by the Free Software Foundation version 2.
    5 s/ k" G3 G1 [6 }
  18. *
    : P4 h2 Q6 f' |7 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : C' l. i+ T2 T3 q
  20. * kind, whether express or implied; without even the implied warranty+ Y7 u# {, |3 E, R- a3 Y( w! F; J/ x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 I& T, {8 A% Z  }5 g9 b
  22. * GNU General Public License for more details.
    $ C; k% Q+ b( x8 \. a
  23. */% f4 |$ f* c: q6 e& I
  24. 7 s& L1 F' T  Y( n& q$ T+ e
  25. #include <linux/module.h>4 Q- `+ g& a" q+ c0 x# M2 o! \
  26. #include <linux/init.h>* v! U3 G% }3 v  K! P
  27. #include <linux/errno.h>! k3 A; o: ?8 N
  28. #include <linux/types.h>; N& H2 y$ O- l# D% h' [0 e) N
  29. #include <linux/interrupt.h>7 {$ I$ B- V2 ]( j$ f2 E5 J" `) U
  30. #include <asm/io.h>
    ) y7 a9 y  B& W  A/ C
  31. #include <linux/moduleparam.h>' p) P2 d8 h  t2 ]
  32. #include <linux/sysctl.h>3 l  h1 F! R- |' u% {" R
  33. #include <linux/mm.h>
    8 m, @# t& d/ e6 j7 ~! U/ s
  34. #include <linux/dma-mapping.h>
    9 U6 {2 A8 {& S  v4 w8 E

  35. $ K2 W9 B$ ~  m2 G* V1 S. Y0 d
  36. #include <mach/memory.h>" k& y* P, W8 i4 t4 f% P: s
  37. #include <mach/hardware.h>
    4 I3 F( f3 o6 D8 {$ u! v# L
  38. #include <mach/irqs.h>( h0 y. `# P" [' J4 H# U! Y* _
  39. #include <asm/hardware/edma.h>: \! T) e! S  ^# l; H( v" O) q1 M

  40. 3 O+ M$ d$ K: H% S
  41. #undef EDMA3_DEBUG  d+ J! K7 B4 ?9 \" t
  42. /*#define EDMA3_DEBUG*/
    4 h5 f( T7 x6 z
  43. ' Q7 H" T) x1 V
  44. #ifdef EDMA3_DEBUG
    2 y0 a6 I& ^) c; H% ^. G" F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 o! F3 D* |6 H! a  z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; s8 |1 e, O1 t: ?# [+ M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- f& q6 z! l3 K5 a4 ?0 f5 G. v
  48. #else5 R5 U" W+ [" {& p/ B
  49. #define DMA_PRINTK( x... )% B( R/ |/ o3 ~* A( i; R: T" Z! n" k
  50. #define DMA_FN_IN
    / u5 |! D5 P) p- ?$ m3 r
  51. #define DMA_FN_OUT) Y, p3 |. m- R
  52. #endif
    / B. ~7 Z9 J$ \, p3 b  |

  53. * M4 P2 O; @9 ^! |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 U7 D! u2 u2 [
  55. #define STATIC_SHIFT                3# M" F( i3 |0 U9 f' |/ T" X& ^
  56. #define TCINTEN_SHIFT               20' M4 V/ Y8 {3 L+ c! }" X
  57. #define ITCINTEN_SHIFT              21
    3 q$ q3 J& ~: J8 R+ ~( G& I
  58. #define TCCHEN_SHIFT                22
    , o6 l! O1 f9 Q; Q
  59. #define ITCCHEN_SHIFT               23& N; m; A. H% x! y  m( d

  60. ' d/ e% @6 b0 U& T/ _- P+ S
  61. static volatile int irqraised1 = 0;
    ( D/ ]& a. f* P
  62. static volatile int irqraised2 = 0;
    / g3 }% P4 @' J: `- {
  63. 5 G; ?% t3 h! o* V. O2 M' y5 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! d( u; M. \# }1 v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* z" }8 v( e# c" \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 n, M6 H& [2 |+ C1 X" {7 |
  67. # v) }) z2 D7 X& C# l9 H
  68. dma_addr_t dmaphyssrc1 = 0;
    ( {. b3 V$ w9 I, K* u* Y
  69. dma_addr_t dmaphyssrc2 = 0;4 p  T1 {" B- z/ @; s
  70. dma_addr_t dmaphysdest1 = 0;  x5 o% [) n( V% ]3 }
  71. dma_addr_t dmaphysdest2 = 0;- u, V- }+ V' T! H/ ]& U
  72. ; p/ }# U+ T( R- D0 t1 g9 O" {' Y
  73. char *dmabufsrc1 = NULL;# R! \) e- C. ]( H+ `+ m, Y
  74. char *dmabufsrc2 = NULL;/ c8 w: @' V# D  R: M, B
  75. char *dmabufdest1 = NULL;
    ) t* a8 Y4 a# M/ B+ e
  76. char *dmabufdest2 = NULL;1 o9 O0 z& n- O* v, q
  77. ! Z0 z, L: l) p3 ~& p
  78. static int acnt = 512;9 T3 x- `4 _2 h" j# i# N
  79. static int bcnt = 8;
    / y3 \7 e4 U. G0 J5 ]/ Y+ T
  80. static int ccnt = 8;$ q: U7 c  [; Y( K/ b. E/ d

  81. / U( ^! B' F7 m; _0 `8 m1 W1 j" d
  82. module_param(acnt, int, S_IRUGO);
    ' _" _- ?5 T/ p6 a+ V8 O5 X1 d, m9 l
  83. module_param(bcnt, int, S_IRUGO);) _0 K! o/ l% B' @. H4 M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ F- O/ ]0 v+ X) b7 G. j# ?$ Z9 a4 z, }$ y4 S" F* Q8 @" g! ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 g  b/ ~% f9 E# y1 garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: W* s7 _* x) C( b: B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ G4 Q4 g) P) V; y3 L. G. A1 P/ T7 V! c7 x9 K- X

$ A" W1 S9 b9 k7 K! ^# n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 20:50 , Processed in 0.040913 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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