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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 B6 D. a" M% R; _- [
  1. [code]EDMA sample test application
    5 R/ }1 h0 h+ i) D/ R
  2. /*
    # I! k. w% k7 l: j& S6 }+ Z7 p$ |) U
  3. * edma_test.c9 F0 I8 D* O7 `3 m1 N
  4. *! P# i. `. E3 B& b# j
  5. * brief  EDMA3 Test Application
    6 ^" [1 p2 A- s" o0 C7 v
  6. *# r) C$ B+ R! ], I' h! s) F6 Y
  7. *   This file contains EDMA3 Test code.# b9 a# ?. g+ G: o7 K; s. M7 A4 N
  8. *
    # L0 o( I+ `8 ?8 a; z, @( L7 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) W2 r+ }4 x$ D9 `2 O  Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- o7 z' O0 i( L9 |+ P
  11. *         TO CHANGE.
    1 t3 z/ s9 v8 O5 O& C
  12. *& ]# d5 a% D) i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 _; d! L1 D. M. b& Q2 Y% ~
  14. *
    . P; {5 p) z0 s: W: x7 u
  15. * This program is free software; you can redistribute it and/or
    % W! \; n: _6 u1 ?$ C
  16. * modify it under the terms of the GNU General Public License as
    - I1 v, z+ H+ Z- d* n2 x1 |
  17. * published by the Free Software Foundation version 2.. N/ v5 ?7 Y. `" p9 ~$ X3 Y
  18. *
    $ ~% g, b- a  w3 d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" n8 w; v& p  l7 ^+ l  c
  20. * kind, whether express or implied; without even the implied warranty! |( k7 L2 u- a' O% k- s$ d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% P5 j: D4 l3 o
  22. * GNU General Public License for more details." M# Z0 Q" {# D: d" C$ Z
  23. */" C/ o  }/ U" |0 P  E
  24.   J( v* x, g6 G! W' z5 U+ r1 Q- i+ Q
  25. #include <linux/module.h>9 X/ i3 C9 j8 w1 N  E$ B
  26. #include <linux/init.h>
    ) |- p- n0 i1 v  S
  27. #include <linux/errno.h>* v" X$ s. l% p8 o# h/ ?- I% w( ]
  28. #include <linux/types.h>) b# ]' x: D. T0 F3 u9 R: N  F
  29. #include <linux/interrupt.h>
    , G8 e- I' N4 J1 u: w+ M5 P
  30. #include <asm/io.h>3 g2 ^8 F  W$ T6 e
  31. #include <linux/moduleparam.h>
    ( D* K- M) e- Q4 B; C, ^# @" P0 I
  32. #include <linux/sysctl.h>
    - i/ |3 P1 x/ C2 m/ ~; V
  33. #include <linux/mm.h>
    4 D/ D5 W  C& f8 v0 W4 _
  34. #include <linux/dma-mapping.h>
    " F6 I, g6 Z$ O' f, d
  35. 1 x, h  l0 X1 ?+ T5 G  T
  36. #include <mach/memory.h>
    % h: V* b. \3 _( ^  c
  37. #include <mach/hardware.h>, t. t5 O- d, ?8 @
  38. #include <mach/irqs.h>+ o1 k+ g" E; U; D+ o
  39. #include <asm/hardware/edma.h>
    6 Q, f5 A6 x6 v, k+ B& x% S8 M
  40. / M1 {. t  ^0 P- k. j9 p: n
  41. #undef EDMA3_DEBUG+ c+ j. Z- H* E1 R' a
  42. /*#define EDMA3_DEBUG*/" k' I, K, B1 x  K

  43. " i$ L0 W' x# m; P! A
  44. #ifdef EDMA3_DEBUG$ @8 D* a6 l- v( I& g) ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 y% A" w& u" I4 Y5 [, @! m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* Y& W2 S- D4 L$ F# I! p- y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) S* Y' t9 ?  p, k0 N$ P
  48. #else. o8 y3 f) C- d! ]% I" F. J
  49. #define DMA_PRINTK( x... )" m2 A" O4 w: _( h) H& R; U+ ]* {
  50. #define DMA_FN_IN
    : e. W+ E7 ^! c- R# @4 c
  51. #define DMA_FN_OUT$ w  h+ s! U- |2 `# A: d$ h, n
  52. #endif. K( `, a+ c; x" m/ N
  53. 4 m" T! l9 q0 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ w5 i1 R2 g2 b2 |- z. W+ t3 G3 y
  55. #define STATIC_SHIFT                3
    7 f6 Z+ V, R3 g! a. k, t- W+ T
  56. #define TCINTEN_SHIFT               20
    : X% @9 C. T. E9 ]2 s" @
  57. #define ITCINTEN_SHIFT              21
    7 Q- K+ d; T# m6 [( C# T
  58. #define TCCHEN_SHIFT                22/ u/ D1 y" @' a+ ]' h9 ?+ N: D4 Z
  59. #define ITCCHEN_SHIFT               23
    / U) L' F/ e) n  s* v5 c2 l
  60. 4 a* J" `: M# U( w. l
  61. static volatile int irqraised1 = 0;
    ! V/ o- w9 o1 O0 n
  62. static volatile int irqraised2 = 0;
    * T$ |" x3 y" N3 U8 N
  63. & ~' C! p& V$ M! v- U& D2 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, C; u  i9 z5 t+ [$ ^/ `$ l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + g  I4 P+ R- ?5 q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) v, F$ t4 Y& ?) _" K

  67. ' B0 ?" Y$ g! x9 }; \/ S5 }' }8 m! Y
  68. dma_addr_t dmaphyssrc1 = 0;
    $ C( _/ u4 K* m0 z+ w0 K
  69. dma_addr_t dmaphyssrc2 = 0;
    + {; j) C3 d5 d+ a
  70. dma_addr_t dmaphysdest1 = 0;) z5 z  m! {. X- g+ P( H: g
  71. dma_addr_t dmaphysdest2 = 0;
    + n- l7 b$ Z1 c4 v

  72. 8 F( v5 L" `5 K5 `
  73. char *dmabufsrc1 = NULL;
    : X7 h, J) I, J: N1 i
  74. char *dmabufsrc2 = NULL;
    $ ]: m0 r$ m* G" \( ?
  75. char *dmabufdest1 = NULL;8 e1 g) i3 w: e- z* z& P
  76. char *dmabufdest2 = NULL;1 O/ I# R. E* `+ n$ ]+ U0 y& ?

  77. 0 h; x* L+ b& ~! a4 {/ f1 g% x, P
  78. static int acnt = 512;
    " @) ?$ `* A8 L- e
  79. static int bcnt = 8;
    3 d8 u- M1 V- u' j  M! z
  80. static int ccnt = 8;, |  l. i( D3 _( \7 C
  81. ; v6 A* ?+ }, _
  82. module_param(acnt, int, S_IRUGO);, [, L5 c: }8 @# F
  83. module_param(bcnt, int, S_IRUGO);! h5 H' Z0 }4 g: [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# S1 R# m7 ~: S0 J$ I( c) ^+ f2 u% ?

) S9 g' n8 v% @, k% @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; }+ Q5 @/ e4 A$ c0 a1 e7 }. p! h9 H6 K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 K. c; X2 J/ M9 n6 \/ @& I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" ]7 Q- \% @$ w
, A' M- N; X2 n% ^1 a4 [- g) l4 O3 I" k9 U% K( |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 13:03 , Processed in 0.040118 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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