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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- r) x0 Y" @3 ~8 w0 a: ?
  1. [code]EDMA sample test application1 B. C- R* P; ?0 d; Z5 Q
  2. /*
    2 h; n# q* F! ]# G4 M- D
  3. * edma_test.c2 H. A: P6 H: Y' T' O* \* v
  4. *) r( B; q: S: ^9 }* H
  5. * brief  EDMA3 Test Application' C& G# }! _. e
  6. */ l4 U3 P9 h* g+ Q) A
  7. *   This file contains EDMA3 Test code.- D  v# ?& u6 ?, o4 m. B+ U
  8. *7 C( }) t8 d7 l5 r* V' B6 p7 w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ h. Z* U' F' t9 r8 O  e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! Q+ f7 ?0 s* c: |
  11. *         TO CHANGE.
    / M- N$ J- ^) H0 z
  12. *
    - h9 }9 W! g+ ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" O  ~! Z7 [! w: h! x
  14. *
    8 g4 S! v6 G/ w4 f" H. [
  15. * This program is free software; you can redistribute it and/or
    ; l3 |% h0 j* f( N" p* Q* \% v5 c! Y  k
  16. * modify it under the terms of the GNU General Public License as, N4 B; }9 y) E" ]) f
  17. * published by the Free Software Foundation version 2.
    ! x7 z1 E% ]' S
  18. *4 v( w; d' j4 z& I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; D9 Y6 a  S# F
  20. * kind, whether express or implied; without even the implied warranty
    % \# l2 o0 ?# a! b: a5 T) K; f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # T. P+ g$ y+ L$ m! p! G. c; B
  22. * GNU General Public License for more details./ W$ H& v2 Q4 M# C. z8 K1 \, T  n
  23. */) N- H# Q& x* c; I0 i; B
  24. " s/ i/ y; n% x/ r
  25. #include <linux/module.h>
    ' Y7 n/ r# G0 Z# f
  26. #include <linux/init.h>" j. _6 f! a. f1 w; v  B! D
  27. #include <linux/errno.h>
      D8 u; @$ T: r" N# B* B& t
  28. #include <linux/types.h>% ?# k5 I' J& g
  29. #include <linux/interrupt.h>
    * |5 f' [0 v* T7 O6 C  z
  30. #include <asm/io.h>
    & D/ r5 ^/ v8 {
  31. #include <linux/moduleparam.h>
    3 v* W4 `+ E! F9 P
  32. #include <linux/sysctl.h>
    ' y+ p' A; B  g/ t, d* J
  33. #include <linux/mm.h>+ s4 j% U& j5 ~7 x# ]% v$ }% K; r
  34. #include <linux/dma-mapping.h>
    , d2 J7 K/ Y# Y; J2 B+ B7 @
  35. 5 b, o; J  P5 x; ]; i7 r
  36. #include <mach/memory.h>
    6 O8 R' L- p6 k
  37. #include <mach/hardware.h>* a0 t  j' ~" a/ |% e+ C
  38. #include <mach/irqs.h>
    0 R/ ?0 ]5 d$ N: }
  39. #include <asm/hardware/edma.h>9 M2 ^2 @2 J* m( `
  40. 9 L0 M" m' a. D" j; ?, f( B
  41. #undef EDMA3_DEBUG
    & J% R: U& |$ A( Z
  42. /*#define EDMA3_DEBUG*/; q0 l6 W; r& [- }
  43. % s/ s+ d3 i& u( V. K& @7 X  O5 B
  44. #ifdef EDMA3_DEBUG+ n1 p1 _4 N: }% R& ]6 y! [* _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * ^: T( |8 E( n* I; y+ v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' ?- K: J3 S/ z8 _6 k: b( Z, ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 r* Q4 @' i& I1 s
  48. #else
    0 w$ M7 x; V# z; b9 m* J% @& u
  49. #define DMA_PRINTK( x... )
    ) B# I, W8 Q. k0 u% }
  50. #define DMA_FN_IN
    - D0 Q7 Y8 E% K6 l! ^. g
  51. #define DMA_FN_OUT3 q* |. `+ Z6 s6 H; @& _7 A" H$ G" V
  52. #endif
    * W0 C6 F; r# q
  53.   @. e6 n( F  j  D8 P. Z2 R5 ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  q/ `8 b2 T4 [4 a
  55. #define STATIC_SHIFT                3" q& a3 L9 y: V8 J$ ~6 Y
  56. #define TCINTEN_SHIFT               203 r2 [$ Q) s. y% {7 w" F& q. \
  57. #define ITCINTEN_SHIFT              21' N: s. F* F5 ^* w
  58. #define TCCHEN_SHIFT                22
    - t1 L# h( ?. `9 p+ @8 }. \4 c
  59. #define ITCCHEN_SHIFT               23
    2 v# }. ~5 D! ^" G# `0 t8 e/ O
  60. ( q+ v9 v3 E: f. h( G
  61. static volatile int irqraised1 = 0;% W" x6 T( b1 Z) O9 h
  62. static volatile int irqraised2 = 0;" D; ~  E# Q# R+ J3 Z
  63. & Q" y2 g; ]0 I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ @' n5 D+ ]$ W! X5 j, c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 v1 K  Z9 y' p: o! H  s4 L0 b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* [0 t0 O4 j4 W6 M8 e. C
  67. 3 z( u5 K$ p+ j+ D, k9 x+ z- H
  68. dma_addr_t dmaphyssrc1 = 0;" P/ K& Q1 _2 m* U1 [8 X: y  U. e5 m
  69. dma_addr_t dmaphyssrc2 = 0;
    % T* T1 S  v6 h7 f1 t2 e
  70. dma_addr_t dmaphysdest1 = 0;0 \/ m. q& j- p/ z8 a' P
  71. dma_addr_t dmaphysdest2 = 0;$ }: s& R6 T" c: A8 x" a
  72.   K$ ?/ v/ E! Y  |1 t$ k& ?" D3 Q2 `. _4 e
  73. char *dmabufsrc1 = NULL;
    ' A! Q/ G, ^0 n0 q! A
  74. char *dmabufsrc2 = NULL;
    . o2 @9 M9 l  O+ W
  75. char *dmabufdest1 = NULL;1 M+ {+ d( ~# J" q2 V
  76. char *dmabufdest2 = NULL;
    * y$ L( E- f5 j2 e

  77. + `9 y% H  C1 U8 F% U/ S$ a. E$ S
  78. static int acnt = 512;* l1 u; z6 w# S
  79. static int bcnt = 8;
    8 C) ~! B5 E* E, r/ w8 m3 j" q2 l
  80. static int ccnt = 8;
    3 b- x( N! F0 w

  81. ! I1 Q# u3 l# z& Z. }& Q+ s$ O
  82. module_param(acnt, int, S_IRUGO);
    8 K) H7 }0 U' }& ^
  83. module_param(bcnt, int, S_IRUGO);
    # ?  e7 Q+ b* H* E" {0 K$ ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 Z0 b- J/ q0 d

- M, L. [7 ~4 m0 q+ U3 W$ o      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 l1 c$ s  M- S2 v4 o" H# F( U+ ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 v' w4 i5 s4 g6 B: F$ z3 s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 ^- p& l3 [, B& a! ^+ |
, x* b& V, ~5 n( B2 [6 w. w
6 K% L" W7 ]/ s. p* p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 00:29 , Processed in 0.041811 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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