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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. a8 V! u' ~" x/ a
  1. [code]EDMA sample test application( _1 N9 J3 i2 K
  2. /*
    0 E  S) i0 o- d  n
  3. * edma_test.c
    $ \8 x* P: h$ P
  4. *1 ^) L- g7 u: u
  5. * brief  EDMA3 Test Application
    5 Y& H. b6 W) ]6 k6 U; {9 A
  6. *6 D" Z3 I: J) m( F0 |, Y. J8 b
  7. *   This file contains EDMA3 Test code.' h; |3 r$ V. N3 l# ~! M
  8. *
    $ L, E8 [. {3 c  ?) U' ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 _( U: J) s3 j0 O6 T9 _# r  |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, \6 f# p- f# K4 d
  11. *         TO CHANGE.
    # w. F8 s3 J/ {9 H
  12. *) {! X2 ~; |$ G- Y6 E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      w6 j' k: J8 L0 R' A4 X9 {$ \
  14. *& k! s4 J5 a3 E7 i# k3 W! g& d
  15. * This program is free software; you can redistribute it and/or
    + B; [" G5 r% I
  16. * modify it under the terms of the GNU General Public License as
    : g8 G0 _5 p* m2 U0 E4 d
  17. * published by the Free Software Foundation version 2./ q( i6 j: f# [- |( H7 R8 s# k
  18. *
    , g4 a6 x9 _3 e4 O+ G/ `( I- I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 A; I1 `2 q- V4 T9 |
  20. * kind, whether express or implied; without even the implied warranty8 g. h5 \$ t0 s6 Z6 K% x* K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! U7 a: i6 y  r/ Y
  22. * GNU General Public License for more details.9 g: K, e5 o/ o3 C6 s7 B  m6 x
  23. */3 @# M4 b* l  X) |# h! k' M/ e

  24. $ ^9 A0 g' o9 C
  25. #include <linux/module.h>- T  O" H' K& s9 p" c* n) T* ?5 L
  26. #include <linux/init.h># B2 ]7 o% @5 j
  27. #include <linux/errno.h>- A2 F; S" L% P. Z4 e
  28. #include <linux/types.h>
      V4 f8 a2 \. n4 G* m; Y% G# \1 w- P
  29. #include <linux/interrupt.h># a- U4 c% v2 f9 R/ @3 O+ L( x7 {
  30. #include <asm/io.h>
    ) G7 [2 l  g  U3 o
  31. #include <linux/moduleparam.h>
    / T7 K$ o: I* M& Q* j
  32. #include <linux/sysctl.h>& K1 p7 v% J. {
  33. #include <linux/mm.h>
    6 D1 k) T4 I' {) V9 M
  34. #include <linux/dma-mapping.h>
    # M/ h3 w! L! t1 [9 Y$ y2 Q8 o
  35. 7 z3 a9 N' k( k% p# R2 X9 W% Z
  36. #include <mach/memory.h>
    % E1 ^* h2 R) G, ?
  37. #include <mach/hardware.h>
    $ A8 b, |+ n2 {$ O- A7 H7 p
  38. #include <mach/irqs.h>
    / f2 R& t: e$ z, h$ g: y9 O
  39. #include <asm/hardware/edma.h>
    % z2 h: o. ^6 G. v2 i$ O! F8 R. s

  40. / X3 ], Z' m6 ^; {
  41. #undef EDMA3_DEBUG
    6 z+ N% c! u  R7 [( @7 r4 |2 K7 c
  42. /*#define EDMA3_DEBUG*/
    ! U: `5 ^" A6 d4 |# @5 N) s( s
  43. : @" @9 m5 t$ q* r3 V4 y
  44. #ifdef EDMA3_DEBUG, u8 U6 j8 e' C+ [" y+ D7 v; h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      N. h! {$ W. {' c" u# e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & S! i8 G, s$ b, S; I$ }- p. V/ H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' N( J  ~' r: }- j$ M& i
  48. #else& u* h+ O9 `) T% U7 ^  _
  49. #define DMA_PRINTK( x... )
    ) w8 J& `4 d; ]7 `$ Q- ~
  50. #define DMA_FN_IN7 G, k) ?- t+ O) k3 x- Q. U
  51. #define DMA_FN_OUT( [2 k4 i. l& J. y# A
  52. #endif
    . X8 I! g2 f3 ?# i; C. B2 g5 E- j
  53. 5 V# d; t+ l/ a. x, f: [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 x: Y7 F/ G3 Q
  55. #define STATIC_SHIFT                3
    5 U1 D9 A% S! v
  56. #define TCINTEN_SHIFT               20
    - r8 M: E* C% `- o6 l* y
  57. #define ITCINTEN_SHIFT              21
    1 S, T4 l$ X' b- r* T  \
  58. #define TCCHEN_SHIFT                22
    ( _$ C9 r7 J' |
  59. #define ITCCHEN_SHIFT               23
    + c) q* {& ], [2 t

  60. 3 R5 M. U! Q' S) [- H
  61. static volatile int irqraised1 = 0;) v; d' E  V: m+ X9 ^
  62. static volatile int irqraised2 = 0;! t! E# v* T, }% R$ @' k! G

  63. 7 [# Z# ^6 A6 ?0 Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + Y& `+ N4 K: ]$ u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 {/ f8 s: d4 ^/ q# {- q1 {7 p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ T: N9 @) Z2 b) b& M% @6 ?8 Q. y
  67. , D( [* h% V. C( B" f
  68. dma_addr_t dmaphyssrc1 = 0;+ l; s8 D; j8 E% K2 `& B8 C
  69. dma_addr_t dmaphyssrc2 = 0;7 Y& I9 |2 I% E
  70. dma_addr_t dmaphysdest1 = 0;
    5 a. p9 C/ T9 {- \
  71. dma_addr_t dmaphysdest2 = 0;
    $ }# z3 _) Z0 U4 ^

  72. $ \3 Q8 F1 Y, o' r
  73. char *dmabufsrc1 = NULL;
    ) x/ r' _6 C" N. d
  74. char *dmabufsrc2 = NULL;
    & K) m# U* p0 z3 t/ ?8 s
  75. char *dmabufdest1 = NULL;
    ) G: S/ x2 _4 ?5 ^8 \$ b
  76. char *dmabufdest2 = NULL;  B! L- j0 p& |1 Q
  77. + t' g8 Q1 I7 ^/ W# w
  78. static int acnt = 512;7 ]7 }  w- w+ x$ s* N
  79. static int bcnt = 8;
    ( |* E# o/ r7 Y9 M- S
  80. static int ccnt = 8;: L2 `; z$ A% |8 p' x8 B

  81. ! y! B; \, ?0 R; F# U% Y: a$ p
  82. module_param(acnt, int, S_IRUGO);
    6 s: D7 ^' o$ I$ \8 b7 k  F
  83. module_param(bcnt, int, S_IRUGO);
    5 J5 w8 b+ Z* P6 G9 F, _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; E7 h+ U  u! M8 H% p" J$ g8 ~
% W9 g) P8 q! }) }1 a" o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& b& l: h# O' X1 P; n8 L* m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  P2 N, K# X  R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 m  E& X. i1 c/ e

/ ]6 C, S9 u, I" S2 j. {. p  B- @, O3 Y* x; M9 L7 o. u: w* `# }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 02:46 , Processed in 0.041156 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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