OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - I# G8 l+ z8 w; C  ~0 ]( Z
  1. [code]EDMA sample test application
      Y3 _9 i9 r/ i
  2. /*) n. K* H. h4 J# y& ]1 G
  3. * edma_test.c$ N$ _( Q0 \0 ^/ z. d) u! t
  4. *& s* Q: @( }- V6 T- c4 d
  5. * brief  EDMA3 Test Application; R1 D  @' }+ H( M2 u" ?
  6. *
    ) x" R: `/ V1 Q+ b
  7. *   This file contains EDMA3 Test code.1 v$ r7 O, ~2 R. y8 V" h2 A
  8. *
    : m# v8 U" N1 k; Z, R4 y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, c6 q! d& I) }; {" o% _$ F- R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ l$ d% c3 K. z: L! H, r: ]
  11. *         TO CHANGE.( S/ W4 e8 o& Q; K% P# @* T1 t
  12. *! ]6 H* L0 U' a& j  T$ A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( g% |4 `$ s- h. W, t9 L/ K
  14. *3 c( R$ y0 x/ ^9 ]. b8 h* t
  15. * This program is free software; you can redistribute it and/or' r1 |% Z8 \# q  T$ U3 ?- m
  16. * modify it under the terms of the GNU General Public License as/ R4 e) U1 @9 @1 m7 ?9 C" n
  17. * published by the Free Software Foundation version 2.
    4 P2 S( I! x+ y( y
  18. *7 M2 q8 {' W; l( P  Q! e( @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, o. x  T" _! Q2 y, R2 @( s6 \2 k
  20. * kind, whether express or implied; without even the implied warranty
    % F" C( ^9 E/ [+ a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! y- j4 g. q1 j  C
  22. * GNU General Public License for more details.
    5 A- }4 u2 u0 L" U, U( L' }* ~
  23. */
    / n. d- z6 H, S+ R! H' V& A
  24. ( k# p3 X" k# n. `" j7 S: {
  25. #include <linux/module.h>/ V+ v7 X! H4 S! Q7 h
  26. #include <linux/init.h>
    1 h+ x+ D% v+ `! u  [' Z# }
  27. #include <linux/errno.h>
    " B6 A$ D8 k0 Z, c" n' R! Y
  28. #include <linux/types.h>" M& j5 p, F" _( A6 F' c- S& B
  29. #include <linux/interrupt.h>
    % m; a. _5 {6 u* J8 c
  30. #include <asm/io.h>
    7 m' u3 ?9 E& _$ d
  31. #include <linux/moduleparam.h>/ ]3 c" n$ K3 D8 I
  32. #include <linux/sysctl.h>
    9 V9 R& L" S0 ^7 o" }
  33. #include <linux/mm.h>
    $ G0 H2 r. E1 X' E
  34. #include <linux/dma-mapping.h>
    0 N1 r  J5 _# y% W5 h& q- j
  35. 2 j2 z0 [: f& Y$ L! w' |: H) v
  36. #include <mach/memory.h>
    2 k9 _% z$ o$ q% c: U9 Y9 H. ^, ]
  37. #include <mach/hardware.h>
    0 ?  I$ n' F( L9 j/ L2 P$ [
  38. #include <mach/irqs.h>+ i: x! ~3 D. o& U
  39. #include <asm/hardware/edma.h>5 c0 x4 O& S2 S% w' I7 B6 W7 X
  40. 7 V0 v2 c5 C8 ~) }0 g* z5 r
  41. #undef EDMA3_DEBUG5 K) X: w' j' J( ~' t) z
  42. /*#define EDMA3_DEBUG*/& l% P" w1 X2 G- T& h

  43. ) C( Q) n- C6 Q5 y( @1 Z* x
  44. #ifdef EDMA3_DEBUG
    - x: @' h5 t, @) [' ]/ U# g3 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 J5 x' @1 h- U+ F% }- T% ~6 a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " }+ O% w1 u/ W  V* |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * z3 ]% k% O3 T) t. L: C- v
  48. #else
    ( G; ?, s; Y- Q! a7 n
  49. #define DMA_PRINTK( x... )
    2 ^9 u2 t% y8 x- f( |3 |
  50. #define DMA_FN_IN
    " U# v0 P% {% z8 V
  51. #define DMA_FN_OUT7 p! g2 ]' \4 }- t+ O0 ]
  52. #endif0 H  |5 ^, s) }0 E' Q' G
  53. ! Q  O& ~0 w  _  v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : m- J$ K- F& `$ E  C! u4 w
  55. #define STATIC_SHIFT                3  B+ P3 O. K' Y  |
  56. #define TCINTEN_SHIFT               20" {) ^5 v* ?7 N8 c& B3 Y
  57. #define ITCINTEN_SHIFT              21
    , q; t9 |3 G8 ?7 _+ K5 W
  58. #define TCCHEN_SHIFT                22- j/ N5 y$ \0 M! R
  59. #define ITCCHEN_SHIFT               23
    3 \8 p: v. I) V2 @/ x

  60. . J3 C( R1 x3 b/ y" B/ s+ S
  61. static volatile int irqraised1 = 0;# ]) G- _4 J" h% Q7 z6 w& m- N
  62. static volatile int irqraised2 = 0;# p' a( n! v% Y7 U* v, ~

  63. $ ]/ R, p7 W7 T0 m* c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . O# Z  F0 S' [: a( ^& H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . w9 F3 n/ k9 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# h0 E- ]5 F# u8 T# f
  67. # g2 t1 h) s$ _' z6 |8 x
  68. dma_addr_t dmaphyssrc1 = 0;
    . b& ~8 p! p$ g2 K
  69. dma_addr_t dmaphyssrc2 = 0;
    & L1 g* [: E* x* B0 e! D' g5 B6 e
  70. dma_addr_t dmaphysdest1 = 0;  W3 s5 r# `( x: R/ z' T
  71. dma_addr_t dmaphysdest2 = 0;
    * t; U: h% V' g, A* n( i+ l# H$ h

  72. 0 |3 }% T9 }" ?% y
  73. char *dmabufsrc1 = NULL;/ d( F% ]. y# u( T
  74. char *dmabufsrc2 = NULL;
    0 z# @, I; x7 \) M, s' Y* M
  75. char *dmabufdest1 = NULL;8 {" C0 K$ I: ^2 O. F/ y. S# s
  76. char *dmabufdest2 = NULL;7 n' ]1 E3 C. Y9 ~1 [+ A7 M

  77. 9 d0 A- Q9 T' T3 ^+ z2 X2 ?
  78. static int acnt = 512;, i6 q/ n  u- N6 U( Z. v8 V& L
  79. static int bcnt = 8;) x) ^$ @" E6 q0 h, W
  80. static int ccnt = 8;
    : ~' |, W* K# c, e; l4 D

  81.   i5 A% ^7 f1 o; g$ v/ h' J
  82. module_param(acnt, int, S_IRUGO);
    - }' r* F( g0 a0 f! ?7 c; L/ z* Y
  83. module_param(bcnt, int, S_IRUGO);
    # F  z' s- b) s9 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 i8 Z! S7 V3 M8 P
( b, W% }- s, G6 H$ {2 f9 j; `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 Z- X1 n& G2 _0 z8 |4 Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  k  s" c. K: S3 D5 u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 m. v  u7 J+ U  p

# p+ j7 I- `+ r3 U5 K  R; ^+ I6 }' w6 u/ D8 C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-15 06:33 , Processed in 0.037632 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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