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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# M% ]: v5 f9 w* Q. j
  1. [code]EDMA sample test application
    4 y! T+ J3 G# w  e
  2. /*
    1 n- p) X6 S6 ]' r8 q! K5 Y: C, o
  3. * edma_test.c
    7 w! Z# P: s, q1 R+ `# X
  4. *" \) z  P. Z: U$ c
  5. * brief  EDMA3 Test Application
    1 t9 J( g: q( n
  6. *4 K' f+ r; S0 G' P! j( N) n
  7. *   This file contains EDMA3 Test code.- Q8 v7 ^# C- S& K, R
  8. *
    ; @. y. Q( ?& `5 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* v! y$ a5 l6 c& a$ o- [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + {1 Z; i/ J: |
  11. *         TO CHANGE.
    ' I' H4 y0 j; @% _8 D( V& A
  12. *, R- e  ~  v3 i8 ?0 V; s5 t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 T/ s8 Q& }( j6 ]; r, v
  14. *
    % J8 \7 R* }  [7 l0 O- a
  15. * This program is free software; you can redistribute it and/or/ v  ?/ Y, P5 E* A0 c7 D
  16. * modify it under the terms of the GNU General Public License as
    * F/ F% E9 {7 C% i
  17. * published by the Free Software Foundation version 2.
    % p2 _- {' T: I0 d
  18. *
    . O( l% p' |( c6 c- ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 l  W/ `) k* T- C
  20. * kind, whether express or implied; without even the implied warranty
    8 Z/ o8 m: G! U1 i- _' M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, _8 d; r3 u6 T* f4 _
  22. * GNU General Public License for more details.3 n8 ^6 U! m  H! v
  23. */
    6 {/ \3 x8 m5 c' m) o) @

  24. $ {% u/ K$ V# J3 Q' R5 _; E
  25. #include <linux/module.h>
    # |% q* `$ e+ X4 J  q  ]; [: d
  26. #include <linux/init.h>5 U- _9 ]3 V; R+ r' A
  27. #include <linux/errno.h>
    3 {" e* S8 k9 U" l9 W
  28. #include <linux/types.h># q) M/ N- C* s8 ~
  29. #include <linux/interrupt.h>6 a9 P' k; P5 g7 C  U4 V! T% [, L
  30. #include <asm/io.h>. R: G; m% p3 G3 w
  31. #include <linux/moduleparam.h>
    ( e- m- r/ c1 t& ?
  32. #include <linux/sysctl.h>
    % d0 [; b4 C/ h1 l2 y
  33. #include <linux/mm.h>
    $ H0 M; ~. |/ ^9 |; ^" ~. d7 z+ M
  34. #include <linux/dma-mapping.h>9 B, F' h9 ~* n1 |. _

  35. ' B# v) p# `1 E, `) t+ ?  S
  36. #include <mach/memory.h>
    6 }$ ?# {& V2 q; J+ n$ A
  37. #include <mach/hardware.h>4 M! l# N+ d8 c9 e# a; t! R& m: i  W
  38. #include <mach/irqs.h>8 \' t/ t6 L9 y* X% I' ~' d
  39. #include <asm/hardware/edma.h>
    # E4 g: Q! T# T8 o0 g& }9 d
  40.   p- f: p$ ?8 }  g6 o- Y! ~
  41. #undef EDMA3_DEBUG
    2 G$ |; m4 E' L7 z" [& O: h
  42. /*#define EDMA3_DEBUG*/4 P! B& u- J+ }7 I; ^, v

  43. 7 _5 S+ \7 A' E0 p
  44. #ifdef EDMA3_DEBUG0 z+ B3 ^( u) |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ O  \+ X8 X0 N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % J2 Q% H3 W9 s4 `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " c! a# y+ p) y* F7 ~
  48. #else
    / j: j' b# _+ t* v: ^
  49. #define DMA_PRINTK( x... )4 E) [3 Z' G4 Y* N) O" w
  50. #define DMA_FN_IN6 `. T: ~8 \0 H1 [% |' J
  51. #define DMA_FN_OUT
    : C8 j6 d- @) a
  52. #endif1 m. u5 Q5 k& D% W. ]7 U6 Q$ @

  53. % p8 l: K2 ^/ Z) B3 C9 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* l: z/ f0 Z0 O2 z5 I4 M, B
  55. #define STATIC_SHIFT                3
    7 {  I1 H$ H' [. w5 y( f
  56. #define TCINTEN_SHIFT               20
    " N" u4 E% d/ V# x/ X- f9 n
  57. #define ITCINTEN_SHIFT              21
    1 k" J$ Z: r9 ]2 |
  58. #define TCCHEN_SHIFT                22
    , x2 W4 j* ~1 z
  59. #define ITCCHEN_SHIFT               23
    $ D5 D) T- \" r/ v3 h& p1 @

  60. : j4 g3 ]- M  V: _* l( l1 @; V7 M
  61. static volatile int irqraised1 = 0;) N8 t( V5 M! B+ L4 u3 c
  62. static volatile int irqraised2 = 0;
    1 V: O/ d9 Z3 B4 P
  63. 2 t& @% c% R/ y5 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 r$ T7 R9 A& q* |+ [& _5 Z4 E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 G+ J1 Q' Y! e! g$ J0 A* v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      m" o4 v3 L# @. G$ P2 b

  67. 6 r% s0 A5 k, }$ Y- r% w) {
  68. dma_addr_t dmaphyssrc1 = 0;; _) n. l5 k" v
  69. dma_addr_t dmaphyssrc2 = 0;4 A: B: e1 q7 b7 D6 I/ g6 ]! z
  70. dma_addr_t dmaphysdest1 = 0;
    0 E; I% J; C) W' K
  71. dma_addr_t dmaphysdest2 = 0;4 d9 F+ E' [; |7 z6 s% \$ q/ W

  72. 9 c6 N* r6 P! ~+ o: q
  73. char *dmabufsrc1 = NULL;
    9 n; e8 x! O% `6 f  k: |
  74. char *dmabufsrc2 = NULL;: Z/ B# s3 W1 L( K& M" A$ {
  75. char *dmabufdest1 = NULL;
    " D6 x/ X  u1 Z+ t; S
  76. char *dmabufdest2 = NULL;! G( D1 K& l4 V8 E% J3 Z
  77. , U9 I6 J! l* b' `$ U8 V7 y  |" U' x
  78. static int acnt = 512;
    0 `8 O8 {0 [% U  H
  79. static int bcnt = 8;. K+ l: W: J; t/ Y
  80. static int ccnt = 8;7 `2 c  Z' ?# ^. R9 B5 w2 q
  81. , ~/ ~% L- n% M6 t; F
  82. module_param(acnt, int, S_IRUGO);7 e  W+ N( G. v
  83. module_param(bcnt, int, S_IRUGO);& H+ X; R$ u' L; ^) a2 {  [4 y- @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) |* [- K& B6 k: w( P: K
3 W3 u* X& @" G% Z, M2 u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. `" `" W% z9 y; z1 ~* |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, J" R8 {0 L8 w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. z& F2 `4 K7 X! z) U
6 M1 w" ?- A" I9 U8 G1 N/ u( b; ?
0 q# Y/ l6 W4 W' t0 \) u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 08:17 , Processed in 0.058918 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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