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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, A( C& W* e3 n
  1. [code]EDMA sample test application
    - n; D1 ~" H8 ]$ ?# `9 w/ d
  2. /*- E& Y0 L8 y) f+ d3 k8 E
  3. * edma_test.c) `& j% ?- _; m. A8 l, X' P
  4. *
    # D* I0 u" I: h8 O; u0 R
  5. * brief  EDMA3 Test Application
    7 ]2 E4 x/ j7 y* w0 J+ B' n
  6. *5 o+ N0 Z+ P- Z
  7. *   This file contains EDMA3 Test code.
    $ c  z( O' ]$ ?% `$ E0 s
  8. *
    # d3 l: w0 Y) H5 ]: f) Y5 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' m  d! e" D3 c' B5 c% P6 C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 e$ k, e5 `$ }! e, n% [
  11. *         TO CHANGE.' t! _0 a5 R) n" T4 R+ Q
  12. *
    % w3 A  @; L' A- J: m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: `# O4 k: l, P; v4 w; m
  14. *
    7 x! t, f* _) ?" r: X; p, B& A
  15. * This program is free software; you can redistribute it and/or
    ' C% I0 T2 d' L8 B; Q! X! I
  16. * modify it under the terms of the GNU General Public License as6 H0 m: \6 w$ e  [
  17. * published by the Free Software Foundation version 2.
    ! M9 K. F/ C, h( g  c/ Q
  18. *% N% E. O" x& z6 @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ h" M6 I8 ?, q8 }  S5 Q7 M- `
  20. * kind, whether express or implied; without even the implied warranty
    % N5 @/ F" ?3 E8 m% [7 j; K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 O* r# M' }3 P8 Y3 B' P
  22. * GNU General Public License for more details.
    7 r8 P* r) g6 U0 e# s: v; O* J/ E0 H
  23. */
    1 w; h# ~  I0 V- {+ \% q3 ^; }# K. c

  24. 1 E4 {! x3 O5 P% o/ z9 _
  25. #include <linux/module.h>5 \' l4 i8 W' {: h) i5 D0 y
  26. #include <linux/init.h>
    ; T, D6 L0 K* Y+ P. ~7 I
  27. #include <linux/errno.h>4 X9 o% f" X6 r0 s$ E* h
  28. #include <linux/types.h>" \6 {; B0 R+ o
  29. #include <linux/interrupt.h>* F7 ]* k. q9 D. {/ w! g" ?
  30. #include <asm/io.h>6 B9 n7 Q' V; p7 u
  31. #include <linux/moduleparam.h>
    $ \5 p5 G! G& M- m' l9 y
  32. #include <linux/sysctl.h>+ c  ^- @# D" C9 [" Z
  33. #include <linux/mm.h>
    9 \9 k! K- R) Z! v, x4 {/ H0 K! T" Q
  34. #include <linux/dma-mapping.h>
    ; _/ f, D. m. J. h. M! j

  35. $ m: E- N, M5 O+ Y$ U7 g5 X
  36. #include <mach/memory.h>
    2 M6 s: B% I2 c: h, k! P5 f/ B1 r
  37. #include <mach/hardware.h>
    9 }  M5 K, o- j+ q( _9 ]1 t
  38. #include <mach/irqs.h>( }- _+ f- P, S2 N6 ?
  39. #include <asm/hardware/edma.h>
    3 s" ~5 ^! M6 w
  40. 8 ?" w" G% ?! p" T, }; w
  41. #undef EDMA3_DEBUG
    1 B" u9 L& i4 j/ O1 z. ?
  42. /*#define EDMA3_DEBUG*/
    ( g2 r+ L: v8 b: p

  43. % D( R" A; W, v$ A" C5 }9 Q
  44. #ifdef EDMA3_DEBUG
    . q6 B, k  R( _% Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 p+ c3 ?4 Y1 J* N) ^; [2 E( s$ v6 E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" q- x3 e: w% G* X0 K' m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 _* Q" X+ }9 L0 w6 ]
  48. #else8 b' L- c$ l  T  r
  49. #define DMA_PRINTK( x... )
    . S& f9 @0 s! y1 R0 A
  50. #define DMA_FN_IN
    . a& V7 \( f( S' i
  51. #define DMA_FN_OUT% X% l1 T; w- y2 X" ~
  52. #endif1 {; |$ M6 w4 K% f/ n( R% y4 a

  53. - T& b" a" ^. H% W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' p+ ?- q; Y- y8 L4 I, M- h
  55. #define STATIC_SHIFT                3# p/ A' e( Y/ }- q+ ?; m, f  O$ r
  56. #define TCINTEN_SHIFT               20* J! m& P  e1 j4 ?: d2 _$ n
  57. #define ITCINTEN_SHIFT              21
    ! U& ~% D* S+ l( f' A4 r
  58. #define TCCHEN_SHIFT                22
    6 ?' h% O4 a. W* a5 b' ^" b
  59. #define ITCCHEN_SHIFT               23
    8 f) J/ ?- g/ g8 y
  60.   u) e) b- N! V7 r' q
  61. static volatile int irqraised1 = 0;, A' F" N3 O7 L" r3 j# L" {
  62. static volatile int irqraised2 = 0;
    6 v$ n: E: ^1 H3 t
  63. / b! z+ x% g" H7 L6 {. ~) C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ p" s, f0 K, U# r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 w0 R/ ?& [" x. m, i4 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 D  Y7 M, o$ _

  67. 5 u9 I. d: B+ A  ^0 S. c
  68. dma_addr_t dmaphyssrc1 = 0;9 J+ R: R  H. a7 x+ k
  69. dma_addr_t dmaphyssrc2 = 0;
    9 U8 c$ P) D& k5 q# s/ N7 ]
  70. dma_addr_t dmaphysdest1 = 0;
    . b  J# e1 O9 W' w- ]4 H
  71. dma_addr_t dmaphysdest2 = 0;3 g# I, w" ~3 ]1 }

  72. ( Y  l9 V  ?$ X# L+ ^. }" J( F" ^
  73. char *dmabufsrc1 = NULL;
    2 T4 X+ x7 _/ {4 }
  74. char *dmabufsrc2 = NULL;
      H, @4 \. |  |7 w, I7 c0 _6 e; _8 v
  75. char *dmabufdest1 = NULL;
    : f+ G+ L0 ], Z
  76. char *dmabufdest2 = NULL;  ]2 U# u! {% o# N+ z6 \1 T) r

  77. , f- l3 W0 u/ }
  78. static int acnt = 512;) o3 t% f2 v0 g
  79. static int bcnt = 8;
    $ [& I$ z$ r8 n5 [
  80. static int ccnt = 8;
    , T( B5 m6 m9 V5 S0 J# h
  81. ) \& m# p8 m/ ~% o0 i+ z/ A
  82. module_param(acnt, int, S_IRUGO);0 x5 V. E; J$ n# k
  83. module_param(bcnt, int, S_IRUGO);
    0 O4 W. R8 R0 v  ~, B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. A" u6 Q  G2 z  t1 C9 l8 P2 z$ u; L

( x  _" u4 ^- J9 Y- f, |4 ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 K: \/ r8 H' @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 A' b& Y* [, x" \2 N2 ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ I: ~6 y5 t0 G' G; b7 N0 |5 s
9 G$ a+ |" E5 [; y
- l' O6 R5 Y/ u, K1 h/ U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 22:11 , Processed in 0.042705 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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