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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ c' d; a2 T  n9 k, c3 c, W) O. b+ R
  1. [code]EDMA sample test application
    , m' _8 z6 F- c3 O8 l; @  u+ D
  2. /*$ K/ y* E% W( Z* r  J/ v
  3. * edma_test.c% y5 Q/ M* a2 B( g6 r& Q
  4. *' k3 ^0 @0 a3 {
  5. * brief  EDMA3 Test Application' _8 M) K) m1 m+ L. B3 G
  6. *: U; n2 }! h* D, F$ D* H
  7. *   This file contains EDMA3 Test code.
      @! x1 V/ _% J. m
  8. *
    * z$ v2 x# [) e7 [: M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" ~% I2 f" w$ \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 y* p$ B( [" Y
  11. *         TO CHANGE.' G, X. L  a2 f- f7 `
  12. *% s9 h* _) D$ }3 G8 t' ]7 N4 I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// r5 s; G" |+ ?
  14. *
    8 p6 b" J6 S. {$ v7 P
  15. * This program is free software; you can redistribute it and/or
    / }6 _/ b+ K+ i4 a$ L+ k
  16. * modify it under the terms of the GNU General Public License as' Z# ?: l9 A3 u& t# Y& l# z
  17. * published by the Free Software Foundation version 2.; m/ `5 }5 p5 g* g0 k) H
  18. *; R! k' @7 s1 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 E$ k. e$ u3 [) W1 Y
  20. * kind, whether express or implied; without even the implied warranty( @, [) L: X! G# B6 B+ V3 f, z. F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % _7 M: t) N; o6 B
  22. * GNU General Public License for more details.
    0 `; K& r/ d- g% ?5 ~9 j$ h
  23. */3 Z$ E+ P3 b- f3 U( V; h  D

  24. 6 M* a4 r0 [9 @9 ]6 [
  25. #include <linux/module.h>) u' R  X' x: O) M
  26. #include <linux/init.h>3 i9 o$ G! v! X; ]2 p7 J& i
  27. #include <linux/errno.h>. a& G! d0 j2 w5 M. e; G
  28. #include <linux/types.h>1 i& |8 j; j$ m2 m& \* d. p8 `
  29. #include <linux/interrupt.h># ]2 [2 z; z1 m* x2 k
  30. #include <asm/io.h>2 Z- z( m4 D& ^6 [1 v! n
  31. #include <linux/moduleparam.h>/ G7 [$ ]* x1 e, q# m
  32. #include <linux/sysctl.h>& L( e' S& M) @
  33. #include <linux/mm.h>5 @, ^4 W; r: |
  34. #include <linux/dma-mapping.h>
    + }: [8 L  H7 Z6 ?1 x

  35. 0 J" s. \& b9 A, V) ?. Q
  36. #include <mach/memory.h>/ R8 E9 H/ s& A1 M4 w" x
  37. #include <mach/hardware.h>4 ?" S: w3 r& D7 p9 S+ }
  38. #include <mach/irqs.h>
    ( C& o( Q/ V' ?& s8 ]9 y
  39. #include <asm/hardware/edma.h>
    $ q; P( \2 L% ]! l/ |8 I
  40. # I3 H3 }* x$ ^1 h* `
  41. #undef EDMA3_DEBUG+ M5 p* N3 n7 t; h; U, n+ h
  42. /*#define EDMA3_DEBUG*/; a, U4 q/ t, i" j, H
  43. 7 t- S9 L) K# U
  44. #ifdef EDMA3_DEBUG' Q/ g. Z7 j: L8 m( ^( O7 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 L; u1 L! L5 i+ S3 M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): ^7 q! [* Y( i4 G+ H' w3 O7 C8 I# n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) B& _7 H5 r- n
  48. #else+ w' E- S7 i1 i) C; O- K5 H) U
  49. #define DMA_PRINTK( x... )" p1 d. A. h5 ^) z: X1 ?# G5 ]
  50. #define DMA_FN_IN# R* B: t+ h* Q2 G2 _, S7 q
  51. #define DMA_FN_OUT
    8 K2 I4 T, q2 J8 @) p
  52. #endif
    ) L1 l, C8 g3 i- |

  53. 8 a" ~8 o# C& J8 O- K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : {9 D9 l" R- x" S* V, W. i# l
  55. #define STATIC_SHIFT                3& G* o+ ^6 E0 t; z. `& X6 X
  56. #define TCINTEN_SHIFT               203 R  h6 \& a$ ?1 ^( d  Z: v7 i
  57. #define ITCINTEN_SHIFT              21+ Q+ W1 Q1 R% e7 h8 P
  58. #define TCCHEN_SHIFT                22% o# z" A# M6 A& w
  59. #define ITCCHEN_SHIFT               23
    ) R5 i3 S% w  A% J
  60. 6 D* `: Q: n: u; Z6 y# d
  61. static volatile int irqraised1 = 0;1 K& _2 I$ ?& c. `/ D) `& T
  62. static volatile int irqraised2 = 0;
    * j& W, q0 n7 e' q
  63. 5 Z/ f, E9 ]3 e. N6 z7 `% k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( `! p. q* I! U- w1 g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) b4 p8 @9 ^. _' _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 ~2 w5 `3 @/ e& Y9 f

  67. ; F; i8 t7 O" r9 E. a- ~' }/ B3 W
  68. dma_addr_t dmaphyssrc1 = 0;
    3 M9 g) k9 }. e
  69. dma_addr_t dmaphyssrc2 = 0;' [5 G0 Q' v1 O5 }4 O8 Y' }" e9 v
  70. dma_addr_t dmaphysdest1 = 0;
    " m5 J( z: ~) K  }
  71. dma_addr_t dmaphysdest2 = 0;' a5 |2 m+ R6 ?8 l7 C$ F

  72. 4 p: V) e9 N/ L+ I! b" I3 _8 O. j4 s
  73. char *dmabufsrc1 = NULL;
    . t8 d$ t# s. U$ M, z% D
  74. char *dmabufsrc2 = NULL;
    6 B+ c9 q* r7 [& v
  75. char *dmabufdest1 = NULL;
    1 z. y  P3 k4 ]
  76. char *dmabufdest2 = NULL;' k. e# L/ D+ n) r4 j% [( v
  77. 7 X8 P/ Q& Z3 i  d7 H% o
  78. static int acnt = 512;
    2 `! S1 R& L' Z9 p6 y
  79. static int bcnt = 8;
    & f5 ]' A( Q/ r; D5 o
  80. static int ccnt = 8;
    - s+ m" D4 r* ?' [# Q. ^
  81. 1 V+ r0 m- {/ w! B( }
  82. module_param(acnt, int, S_IRUGO);
    + E1 G# R0 z' w0 |
  83. module_param(bcnt, int, S_IRUGO);
    ; S0 Y4 W% H6 B* F) x1 P& [4 I: o
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 }0 a, e2 w; S" V$ S- f6 C( J& T5 K+ W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 L! M' f/ {. \  E/ a6 darm-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* W4 L+ g4 ?: o  r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 ?' P+ i4 @3 j& X+ U: j& e0 l2 ~" ~2 e$ G5 j- }& R* t& ?, n; ~0 L: D

; g+ t* P+ }! v# t+ Z9 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-15 20:39 , Processed in 0.043760 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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