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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! L! f/ ^7 ]% j) g
  1. [code]EDMA sample test application+ A1 S: P/ a; [8 F- I; K
  2. /*+ ~4 G& f1 U( }$ g& p4 E+ I- j; D
  3. * edma_test.c
    , b" R/ E6 G' ]& [) S6 ]
  4. *( |! X$ d9 ?& `% r; j2 \* q7 m# k: [7 l
  5. * brief  EDMA3 Test Application6 O1 D/ Z. K7 F
  6. *7 N% B/ k; Q% J0 ]
  7. *   This file contains EDMA3 Test code.9 }# b5 t6 Z, {5 m2 C
  8. *$ _- P+ W9 @9 g8 S8 d% n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * i6 W" t# K/ S9 C" _% P/ [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ Q* n: m% _' B; C
  11. *         TO CHANGE.
    " z* B+ ?5 L! j
  12. *( w- U" q$ V1 V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + V7 x  K7 m' U6 o
  14. *( i6 O& F2 F% ~0 R2 h6 P
  15. * This program is free software; you can redistribute it and/or1 }+ ~! t4 ^  i8 Q# t3 W
  16. * modify it under the terms of the GNU General Public License as2 c4 b& \2 V( X. W) x+ D; `
  17. * published by the Free Software Foundation version 2.5 [8 s9 p- X7 \
  18. *
    ; Y8 Y9 i# s+ f( `! T: S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* r6 A9 g' W# _4 x3 \. q- H9 u  R/ s6 W6 p
  20. * kind, whether express or implied; without even the implied warranty- C( F3 D, g9 D9 z% i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ N( q1 g6 E0 H) s- W! G
  22. * GNU General Public License for more details.6 C7 l' m* L' Y
  23. */
    2 l' G  U- Q8 O# @: @8 j# x) Q/ C

  24. ! M1 r) H* P, v  h
  25. #include <linux/module.h>9 e2 Z5 r( ~1 a' d% c
  26. #include <linux/init.h>5 T4 P0 G5 W, g: ?0 U8 o
  27. #include <linux/errno.h>* X- c, N/ C: B8 Y. u9 p
  28. #include <linux/types.h>% f' _# f( ^' r" D& u
  29. #include <linux/interrupt.h>2 X  X* j8 q2 |/ x9 S! t0 Q
  30. #include <asm/io.h>
    ' Z( l0 X5 T$ N* t7 ?' r
  31. #include <linux/moduleparam.h>
    - ]: l; D) S: _) ?4 E
  32. #include <linux/sysctl.h>) i6 r9 c3 K: L) c1 l: j( w/ M. g
  33. #include <linux/mm.h>
    3 J; _3 g! i9 l7 p! `1 t' v
  34. #include <linux/dma-mapping.h>6 C( F' {4 X! d' Z0 r

  35. # Y) }) V9 T6 [6 a. G
  36. #include <mach/memory.h>
    7 t# M( y6 w4 B" o  \2 ~
  37. #include <mach/hardware.h>
    & N% W' R3 `) F7 B( d% n2 Q
  38. #include <mach/irqs.h>
    , B  H8 k; r1 ?- T" I' A& a, @
  39. #include <asm/hardware/edma.h>$ E& r/ {; C. `
  40. 9 l+ Z- c. M: V
  41. #undef EDMA3_DEBUG
    : y% _8 P8 N5 Q# b7 M. B9 a
  42. /*#define EDMA3_DEBUG*/4 M! a( ~- ?! V, j5 n; ^1 n

  43. + R8 _# o9 h( X/ H0 c  C8 a
  44. #ifdef EDMA3_DEBUG, u( f! P: \) k6 _0 X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): v8 B3 |2 D# H3 G9 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! X) i# x( D  o2 d1 _# H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ ^5 `& }2 A, {5 ]# ?* F* Y! Y
  48. #else
    % i& X+ v$ `2 x# e9 y
  49. #define DMA_PRINTK( x... )
    ; `  W* E3 n' k5 c. u' _) [9 t
  50. #define DMA_FN_IN
      I% H/ F& [4 k, T  f
  51. #define DMA_FN_OUT9 F5 T4 a. _7 o- R- ~
  52. #endif
    . ]9 L" B3 g5 K1 H4 ~- x2 c

  53. ' w2 @0 y  r2 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( D5 j- {3 I. n8 |
  55. #define STATIC_SHIFT                35 C! q1 g1 g1 ^+ u1 b
  56. #define TCINTEN_SHIFT               204 D& N+ h* b0 ]; [
  57. #define ITCINTEN_SHIFT              218 R3 r6 m" ~/ `
  58. #define TCCHEN_SHIFT                22
    7 e, [. T9 z  e5 K+ Y, y( v6 O/ ?* v
  59. #define ITCCHEN_SHIFT               23
    ( v% T1 I; ?6 f4 F8 s* I+ x  v- V9 b
  60. / G1 L8 S: U, `
  61. static volatile int irqraised1 = 0;
    * i$ k* Q) k: a( {! h
  62. static volatile int irqraised2 = 0;
    # D) v5 X- g" c/ f% g$ _

  63. 4 I* x5 t% T9 e; @, j' N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 x% o# o! F6 t* J. \( q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ F7 g  D$ M9 f0 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* f$ G2 R5 f; B7 E, N9 X6 L

  67. & L, x2 g# r# X# q4 }
  68. dma_addr_t dmaphyssrc1 = 0;
    2 f; C  q7 T8 n
  69. dma_addr_t dmaphyssrc2 = 0;
    - Q7 `  f: |$ g7 k! _' ?
  70. dma_addr_t dmaphysdest1 = 0;
      S0 k( M: b& T* q: R
  71. dma_addr_t dmaphysdest2 = 0;
    & p& V3 P) U# {

  72. . w- {: o+ _& |. Y4 f0 ]
  73. char *dmabufsrc1 = NULL;
    5 K/ M# V* K0 G0 t) s+ L' k
  74. char *dmabufsrc2 = NULL;  G2 K) w5 I  S- R5 L
  75. char *dmabufdest1 = NULL;
    $ `' q' Z" x8 g+ j* k
  76. char *dmabufdest2 = NULL;0 `- a# ?! t4 p! M% I. B) ?. z, F- j
  77. $ j) m# O3 Z3 d4 ]
  78. static int acnt = 512;
    " e0 Q! r2 ~0 F* H3 G& @) M7 X4 e
  79. static int bcnt = 8;
    # p+ F, h' k5 Y/ w( q: t4 ^# a
  80. static int ccnt = 8;
    ) q) Y9 u5 e: {# T) w/ A

  81. , x$ E- W& [) Q: G5 t  k3 c
  82. module_param(acnt, int, S_IRUGO);" B8 p, C; n/ h$ d1 [
  83. module_param(bcnt, int, S_IRUGO);
    1 P5 V$ q" F1 P4 ?1 m. i* ]; X' F* f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ b8 R7 r+ Y2 X/ Z
' @# h, D2 j+ J% i7 {5 y& v+ U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; N2 q" w: L4 u$ }$ l6 c
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 H2 @7 E% L0 X+ J' [& _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( I; A) X3 l  G4 s% `$ ~- i' t0 e4 X* [- C) |  O" Y

, M4 W+ b2 s9 {1 b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-13 20:58 , Processed in 0.041577 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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