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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# M9 C. e( o6 p' D7 `. E2 a
  1. [code]EDMA sample test application, G; |% b1 {+ i; V" O
  2. /*
    # P6 [+ a  V/ G
  3. * edma_test.c6 m8 b8 W3 E9 [9 p1 x
  4. *
    ( v1 _% c0 M9 G* V! q! [6 b
  5. * brief  EDMA3 Test Application' z1 Q6 H7 {2 o5 D
  6. *
    - T* }/ E" f- F- }0 B; Q
  7. *   This file contains EDMA3 Test code.) X& z- g& U, n& `0 j" r, G+ O! T
  8. *
    * N8 ~6 y$ `+ o$ ~' r7 \& a9 F/ J) k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. q5 k# A& h) g! G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 H# F7 }  @3 f0 q6 y
  11. *         TO CHANGE.5 f# j2 ?3 V& Z3 w0 l
  12. ** S# w! q8 k. M. u8 ]  t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , Z, f6 s/ _, {* @
  14. *
    : ~5 v2 l, o* q. j2 e
  15. * This program is free software; you can redistribute it and/or
    & o, c6 `7 g* h' z0 v; [
  16. * modify it under the terms of the GNU General Public License as
    ' c) m9 Q" a# f, N7 E
  17. * published by the Free Software Foundation version 2.) x' \. v& Y: X% N
  18. *. G7 W: A  ^3 a2 S( x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 B, E$ U5 Z0 C
  20. * kind, whether express or implied; without even the implied warranty0 H! u( u/ {4 \' @5 _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ s8 T8 a2 q) y% H9 c9 z/ |
  22. * GNU General Public License for more details.
    : a3 @5 e) s' b9 y& j$ H
  23. */. l, [" D/ H& a( Z1 _

  24. $ t$ x* t; q3 i+ s  _; P
  25. #include <linux/module.h>) }8 l3 O1 q( M- Q
  26. #include <linux/init.h>
    3 S/ p* L6 a  p# D1 ?
  27. #include <linux/errno.h>
    / H* \5 t) n" V0 t& o
  28. #include <linux/types.h>" ]1 R; w4 H, N- h8 F) [
  29. #include <linux/interrupt.h>( a. [( v- `% Z& D" x. d
  30. #include <asm/io.h>
    ) e+ c" E# u- r6 T7 ^- R
  31. #include <linux/moduleparam.h>
    8 X3 k8 [, Z# I6 f3 }
  32. #include <linux/sysctl.h>
    ' K6 d1 j! z+ e0 Y2 |% V
  33. #include <linux/mm.h>  M! N& A* A/ Z( n* H6 p, X- Y
  34. #include <linux/dma-mapping.h>
    2 \' K+ @/ n1 l) x: @/ t
  35. 0 Z, s, U! e4 `7 N( N
  36. #include <mach/memory.h>
    , w7 H. h+ m+ T  H2 A8 d
  37. #include <mach/hardware.h>
    $ O  h$ b  t9 m. e0 H
  38. #include <mach/irqs.h>  l1 S! R8 i& i8 i
  39. #include <asm/hardware/edma.h>& R# {9 ?4 l" _3 X

  40. , g8 i! S" c$ k1 q+ d# H& B
  41. #undef EDMA3_DEBUG
    6 L9 [1 {& D1 |- |- K. v% z6 a
  42. /*#define EDMA3_DEBUG*/* S; d6 Y9 L: s' t

  43. + B' C  U7 y& g8 z( g/ p
  44. #ifdef EDMA3_DEBUG* H1 d& a! c& N& b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . M( g6 G) r4 T; h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* }) B! e# u, f* e. y# h/ ^# O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + p) o- W4 f+ \. U: A
  48. #else
      ~9 x7 u; t+ D' }
  49. #define DMA_PRINTK( x... ): L% u+ A7 z% p) U$ P+ N- N
  50. #define DMA_FN_IN
    # u/ c: W  v7 H' C9 g
  51. #define DMA_FN_OUT5 G8 W& H; x/ w" y1 R
  52. #endif, Q7 p2 v- h0 o; Z! F, I
  53. 0 k$ h- X) S9 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( b: a8 \3 V7 V4 g
  55. #define STATIC_SHIFT                3: i6 P4 M2 q4 o- C; y
  56. #define TCINTEN_SHIFT               20
    ; |' K: G. N# e% I
  57. #define ITCINTEN_SHIFT              21- |2 k- @+ E8 x
  58. #define TCCHEN_SHIFT                226 J+ d4 P* m/ h* }$ N! g2 k
  59. #define ITCCHEN_SHIFT               232 L7 U4 e0 W# r* X8 J7 S% B) Z' G+ s

  60. ; N6 Q9 \) |) d
  61. static volatile int irqraised1 = 0;
    4 l( C- J9 ?: S' N/ L7 |
  62. static volatile int irqraised2 = 0;
    , B1 C: v+ |6 V
  63. , E' G) K/ U& d3 p) s; L9 `) @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 B, k' y4 w# R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: Q8 K# `/ l2 Q* i4 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( T' P5 @1 U' y! S. G  K
  67. # U: p9 Y& S6 p$ M  r+ e' j2 @
  68. dma_addr_t dmaphyssrc1 = 0;
    3 R! a& \  Q( Z& l! X
  69. dma_addr_t dmaphyssrc2 = 0;8 J, M/ n4 T. Y
  70. dma_addr_t dmaphysdest1 = 0;1 K; P0 f- a+ [; R
  71. dma_addr_t dmaphysdest2 = 0;3 P! r& `3 ~- x' j* t+ h% R
  72. 8 d  h+ \0 b4 u. v: ^& [
  73. char *dmabufsrc1 = NULL;
    ) \7 ~. Q4 K1 v# ~; b6 U
  74. char *dmabufsrc2 = NULL;
    4 v% i2 |+ }0 F1 y: w% e
  75. char *dmabufdest1 = NULL;
    1 {0 d/ n  \( e- Y, |
  76. char *dmabufdest2 = NULL;1 u( z. e  U0 `$ w

  77. ! J1 U! E: P6 E4 s' |& Z
  78. static int acnt = 512;
    " E, z& Q  ~4 _- D# l
  79. static int bcnt = 8;/ o  P  e/ w% ?" Q" G, @
  80. static int ccnt = 8;! q! J# I& L+ h8 n9 s1 g( C

  81. $ J5 \, [& M5 P; E8 D
  82. module_param(acnt, int, S_IRUGO);
    + j% l# b: F# g, d& ~7 V9 v8 ~: ^
  83. module_param(bcnt, int, S_IRUGO);
    & P' c% i& e& Z, _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ y9 q/ b4 X! O8 f$ u+ x

/ o5 z. a2 A# G( S/ E* o5 R4 N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& R! @: v! C# @. K  |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 A3 l7 ^% R: e+ ~7 S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! B0 ~9 d. G" l' [6 m

1 ?8 u$ D4 J' B2 v/ P+ ^1 `
6 K) j: @2 }7 R  U4 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-21 03:53 , Processed in 0.041237 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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