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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! `) ^9 G) q& C) B
  1. [code]EDMA sample test application5 u( C! r- R' [2 q5 P* g  h$ T
  2. /*
    - z$ N! e$ @6 L8 r
  3. * edma_test.c
    8 z- w5 U- z" y5 H9 o0 ~4 u' I
  4. *
    # T1 H2 M7 k5 A2 q. c7 q5 {8 ]
  5. * brief  EDMA3 Test Application
    : ^9 N2 C( {. I% R# _
  6. *
    5 i( k- f9 [2 l& i* s
  7. *   This file contains EDMA3 Test code.
    : [' S& \# r7 t2 N6 Y. v
  8. *& v4 ]# S' f* Z* e! ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( k" a+ t! @; e% i- `0 O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & N5 Z. {2 c. c( z6 e* p, J
  11. *         TO CHANGE.
    ) {( e7 @/ f  @- @
  12. *% u1 |  ]5 p+ V0 B  C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* h7 X5 v6 i9 U! y) ~5 l
  14. *
    6 B1 O7 q% h0 W; D5 Z' w
  15. * This program is free software; you can redistribute it and/or7 V0 H4 N- ^( z5 i
  16. * modify it under the terms of the GNU General Public License as, U' J) h$ T% y# W7 L4 A
  17. * published by the Free Software Foundation version 2.! r& Q$ O2 u2 M- }# D
  18. *$ u+ E3 f% C! P' @! z8 v8 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 f3 ~- ^2 d4 ]& q0 ^7 z# ?
  20. * kind, whether express or implied; without even the implied warranty( c3 m8 n- ~) }! `& r; q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" z/ r& w# Q2 j! ~4 |5 k+ B9 V7 Q0 ^
  22. * GNU General Public License for more details., K0 s% P: T9 i* G( {+ v' `
  23. */
    9 v% u% l3 Q) W, N+ V
  24. " w! t/ v( C6 t( I
  25. #include <linux/module.h>
    * |0 l9 v: n) s
  26. #include <linux/init.h>  x3 z% H, v7 y( _$ u# u8 |* o
  27. #include <linux/errno.h>7 ~0 z. U: T, X6 r" J6 x
  28. #include <linux/types.h>/ b, U; x4 }/ A# m  h" U4 n
  29. #include <linux/interrupt.h># `! l- H2 V& u+ p) L3 R
  30. #include <asm/io.h>
    . L, ~, n" N/ @1 a: ~) P0 |
  31. #include <linux/moduleparam.h>. d/ }! O4 g! v: k. e( C+ h: X9 K
  32. #include <linux/sysctl.h>
      J9 |  l* p9 i/ a8 o/ O/ n6 D& [
  33. #include <linux/mm.h>
    : h0 a9 ~& P3 ~* G$ @3 X. a
  34. #include <linux/dma-mapping.h>
    3 y6 ]+ Z$ ~* D$ v

  35.   v: H. C8 K2 |$ ~
  36. #include <mach/memory.h>' F5 t0 e' m3 H' p+ z
  37. #include <mach/hardware.h># r7 Z% u/ X( `: r# m' c+ I
  38. #include <mach/irqs.h>2 N- W+ M. F$ b, m/ B
  39. #include <asm/hardware/edma.h>
    5 ]3 v9 ^5 p" c! I+ f

  40. ' \% y' w/ T7 ]! d
  41. #undef EDMA3_DEBUG1 |" z( M/ T% h
  42. /*#define EDMA3_DEBUG*/
    2 k, R( B4 \- N2 \7 \9 S0 l
  43. - t3 Y7 F! _( Y0 _) p1 D& q
  44. #ifdef EDMA3_DEBUG2 E4 L2 z! T% P) X; [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 ?; r; ]" w  q2 g% v: p) _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & P1 D5 p7 p& ?9 s' E! C- Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 J: r; }' ]$ r
  48. #else% l" z! D/ _+ z2 C* @! q0 G
  49. #define DMA_PRINTK( x... )
    - V# C$ V& x. }- k! O
  50. #define DMA_FN_IN4 C; a: ]/ \& K, A+ _' l9 C
  51. #define DMA_FN_OUT7 T# l1 R7 F. @7 U
  52. #endif1 t* D. l* ~* l! f! F# M+ W$ Q
  53. $ A. N" ^) g) [( T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . r+ i- {  D9 [7 d$ @! A
  55. #define STATIC_SHIFT                3; J& d/ ]6 F8 R3 K" a
  56. #define TCINTEN_SHIFT               20( \! y2 _3 z9 z' C. Q2 e6 F
  57. #define ITCINTEN_SHIFT              217 J% ]7 A( z; q
  58. #define TCCHEN_SHIFT                22
    5 n+ b' j* e% E0 S4 @) K
  59. #define ITCCHEN_SHIFT               23" E& h3 m! H& a9 _5 i8 e% t
  60. 2 G2 t6 Y8 L" H) D4 m  v
  61. static volatile int irqraised1 = 0;
    6 u' O0 m" U# Q: g4 y; D1 l
  62. static volatile int irqraised2 = 0;6 {2 d9 f3 }4 S/ V" g7 R' X
  63. $ Q( \, O8 D5 d9 D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ R5 L/ C; S. r7 @7 `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 Y2 I; v1 q' T! p# j2 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# N; c1 i3 q  t* K* C, u0 ?

  67. % ?7 Q- k' S3 ~% i
  68. dma_addr_t dmaphyssrc1 = 0;: i$ ]6 G2 l8 c* T, W) L
  69. dma_addr_t dmaphyssrc2 = 0;& H" {3 U' I1 v5 O% \! E% F
  70. dma_addr_t dmaphysdest1 = 0;% T' Z6 w4 Q7 P( a! g! H
  71. dma_addr_t dmaphysdest2 = 0;
    ' ~" A9 c7 E8 A$ R9 w

  72. 8 ]2 w$ I. h, e% F
  73. char *dmabufsrc1 = NULL;7 a/ F; i; A& |7 f
  74. char *dmabufsrc2 = NULL;; I9 e% f/ R  g9 q2 e6 {6 [
  75. char *dmabufdest1 = NULL;' T' T4 V1 F  c* x6 n' `; [6 C+ d
  76. char *dmabufdest2 = NULL;
    ( r" ]& \; A! }5 i

  77. ; ^2 d9 ^. Z9 B' R" d9 s4 z1 e
  78. static int acnt = 512;* |+ @& j! N, `6 c! I1 ~0 g% U8 `
  79. static int bcnt = 8;
    7 h: S, `4 G7 Z2 _
  80. static int ccnt = 8;5 T( V3 T5 ?0 H+ J- D
  81. 1 x: g/ `4 i; _! s4 S6 z
  82. module_param(acnt, int, S_IRUGO);. f3 q. Y7 x$ F" W& s
  83. module_param(bcnt, int, S_IRUGO);
    + }$ L. ]. U( n5 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 J' N, l1 G7 n% q$ L
4 q# q& S2 [% T7 K. g, c6 y5 @5 X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, H/ `, F+ B$ Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  t# S- r% }, x. B! r3 B  @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" Z& G% R6 @1 M" y. h; p
4 V1 g5 \; C3 U4 M$ t* s& g

$ o+ g, ~. B6 b) p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-21 22:27 , Processed in 0.040561 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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