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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 V5 U# G, e+ M" z2 O1 z
  1. [code]EDMA sample test application4 a6 X" ]# r$ W, }
  2. /*
    ! M+ Q3 a* u% n. z/ b
  3. * edma_test.c
    8 W3 X, M  D2 T, f! b" K
  4. *
    + S/ W& }8 `& B: z
  5. * brief  EDMA3 Test Application7 I& H6 ~) m# O
  6. *
    % j/ n9 C! [) v* u9 j9 S4 ~8 j
  7. *   This file contains EDMA3 Test code.
    ! g+ S. \5 w% q& Z$ I& o+ o- q
  8. *6 ?/ c# u+ k- _7 z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" A7 M1 W( l/ B* A) N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 }* Z- M  y) [+ g. g
  11. *         TO CHANGE.7 N; J8 p- [4 N' O3 D
  12. *
    % z  Z& a. I$ o8 S5 w# |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 l, w4 J4 _/ v+ L' e. }  Y
  14. ** [  R. }# T5 J
  15. * This program is free software; you can redistribute it and/or1 Y1 C/ J0 q* i8 D, B
  16. * modify it under the terms of the GNU General Public License as
    ; _& Y) ]! B7 @
  17. * published by the Free Software Foundation version 2.1 }7 s" {5 I! R
  18. *
    # b4 O5 u; i. x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, f  M  ?7 }) O6 d/ @
  20. * kind, whether express or implied; without even the implied warranty, L8 B3 g8 u* I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  R. y0 z& ?0 k! n+ T; \) }' ~
  22. * GNU General Public License for more details.
    - Q* m0 x* B) ]6 b& c1 j
  23. */+ s' @4 j! }8 o' t
  24. / _4 ?/ e" \& _$ t: H6 }
  25. #include <linux/module.h>" A. J6 i. X( {& y
  26. #include <linux/init.h>
    # ~% M( b/ R: Z# R
  27. #include <linux/errno.h>( \7 V, w* `5 K
  28. #include <linux/types.h>
    , B4 S2 l1 ]% m. M+ ~
  29. #include <linux/interrupt.h>
    0 a9 \1 _3 H7 _9 k
  30. #include <asm/io.h>8 |" S: N% L4 L! `! B5 f  o5 @% \0 \
  31. #include <linux/moduleparam.h>
    6 m2 J$ F7 F- |
  32. #include <linux/sysctl.h>
    # b# ~( U0 v" r, l/ G
  33. #include <linux/mm.h>8 [- x8 d7 F; f# P
  34. #include <linux/dma-mapping.h>
    " Q3 g+ P- c9 X& _7 x

  35. & ~: n4 U3 D- h4 T6 @3 \' B
  36. #include <mach/memory.h>$ V6 u4 i" P+ S: Q; B
  37. #include <mach/hardware.h>
      {2 ]9 ]( e5 a. {- a
  38. #include <mach/irqs.h>
    ' o& x. p" x; d! b5 ]- I% X& G6 y& _
  39. #include <asm/hardware/edma.h>9 O1 B& E! E! v$ ?6 Z. n
  40. 6 x9 l0 Q# C$ B% a7 L0 k$ {. L0 G8 u
  41. #undef EDMA3_DEBUG; y, k+ [* {% i; P  u4 i! K% S* x
  42. /*#define EDMA3_DEBUG*/
    ( _2 I9 Z8 x% b& L; {% l( t* z

  43. 8 ~4 I' o, M& k: ~, `
  44. #ifdef EDMA3_DEBUG- t( b- Z5 C( C3 o: p% B. q5 _) _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- I9 j: [+ A" s! ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + g" S0 B! e/ k* V6 i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / v" q. l# x$ N, l* n" h/ J. g
  48. #else1 c4 i2 W' }6 I
  49. #define DMA_PRINTK( x... )
    6 v6 W6 _2 A$ t, q/ W
  50. #define DMA_FN_IN
    8 E3 ^  P6 q* v( o& ?6 G/ ^$ p' ^
  51. #define DMA_FN_OUT
    , D+ X/ S4 R4 G( h: p8 z) s
  52. #endif. F% V; m, y6 Q) t8 R
  53. & o3 Z, c( r' f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ N7 U3 U9 L& |$ k
  55. #define STATIC_SHIFT                3% w9 u. p  A3 ]
  56. #define TCINTEN_SHIFT               20
    ; |% ]; @3 m# k0 Y1 d7 h# K
  57. #define ITCINTEN_SHIFT              21+ T# i3 G) T; Z+ P" q
  58. #define TCCHEN_SHIFT                22
    ! I" Z: {, n% L9 `! \
  59. #define ITCCHEN_SHIFT               23! K3 }# s3 n' }0 D: F
  60. 8 H( P. y5 \% M- c0 h" h
  61. static volatile int irqraised1 = 0;: p% j- {/ S) v! k3 [  V, ]
  62. static volatile int irqraised2 = 0;$ J5 }& E+ y2 G( F2 L

  63. 7 c( M" ], V$ w# h1 l: s, B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ K% |5 g3 J9 d$ {: k$ E' Y  h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ~6 ]/ D, n# l% c0 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , _, W- e' Z) F
  67. 1 ~8 ^8 z' j1 h) J; s# J
  68. dma_addr_t dmaphyssrc1 = 0;3 r; o2 D; j$ e8 K
  69. dma_addr_t dmaphyssrc2 = 0;  I! Q. A) [( @& x, |! {, T& f
  70. dma_addr_t dmaphysdest1 = 0;/ Q8 j% F7 }! O$ f0 N. l" c
  71. dma_addr_t dmaphysdest2 = 0;
    * U1 o5 _$ L% J$ B( x. F

  72. ' `0 T$ X* [+ a5 I0 ]# j
  73. char *dmabufsrc1 = NULL;
    2 K( @7 |; p0 `( g6 A0 U0 [
  74. char *dmabufsrc2 = NULL;
    ) Q, J- l. d& y
  75. char *dmabufdest1 = NULL;* t2 ~) B/ B& T% n9 A* n% N2 M
  76. char *dmabufdest2 = NULL;
    2 }: D$ R6 u' [1 E. L
  77. 3 X- J/ d1 x4 n/ R5 d9 ]
  78. static int acnt = 512;
    7 c& l( _- J6 |+ l1 Q- ^# F
  79. static int bcnt = 8;
    6 k$ i. G  L0 b' O
  80. static int ccnt = 8;* z4 N0 f8 L7 f+ I
  81. - ~0 L% K) z) z3 Q1 a+ O* d
  82. module_param(acnt, int, S_IRUGO);
    & S4 U+ s+ w) q$ o
  83. module_param(bcnt, int, S_IRUGO);1 e+ R: Y3 i' e1 L; L3 H5 `# b& a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! N% E; J# W# R+ v# H

2 o$ d! d) ?7 i6 j- M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ x& w! ?( p1 \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 z3 m8 V# u$ _' j& \  O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 Z; Q( |2 s- R5 [  Z$ U% H

- y7 F( F, }' l& x: k0 T
" a/ q3 U) I% s+ P( M- k* @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

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

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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