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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 ]! u" K* u6 G, f% h( e
  1. [code]EDMA sample test application( y$ @2 K& k1 V6 |; y! y. h( I5 v
  2. /*
    ( X. N/ ^" ?+ [6 `( d: {0 Y2 B
  3. * edma_test.c0 F/ W" Y2 c6 M- v  j; s- T  |
  4. *
    ) m4 N4 q4 P/ |0 d8 c- Y4 N
  5. * brief  EDMA3 Test Application
    + _' k( A3 h5 T
  6. *' L( V6 o" _" \  V, f
  7. *   This file contains EDMA3 Test code.0 C0 j- X, a. _% [
  8. *
    ) a8 N. _3 ^( Y: a4 X& L4 }! o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % D4 e  @; X4 t/ G" b1 ]5 S: _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: U2 N+ _$ i, U% O3 F  n. q9 W/ ?
  11. *         TO CHANGE.0 {/ m) G. k) o2 Y
  12. *
    & j0 e5 [5 T7 M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% x! ]. s) V- B' `1 a# \
  14. *# w+ M& Z; a- h3 v
  15. * This program is free software; you can redistribute it and/or0 z( t- {1 A, [) Q& I( h
  16. * modify it under the terms of the GNU General Public License as- g% I! Q0 D' @: K0 b
  17. * published by the Free Software Foundation version 2.
    + a% ]4 q9 h. u% X/ C- d
  18. *: _" @8 R' U* l% e: w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* w0 I* I* x2 O- z% z, r
  20. * kind, whether express or implied; without even the implied warranty) v0 Y& v1 b3 S; c! m" X% p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 G2 d. D" V/ d2 G& H7 K
  22. * GNU General Public License for more details.
    0 v9 C: ?3 n/ }& w  b6 A: q
  23. */
    " s* h9 c/ H- _6 W. Y9 F2 ]
  24. - d& T" P9 a: g* b
  25. #include <linux/module.h>8 |" H: W7 O0 x- u/ r
  26. #include <linux/init.h>: L9 ~  {5 G- |
  27. #include <linux/errno.h>3 f+ e' |1 V( L+ s6 g1 I5 J
  28. #include <linux/types.h>1 W" N; y: i: j8 e3 h, w% @3 m
  29. #include <linux/interrupt.h>
    2 f1 j& ^. G/ H7 v2 O9 a% M! q
  30. #include <asm/io.h>
    / y5 i. O% o" `  t
  31. #include <linux/moduleparam.h>
    7 v9 a, i  W) ?5 X
  32. #include <linux/sysctl.h>
    ; N! S# J( V* n( t8 p
  33. #include <linux/mm.h>) ^4 t. y; V1 z! x$ ~5 G/ L! k
  34. #include <linux/dma-mapping.h>
    ( e1 b; {7 ?3 e0 j
  35. / K4 a$ R1 U0 H
  36. #include <mach/memory.h>
    & [; G& P" Q- ^# G. S- s
  37. #include <mach/hardware.h>2 V" V2 E  H1 K  c% S% M+ j
  38. #include <mach/irqs.h>% x9 _0 o0 C. q- d( l( @
  39. #include <asm/hardware/edma.h>, v0 I0 E; ?% O6 {$ r* f

  40. + x  L' S1 [+ f: v* S
  41. #undef EDMA3_DEBUG
    6 u2 a* r, Z; G- H8 {* m8 ~& S' j
  42. /*#define EDMA3_DEBUG*/
    $ T* c# T0 G. h4 b" P8 h' ~
  43. , u+ D# R; `( G4 Q; R& D9 y! o
  44. #ifdef EDMA3_DEBUG/ F2 ]( a9 f8 {6 b- c7 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 d; p) d/ C  M' V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 w5 |! V8 G  H0 [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 m: j0 ~, d) @/ i
  48. #else
    7 j3 b# u# P% G7 h# V0 Z0 M& m
  49. #define DMA_PRINTK( x... )6 @6 y6 }& X+ ]
  50. #define DMA_FN_IN0 G7 d% W$ M- c0 n; ~( s  m, m
  51. #define DMA_FN_OUT
    - ?2 I6 D! ^' r: g3 H  m6 f
  52. #endif
    9 w, A' K& x5 Z* w7 {
  53. : r6 B* A0 F2 u. {$ t$ v; z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 s! W% F5 m) p9 H5 E; ~
  55. #define STATIC_SHIFT                3
    3 A$ g# D# g! A$ _6 V3 Y& E
  56. #define TCINTEN_SHIFT               202 a1 g6 d0 k- I5 V+ I  _$ {5 ^
  57. #define ITCINTEN_SHIFT              214 G& ?- q* f" X4 c( H
  58. #define TCCHEN_SHIFT                22
    # @- Q' b) }( e; F2 J
  59. #define ITCCHEN_SHIFT               23; o& z* f% s( W( X
  60. - l- `3 N, C- j, _8 g2 q3 ]
  61. static volatile int irqraised1 = 0;1 j+ Y; J( r( D- e  j0 }
  62. static volatile int irqraised2 = 0;
    + z; _1 ~- O$ j* O, H4 s

  63. 1 @# X% D6 u0 K) ]8 t% J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 w) R# P* r9 U- C/ Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' o. \9 z2 S2 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 q" |1 V3 A. i

  67. - p' I* k% s  i
  68. dma_addr_t dmaphyssrc1 = 0;
      U6 n0 B' s6 H& `- H" R" O7 n
  69. dma_addr_t dmaphyssrc2 = 0;
    + C- S: s8 _, u2 a) |$ f
  70. dma_addr_t dmaphysdest1 = 0;
    $ O4 a. m& D5 H) F9 a. d
  71. dma_addr_t dmaphysdest2 = 0;
    # B7 a  K7 ]9 j9 v; l. l% u, W! K
  72. & V# U# S6 l; ]7 p! _" [
  73. char *dmabufsrc1 = NULL;) u  a1 ?" W; r7 {
  74. char *dmabufsrc2 = NULL;; J) _" a+ l( F! M, `
  75. char *dmabufdest1 = NULL;
    + J3 K+ }. A. p& I% W2 l1 |% x
  76. char *dmabufdest2 = NULL;
    $ h0 M5 P- ?' n6 a) R% q: M

  77. - t: ]" I2 n1 t! W, x) ?
  78. static int acnt = 512;
    ' \1 c. q# {, m$ A7 R
  79. static int bcnt = 8;* W% `  i  c3 k3 p% o) [
  80. static int ccnt = 8;0 C8 d/ u- \3 D& G
  81. 2 V7 I+ L0 s5 N- T+ [
  82. module_param(acnt, int, S_IRUGO);  z' i' C! n6 ~) p- o1 f
  83. module_param(bcnt, int, S_IRUGO);! E- H3 I" q3 k: P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 P5 m3 s2 R6 J( A( r0 \
5 ~9 i8 J: }5 k: t4 ~# s2 E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, o: g; H8 `" g" v" I4 Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! b# I3 x( I) Q4 ~4 h1 d9 Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; y9 W' x; \* Z$ @& X( ^$ ~. s) L& [# W! \$ c

6 U7 W8 Z8 n) d: w3 t! [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-11 05:05 , Processed in 0.040007 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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