OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , T5 @- A7 e( k0 v6 h, Z
  1. [code]EDMA sample test application8 P7 o: l. ?' C! `. e8 z2 d! x
  2. /*! u& d+ T. r) f- M& W# ?' W
  3. * edma_test.c) y: R- {. S+ O. R; u$ F/ R
  4. *
    8 F: n2 F: `  V0 H. E; x
  5. * brief  EDMA3 Test Application. n+ s. z# ^* y" m. K
  6. *
    & K# r1 Y8 g! L1 k, P6 I4 H
  7. *   This file contains EDMA3 Test code.
    / \# X% `( n3 Q- k8 n2 _
  8. *
    ' _, G  b4 u/ D. V9 x: W/ m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # Y6 s' ?* ^+ m# P* A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& s; R/ U& D9 {  [9 z/ e& q
  11. *         TO CHANGE.
    1 J& x3 M) Z  v6 T  U
  12. *8 z' i8 v5 R' C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 L* U$ h: F% G7 A7 ]5 {7 {
  14. *
    . H# N" g! }2 T% a
  15. * This program is free software; you can redistribute it and/or2 z4 C: |& k# I4 b5 y" ~, m2 W  ~
  16. * modify it under the terms of the GNU General Public License as
    " I+ v5 u) y, W
  17. * published by the Free Software Foundation version 2.
    - i( H5 A# \: d$ _& M* o
  18. *# N" W# v0 X7 K  [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" o; n2 I; [; L# [+ V- F, K) p
  20. * kind, whether express or implied; without even the implied warranty5 [9 ^; |0 L, p; k+ a7 A% h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 `2 s. D0 s8 t6 ]1 p, b
  22. * GNU General Public License for more details.
    9 C7 r( K* R( O, V: O8 r/ G5 g; F
  23. */3 V5 e1 u8 H+ r, I% D9 b* i

  24. $ ~8 k0 T. o" W3 \2 T0 G
  25. #include <linux/module.h>  O8 E( @1 }6 e! c9 [3 j
  26. #include <linux/init.h>, {. a  ?* H% ?) E6 l% ^9 K
  27. #include <linux/errno.h>( F2 R. i: X& j% }5 T0 k& L
  28. #include <linux/types.h>" p6 D# @6 S9 I. n
  29. #include <linux/interrupt.h>& y) E& i8 i$ K: ~3 x# @; q/ X# S4 W
  30. #include <asm/io.h>
    + |& J/ e# F8 q$ Q0 p* P& z
  31. #include <linux/moduleparam.h>+ E0 v% @$ I& Y7 v4 i9 f
  32. #include <linux/sysctl.h>/ s& P2 N. Z6 \) Z5 l- s4 e3 }  @
  33. #include <linux/mm.h>; I3 [% A( x0 c) N6 v+ j0 w  c
  34. #include <linux/dma-mapping.h>
    . y* r& ~; n, j

  35. * i: G: q$ A2 X" I' c2 I9 O' ^
  36. #include <mach/memory.h>' w! q/ i: v% M0 u5 j
  37. #include <mach/hardware.h>
    1 r; i* v1 f% V. T; x
  38. #include <mach/irqs.h>
      H) j5 Q" P) o' Z* t
  39. #include <asm/hardware/edma.h>
    ; A0 n! ?, F  B/ ^9 A/ ?
  40. + S( X- ?8 d, W  H
  41. #undef EDMA3_DEBUG! P% v  }7 `, U2 {
  42. /*#define EDMA3_DEBUG*/
      h! l% K- a( A
  43. * t6 i. n2 `, _2 E7 D5 }1 M- P
  44. #ifdef EDMA3_DEBUG$ X# }1 V- j0 \& B% B7 {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 [3 S4 b0 v# ]! a% e9 e* P' [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , O# O2 W( k( }2 e+ N6 o; j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 \7 Y7 b9 ^! m$ O* a. t
  48. #else
    " s- R: x5 \8 H2 K- M+ @1 }5 N
  49. #define DMA_PRINTK( x... )
    & D+ z% R. C- M) R8 ?/ b' i* h
  50. #define DMA_FN_IN; E# p9 L9 ~; ?4 b
  51. #define DMA_FN_OUT
      m5 H" @% z$ H0 X
  52. #endif
    . `# Q( M% `8 P# V* w/ C9 S" u

  53. 7 D* G% C5 j- L! g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * c( H$ W3 E2 ?/ ^! l% W
  55. #define STATIC_SHIFT                3( @6 H/ L$ e$ C2 J5 @* f
  56. #define TCINTEN_SHIFT               20& D7 E+ D! X4 V/ o+ j2 E6 o5 h
  57. #define ITCINTEN_SHIFT              21
    1 L2 f. f* K6 t$ i/ v
  58. #define TCCHEN_SHIFT                223 Q" B" o7 s7 d9 T. Q  ?
  59. #define ITCCHEN_SHIFT               23; p' B( Q- [7 N

  60. # o* e8 t4 s0 }/ z$ f: Q
  61. static volatile int irqraised1 = 0;
    2 I$ |! s, F5 T5 I/ J& f  n4 E
  62. static volatile int irqraised2 = 0;
    3 w% s% Z8 \% S) [" Z
  63. ( c5 l- ]+ Q( C7 G& s2 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 w* o& U5 l, m/ r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' \" p# S; ]/ V+ m5 f" c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 A  C" W4 q9 K
  67. 6 M9 O1 d# s/ v1 {$ ~% R- L' ]
  68. dma_addr_t dmaphyssrc1 = 0;+ i6 b1 e* z1 u  ~
  69. dma_addr_t dmaphyssrc2 = 0;
    " e4 W) P( t9 j* ~' G3 O" v$ d
  70. dma_addr_t dmaphysdest1 = 0;9 x( ]* ^7 }7 `9 R, ~# I
  71. dma_addr_t dmaphysdest2 = 0;0 ]2 G8 Y& f4 _! J2 i# t

  72. ) C5 h2 d1 A5 h8 n) s" P
  73. char *dmabufsrc1 = NULL;! x) B! s  K* ?5 r  a: B  K; ~
  74. char *dmabufsrc2 = NULL;/ _& N/ F  ~. @3 f; n9 o& h
  75. char *dmabufdest1 = NULL;
    ( P" [7 S' v6 g# |. B' Z6 ^
  76. char *dmabufdest2 = NULL;; |# F9 \; |* A
  77. " `  t7 }; O7 J* k5 v6 A$ s; B$ k
  78. static int acnt = 512;) S3 k7 Y/ P. V9 i% L5 p
  79. static int bcnt = 8;
    7 l2 Q9 D, n5 x: ?8 k$ F9 @
  80. static int ccnt = 8;
    & a- x4 H( l- E

  81.   a& ^- M" i# f2 t7 `( k5 ]
  82. module_param(acnt, int, S_IRUGO);
    0 W2 j5 ?3 G5 N9 ~, o
  83. module_param(bcnt, int, S_IRUGO);$ ~( P1 v1 O9 {+ i( Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 W9 b9 I! S! X' r
& D' {, F. q  i% x" S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' d  n# I4 n# {, S5 Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) Y% j1 J1 E9 k2 K. ]& L+ P6 R# n) I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 C0 _: U. |  O: G7 y/ w+ R

& ~8 d: a3 Z2 k+ l% g8 H- N. Q% T, [0 Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-12 03:38 , Processed in 0.043817 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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