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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : V6 r: \& C* G' D) w# \3 S+ h
  1. [code]EDMA sample test application
    2 t1 V. |3 U( n0 |2 Y
  2. /*) k6 s" g% o% p: V8 X
  3. * edma_test.c$ ]# ?' L1 Q2 P0 Q$ F
  4. *% F+ }) V3 F% c' I2 ~/ b" n
  5. * brief  EDMA3 Test Application+ Q6 b. u  N9 C* r4 Y
  6. *
    - C/ b% E# i" _( z" w$ t# ?. D
  7. *   This file contains EDMA3 Test code.- c# _) S( m$ b4 Y0 S4 Q- i5 Z( u
  8. *- o5 i8 ^6 g5 j. S, }+ C8 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + `8 n9 a% h" e7 Y" C% i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. E4 f( N9 {& {! w& a& W' c
  11. *         TO CHANGE.
    " M7 Z5 H2 t9 ?3 i" {5 e" _3 T5 Y
  12. *
    7 l* L9 n' t0 T3 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) N) ?) K) s* U9 H  V
  14. *
    ! w; I* [+ z( f
  15. * This program is free software; you can redistribute it and/or* e. E/ W$ {! s1 P$ z1 ~3 m
  16. * modify it under the terms of the GNU General Public License as& s, m% d5 |; c5 I  s
  17. * published by the Free Software Foundation version 2.
    ! q: h2 }" _4 N) q- D9 s
  18. *
    , I% Z/ |$ R- P+ _" V8 x1 p( V' o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; I/ c# v2 h5 Z! P5 V! a  N2 l" o
  20. * kind, whether express or implied; without even the implied warranty  m+ [/ _; L7 f0 z* e9 ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 y7 Z4 Y& o) r9 M" p0 }; X" m
  22. * GNU General Public License for more details.$ T( c* N; ]; \; I9 @: B/ u
  23. */
    7 ?# @( G3 h) Q! T( g" o; Q
  24. 2 N  h' [6 u! i  o  y4 v# J, E
  25. #include <linux/module.h>
    7 l6 F; C: d7 V( Q1 B
  26. #include <linux/init.h>0 `4 I, y& R. ?- {; R
  27. #include <linux/errno.h>3 Z) T3 x! O- D: {
  28. #include <linux/types.h>8 U2 e5 M0 s& T$ v$ {2 I1 h
  29. #include <linux/interrupt.h>+ z# U' i( T: U9 i4 _  F. r- w
  30. #include <asm/io.h>2 `# Y! o7 v- B
  31. #include <linux/moduleparam.h>, V4 G; k+ T: D5 V7 m
  32. #include <linux/sysctl.h>0 b/ J2 n# k, Q/ \% Y- `
  33. #include <linux/mm.h>
    $ @- G$ t" r8 T. H1 ]
  34. #include <linux/dma-mapping.h>
    " E4 z" Z2 F; h6 g' M# I
  35. / }4 M+ o" N/ T* \7 z
  36. #include <mach/memory.h>$ D  q# W- V* g; C4 v4 J0 L3 T
  37. #include <mach/hardware.h>
    & i, Q6 L6 l  ~3 N# O( f. [2 k
  38. #include <mach/irqs.h>- q( k. ?4 O( G. M' d. C9 j0 _& d5 J
  39. #include <asm/hardware/edma.h>
    . ]' s3 b) d9 k8 N
  40. - F8 ], p, R1 r+ {
  41. #undef EDMA3_DEBUG- n) @2 |5 P, V/ s8 ^. R3 G9 i
  42. /*#define EDMA3_DEBUG*/6 l) h8 P  j9 y! J  F' L

  43. 8 U8 a! F* w3 G6 ^7 R; b
  44. #ifdef EDMA3_DEBUG
    : b0 p) Z$ X- o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 g) t3 G( ~; T4 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 C9 b2 Y3 c, G% W4 w+ m. [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 ~3 }$ i& w, X: \6 H* J1 s
  48. #else" S" B3 ^2 {  t1 k9 F0 Z6 S
  49. #define DMA_PRINTK( x... )& b7 t9 F% n  b# P
  50. #define DMA_FN_IN
    # z, v' f8 s( K* G% D  P7 z7 K
  51. #define DMA_FN_OUT+ S7 ]# Y1 }* x( }' @; ^! L
  52. #endif: N6 x" n$ \& T& K2 \
  53. ( {( K- \0 ~! X( P$ Z3 t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 s2 D4 U, U; u- P5 {5 C
  55. #define STATIC_SHIFT                3  a/ V* O( Y+ q* P4 A# W
  56. #define TCINTEN_SHIFT               20& e: V$ }& V' B8 s% I4 v
  57. #define ITCINTEN_SHIFT              21/ h  N: j, O3 Q  \* U# z8 e
  58. #define TCCHEN_SHIFT                22
    ' G6 ~- L5 ]1 w# \
  59. #define ITCCHEN_SHIFT               23
    % J7 l& ^( t8 D+ k  [7 {3 i
  60. $ n8 `- o; u" |) \  B# K- H' Y4 J
  61. static volatile int irqraised1 = 0;# |, E% E3 u, X* w
  62. static volatile int irqraised2 = 0;0 D# |8 ~6 X+ o- |+ }/ s( E

  63. 1 F( p) L  g& {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 B7 ^; P  B* x3 e: O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # G8 j; |/ }5 ^7 U0 O) O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Z2 n/ z7 v6 E
  67. : v% b+ g% P. `9 F7 ]3 |# y
  68. dma_addr_t dmaphyssrc1 = 0;
    7 ?/ L7 ?( a  x+ B- q$ V$ w, O1 E, q6 {
  69. dma_addr_t dmaphyssrc2 = 0;
    6 m3 j' O) I3 s+ Y/ ]6 [* r
  70. dma_addr_t dmaphysdest1 = 0;
    3 T# b& {* t& [: j
  71. dma_addr_t dmaphysdest2 = 0;
    3 G6 f4 |2 ]% v  o

  72. ) l; ?8 r+ ^& r% z/ y
  73. char *dmabufsrc1 = NULL;' J8 @. R& ]- o8 u: h' O) J
  74. char *dmabufsrc2 = NULL;
    2 m2 W* g6 s: B+ H, m
  75. char *dmabufdest1 = NULL;
    3 U4 _. _4 W- o) R$ I" `
  76. char *dmabufdest2 = NULL;* @/ C  I  C. V7 L
  77. 9 C) P+ h  u3 v% t) {
  78. static int acnt = 512;
    2 L0 x" [- J* s' p/ p7 b
  79. static int bcnt = 8;# c6 `% @1 i* y4 N1 K
  80. static int ccnt = 8;& c. }: v7 Q0 v0 C$ d

  81. 4 `* A) L' g6 I& W* p' r# P
  82. module_param(acnt, int, S_IRUGO);: }/ t+ }$ M- M  @6 ^& s# @
  83. module_param(bcnt, int, S_IRUGO);
    8 X1 k6 f8 _  O6 |
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 [* V  S5 z* S$ }5 I6 t& o/ U! ^- }) |. ^! d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" c4 B, H( p6 K1 G; b" j- {5 r! Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 F$ p) D; K4 B5 t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# o2 Z: u$ d" x# Q" F! Q: l3 K4 F
3 P6 F" Q( e- w5 \, T( \' d* |1 l! T8 I$ k, h" K  P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 06:09 , Processed in 0.040383 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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