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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# _# i! J* b8 ?* _6 N1 P- a
  1. [code]EDMA sample test application4 G; f) l: Q* r: K4 w1 j
  2. /*" ^5 f, Z0 C4 t, h+ J% ]
  3. * edma_test.c
    8 T2 |2 X- E+ r
  4. *
    4 \8 L1 m* o' m3 j& q5 d- P
  5. * brief  EDMA3 Test Application
      n9 n6 j* K  ^) P, B* @- G
  6. *4 c+ i1 P2 {9 ^% [8 @
  7. *   This file contains EDMA3 Test code.
    ( v9 M1 V  N% i# Y
  8. *& n0 h- p; o, s, x' b7 o) O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, p) q1 s# {% c# |8 m7 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) C  ~, ?  l8 v# ~* f
  11. *         TO CHANGE.0 R% w* F- l- p8 S: `: _- T
  12. *
    5 U7 r# J3 h5 x4 V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 g% ]( b! A0 i- W' F& R! F
  14. *' N4 n8 C! T; P/ U- {
  15. * This program is free software; you can redistribute it and/or
    9 L* \- W$ U% \4 A. P
  16. * modify it under the terms of the GNU General Public License as7 D! M5 y5 ?0 W- e" b* W! Z! k
  17. * published by the Free Software Foundation version 2.; P0 U  [) t, K* x8 ?
  18. *, E0 J/ R. x. r/ k1 U' e& k4 M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - l1 n3 x* v6 t
  20. * kind, whether express or implied; without even the implied warranty
    - o9 r5 h, \. s2 K5 Z' q+ S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : q4 Y# D' s: f. U8 P" ?
  22. * GNU General Public License for more details.
    5 i7 Z9 W7 C! s/ J/ P  ?
  23. */
    ( E, k) X; Y& p) u2 P* [
  24. 1 O3 Y, m4 U1 z, q( R
  25. #include <linux/module.h>& v1 m/ R- R; s2 s% I4 T6 q- `  B
  26. #include <linux/init.h>7 _  O& ], l$ Y5 m7 b
  27. #include <linux/errno.h>
    : c3 A7 a! P7 ^5 t5 i8 e
  28. #include <linux/types.h>9 }4 t: V- I0 m- V0 w( F
  29. #include <linux/interrupt.h>2 h# C* @& Y8 l/ Z; v+ N
  30. #include <asm/io.h>
    0 M+ H+ Q1 X5 p9 ?4 Z9 G) y
  31. #include <linux/moduleparam.h>, H8 Z  K$ O' e+ C- h* g3 i  X
  32. #include <linux/sysctl.h>
    % @& n2 Z; y; T. O. M
  33. #include <linux/mm.h>
    , c* \. [! p# w' k. Z# g
  34. #include <linux/dma-mapping.h>1 a6 f1 M6 l# M6 e- q1 L/ g- n

  35. ! b- \  w6 W( d% {) ~9 K, Z
  36. #include <mach/memory.h>
    ( m& V: H, X, W1 e5 h; |" b: w9 H
  37. #include <mach/hardware.h>
    0 T* `# A/ a( z0 W0 L  e
  38. #include <mach/irqs.h>5 p: }4 {6 G9 }0 R0 ^4 K+ }, i
  39. #include <asm/hardware/edma.h>
    1 m/ Y/ f; o( A. y6 z* k1 Y  \2 [. ?

  40. " I2 k4 K; H. C6 a: K
  41. #undef EDMA3_DEBUG7 Y/ }8 C& |" Z$ O2 g
  42. /*#define EDMA3_DEBUG*/  H; B" i% Z3 V. s7 A2 q: X

  43. ) [3 ^) M3 a3 B' a8 q
  44. #ifdef EDMA3_DEBUG
    * D9 y& S) D" |! L6 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . f: Y% |3 S& O6 O- p. o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 T8 k: K; ]4 n  }, K9 T$ }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # t" l, h3 |; d( Q
  48. #else6 i9 X. E! T. o5 ?$ r( N9 L
  49. #define DMA_PRINTK( x... )% {# o8 A6 o( M3 `0 {  W
  50. #define DMA_FN_IN% q) G& n, e9 {) E: x
  51. #define DMA_FN_OUT; b& C, e. g7 g+ C1 R
  52. #endif
    2 X- C" J; W3 R/ f# G2 e

  53. 8 `( }7 M5 a1 c  R( K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); j3 I$ a$ a' r, `( \
  55. #define STATIC_SHIFT                3' K2 b  G* p2 \3 j+ L% g- X4 e1 e
  56. #define TCINTEN_SHIFT               20
    5 I+ Q: ]0 d9 f2 Q' [
  57. #define ITCINTEN_SHIFT              21
    ( E) W/ u! O7 z" C; t4 I) ^
  58. #define TCCHEN_SHIFT                22
    # I$ E' K5 Y4 t! S
  59. #define ITCCHEN_SHIFT               23! u# E- V0 K2 L+ P4 C, t( {% f/ ~
  60. " g6 r! k9 q0 D( o
  61. static volatile int irqraised1 = 0;9 n0 P% o9 [1 W& K" k
  62. static volatile int irqraised2 = 0;! d, V$ E; I/ c0 v; N% M

  63.   i! [% z& s5 F( c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . b5 p) s* O) _  a" }/ K' r/ F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ u3 P! p% A( i2 Z. L) B0 j# a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ~7 E7 @  w# x) h# D  R, a
  67. ) U  v. z1 w0 @0 m, L" ?! a. l* ?* U
  68. dma_addr_t dmaphyssrc1 = 0;- W5 G+ M, c1 m+ R9 w
  69. dma_addr_t dmaphyssrc2 = 0;
    * q* J7 l) |* o4 G! T! O! H/ }, X
  70. dma_addr_t dmaphysdest1 = 0;' h/ I; f" O' h; ]% V) v0 X: K6 Q
  71. dma_addr_t dmaphysdest2 = 0;
    6 Q  F: e0 `) h+ f2 s& K6 u; H# `
  72. + ^# L& Y( Q8 v$ g1 J5 O
  73. char *dmabufsrc1 = NULL;; k7 r% P! X- N, C* Z  e
  74. char *dmabufsrc2 = NULL;& {: U0 M4 U: [, Y
  75. char *dmabufdest1 = NULL;
    * Y, L' g# s/ M. i1 _7 p( M
  76. char *dmabufdest2 = NULL;* X% Q! S1 K% d/ ~' R$ e

  77. . B* t) {9 G* h6 ^5 `9 U+ ~  A
  78. static int acnt = 512;
    % ?4 x2 \/ s- a' D+ r
  79. static int bcnt = 8;
    ' n. a! F0 E" p" L" L6 w- p
  80. static int ccnt = 8;) a* x" h* k& y  x- a+ ]

  81. 7 r; H' [) U( E
  82. module_param(acnt, int, S_IRUGO);* h; c/ C) \* M# x6 }9 L
  83. module_param(bcnt, int, S_IRUGO);
    ) x9 ?  L3 l& c( p+ h3 d. ~2 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: f6 q5 S5 P& \5 m2 @2 C7 N  g+ S: y% l# O* M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 o) |: Y/ d- G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) N5 ]- ]  [  |" ^/ g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 `, ?- }6 W' z) }! h
; l# ^, Y1 @+ r; b2 z0 F

0 h9 j$ e0 G" Y8 o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 13:08 , Processed in 0.039759 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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