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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + m8 L& N2 Y& }
  1. [code]EDMA sample test application
    + D$ Y4 Q9 _# _. x8 r! _
  2. /*9 k8 s; |1 B; `# S
  3. * edma_test.c" ^! J+ f" i* `: e/ V1 Z. t" v/ V
  4. *0 b: W9 A' X- R
  5. * brief  EDMA3 Test Application8 |3 q6 O# s& a) n
  6. *
    4 Z% N" B  f. Z. h7 X
  7. *   This file contains EDMA3 Test code.0 P  W& g& n8 [! y1 d  b  M
  8. *
    6 O! ?: f% N9 x2 c4 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 R+ e" {- R! Z( n! x" F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 I1 _. |, L! }/ x- z) v# W- L. l5 @
  11. *         TO CHANGE.  y; X0 I: @# E6 {8 b
  12. *
    5 @% ?9 R# D9 N- y8 w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 d; o% ^' T) I& B
  14. *' L4 ?9 x( W( p2 d0 I8 b+ i
  15. * This program is free software; you can redistribute it and/or
    ) Z; i" C+ v  E% Q: ]. Q
  16. * modify it under the terms of the GNU General Public License as9 q4 K% |3 V  S+ J7 @
  17. * published by the Free Software Foundation version 2., X! \6 W4 p( p1 I/ n; F
  18. *; w8 @0 ?0 t0 \% F% k# o$ K  |) \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, S5 ?$ D) g+ W8 C" d
  20. * kind, whether express or implied; without even the implied warranty
    % W4 A1 z# |% `" B* ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - v9 u2 @- D: \& ~5 T" K8 }4 E
  22. * GNU General Public License for more details.
    & U2 l; C" A- K# K5 c
  23. */, U, M( ~. k: v, \# `/ }$ M$ E9 X. _( j
  24. & H/ `1 N% |$ N! f6 _
  25. #include <linux/module.h>% J: t8 w  R4 `0 s$ Q0 O
  26. #include <linux/init.h>7 x6 L: x3 L+ `0 j
  27. #include <linux/errno.h>
    ' r! T& B5 Q4 T0 q4 X
  28. #include <linux/types.h>
    " X: @! W: I6 z& T; X  e( h
  29. #include <linux/interrupt.h>
    ; h" |/ N5 M& g! l7 a
  30. #include <asm/io.h>) V) e- C1 I+ S1 Z+ @2 |
  31. #include <linux/moduleparam.h>; h. J, J2 x( K+ u
  32. #include <linux/sysctl.h>. ^8 b+ p4 H; P: o0 X
  33. #include <linux/mm.h>( ]/ x. c0 W, ~9 g. s
  34. #include <linux/dma-mapping.h>
    ; u! E/ u; d6 M: @2 y' _
  35. ( o6 R' j$ P8 ]8 a7 h
  36. #include <mach/memory.h>
    / U) D: g  y( P* |. \
  37. #include <mach/hardware.h>
    * X* H* D. q$ j
  38. #include <mach/irqs.h>
    " i0 j9 k& S/ `, e5 i
  39. #include <asm/hardware/edma.h>- R' B) P. c( b  r: b+ u& [

  40. , G$ M, X3 d( V
  41. #undef EDMA3_DEBUG
    5 M2 b5 R+ B$ S: N
  42. /*#define EDMA3_DEBUG*/4 K* \3 i1 o6 U( A$ P
  43. " r! ?9 e( c9 H+ H6 @% D; q
  44. #ifdef EDMA3_DEBUG
    : z8 R# U3 ]1 s% D* i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * h$ C9 V! p2 L4 J% I/ P2 N- E. U4 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 C! Y  Y+ @. c5 a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 u( o, y, h2 Y
  48. #else
    3 l: b" ^8 k3 a& B* O
  49. #define DMA_PRINTK( x... )4 j. t" V) N3 S6 ^
  50. #define DMA_FN_IN* D) O4 M3 \( w, n7 `: c% e
  51. #define DMA_FN_OUT' X3 Y+ Y) f6 [# X. L# F8 y
  52. #endif
    . s1 f9 D" m  y- D4 g

  53.   X2 _! E  ^3 a, X8 F# B5 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 F) W* [$ S9 s5 k1 U: f
  55. #define STATIC_SHIFT                3
    0 Q  W; N! |8 B8 F* w7 E, r. S& a  E
  56. #define TCINTEN_SHIFT               20- G$ T" {( L) P" @7 o% ]6 x
  57. #define ITCINTEN_SHIFT              21* m7 T3 |/ Y/ {& E# F0 Z; X
  58. #define TCCHEN_SHIFT                224 Q! t. d: J/ v# [9 g% X
  59. #define ITCCHEN_SHIFT               23
    9 U% U) x. w) e$ P) B
  60. 3 G( f3 _4 \' {! i; U) Q' b7 k
  61. static volatile int irqraised1 = 0;
    4 A+ k/ x/ M- F  L4 U, ?/ y
  62. static volatile int irqraised2 = 0;
    4 ]( z' C( Q" u2 X, z
  63. $ s9 a; G: n) z( ^! T% c: q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 r/ l) f) `  t9 s) c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' d  U/ k' U7 G0 Z2 x! C3 m  p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Y+ {/ }! t& F$ W

  67. % v  s5 Y+ t; q( J, s7 ]" h
  68. dma_addr_t dmaphyssrc1 = 0;
    ! |1 |' E; d& ?+ c( i
  69. dma_addr_t dmaphyssrc2 = 0;
    8 P$ y2 D2 @3 M
  70. dma_addr_t dmaphysdest1 = 0;
    2 i8 P' g) i( Y
  71. dma_addr_t dmaphysdest2 = 0;
    8 l5 F# [/ B1 s0 s# S
  72. ; N7 C0 J+ {) F4 K( ~2 T/ U* E& j7 k
  73. char *dmabufsrc1 = NULL;0 g5 z& N8 c( Z3 `
  74. char *dmabufsrc2 = NULL;
    2 t" g, B3 Y0 D! I6 i6 f
  75. char *dmabufdest1 = NULL;9 E; y& Z2 D3 Q( l4 [( m0 P: z" N
  76. char *dmabufdest2 = NULL;2 t; G" y( v; T, z% V
  77. & \9 N9 r; \5 f) g" X" u
  78. static int acnt = 512;
    , I3 m2 A+ N# t4 x; U8 B! m2 _/ c
  79. static int bcnt = 8;0 Z) }" i' u9 y! ^% }. P2 g
  80. static int ccnt = 8;
    ! |5 K( ]6 z( _6 V& Y6 [
  81. $ C# V; @+ I9 f
  82. module_param(acnt, int, S_IRUGO);) B4 v0 x/ F# z$ X# ]
  83. module_param(bcnt, int, S_IRUGO);
    2 O  g# i1 R2 p3 B& R5 Q( ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! G  I" q4 X9 X* k5 b

( |8 c+ K5 \4 F( p! I  X6 [5 K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 L  ^6 ~- n8 L' W+ n. n+ Narm-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 U- w% b; L0 ]9 s4 e+ v1 R$ n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- n, A6 u% x$ ~& ?: @' Q7 B+ `+ N# \+ h" X

6 k! L! R" K6 b' b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-23 06:04 , Processed in 0.039668 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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