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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & p' X1 f4 @( x- Y# g, O
  1. [code]EDMA sample test application
    6 n/ W" x4 y/ g; V: _0 k
  2. /*6 i3 }8 Y. C1 a4 g
  3. * edma_test.c
    ; K1 M4 Q& S+ G- U) }
  4. *
    6 l8 o5 h2 J1 i2 H. C8 S8 o: P
  5. * brief  EDMA3 Test Application; ]) m7 k( N# l7 D, m
  6. *9 h* E$ r4 S% F% G, S0 S& `5 u
  7. *   This file contains EDMA3 Test code.. n' T$ Q& ^0 T* ]0 x4 i) s
  8. *
    " T6 F. w6 G# O* X" e) P( C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ m# I# ~! a+ L5 w7 K! h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! Q3 q2 N: s% E' B9 I* d
  11. *         TO CHANGE.
    # ^* K4 b' C8 {& T- q' s4 B
  12. *; y% ~, Z# Z; }  T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 f' Z* r2 K5 E9 r' ~1 }
  14. *( o- g6 h2 k0 s8 G9 W$ |! _
  15. * This program is free software; you can redistribute it and/or
    9 F2 o4 d) A  @! V$ x( q3 o/ A
  16. * modify it under the terms of the GNU General Public License as- h+ T# {; ?) H* O' z4 O5 g
  17. * published by the Free Software Foundation version 2.
    # L1 c- C' x7 O/ _, o9 [+ G
  18. *
    4 t2 j9 i& q6 Y/ n2 y3 t( s: Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 ?9 M, R  N1 U0 j5 l0 N2 G
  20. * kind, whether express or implied; without even the implied warranty
    4 Y+ X" _9 B/ {9 \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 m! M$ S, q( N# \" [
  22. * GNU General Public License for more details.1 E4 A3 U" e8 S) I8 @/ g2 O  n# R
  23. */% H; C/ K5 R( k& [; a% S3 g+ m
  24. ' E( ~) K3 I  o5 M9 V; z
  25. #include <linux/module.h># @' i3 R) U: P$ C8 _: A
  26. #include <linux/init.h>4 R  S+ @4 ?# l  ?0 }
  27. #include <linux/errno.h>
    6 ^5 [( H* I, W  [2 i
  28. #include <linux/types.h>
    5 I5 e3 {5 P6 d0 z! p' H
  29. #include <linux/interrupt.h>8 n( Z' w1 u' F% O
  30. #include <asm/io.h>' W" {: C+ c; p; S& B6 E6 h5 {
  31. #include <linux/moduleparam.h>
    - }3 q! }1 O1 o$ t( y
  32. #include <linux/sysctl.h>
    : A: [2 \7 `$ O3 l) {' x. Z( {
  33. #include <linux/mm.h>7 B, h1 U9 K/ e! i9 U: G6 \
  34. #include <linux/dma-mapping.h>/ L% T( f' H3 Q/ @3 ]  [- W
  35. ' `! d: ^2 t. O7 v+ f
  36. #include <mach/memory.h>
    . i5 ~3 ^1 C: ~# F& Y
  37. #include <mach/hardware.h>% S9 @4 O' x- j  r
  38. #include <mach/irqs.h>
    ' A  p0 Z) k4 |" E$ u; s
  39. #include <asm/hardware/edma.h>- @# A& L! f9 t: D! Y5 J+ C0 j  a9 ]
  40. & f4 S6 R+ b3 ]/ i' y
  41. #undef EDMA3_DEBUG; H& L; p* q9 p" c/ B$ L8 J; V
  42. /*#define EDMA3_DEBUG*/5 \' O  O9 t- G+ z+ p$ M& }' S; c

  43. ) k& ~# t# Z! c+ d3 C; q8 i, i
  44. #ifdef EDMA3_DEBUG
    : k& u4 {1 O3 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) N' B$ M# D; Y  l- W7 U2 S, A7 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); }5 }8 h" F' |* j3 v2 x5 Q/ [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 _; n; `% E+ k2 k, x% t1 _2 P
  48. #else1 ^, A% Q7 N+ d# r
  49. #define DMA_PRINTK( x... )
    ! \2 x2 M) J( f3 ~
  50. #define DMA_FN_IN
    : m$ U9 H: z# C: v6 M  M
  51. #define DMA_FN_OUT' z* `! A! {: ]5 w
  52. #endif
    ! A3 |; b/ R# H$ J8 R6 j7 j  @6 x
  53. 0 l) z. c/ M, x' ]( S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 _/ m6 G9 C: k" [. `% l
  55. #define STATIC_SHIFT                3
    ; B% z5 Y* I9 s- ~
  56. #define TCINTEN_SHIFT               20: G1 R: r4 D' t; i" g% }) \- z, z, `* O
  57. #define ITCINTEN_SHIFT              21
    ! l4 @2 _. ~9 u
  58. #define TCCHEN_SHIFT                22
    % S/ i" O0 k* f. T$ C5 Q7 c( [0 {
  59. #define ITCCHEN_SHIFT               23$ \& k, i* e& C# B
  60. - L( l/ x# `5 P* z( W" M. g
  61. static volatile int irqraised1 = 0;; m/ o/ N* h" n7 O
  62. static volatile int irqraised2 = 0;
    8 V; ?0 I0 ~  l4 F& n

  63. 4 \0 f; m% ]% s/ {* N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 J. Z7 A: ~/ c4 d2 |& W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , ~! @2 a8 N4 u8 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 {- ~4 v3 M$ h" i! S
  67. 2 ?+ b# z1 c- U1 k/ W
  68. dma_addr_t dmaphyssrc1 = 0;, y$ D5 _) X7 Z" v- _+ R
  69. dma_addr_t dmaphyssrc2 = 0;
    0 ]; \8 b) W1 Y; Z+ L7 N/ Z# _8 [
  70. dma_addr_t dmaphysdest1 = 0;& e2 F& i6 U6 d3 {( f/ E
  71. dma_addr_t dmaphysdest2 = 0;& y: l8 x4 y/ }% T9 G2 `* d1 V

  72. % k9 M3 I; C8 M* v5 n
  73. char *dmabufsrc1 = NULL;6 z5 l0 h  @5 A. x
  74. char *dmabufsrc2 = NULL;' ]% [+ G2 ?5 M  m6 y9 }7 B3 i
  75. char *dmabufdest1 = NULL;9 ?$ H- {+ N8 v/ S$ o
  76. char *dmabufdest2 = NULL;
    9 h# [- V1 o' _
  77. 1 J) D. J0 R( R, U
  78. static int acnt = 512;
    0 |" r# I1 Y8 [1 j' z6 E
  79. static int bcnt = 8;
    3 c) A! V2 Z7 A
  80. static int ccnt = 8;
    # \1 t( ~6 \" T/ V% J# S; R

  81. - ?0 y8 F0 W4 f; v
  82. module_param(acnt, int, S_IRUGO);7 ~' p* ?1 V) _
  83. module_param(bcnt, int, S_IRUGO);( B( [" I! ]1 u; J5 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 q- f8 ?0 V2 L, u

3 T! z3 j7 K. }2 h& w) P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. l6 U& V/ S/ g  \8 F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" H0 n& S' L( A- W- H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. o4 S% \9 b( u% n
% u" T# |' ]. J2 e% E" w; @# Q
3 U  p8 P0 Y/ n4 o1 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-26 13:37 , Processed in 0.037554 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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