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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , G6 e- `  y9 j9 ?; _
  1. [code]EDMA sample test application
    5 D! x2 O3 a3 Z- a4 m
  2. /*
    4 P. C6 F9 v' m# n
  3. * edma_test.c" p* ~3 U* {$ V
  4. *
    0 W+ c; ?4 z' @" k  O2 A
  5. * brief  EDMA3 Test Application3 d7 X& [/ x- q9 _! \3 d
  6. *
    . Y  F+ f& Z9 E3 a: [9 Y) p
  7. *   This file contains EDMA3 Test code.
    / k5 G$ }$ N; L, c2 e# D/ \2 a
  8. *
    $ ]2 z7 }, k: z/ `2 g" o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) M$ F! A/ a3 s6 t6 C" m. e+ |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 a0 C* Q' b/ L+ P/ A! F
  11. *         TO CHANGE.
    7 `* M+ W% E# f5 `* L. z9 U
  12. *+ E7 f& Z$ |% h4 O+ t: o( p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 b5 X: h# S5 E+ s
  14. *) A" }) v* B; i! }* ]
  15. * This program is free software; you can redistribute it and/or
    9 x& P# X( E; m4 A; F( `; D
  16. * modify it under the terms of the GNU General Public License as
    / }$ x  H0 ^0 [& ~. b% {
  17. * published by the Free Software Foundation version 2.
    7 P  Y2 p$ j$ N3 O% p$ f
  18. *
    4 D! M$ d0 b; ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 x2 C( g5 h! B* D9 L' U+ r. Q
  20. * kind, whether express or implied; without even the implied warranty( W+ r9 v! m3 n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 g$ `9 {0 k) o; K
  22. * GNU General Public License for more details.4 p% u' a$ [9 `0 f* X
  23. */
    3 x+ U  T( i; M9 S3 x
  24. % [* S6 f+ ~4 z% I; ]" b6 l
  25. #include <linux/module.h>
    + _  r, _* G; U0 E8 t( H) d
  26. #include <linux/init.h>( M! ~7 f7 g# p! {7 ?
  27. #include <linux/errno.h>
    6 ~. Q) R2 d" {
  28. #include <linux/types.h>! @4 E; h6 U( Q1 @) L
  29. #include <linux/interrupt.h>- b( Z  ^, e& I9 d* `4 j) m
  30. #include <asm/io.h>' Y3 i% \# K$ r" V( k; Q6 ?9 y
  31. #include <linux/moduleparam.h># N5 i( s' }4 I) E: S9 ]. {
  32. #include <linux/sysctl.h>
    / Z* r7 Z, K' y. c
  33. #include <linux/mm.h>) c3 y# T8 m" k  a
  34. #include <linux/dma-mapping.h>  j; J8 t! W' r' O; y* q+ D3 g
  35. 0 @3 k( P) O4 v  s$ B7 ]. a
  36. #include <mach/memory.h>* i8 r& f5 M: j1 |8 A8 Z
  37. #include <mach/hardware.h>3 r( B/ c! g  V$ P/ T. \) q* a
  38. #include <mach/irqs.h>
    7 u- Y1 f2 F0 x2 u' V
  39. #include <asm/hardware/edma.h>
    . e' U: L$ W/ M  ]* ~9 |

  40. & l0 o$ N, I0 b  r( S1 s& k5 V
  41. #undef EDMA3_DEBUG5 n" T3 X" a$ W! `6 G
  42. /*#define EDMA3_DEBUG*/# W7 Z  |/ V) O3 S( ]! l
  43. & b! W1 m0 S2 B' |$ m
  44. #ifdef EDMA3_DEBUG
    + u* H! g+ r7 D6 U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; z# q" H* q' c. `5 q6 }. @! Z- _4 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 ?) L0 }6 W: E7 Z* `! I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 @) c2 m& z' a* v# ?! C( d
  48. #else
    & N/ G  c) c+ ^) |/ J) C2 L8 X
  49. #define DMA_PRINTK( x... )
    / j6 U; U1 ?! _, ?
  50. #define DMA_FN_IN* n( v! C# n% _8 a! G6 v' j
  51. #define DMA_FN_OUT2 H# J3 r/ V4 `; B5 y% s
  52. #endif
    $ O8 F' Z: i* \  f
  53. 9 ~  Z, \$ J2 e  A+ D7 L# {; R$ G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 {' l, a# l4 s: C- h
  55. #define STATIC_SHIFT                3
    ! m2 ^3 o" w$ y3 U
  56. #define TCINTEN_SHIFT               20* b3 ?4 U- R8 \( H% [; X( G
  57. #define ITCINTEN_SHIFT              21
    " A9 S5 f& `& Z. H5 h3 k
  58. #define TCCHEN_SHIFT                22
    & `; I2 g* N8 f* A
  59. #define ITCCHEN_SHIFT               23. m: x8 J% h' s( r2 p- U$ j
  60. . a% }' E9 P. @% G
  61. static volatile int irqraised1 = 0;1 V" [. R3 p7 p2 x5 Z" c# }: i
  62. static volatile int irqraised2 = 0;/ b# z# z  o( i& ^8 f! P9 Q
  63. 6 q- z. }% a3 H% d& ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ?2 e; n. V; f% M, M! |* P9 E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % M* x- Q1 @  i0 ~6 `+ b; b6 H! F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  H7 o1 T( z/ e* O# t, |
  67. ! D! V; Z. ?2 H' K; B. H5 s
  68. dma_addr_t dmaphyssrc1 = 0;
    & I. J- W* p/ H, b' T
  69. dma_addr_t dmaphyssrc2 = 0;
      o, V0 @: c( J7 K# x
  70. dma_addr_t dmaphysdest1 = 0;
    ; S9 a" G0 S3 P; ^: J) i0 @
  71. dma_addr_t dmaphysdest2 = 0;
    " H* j* T! l0 D0 Y1 y/ B8 n

  72. , p1 [, J7 J( }' @; i# ?  p( f
  73. char *dmabufsrc1 = NULL;
    ; j3 V' O% [* T$ _) X  h3 N/ U4 ^
  74. char *dmabufsrc2 = NULL;( d" j  N: P; ?: u5 t
  75. char *dmabufdest1 = NULL;
    % S+ @1 i/ a1 [
  76. char *dmabufdest2 = NULL;
    . t0 q- \3 D) e$ A6 X. P6 F2 @

  77. ( X4 D& @$ Z4 n$ m/ V' G. o
  78. static int acnt = 512;
    1 \  J) `* a( w! z
  79. static int bcnt = 8;
    9 W+ x' U8 K  D/ g
  80. static int ccnt = 8;
    - O5 m" h( W& a" B8 q) i3 I

  81. , F) D3 @+ c; c. y9 k5 }" `
  82. module_param(acnt, int, S_IRUGO);
    . W5 V3 x6 A3 K, N/ a, m* i
  83. module_param(bcnt, int, S_IRUGO);
    2 z. Z) @" W( m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 c( D' g  N/ T
( z- a( N# Q1 u' U: j: d1 x& b' U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 e) H' [  r" ~2 N' \( [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; n: X' e5 w% m- w) n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! s  U1 i4 b. J8 V
4 K) J  b1 K* u
6 ?/ o/ q9 n; n( h$ H- F. J7 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 09:53 , Processed in 0.040396 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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