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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 ~9 \) M" _0 e
  1. [code]EDMA sample test application
    2 }  r0 m9 h. f6 ~1 I3 X: F
  2. /*
      F( o$ D' r& ]! @" a6 E
  3. * edma_test.c# U0 E% {" H4 [7 M
  4. ** x5 x& v5 M: F- _/ }+ K
  5. * brief  EDMA3 Test Application
    : o5 H9 M+ M/ [1 }7 N8 f4 R( t
  6. *
    & A* l7 m; Z# `, P7 i$ e
  7. *   This file contains EDMA3 Test code.
    * T( y4 P" I( U, z: K
  8. *- _- h0 K$ ~# c% J1 m0 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# k6 g+ _. O; _! V" p9 c" W0 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 [2 g% m+ F$ W+ L$ z6 [- `2 g+ l9 N
  11. *         TO CHANGE.
    / `& G" h6 t% L& r: L$ ~4 _. U6 w
  12. *$ p( z# [' \! r9 X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / [  u4 {$ T7 ]7 v* E% c
  14. *
    2 i# L4 t$ }8 |6 {' ~6 p2 S2 Y
  15. * This program is free software; you can redistribute it and/or
    ; B( D' Z6 ?- e# a+ z
  16. * modify it under the terms of the GNU General Public License as1 r* c! @$ _+ K) H( n6 p; f; T# S% q, B
  17. * published by the Free Software Foundation version 2.
    , P; s7 X: ~/ M8 _
  18. *
      o2 f0 X4 F1 g+ m5 {& _7 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' Y! b* v7 F% g1 W& a! ?
  20. * kind, whether express or implied; without even the implied warranty4 V4 n$ ~1 s- X9 f9 J' x' ^, }: a/ Y5 h9 S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 U, @4 q9 [1 C* [$ B
  22. * GNU General Public License for more details.
    & @7 d+ ^- C5 [! R- e" k* ^+ d
  23. */
    ; k/ l8 D# c- F/ }

  24. ; i2 O. }% `' g" O
  25. #include <linux/module.h>" r7 Q6 |0 v/ M# i
  26. #include <linux/init.h>, W" e  K' ^7 u/ N. A8 E7 {6 m
  27. #include <linux/errno.h>/ W3 F' }) k3 l5 j
  28. #include <linux/types.h>2 l3 z( r. U/ @1 R$ N; c& L
  29. #include <linux/interrupt.h>
    " G* D6 v' d! e+ Z3 Y
  30. #include <asm/io.h>
    + e- T. u0 q, N7 w/ q
  31. #include <linux/moduleparam.h>
    ' K! Q* b' v6 Y: H. I9 `0 _
  32. #include <linux/sysctl.h>: I$ g4 b5 g3 C* H+ f
  33. #include <linux/mm.h>
    1 I8 a* ?  m" ~2 I' W" E8 [3 k
  34. #include <linux/dma-mapping.h>
    $ L( \0 ^& X1 L0 g! u6 i

  35. ) [- T+ x2 [, f& Q0 w
  36. #include <mach/memory.h>! M* U6 T6 M* @+ O4 x8 d
  37. #include <mach/hardware.h>' R" t. P$ {7 }3 w9 D- i8 N
  38. #include <mach/irqs.h>* U( b; K, j2 y0 V& J
  39. #include <asm/hardware/edma.h>) o( o3 v" I: \! r

  40. , g* U  A; K) t" E
  41. #undef EDMA3_DEBUG
    0 R. `( m$ W% d4 u8 B
  42. /*#define EDMA3_DEBUG*/! k8 _% i% J3 w3 h8 U

  43. 6 f) d0 j- @2 g3 }3 ^
  44. #ifdef EDMA3_DEBUG
    1 R6 s! r7 V( \! D$ }. Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), k3 w* q1 Z; d# A. L! j6 n1 U, J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 s, Q! a; i, O+ S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 b9 b% c5 A/ v* ]0 x: K
  48. #else
    6 J+ f' |9 y, V/ C0 C
  49. #define DMA_PRINTK( x... )
    , j/ V$ s9 A- Y
  50. #define DMA_FN_IN, C( g# a# x  Y2 z
  51. #define DMA_FN_OUT% q: B' j; ^# a9 s
  52. #endif* j6 A9 u  g  d% A5 f
  53. ( c( U# ?* z4 `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " _; O. g% Y: j& V9 G
  55. #define STATIC_SHIFT                3  Y; G* q, a* [
  56. #define TCINTEN_SHIFT               20
    ( |# u" K8 K0 h1 n4 C
  57. #define ITCINTEN_SHIFT              21) e8 J( M$ q4 c* j
  58. #define TCCHEN_SHIFT                22
    % u5 h9 |$ W2 c
  59. #define ITCCHEN_SHIFT               230 M- l% Q' ^# Z" _; R/ V

  60. / j4 ]2 v% E, ~# E& @
  61. static volatile int irqraised1 = 0;
    8 N) }- Q4 ~! K- I" ?5 q1 @6 e
  62. static volatile int irqraised2 = 0;
    ) Q  v5 c! h+ W: D2 n- D. v/ Q' A+ b

  63. 5 i. F$ L; C& L$ q' a& ?( B; [/ B+ v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 o6 y) L- a% f. d# d! D; l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( n0 _6 ?% W+ y5 a2 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 F5 T5 [0 x) Y* n# D: K& S
  67. ) p1 l# Y9 {" {9 X
  68. dma_addr_t dmaphyssrc1 = 0;
    ! _4 l+ W+ Z8 z
  69. dma_addr_t dmaphyssrc2 = 0;# H) L8 g/ f4 _& O) c7 n; h  Y
  70. dma_addr_t dmaphysdest1 = 0;' S; `9 _: L  U2 |: x& x, {
  71. dma_addr_t dmaphysdest2 = 0;
    % _  h- q- [4 X4 Z/ C! \* m2 g6 ?" J
  72. 3 ~& P6 p8 ]' v3 a: t( L! `9 G9 V
  73. char *dmabufsrc1 = NULL;; \$ Z& t1 M2 A$ e0 r0 m+ ?
  74. char *dmabufsrc2 = NULL;
    ( ?2 q2 L' b4 L6 n
  75. char *dmabufdest1 = NULL;1 i& e: H6 C( O+ y
  76. char *dmabufdest2 = NULL;
    ) A  R0 U# b9 Z. Z- ~
  77. ! F( Z/ K9 }( [  R7 Z/ S
  78. static int acnt = 512;
      N: E  C2 Y7 s- O# @
  79. static int bcnt = 8;8 L  I; `) O8 }4 U+ D# U) @
  80. static int ccnt = 8;
    - [8 @6 {1 B& p% P. a' g
  81. 8 g) R0 U: o7 }; M6 a2 I. r
  82. module_param(acnt, int, S_IRUGO);
    1 J1 v0 S7 o& u
  83. module_param(bcnt, int, S_IRUGO);$ m- v% L9 ^" G( P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 D8 r" S6 s5 a. A- e
# _0 S( |! {+ a5 M$ O- V, M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& b" _/ R8 T5 _) h( L! o$ t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ X3 p* ~$ t$ X, v$ b5 e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 F8 K. d. m( Z/ L0 S& \  R3 C2 H$ g6 o
7 U4 X: w- {1 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 17:43 , Processed in 0.045920 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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