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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 }2 `- ]1 I# v7 m- L# d8 h
  1. [code]EDMA sample test application/ Q4 D+ s1 T* @
  2. /*0 W: @# w- X. g5 g
  3. * edma_test.c
    2 i; l1 s% J9 E1 `; M$ @9 Q
  4. *2 N3 W" P4 V( l6 d! Y2 C$ ^
  5. * brief  EDMA3 Test Application; m! q7 w* o( S+ e, H+ m: g
  6. *
    2 y- v' V2 v- T5 }1 {5 }
  7. *   This file contains EDMA3 Test code.( Z- l; y' \: _# T  q
  8. *
    ' s2 l/ F& T% M& o& I1 q& T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 B. W3 ^( b2 h$ Q+ c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ f5 l+ x' N" y( Y4 O8 L6 T
  11. *         TO CHANGE.
    7 H9 s# b3 c3 q) M
  12. *4 d1 W) Q8 [+ _2 _) L9 D  g: A, A  B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ K" g% A  M! h5 S
  14. *
    7 }/ C* H# w8 f. S$ l6 ?
  15. * This program is free software; you can redistribute it and/or
    ( v3 w; w! L5 v3 v+ [
  16. * modify it under the terms of the GNU General Public License as; w- i2 e- H+ n0 h
  17. * published by the Free Software Foundation version 2.
    - T6 C& U' f3 ~* |
  18. *. }/ C- t# j0 F6 A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( \% Q' R1 l* r0 K7 d* [5 u4 W
  20. * kind, whether express or implied; without even the implied warranty2 `* b) V& A. v& p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ @% Y% D- ~2 f
  22. * GNU General Public License for more details.
    5 K* [& y# t# M$ ^7 Y7 \
  23. */
    " d! o" Q: h0 M. ?! g" S$ Z
  24. , j2 V; K* [" L; ^
  25. #include <linux/module.h>3 c7 k) o! g7 m( u9 T! T8 C- S
  26. #include <linux/init.h>
    1 O. z, R0 z/ y$ \2 g$ y
  27. #include <linux/errno.h>
    & X0 c2 Q" O$ H' U+ t# H
  28. #include <linux/types.h>
    0 T, e  u% P1 p' n/ d, m
  29. #include <linux/interrupt.h>+ X- t" U- z' [; Y2 k2 B
  30. #include <asm/io.h>2 d' `8 C) ?& r# p: d" E
  31. #include <linux/moduleparam.h>
    9 q$ M( l5 P, Y5 x3 h
  32. #include <linux/sysctl.h>: o% z! s& E- k$ x/ `
  33. #include <linux/mm.h>0 R( F6 n; B7 o( M
  34. #include <linux/dma-mapping.h>
    6 U# L: o8 W2 u% T, H" T7 @. H

  35. 1 ?, O" G5 s- [, C; y/ J
  36. #include <mach/memory.h>! J  x7 D5 P" o; V8 u
  37. #include <mach/hardware.h>; y2 G1 H; n$ z3 p* B1 L
  38. #include <mach/irqs.h>! Q9 `, t5 W: F3 P
  39. #include <asm/hardware/edma.h>) n- I4 j4 ~: V1 g, B+ |+ W0 l3 S

  40. + |. g3 t9 I* A4 o
  41. #undef EDMA3_DEBUG
    7 \7 Y0 v" ]1 s2 n2 M# v* |4 K3 n' p
  42. /*#define EDMA3_DEBUG*/
    ( H( W# [. a4 ^# F$ ^
  43. 0 @: V$ f5 o7 ~3 X3 R
  44. #ifdef EDMA3_DEBUG
    7 v2 q( D( p0 o) m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! d1 R8 q/ O/ ?+ I! k7 q0 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 Q: o$ V$ B7 `5 j* g9 i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! W- }$ f2 }" f2 z9 P2 X
  48. #else
    # b7 X) P! v! z
  49. #define DMA_PRINTK( x... ); [% N- R$ A3 f5 X0 O* H( [
  50. #define DMA_FN_IN( E2 j6 Q% ~' [- V, K3 c
  51. #define DMA_FN_OUT
    " n5 Z6 u0 x7 b( x  w. I
  52. #endif
    # ^" L* E1 V" i7 u: i
  53. 2 q8 `/ D3 n# c2 S' G$ E) k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 v. Y) I7 K/ h6 v0 a0 h# |
  55. #define STATIC_SHIFT                36 x. ^6 U+ S0 m1 K0 @+ _$ s, Y. s
  56. #define TCINTEN_SHIFT               20
    $ R, e4 U& B, P
  57. #define ITCINTEN_SHIFT              21
    * g9 `( H+ l: c
  58. #define TCCHEN_SHIFT                22
    * S" v4 t! t9 ~( E1 H" k5 r$ M
  59. #define ITCCHEN_SHIFT               23( M. |, @1 k6 M1 M

  60. $ }, ?' e- A, k7 v( @
  61. static volatile int irqraised1 = 0;
    . z: H) S4 ]4 r8 Z6 h- H( v
  62. static volatile int irqraised2 = 0;- O) X/ W. _! v1 q# _; R" I8 h

  63. , X7 b; J( Y3 K' T2 W7 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" I, E: i3 T: b: O. X- p  [& N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( j! H* }' ?2 I+ [6 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( y6 B- q: A$ E8 m" Z( c

  67. # [* [' n9 z! q# b' b3 \+ }
  68. dma_addr_t dmaphyssrc1 = 0;
    # V2 O' h# U0 ]7 C& Q
  69. dma_addr_t dmaphyssrc2 = 0;
    3 s, J% _- y2 V  E
  70. dma_addr_t dmaphysdest1 = 0;
    2 C4 ]' ^) H" q0 ~% d+ F
  71. dma_addr_t dmaphysdest2 = 0;7 `8 l4 T) W: g! j4 n3 ?& `! Z# S

  72. # g$ {3 Z/ C$ k' E
  73. char *dmabufsrc1 = NULL;
    ! X# L& S! n# q8 U
  74. char *dmabufsrc2 = NULL;  E! A9 o' s4 p# c7 ]1 h# _3 a0 ]4 T
  75. char *dmabufdest1 = NULL;$ |, Y- e$ x( {0 c
  76. char *dmabufdest2 = NULL;; a( l4 w/ L0 F8 ]8 i) U
  77. 0 v, w/ W, c) `2 T9 E
  78. static int acnt = 512;) v, X. l* C9 W8 [
  79. static int bcnt = 8;
    : y. T$ t- ~4 f& N$ i) K6 D4 h' w
  80. static int ccnt = 8;
    9 \* L$ P5 ~! l% Q
  81. 6 C* q% C6 L* v- e& f$ v' m$ J% k
  82. module_param(acnt, int, S_IRUGO);2 ?% _0 N* r8 a* F/ h
  83. module_param(bcnt, int, S_IRUGO);
    ' F5 e  {% q7 V; z, o0 X
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# c) k) C/ S5 q$ ^4 r2 m; D. J0 p6 j1 i7 f# u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. D8 _3 O% j" Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ e; n4 P% B, Q! l( r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, y- K5 c8 E: e; M' {: @! C% h# n5 b& s' i$ D4 |0 u
( V' D( T4 s7 {$ S* s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-16 00:17 , Processed in 0.042028 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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