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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * J* L8 {3 h. A5 p0 S
  1. [code]EDMA sample test application7 ?7 a  o8 L) V1 n0 s& B
  2. /*
    ) j3 {. O; j; z8 R. C4 \" z
  3. * edma_test.c' p8 b; t! `2 u, F( ^& @+ u
  4. *8 F, K) t& |# I, f- }3 c
  5. * brief  EDMA3 Test Application
    . ]$ C0 j: z) K2 Z$ A
  6. *
    : a0 q. o' y+ X
  7. *   This file contains EDMA3 Test code.
    4 `; i/ ]# M% E2 B
  8. *- ^7 K8 Z) e* s# n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ P2 o; q, t3 Q* ]( E8 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 g. N7 J" k$ r9 E( q, L
  11. *         TO CHANGE.: ^0 u& k; r0 K+ D8 B- B! o# n
  12. *, X' V. e7 c6 v+ D/ h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 v: R. _. e7 k7 ^' N8 o
  14. *
    1 b( ^  j* C. N# f  t
  15. * This program is free software; you can redistribute it and/or% Q2 O- r6 x  I/ N
  16. * modify it under the terms of the GNU General Public License as
    " ^* ~+ o# L7 x& }; D4 U8 K
  17. * published by the Free Software Foundation version 2.
    , M* I% G+ R  `" B
  18. *. @2 C% h" \+ h8 M  ]2 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& s2 y1 k: |8 e
  20. * kind, whether express or implied; without even the implied warranty
    0 o* ?6 a7 W$ R" n  p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 B% K* f4 {( E* R/ S1 V( X' ]
  22. * GNU General Public License for more details." U0 B% O8 E- i0 W( V
  23. */; O+ w; S. R( r" M6 _

  24. 1 C6 P1 x1 |& {$ g+ G) ^
  25. #include <linux/module.h>/ h0 w, E' Y1 ?# [4 D  `( @
  26. #include <linux/init.h>
    ( g# W8 K8 u  q5 v+ k8 h
  27. #include <linux/errno.h>
    6 l5 Y* l+ S  q& S4 q. P
  28. #include <linux/types.h>" T" N7 s/ B- x- s2 K& J, Q
  29. #include <linux/interrupt.h>
    5 {. l2 ?/ M4 ^3 u  }9 g. [
  30. #include <asm/io.h>) m1 }  I6 a7 u2 t
  31. #include <linux/moduleparam.h>7 w0 h, v( T( V' X6 a  Q
  32. #include <linux/sysctl.h>
    , [4 y' g, e/ w$ R
  33. #include <linux/mm.h>
    * @! y! {: _" G9 ?( k* L+ L
  34. #include <linux/dma-mapping.h>
    # k' G! O; ~4 G- D3 F' x! d

  35. $ l8 n! n, R' T; v
  36. #include <mach/memory.h>
    ) h- e7 @( O; o4 s  U8 u" L
  37. #include <mach/hardware.h>; W1 A- Z- @8 k+ H! N
  38. #include <mach/irqs.h>9 |6 D/ B2 n/ Y. I3 E: Y
  39. #include <asm/hardware/edma.h>- p$ g6 o4 H- e& `% b% F

  40.   I! D2 }: C- b; e0 C
  41. #undef EDMA3_DEBUG2 }% G9 N  K# I6 @2 R4 ]: f3 J
  42. /*#define EDMA3_DEBUG*/
    7 A3 ^% m+ Z% `3 w& e" }0 `
  43. ) q# c4 j) A+ T! E% @, T" C
  44. #ifdef EDMA3_DEBUG  k; c5 w; q! Y5 s9 K8 d2 \" `3 ^$ Y0 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * g& ~  o; E! d; V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 j9 k; ^  B" g0 y" A' }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ s7 S" _* A: V2 y6 u
  48. #else
    " O' h: y; A' ^+ L3 |% Y) b$ u1 a
  49. #define DMA_PRINTK( x... )' C  l) F8 Z$ M6 x5 x
  50. #define DMA_FN_IN
    3 ?3 J; s3 M; z6 i; j9 |" I
  51. #define DMA_FN_OUT# w0 b' ^+ b9 o% N
  52. #endif
    / `: V; e) E( U/ N

  53. ( \9 C* X6 b* V+ u: a, U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), @" j+ d, T/ e5 h- r. a# _
  55. #define STATIC_SHIFT                3& ]3 w& n; J5 d- R
  56. #define TCINTEN_SHIFT               20
    3 X( Y9 d2 K9 b. T8 o
  57. #define ITCINTEN_SHIFT              21* _$ `% R- @* I, s  y: B
  58. #define TCCHEN_SHIFT                225 n9 m* G3 H0 `7 ^1 ?- f$ l- |
  59. #define ITCCHEN_SHIFT               238 T0 [9 D% T( ~( g/ ]5 P$ a

  60. 9 J4 D" o' ^: f: |
  61. static volatile int irqraised1 = 0;8 U/ [2 r; u) A, Y
  62. static volatile int irqraised2 = 0;' i3 B% ]5 s/ O
  63. 1 y. b/ j& k7 Q, \  M- r$ n0 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& l( E: p7 U0 D; E0 {+ T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 J2 i9 _8 E. ?2 h# ]8 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 v+ i, |& I" N4 I8 o$ O( t3 [
  67. 3 H# A3 T4 c$ s) `  E% A: v, s
  68. dma_addr_t dmaphyssrc1 = 0;
    * _+ k4 b5 q" H1 _. ~, b
  69. dma_addr_t dmaphyssrc2 = 0;/ a; J# t: d3 ?$ l
  70. dma_addr_t dmaphysdest1 = 0;+ g" \1 i) m2 E8 }5 U2 Z3 _$ E- x
  71. dma_addr_t dmaphysdest2 = 0;2 b1 q! _3 m  R( p/ l
  72. " S5 W! Y7 `' H" m4 k/ A( ?& S, `
  73. char *dmabufsrc1 = NULL;
      f2 _" x) D9 ^( O& |9 p
  74. char *dmabufsrc2 = NULL;* T3 g# Z- M9 D" r
  75. char *dmabufdest1 = NULL;
    3 R* d4 }0 M) d9 C
  76. char *dmabufdest2 = NULL;
    4 e( |5 Z0 L  N, _0 h% ]

  77. " p- W5 Z: N6 b
  78. static int acnt = 512;: O: V( c$ l! d- a2 S$ a8 ^
  79. static int bcnt = 8;$ J( X. Z2 {/ @/ F2 p# E& r. `5 Y1 ]
  80. static int ccnt = 8;
    ; Y7 e. p& o. g* o' X$ x

  81. ) l. n* l# @; X* ^& N" Y% ?
  82. module_param(acnt, int, S_IRUGO);- ]0 d: N; s7 O* C: b# v
  83. module_param(bcnt, int, S_IRUGO);
    2 U2 g9 n" V" |$ v% j+ t. h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 L9 Z7 ]8 ?8 m9 ?1 h3 r9 |
3 a2 C( ^7 x/ |1 L8 x* C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% j6 m7 B+ E! l# \
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 d; ~  _: p3 {2 Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- g. b: n7 u& T

# v4 c' H& @" `) P* Q! I3 o  ~6 i3 W2 k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 09:38 , Processed in 0.041008 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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