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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) Q5 s$ w8 I4 d( {& w: T* ?; O
  1. [code]EDMA sample test application9 h6 ~# L" @, d: p, b( L
  2. /*
    / u* `; J: O2 y# b. N
  3. * edma_test.c
    3 y: ~$ r  L- I2 w% I" H7 _9 K! Y
  4. *
    7 S2 I0 M$ w1 E5 e$ n3 ]
  5. * brief  EDMA3 Test Application9 `, \1 ?3 W) T: L/ D' S4 i, O8 t
  6. *
    , s& U& z. d0 B- `6 }6 x, f: R
  7. *   This file contains EDMA3 Test code.0 d: q3 g, m! n
  8. *
    & B& @/ `' f3 D, G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* }# ?" R: f; r$ W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 |. ^3 x# Z7 A' d1 Z1 H! o7 W
  11. *         TO CHANGE.
    7 h. v5 G- L/ Q
  12. *
    ) W" H1 f% U/ y1 D, Y( ~3 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 E, I- ?1 B" q4 q5 R
  14. *
    * {! Z" J; m/ w2 y4 x/ G& ^
  15. * This program is free software; you can redistribute it and/or
    . e6 s9 H% I: t( r4 t& y4 ~1 N
  16. * modify it under the terms of the GNU General Public License as4 |2 w7 K" Q, Z/ c
  17. * published by the Free Software Foundation version 2.
    + M/ \) @& w6 S
  18. *0 n# x$ O2 E# a0 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 z, O2 a- t0 N- j
  20. * kind, whether express or implied; without even the implied warranty% E- y' U) v5 Y+ {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) ~- b) i: h1 p- a+ i6 `
  22. * GNU General Public License for more details.+ Q/ H7 m7 J' q8 \% T3 d. I
  23. */
    & i: D( {8 z/ ^  @1 y$ u  o& h5 k
  24. # b: o4 `2 `8 S6 f7 j6 _6 {
  25. #include <linux/module.h>4 B. d" W' P$ J( H1 V$ i% U
  26. #include <linux/init.h>
    4 o7 G, h* l2 a7 G( H0 _$ {' Q4 `
  27. #include <linux/errno.h>
    / o  A  a3 B# G6 H6 w; l
  28. #include <linux/types.h>* h( P! k; Y) R
  29. #include <linux/interrupt.h>
    : L5 N) o9 X/ r& Q
  30. #include <asm/io.h>! N1 Z9 a# V  I0 A
  31. #include <linux/moduleparam.h>
    5 f0 F; o  G" S3 r* Z
  32. #include <linux/sysctl.h>3 Y2 n) c; ]0 ]# y4 u7 z
  33. #include <linux/mm.h>
    , S- c& V4 z* `. y$ z) k+ V: b
  34. #include <linux/dma-mapping.h>
    , U# a, I9 ~6 g, \6 c0 v+ ^! {
  35. " _0 A% G( D0 v2 _
  36. #include <mach/memory.h>
    8 u# E( Q6 i5 W2 m* s0 }% e! T9 a! T
  37. #include <mach/hardware.h>
    & t/ m- f/ o7 m( _$ J
  38. #include <mach/irqs.h># s6 V) r" q& ^3 T% n" v* v1 |
  39. #include <asm/hardware/edma.h>: M* L3 E. `) b* B1 y; U
  40. 6 u( b( h- [/ s+ t3 R
  41. #undef EDMA3_DEBUG
    + h: ]$ H& x! _6 `- i: B9 Z3 l+ N: o
  42. /*#define EDMA3_DEBUG*// j) k1 K5 I( n' y! |" K; d' }9 K
  43. 0 d* ?: i3 ^$ f: Z5 W+ N$ E& A
  44. #ifdef EDMA3_DEBUG
    / E/ z' U5 N* @# f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 [' k2 Y5 h- F9 K- w) H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 x& J" j  J- f. L, F7 U; {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & i: F# e5 K; N: T& _+ a( k9 q  t
  48. #else0 J1 Z; {! s+ F  H
  49. #define DMA_PRINTK( x... )
    3 m' ^* p3 u: _2 K2 J) s
  50. #define DMA_FN_IN+ F" w8 l0 n  f8 E
  51. #define DMA_FN_OUT+ g2 |) L; I) d$ j+ s( O
  52. #endif& R2 C& f5 M& E5 k$ \) A
  53. 0 Y& K$ k* U! {9 X. a5 v; Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 C9 y* _% }# p) s3 K5 E: e
  55. #define STATIC_SHIFT                3: ]6 P3 H2 H2 N! [/ H% @# H
  56. #define TCINTEN_SHIFT               20- K" O+ y7 {4 D
  57. #define ITCINTEN_SHIFT              21
    ; D) r0 {) b3 c& M
  58. #define TCCHEN_SHIFT                22
    : S# B- L# d& u7 w0 i* J- D' \
  59. #define ITCCHEN_SHIFT               23
    # N" |0 V7 C) j

  60. 8 z2 c- o8 i7 c
  61. static volatile int irqraised1 = 0;
    - q% D$ U* |) X) U- }
  62. static volatile int irqraised2 = 0;3 @' z' K( b- w  M( C) k, M, x
  63. $ P" k, F+ ^. [' v( d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! {6 d# m& ]! `3 g5 }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 X+ }/ W' b( }# N; o' t9 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + F# T, M& p- V! x5 _( @4 {

  67. 3 I0 j; P0 O- _
  68. dma_addr_t dmaphyssrc1 = 0;
    8 |1 T3 ]$ ]) J4 c% u
  69. dma_addr_t dmaphyssrc2 = 0;
    5 _; p3 N. c5 ~2 A! R! A
  70. dma_addr_t dmaphysdest1 = 0;2 {# W) {7 L: [* D/ N' z, _
  71. dma_addr_t dmaphysdest2 = 0;
    - R; d* C/ N4 \7 o& Q1 I. v: @' @1 E; m
  72. 6 c- |' }$ Q7 z) ]! T
  73. char *dmabufsrc1 = NULL;
    ( c/ Z! I8 K& g$ y0 O5 h* Z; M
  74. char *dmabufsrc2 = NULL;
    . E" k9 ?" P$ E0 C
  75. char *dmabufdest1 = NULL;9 ~8 A7 ?3 `5 n6 ^1 [" k- N
  76. char *dmabufdest2 = NULL;% E! u4 {1 h; \9 a3 I5 }

  77. ' ]; o; R2 L9 C2 o. a
  78. static int acnt = 512;7 k5 a0 M$ N% J$ W' h) J; F
  79. static int bcnt = 8;. b) u$ O& r5 v5 }
  80. static int ccnt = 8;. E# K% w" ~0 s) _* v( L
  81. ) O3 @# i9 B5 [( m% }  z! x
  82. module_param(acnt, int, S_IRUGO);. y8 X; @5 t8 L, _7 y, {- A" {3 N
  83. module_param(bcnt, int, S_IRUGO);
    9 ~/ {( k& {: c% y4 R7 ~& L$ F8 a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ g) a0 z2 e! {' \+ x( _

# w2 N) z+ J. C9 h: F+ c4 l3 ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 N% Q$ t8 d- K# }7 q2 ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( {' ]3 I: ^; U6 [: J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ V' f3 H: B7 V/ b
- l5 K+ @0 d$ Z# }7 d

4 f( N- m9 p+ c2 r0 J& t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 15:54 , Processed in 0.039242 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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