OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 ~. K6 j1 w9 Q+ l! R1 P; Z
  1. [code]EDMA sample test application0 e# s7 j3 H  P
  2. /*
      W" f, O& X1 O2 T- }
  3. * edma_test.c7 t8 v2 f% f* h7 O! d  r0 k
  4. *' q0 @: G4 D, X
  5. * brief  EDMA3 Test Application
    , |/ H+ O3 U- i! o6 r- \" [; G# J
  6. *# I" _1 P. Y/ x; F
  7. *   This file contains EDMA3 Test code.
    , S7 U1 o( G' l. [7 A' M, h
  8. *
    $ g! @( ^3 Q, A; R' W  }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 \! ]9 q& j4 O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      A6 ?6 G0 A% Y$ Y" @- P  f
  11. *         TO CHANGE.& j* N; b) g6 O5 e9 d6 t: v
  12. *4 }% |/ T1 L2 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; K* I2 W- _1 q2 Q! L
  14. *+ ^/ J8 r" }" l9 i# L
  15. * This program is free software; you can redistribute it and/or. J( g% M+ k3 G
  16. * modify it under the terms of the GNU General Public License as
    7 r7 d$ `& V2 f* n1 T
  17. * published by the Free Software Foundation version 2./ P' l( T- I# e% P( U$ j  ^
  18. *( V; g0 j$ T) k# t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # p& ?3 `- n! D1 ~% n
  20. * kind, whether express or implied; without even the implied warranty) w! I9 }& B$ r' a4 g: H! S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' b* N* J5 c; }* c9 V% Z7 R: g4 f
  22. * GNU General Public License for more details.3 M3 I* n1 L9 P% {6 D
  23. *// J2 K' r/ T1 J. D; [) \  F4 u

  24. % x+ D0 m% E% S: G; T+ b" H1 k% ]
  25. #include <linux/module.h>: Q4 K" X9 E& x& n1 R2 t
  26. #include <linux/init.h>% ^0 ^' T' r4 K. J( X% _
  27. #include <linux/errno.h>* i3 {# w+ {! c' u7 O5 |$ ~7 }
  28. #include <linux/types.h>2 e; ?; ?. Y1 @9 l) ]
  29. #include <linux/interrupt.h>* c  a  ~0 v. f
  30. #include <asm/io.h>1 ~& q$ T. Y4 a- `
  31. #include <linux/moduleparam.h>
    5 o+ }$ e7 v- O2 M9 o  o
  32. #include <linux/sysctl.h>
    % [/ @) ^/ V( y5 e. G  R3 k
  33. #include <linux/mm.h>
    4 I( `6 O( s& ?4 C/ M3 F
  34. #include <linux/dma-mapping.h>7 [5 X2 G! S0 a2 Q4 d
  35. $ V% q6 K. h/ a5 A7 b- ]; N
  36. #include <mach/memory.h>. \6 l1 Q" R8 W6 Y8 c' Y/ V
  37. #include <mach/hardware.h>! t! K* E8 p, Z! C- d; ~) H- \
  38. #include <mach/irqs.h>! h0 {5 J* y0 i) v# [* i2 w' u
  39. #include <asm/hardware/edma.h>- A6 i/ _9 M6 S( w6 T; c0 b3 f
  40. & Q! o  ~( m9 k2 H
  41. #undef EDMA3_DEBUG- W. v2 o% V+ n1 `0 m: |2 W
  42. /*#define EDMA3_DEBUG*/
    , a! ?. U8 R' h9 L/ y

  43. 0 V9 ?7 y: V" E3 h: H, d" \
  44. #ifdef EDMA3_DEBUG/ L9 e; a0 L% p$ V7 L3 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 ^$ v/ Q; G8 ]0 ~' L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / `- p& D& t0 d) Q/ a/ b! N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( K4 f# H; J# O3 z( F
  48. #else
    / _& F3 h2 G% ?0 N7 F
  49. #define DMA_PRINTK( x... )
    4 v: O: g% X+ C
  50. #define DMA_FN_IN& H/ R7 x( N1 o5 R4 W, a& a. k
  51. #define DMA_FN_OUT
    & A! H3 k! @  S) S
  52. #endif
    , h! E9 g# L) j2 f+ ^
  53. 0 n; g" N6 e4 o; }+ s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 u  Y3 V9 Z1 i3 R+ V! O
  55. #define STATIC_SHIFT                39 H* h( P8 b; O8 h! r
  56. #define TCINTEN_SHIFT               20
    1 j- V1 M% z* T3 x- k+ r
  57. #define ITCINTEN_SHIFT              21/ x4 t% I) A/ R2 O8 s& l- i
  58. #define TCCHEN_SHIFT                22
    " e. g3 f: Y# n  f. D
  59. #define ITCCHEN_SHIFT               23. Q$ n4 V+ |- l3 x5 c- L( V, v+ P" q$ }
  60. ) K$ U8 G2 m2 P& {0 B2 Y0 V, N
  61. static volatile int irqraised1 = 0;
    , Q- r6 \: ?) n) I. p: M
  62. static volatile int irqraised2 = 0;6 P* y: [/ W( N) k
  63. 4 M& J( s: x" B' l" t  ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( m/ |* S1 P) I$ g5 Q! P/ s; b" N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ e% s1 {& {$ J# T" Y6 K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, Y8 v! w0 J. W! _. Y8 t  F

  67. 8 ]: a" c8 N/ [0 B
  68. dma_addr_t dmaphyssrc1 = 0;( t5 P, ~! v$ x6 K
  69. dma_addr_t dmaphyssrc2 = 0;; Y* X- A& U, I3 l6 [
  70. dma_addr_t dmaphysdest1 = 0;5 Y6 r  o4 m: i
  71. dma_addr_t dmaphysdest2 = 0;7 J6 }6 e  |. U* N  P
  72. " {9 z  [1 B/ j0 g$ v: s
  73. char *dmabufsrc1 = NULL;
    ( D1 G9 d# Q3 |& Q8 F0 _* g
  74. char *dmabufsrc2 = NULL;
    $ L/ R+ R! _$ M2 K" v$ Y/ G+ T  o
  75. char *dmabufdest1 = NULL;2 L( ~. F9 }7 y9 M2 u
  76. char *dmabufdest2 = NULL;3 S7 S$ P$ q) `: \% ^- Q1 R

  77. ' Z' C, _$ l7 J0 [( T6 J  H6 _
  78. static int acnt = 512;" B) w3 X: L# g/ ^2 T
  79. static int bcnt = 8;4 I5 j; }$ u( v* [
  80. static int ccnt = 8;9 H! {6 E! f  \4 P9 P& F9 R

  81. 7 D# ], |: c% C3 V+ x# k$ X' v
  82. module_param(acnt, int, S_IRUGO);2 H- F) x0 Z2 j! h) D5 n9 U5 X$ E
  83. module_param(bcnt, int, S_IRUGO);7 f- G4 h- Q7 ]/ X  U, n4 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 f" M1 V  r+ I- ?3 [) x- a: r  Y. Y- U1 k' L  S6 J3 n9 `' d9 E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 ]! Q. {, t% m) `' A% Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( p+ p: v/ R# U1 V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 E2 U1 X7 i- ]' Z
" I5 ?& |+ Q2 Y& u- r: d' m3 E/ `* p9 ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-27 03:18 , Processed in 0.035623 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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