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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * W; `7 f% Y! J3 w: r2 ~" X
  1. [code]EDMA sample test application
    ( V- ?! f6 j$ D. C0 D: u) V* j/ H0 a
  2. /*
    ( W5 O* L, r  ^" J( X  n/ N
  3. * edma_test.c. M, D+ ]& g1 U
  4. *
    , p3 X0 x* O5 V) B/ x; a+ b
  5. * brief  EDMA3 Test Application2 A! S) T: j8 r. `+ r
  6. *; q. h! F. n$ x9 O) q
  7. *   This file contains EDMA3 Test code.* ~# i# @* g1 J" X: p
  8. *8 z7 M- K+ @. v6 |2 h4 _% Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " I! h  y" e$ E7 u' u8 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * }- K$ t0 w; D; ~
  11. *         TO CHANGE.5 ?% ~  N  J" e8 e$ B" x( O
  12. *
    ( W$ V+ k* L2 P: i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " r; L/ X' Z7 y" _2 ?* u
  14. *
    5 N9 C. |  w# D0 W( D# U
  15. * This program is free software; you can redistribute it and/or$ P8 c' w, ]# k
  16. * modify it under the terms of the GNU General Public License as
    * g& @* \/ g- @+ U
  17. * published by the Free Software Foundation version 2.. G. M9 \2 E- j6 q. X3 W- x/ s  U
  18. *
    - h  `. \# Q2 x& H4 O: X0 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 k( ]. p0 C- _. e
  20. * kind, whether express or implied; without even the implied warranty0 b" s9 x6 h/ c/ J' k( o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; Y8 @7 Q6 q- T7 z
  22. * GNU General Public License for more details.9 ~0 j/ K- P3 D" x* Y
  23. */( H, _$ a6 {% [
  24. ; j' \# Y! h- `* r
  25. #include <linux/module.h>/ N6 K7 M: n& A. v
  26. #include <linux/init.h># S. {1 y$ p6 o
  27. #include <linux/errno.h>
    4 r/ v: F8 U  |; h0 [8 F! O+ a
  28. #include <linux/types.h>
      Z4 B( Y6 l! z$ e4 W
  29. #include <linux/interrupt.h>
    1 d( Q* i% N* p  j( u4 ^7 }# b
  30. #include <asm/io.h>
    % j% v) i9 t& e- U- L
  31. #include <linux/moduleparam.h>. ]' r0 O# w4 l5 O
  32. #include <linux/sysctl.h>
    0 h; ?1 C0 b* J8 q$ J& Z3 g/ {
  33. #include <linux/mm.h>
    + ~: A1 g/ H) a/ R  m
  34. #include <linux/dma-mapping.h>* f" {" H# `+ Z3 J' Y3 ^$ ~1 {3 x8 d

  35. / P8 H7 ^% \& S! z7 L$ q8 W. B
  36. #include <mach/memory.h>
    , K7 d9 a: o# B4 {
  37. #include <mach/hardware.h>; J5 M- u( I: G4 Y4 g6 t
  38. #include <mach/irqs.h>; F  r# p0 W- Z5 ^* I2 y  j5 s' d# K
  39. #include <asm/hardware/edma.h>4 f. }' O6 F( i5 m% r6 y1 f8 J* F; x* @5 r

  40. 2 O/ W$ b& i, n9 c
  41. #undef EDMA3_DEBUG
    ! v9 o! X2 }6 h  L, e6 h; n
  42. /*#define EDMA3_DEBUG*/
    3 C, f: ~) f- K; z5 I

  43. 2 y* h# R* H, l$ T! p7 [" T
  44. #ifdef EDMA3_DEBUG8 D* Y1 M: Z3 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + J% F8 P( V: L9 R9 F0 }( Q, D$ a3 E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 r$ u/ r) |) D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # N( a' I! u& S
  48. #else
    ! |# U' `+ w6 x- M+ `
  49. #define DMA_PRINTK( x... ): R4 o9 _" c9 X) d* E
  50. #define DMA_FN_IN
    0 D& K- o) E" ~0 B" b. ^
  51. #define DMA_FN_OUT' o( C/ @( B  D; C+ C9 u$ O. I
  52. #endif( O- D$ r! b8 U& P& E  k, Y. v
  53. 2 S( u7 u7 e6 C5 t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). p9 P8 I9 N  r. h* {4 _- Q  b0 O
  55. #define STATIC_SHIFT                3
    9 l) g, v6 o4 U, G/ [! u/ |9 F
  56. #define TCINTEN_SHIFT               20
    9 o/ l; m& ]: s
  57. #define ITCINTEN_SHIFT              21
    / t  p# A: e) ?5 w- A
  58. #define TCCHEN_SHIFT                22
    0 h" E( B! @* y$ M7 w
  59. #define ITCCHEN_SHIFT               23
    , b* ]0 }4 x) j0 Q# V1 k
  60. % Z# `( U: V$ ?5 \$ Q
  61. static volatile int irqraised1 = 0;' V- K, W5 Z/ U$ w9 v1 W
  62. static volatile int irqraised2 = 0;
    - k, o. B. u: S/ p

  63. 4 n, F/ |" u( d( ?) z. w) A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 m$ A, T6 g- R# _9 Y* z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) D" D( N* {% u: w! o6 P8 J" e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; n9 K& \% U4 m; J7 P) I3 F
  67. $ E# y$ P9 L1 K" _7 H. N
  68. dma_addr_t dmaphyssrc1 = 0;
    : R/ B) J0 P9 b+ i0 W
  69. dma_addr_t dmaphyssrc2 = 0;
    + p6 Q- q: V5 T$ m2 q* k. H) I
  70. dma_addr_t dmaphysdest1 = 0;1 Q; i! V' n8 }2 ^
  71. dma_addr_t dmaphysdest2 = 0;9 V! M1 f4 a& x

  72. % ]7 m2 g, t4 m, o: b
  73. char *dmabufsrc1 = NULL;7 T' Q: Z& s% _- q
  74. char *dmabufsrc2 = NULL;8 V( Z7 `$ V1 Z/ K# A2 c
  75. char *dmabufdest1 = NULL;& I9 o  c# B3 N. \1 x' \
  76. char *dmabufdest2 = NULL;
    1 R" S2 x/ H7 d. ^/ U& u  b6 _5 l

  77. 0 J0 C: M$ E$ U
  78. static int acnt = 512;' ^: {# d# l3 M! |9 J# Q% H1 O" G- h
  79. static int bcnt = 8;! A) z. v8 E1 [% o; \) i1 l: _
  80. static int ccnt = 8;# p: E0 N1 J5 p) i/ d# T  ]( k
  81. 5 K. Z5 j: a8 D4 y; Q% [
  82. module_param(acnt, int, S_IRUGO);
    " S. k0 H' _8 g' k: Y+ X  N: e
  83. module_param(bcnt, int, S_IRUGO);
    / j# ]6 T# C1 P7 A- \$ V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 o; v4 s0 W* w2 @7 A9 J( c
# ]4 M( _# x  y- B* E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ o# t( i' A- k$ X. W( b0 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# U* P0 {( O- j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 h* ~/ Y: |8 [3 J1 Z" D
) o; S) R8 P2 H
0 R9 d3 _1 |& W9 K" H& M, `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-16 11:27 , Processed in 0.038600 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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