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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; n3 {. x; _2 R: s3 q. O! y
  1. [code]EDMA sample test application
    # v+ F3 K! W& f- l
  2. /*
    , Q1 V/ @5 ?6 b
  3. * edma_test.c
    - W% E  S5 p; f) P+ E! w% ^4 t
  4. *
    & ~9 s1 W. u5 [. G& N, w
  5. * brief  EDMA3 Test Application
    1 p0 ]- S3 W. Q2 e' l1 _
  6. *
    ! B' X% i; c, f9 B: I; S# Y# v
  7. *   This file contains EDMA3 Test code.
    ( f' k5 @8 B3 |$ N5 K! p
  8. *( G" p/ z- C* J$ }8 b. h$ a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ~' B8 L7 F+ }2 o4 D* k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 I% u6 I' i( z- n
  11. *         TO CHANGE.2 \' d& `* F3 X' p# e1 J& S. ?
  12. *& _2 i6 q4 A  W- L. N! v( r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  \; V7 d9 }% J! Y
  14. *
    6 q( X+ |8 X: A. n& @
  15. * This program is free software; you can redistribute it and/or0 T: i. _! Y$ k: `) P4 y) m
  16. * modify it under the terms of the GNU General Public License as
    8 ]4 e" |* c0 h6 E8 Y1 n
  17. * published by the Free Software Foundation version 2." L8 P9 D' g3 N* E( Z3 A" T
  18. *
    % J! t& s0 F. D8 B0 j& t# A- R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 N  N2 [6 F, T# G
  20. * kind, whether express or implied; without even the implied warranty+ C2 R4 |7 _9 z" j, a7 ?; B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# b5 t7 O* s0 y9 e4 `2 a
  22. * GNU General Public License for more details.$ i7 k5 Z6 b" T" X) B) {
  23. */+ C5 }3 |5 _) A+ ]3 X

  24. ! F2 `& r0 Z+ h  v
  25. #include <linux/module.h>2 Z" y  S+ H5 q3 {' e3 m
  26. #include <linux/init.h>8 A  [0 y; X  |: L1 [
  27. #include <linux/errno.h>1 U! [6 |* v+ {& N
  28. #include <linux/types.h>8 R& j! P& a; ?" B# Y1 c
  29. #include <linux/interrupt.h>: M, f$ |# L; t( e2 T3 J
  30. #include <asm/io.h>
    ) \1 }# P6 U9 k) r3 O! P. O! D
  31. #include <linux/moduleparam.h>9 p. L4 u$ \+ i+ @- y2 C& A% t- s
  32. #include <linux/sysctl.h>
    & M( T7 F& z0 {9 D
  33. #include <linux/mm.h>
    : U# X) I+ K" Q4 _% [
  34. #include <linux/dma-mapping.h>1 C5 b: ^: z. U: e" _7 ~
  35. " [6 W0 |0 g6 c6 X( H5 }
  36. #include <mach/memory.h># P' B& N3 Q+ R2 v% d5 I9 p0 J
  37. #include <mach/hardware.h>
    3 L* d- c  D9 u* P$ Z6 `
  38. #include <mach/irqs.h>
    ( b* |- u1 t" o" Q* ^9 p
  39. #include <asm/hardware/edma.h>9 Q+ \; v) A  r& S5 j

  40. / ^( q: e* W) d  p; i# h
  41. #undef EDMA3_DEBUG" m% I; J0 L* V% y3 K
  42. /*#define EDMA3_DEBUG*/) @( L( I8 t" I  a0 j9 ^" S  P; Y; \
  43. - }' ~+ k+ N+ w# A6 \" W! k
  44. #ifdef EDMA3_DEBUG
    ' L5 P' R2 P4 Q+ s1 I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" K: o' E) k- v/ d. k% Z: `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # X9 t; P, o( S* B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): W) s# X5 K" d% G' _, g) ]
  48. #else1 }8 N: w; U! O7 M' J8 K
  49. #define DMA_PRINTK( x... )
    2 K' h- c: p8 M
  50. #define DMA_FN_IN! [: {1 V; ?' E' k" J
  51. #define DMA_FN_OUT
    2 `/ L4 M7 C6 f8 `7 O4 r* g
  52. #endif
    ; g6 @7 o$ J9 U8 R* d, p2 D

  53. 0 V7 |9 Q! N: o. s4 N& k) A0 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 K$ u8 X* B2 ]6 Z
  55. #define STATIC_SHIFT                3  p- J( n; y0 z6 ]) g" o/ j
  56. #define TCINTEN_SHIFT               20% @- [2 y* o2 f- D/ S
  57. #define ITCINTEN_SHIFT              21
    3 c6 U) P3 ~- h7 }
  58. #define TCCHEN_SHIFT                22) u" Q+ A) l" K  }0 R7 @
  59. #define ITCCHEN_SHIFT               23/ K5 K) B2 P  C( G+ S

  60. , H0 `& f; u$ Z3 A- @) E
  61. static volatile int irqraised1 = 0;0 k3 B8 z) X5 o( m, Q& S
  62. static volatile int irqraised2 = 0;
    2 _7 r7 L+ r9 Z
  63. 1 l" G/ R# n8 _: l1 j0 [5 M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 c8 j1 r/ V& N% V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ E) W& c  Z4 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ [9 v) _7 j9 U. M

  67. 2 ?' f0 E- q" C9 Q2 G
  68. dma_addr_t dmaphyssrc1 = 0;
    # l8 t5 W* n7 J* w( c
  69. dma_addr_t dmaphyssrc2 = 0;
    8 Z4 P- w4 Y! q+ a0 `- F
  70. dma_addr_t dmaphysdest1 = 0;$ R9 H' Q1 j* t- Q* K! ^7 q; c0 l
  71. dma_addr_t dmaphysdest2 = 0;5 z3 K# {+ v7 T1 u
  72. 5 Y. _. c; F$ b9 @
  73. char *dmabufsrc1 = NULL;
    5 ?* e/ ~# M  r) [1 B) p
  74. char *dmabufsrc2 = NULL;! V( S. E, Z- z' p* z7 P2 v; Z
  75. char *dmabufdest1 = NULL;
    5 t- v( {. G% D/ J
  76. char *dmabufdest2 = NULL;( O) F0 ~- m9 f1 j; |! G

  77. $ B4 M6 n: T7 s: K; j" {
  78. static int acnt = 512;& X' n+ J0 n  E6 m4 J
  79. static int bcnt = 8;! H1 b1 Z/ x& P2 {
  80. static int ccnt = 8;
    & d/ t! }) A0 I: g: O% H
  81. . `2 l* ~8 M  W+ W# e0 N7 x
  82. module_param(acnt, int, S_IRUGO);
    5 `6 V; }& i* Y
  83. module_param(bcnt, int, S_IRUGO);
    , p) q8 _8 |$ a5 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; K; m8 a, q( a8 V/ ?3 e+ j! o/ |
  T/ h  P/ B4 u  c/ g/ q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& k8 }* @$ o' ^; v& L: D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  g4 {& r* g' b: ?. Q' W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 x& d6 G; u8 S3 J3 \/ F/ t' A

# s9 x( ^% o6 Z  _/ f+ Q' i/ g' ^, H! @' {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 11:36 , Processed in 0.040143 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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