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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 P0 c4 b) }' i; @2 l, B+ U2 X
  1. [code]EDMA sample test application7 q, v" n6 [8 l0 R) w- `
  2. /*4 H1 V( T5 Y8 Z* j, _7 ]
  3. * edma_test.c
    5 M4 R8 a" E; [5 [
  4. *, p1 _, X: H  I: k1 s; ~# E. S6 X
  5. * brief  EDMA3 Test Application4 u* a4 E/ W. a$ F
  6. *- f9 L# z/ W6 H( O$ b
  7. *   This file contains EDMA3 Test code.
    % y& E0 {, i8 T& k
  8. *
    ; v# v" s- ~6 k3 Z* N' n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! Q2 C) a8 |% |1 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! d5 e; s, E9 N4 \. a! p, t- e
  11. *         TO CHANGE.% w: l' `: `9 z# A/ ^
  12. *
    6 }  [7 }$ Q, k+ w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 M9 ^: Y# W' u. E$ g* w5 a6 o
  14. *
    . l6 Q/ Q4 Q$ F3 V% U3 o/ l
  15. * This program is free software; you can redistribute it and/or) P8 e4 Y* J4 H0 [+ ?# s
  16. * modify it under the terms of the GNU General Public License as
    4 q/ {1 `5 D$ U7 m8 Z' G
  17. * published by the Free Software Foundation version 2.
    % ]" d7 _4 @) e4 G5 M4 R' Q
  18. ** ]' M- |! E% L& A. y1 X7 U* M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      j" j. }# o+ u- F$ W# d
  20. * kind, whether express or implied; without even the implied warranty6 o* |( o- P9 c: Y  M8 s! Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 O* k( l- N1 o4 O' Q. H5 t( W
  22. * GNU General Public License for more details.
    / ]$ m7 e% l* R2 B& d* G/ c
  23. */
    ( |! y+ {* y* t4 h# M; G8 ]  k

  24. + h$ R7 t9 t" r2 N
  25. #include <linux/module.h>
    ! a% s: u! N8 a8 q1 F$ X
  26. #include <linux/init.h>
    ' q+ a5 T0 u9 B/ t& j
  27. #include <linux/errno.h>' u0 }2 V$ A5 q4 k
  28. #include <linux/types.h>
    ; s8 g! Y/ K. ^2 q
  29. #include <linux/interrupt.h>
    1 `4 R* B( r$ S6 ~( A  O
  30. #include <asm/io.h># Z" g( h" p8 T! D) _, W
  31. #include <linux/moduleparam.h>" _& x4 J9 n1 v( y+ v
  32. #include <linux/sysctl.h>
    ( ^7 ^. P, m' t9 T
  33. #include <linux/mm.h>
    . _, U' o4 D6 t' U) u
  34. #include <linux/dma-mapping.h>3 L% {6 U2 A# M

  35.   q0 I/ r3 Z% |2 K% R
  36. #include <mach/memory.h>
    ; B; F! s0 e0 S
  37. #include <mach/hardware.h>
    0 ?' R& ?8 Z( s
  38. #include <mach/irqs.h>
    / H( p" X2 g  m7 u4 _
  39. #include <asm/hardware/edma.h>7 r! }$ h) |) t( O( s; z; Q
  40. # `( v" L# f. Q8 n
  41. #undef EDMA3_DEBUG
    - A7 l7 k& O) b7 f  N) d6 R9 c0 I
  42. /*#define EDMA3_DEBUG*/
    2 u% w: f& c  N. n1 {  i3 @8 b* f, X2 P
  43. 1 f7 B/ i* }) A( B' D
  44. #ifdef EDMA3_DEBUG
    4 G5 I/ Q' o. T+ l8 t/ ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 X4 K8 W9 w# y: [: w5 z8 t. K4 Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . j  Q- c1 J& w# Z" X0 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" E  L( P# P) L2 C& D
  48. #else
    7 [. O# y# Q# D
  49. #define DMA_PRINTK( x... )
    7 a6 l) ]/ W0 c" _7 O6 j7 E, Z
  50. #define DMA_FN_IN
    2 b* d" q. U, `4 @# {
  51. #define DMA_FN_OUT
    8 X: N4 A3 x2 Z. A/ J! I2 G
  52. #endif' |. H3 E% {6 q1 g3 t/ ]
  53. " A9 p8 c" r: ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ {3 e6 a0 u) b9 r
  55. #define STATIC_SHIFT                39 d( p' o* f- n( P5 J6 O: D
  56. #define TCINTEN_SHIFT               20
    4 K% ?2 J9 Q' \* h8 d2 P$ g
  57. #define ITCINTEN_SHIFT              21: a! P0 {# t3 G
  58. #define TCCHEN_SHIFT                22
    * p$ u3 a& C& [% E5 Z2 z
  59. #define ITCCHEN_SHIFT               23  X7 L; P) w0 K

  60. % V7 J0 L2 E0 P+ N# I
  61. static volatile int irqraised1 = 0;  E! l: V* k4 m( M$ M/ j
  62. static volatile int irqraised2 = 0;8 q4 @) P. m0 M. S% X

  63. ' N3 E7 p- b! h- e( J9 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, h& k, u6 O- D9 g" c4 {2 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) O2 Q1 F* h! `" ~2 G6 ]5 ?) v% y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* e  ]( s4 y7 ~7 `1 P) x
  67. 6 m) w* Y( A; ?0 G# Z5 K
  68. dma_addr_t dmaphyssrc1 = 0;* {$ R! y3 l! }6 B
  69. dma_addr_t dmaphyssrc2 = 0;) |$ e/ l; U" S5 M
  70. dma_addr_t dmaphysdest1 = 0;% \' H" h' X& J3 x' @* e
  71. dma_addr_t dmaphysdest2 = 0;; z3 Q- f' y: [8 I5 [1 D$ x

  72. 5 |$ }  ^8 A: q* V) d$ N4 J# ~" G" k' G
  73. char *dmabufsrc1 = NULL;. M4 r/ X$ V  @' l( L
  74. char *dmabufsrc2 = NULL;
    1 z9 T3 [! Q' P" b
  75. char *dmabufdest1 = NULL;$ d- ~  a: Q, `
  76. char *dmabufdest2 = NULL;
    . J: w# s5 B0 @5 D% a, `0 G
  77. / r; g; Z7 o  _% P, m- Y0 V8 z5 y) |
  78. static int acnt = 512;
    / g6 @" q$ X( u8 M6 V  p2 e3 b
  79. static int bcnt = 8;
    0 f6 Z" w& `6 J  E2 M' N
  80. static int ccnt = 8;
    * @$ t* l8 ^& L4 j3 [% O
  81. ) G1 G# T- c& K0 i' v
  82. module_param(acnt, int, S_IRUGO);
    6 T$ S8 L) y8 s: J/ L( R, I, x# S  ^
  83. module_param(bcnt, int, S_IRUGO);
    ; o3 T: y; a) b! [6 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ c( a* _8 E3 q% f3 O8 Y$ H% ^

9 z- O. X, P$ {/ e2 `" Y- f      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( ~; {5 q, m4 R# O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  p" T, X/ O/ R/ ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 G" F2 w8 {3 r, i9 x) h1 u- y. W0 F/ O! @) C+ ^# V. R

6 N* a0 }  A" X% ?7 B- ~1 F- C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-22 13:39 , Processed in 0.042219 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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