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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( B2 Y2 g4 z+ F7 q
  1. [code]EDMA sample test application
    $ Z# C4 J9 T/ e0 L/ u! \
  2. /*8 o9 Y9 `) T! `; c  g+ P( Y
  3. * edma_test.c' f# O, q' O0 n
  4. *
    7 w& q) D- E* I, N5 @1 U
  5. * brief  EDMA3 Test Application# y/ U: b2 ]. y9 u+ D0 e
  6. *
    " f$ t2 I: s0 q" K3 L
  7. *   This file contains EDMA3 Test code.
    3 N- O* H! J0 m2 E; p/ U  s
  8. *
    7 N, I) `$ _/ v) R  B" [3 }; j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 f- ]* m! E5 W/ k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& U4 G2 J( J; V% w* r' q9 \
  11. *         TO CHANGE.
      {* \0 |; L$ Z' A" h* X4 W9 Y
  12. *: r) k6 v0 t' j0 v% G+ C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 D6 ]( c. H/ u7 [! T3 S# F& h
  14. *
    , W" Q$ p0 D7 k, q3 @6 Q1 v* r
  15. * This program is free software; you can redistribute it and/or9 t" k$ W1 p# ]0 |* L; m" M
  16. * modify it under the terms of the GNU General Public License as
    / v" W4 j. A: _, a1 a* D
  17. * published by the Free Software Foundation version 2.
    " i! N+ C7 [7 H( u; l$ Q- G2 y$ g& u
  18. *
    4 q, g% j, f8 w% V  N; ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' r+ q; I/ T. B  v- X
  20. * kind, whether express or implied; without even the implied warranty
    $ i; F7 j' h/ l5 {6 U1 F0 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & |9 J. V& p* ?
  22. * GNU General Public License for more details.
    ' {9 w0 P# O7 ^' V2 F
  23. */3 d3 g" q; c3 o1 c

  24. ; O- ~! t& v7 i
  25. #include <linux/module.h>
    1 O& C3 u: a# B/ {9 X& v
  26. #include <linux/init.h>: r) b+ @8 O% \. ?
  27. #include <linux/errno.h>2 n; f* s1 w6 p; Y
  28. #include <linux/types.h>
      E1 c$ j' L+ t9 _7 ?2 }; l) X0 U
  29. #include <linux/interrupt.h>
    6 h5 Y' j! J, {
  30. #include <asm/io.h>4 K2 z# U" c* K6 o
  31. #include <linux/moduleparam.h>0 A. w1 Z. A0 A) t
  32. #include <linux/sysctl.h>
    / l, K8 K& h4 M+ K
  33. #include <linux/mm.h>
    / @4 Z) ]4 C7 s9 p! S1 [, Z
  34. #include <linux/dma-mapping.h>; X% p) a- f! T2 ^* i7 J
  35. 7 F, K: w2 O, W" \+ c! {3 T% ]
  36. #include <mach/memory.h>
    , W' J" R; c2 m, L: y
  37. #include <mach/hardware.h>
    3 l0 H" h( H. R5 Y8 \5 I
  38. #include <mach/irqs.h>+ R" K# H+ Y2 ^7 z; ^; T
  39. #include <asm/hardware/edma.h>
    1 i8 J/ s6 `3 ^
  40. % _. K0 ^4 L' [% n# {
  41. #undef EDMA3_DEBUG
    4 y. P& \& u. y+ L) ]
  42. /*#define EDMA3_DEBUG*/
    7 L4 {/ `& G1 U8 O
  43. 2 y3 K* Y# i! Q- t1 I
  44. #ifdef EDMA3_DEBUG
    8 o; ?4 c. Y2 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* F1 Y1 k& t$ G& {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( W8 ?' E- Z) E, Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - c9 z* F, Y# _8 R. R9 b
  48. #else+ u5 ]/ I& T7 |0 T4 b: |% y. |
  49. #define DMA_PRINTK( x... )8 H4 M1 ^1 U3 C4 q
  50. #define DMA_FN_IN$ n+ P% k2 _- }* I
  51. #define DMA_FN_OUT9 h. ?' \6 D$ H% f
  52. #endif* ~7 j3 S( |% ?, |  e

  53. / m" D9 J& s% S7 C  _8 }1 b  Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % m7 `: H- q7 T! C- m  B2 t4 C
  55. #define STATIC_SHIFT                3
    2 V! y" l  x1 l$ t9 Q8 Q/ M
  56. #define TCINTEN_SHIFT               20: c  D3 s* m+ P6 P
  57. #define ITCINTEN_SHIFT              21
    ; E# g3 A- x9 h/ T- O, U4 y* A
  58. #define TCCHEN_SHIFT                22& N5 G; N3 Z) b" G3 H& o
  59. #define ITCCHEN_SHIFT               23
    % P8 G5 [% d/ L6 B* O" j6 p! Z

  60. , k% l% y2 {2 [+ ~; z) I
  61. static volatile int irqraised1 = 0;9 B* e8 Z3 s0 l5 ^; Y1 w) x( k% d# N
  62. static volatile int irqraised2 = 0;4 b, T0 s3 X. N' Y' t) ~

  63. ( |, t* r4 [; J9 F7 ?, Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 a7 |3 W6 C  l  \  k$ S7 A+ ]  v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) T/ E$ H' Z9 L; `0 B. v  u3 d- }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 `1 ^8 z* }+ h( X7 m% a

  67. # v8 B& l# q7 W; q6 y1 B# L! i
  68. dma_addr_t dmaphyssrc1 = 0;
      D* {7 k2 i2 a" {0 p' w! v
  69. dma_addr_t dmaphyssrc2 = 0;, P1 W  j5 N5 B& a% J" B4 T
  70. dma_addr_t dmaphysdest1 = 0;
    6 x" o( s, @( w# l1 N' u' ~
  71. dma_addr_t dmaphysdest2 = 0;5 H$ @# h" ^- w; D: |$ K2 ?& y
  72. ( x! F" N5 g$ Y
  73. char *dmabufsrc1 = NULL;
    # v9 H9 n- t/ c$ b5 Q
  74. char *dmabufsrc2 = NULL;
    6 |9 i* a! R# _* c7 ?7 E
  75. char *dmabufdest1 = NULL;
    ! {& W3 k' [  B- I
  76. char *dmabufdest2 = NULL;1 A2 Z+ h* r: ^1 V
  77. 1 y4 r7 K3 A- Z
  78. static int acnt = 512;3 u; T* s7 V8 r7 z+ k
  79. static int bcnt = 8;$ [4 n1 S+ u( }
  80. static int ccnt = 8;
    ; T4 Y5 r; n1 \! L5 _7 m) Q

  81. " w; O' B; l0 g" r% i' n
  82. module_param(acnt, int, S_IRUGO);0 O+ G6 g4 v  G
  83. module_param(bcnt, int, S_IRUGO);
    2 ?% j1 D6 s3 I& m% e  g3 [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 G/ I( r' }0 {+ H" a* B: d' K& @5 B5 T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# o. j8 ]5 v7 H& barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- a) l: S9 n2 Y* G' g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 q% C4 s0 ]+ F  n2 k6 ~& e
- w$ n! D) r1 q4 ?# ^5 g- j. X0 i
- Z- d4 O  x, J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 13:54 , Processed in 0.038693 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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