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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / x) B  H5 O# C/ Y0 p
  1. [code]EDMA sample test application( C$ J) m& ^. a  T" `4 d9 R
  2. /*
    % o1 N2 S6 O$ V2 B* n
  3. * edma_test.c( @. Z5 }. ^0 }# T+ g
  4. *$ Z& b5 M8 c) V6 [7 j
  5. * brief  EDMA3 Test Application6 }- J3 D3 F3 i5 P% `& _9 o8 c
  6. *
    ) p; j5 P) [! u: Z! H, [
  7. *   This file contains EDMA3 Test code.
    " \1 d: [! ]! V( P* H
  8. *
    # |7 t1 a; v3 s# z$ l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# e. ?) s; l# W. @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! n" |# u8 k- l$ J# a  M
  11. *         TO CHANGE.; F% Z6 W: x$ R" Y
  12. *
    : `' `3 }. Y: J* F& @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " r8 j$ K' n6 m  [
  14. *: P% E; Y# H: [+ J* j1 ~- Y
  15. * This program is free software; you can redistribute it and/or( j- V" ]7 e8 \9 q4 C4 \
  16. * modify it under the terms of the GNU General Public License as8 c% f8 Z6 y0 A/ [- N# I9 ?9 g5 i
  17. * published by the Free Software Foundation version 2.
    1 V. ]" ^8 S8 N" W( O( N: V
  18. */ s7 W- o' o5 _# R# e* P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / U; r3 ?! ]3 N. ~
  20. * kind, whether express or implied; without even the implied warranty
    ! o* D" r( u0 Y; F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # g3 Q4 j. @7 t& K& X
  22. * GNU General Public License for more details.8 j  w) j, v7 z9 ^4 l
  23. */% M) r% ~+ P1 Z) v& y2 M
  24. ; t6 J) o1 A- s& B# S0 k# b
  25. #include <linux/module.h>
    1 ]- X" P' \: x+ c. B1 M# V
  26. #include <linux/init.h># H) B3 _. X2 \1 t- q: G% {
  27. #include <linux/errno.h>9 Q& r' \; Z8 b7 {9 Y0 h: }
  28. #include <linux/types.h>
    % }  N4 V- R4 A" n
  29. #include <linux/interrupt.h>. T7 j; |7 g/ k9 A8 L$ J
  30. #include <asm/io.h>" q# _1 f) c; s; d( R
  31. #include <linux/moduleparam.h>
    / @5 U. p+ Y6 |
  32. #include <linux/sysctl.h>" [) G, F  G# z8 b, F( M/ s) [
  33. #include <linux/mm.h>; t, }& S* X6 A3 p# z$ _7 L
  34. #include <linux/dma-mapping.h>
    2 E# d1 B  {. E8 g, w& m
  35. & }  s  v* i+ x
  36. #include <mach/memory.h>- u+ [& P* K3 ?; c$ k
  37. #include <mach/hardware.h>
      F  N; V( g" u6 f
  38. #include <mach/irqs.h>
    1 F* ?) L1 j) p3 u# Y
  39. #include <asm/hardware/edma.h>: v) y1 M5 T3 g% b, ?% d
  40. 2 c  |8 o9 E) h' D
  41. #undef EDMA3_DEBUG7 `) _; P) [. L6 \" ]9 k* S
  42. /*#define EDMA3_DEBUG*/
    1 x/ v( s. _' o$ |

  43. + R$ I6 y% z2 D  }1 t; @
  44. #ifdef EDMA3_DEBUG
    / h' B! u0 O; Q- a; S7 T* z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 `/ A* t( _* V# K4 j% U* s9 \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 [! W# S: ]! B$ U1 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ T8 e$ u- ]3 U) j
  48. #else
    ) P; q( f0 c; S7 w2 D6 @" F
  49. #define DMA_PRINTK( x... )3 H! x* P2 F7 Q  N4 j2 R
  50. #define DMA_FN_IN
      ?$ L! P) a0 }; W3 T, @
  51. #define DMA_FN_OUT
    / }1 f- n7 Y9 E
  52. #endif4 F1 ~( |2 H5 |2 f2 x; D% ~9 e5 ^

  53. . U- Z0 t* h! q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) [4 r" J. J) U' P$ \! {. C
  55. #define STATIC_SHIFT                3
    ( q; u! z$ I5 i! N( ~
  56. #define TCINTEN_SHIFT               20
    ' j9 c; J4 |" }# {7 |! c, n" W1 |) B
  57. #define ITCINTEN_SHIFT              21
    ; S; V, j$ c/ v7 O1 M, H: U% X2 {
  58. #define TCCHEN_SHIFT                225 G9 @$ L/ H/ N+ r
  59. #define ITCCHEN_SHIFT               23
    8 ]! E. @2 A: b) m2 a
  60. 9 m+ d: {5 _9 Y( T1 o1 x* `4 M6 I
  61. static volatile int irqraised1 = 0;
    , r- V- R8 G. c8 t- r1 e. C+ @2 Z
  62. static volatile int irqraised2 = 0;, I' R( p  d% `5 g- N
  63. 2 z8 g( S* B6 F$ ~, B3 T/ g0 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 c) J' J2 r( h: w7 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- w  j$ S; V2 g+ d: |  F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ~' Y6 n7 L" {6 D$ c
  67. ' {  M& t: r1 w- o4 l1 C$ x3 p5 @
  68. dma_addr_t dmaphyssrc1 = 0;
    / ~3 |7 G: M. r  ~3 g% n: B& r. `
  69. dma_addr_t dmaphyssrc2 = 0;
    & Y6 n" z- m. S% }
  70. dma_addr_t dmaphysdest1 = 0;
    ' S# E4 f2 c( \, |- c/ P: L
  71. dma_addr_t dmaphysdest2 = 0;
    " y  J8 E, O# T! t7 Y8 d

  72. 6 `& z/ b/ I- j" e
  73. char *dmabufsrc1 = NULL;
    ; D( H$ X5 N/ y7 U
  74. char *dmabufsrc2 = NULL;
    % s: D( c$ n; W6 c- K
  75. char *dmabufdest1 = NULL;0 U6 I8 F3 D8 D7 e
  76. char *dmabufdest2 = NULL;
    . A* q5 h  P' R8 K( h! N
  77. 0 k; K; m0 z& E3 L
  78. static int acnt = 512;, K. d4 R/ G  M! |" H( Z
  79. static int bcnt = 8;
    + C2 P7 X7 I4 W/ u  _! d
  80. static int ccnt = 8;7 r# m% R$ {9 N. ?, M6 W

  81. / {# g1 q4 J/ ]: C9 \2 I
  82. module_param(acnt, int, S_IRUGO);
    , A& Y& K) ^4 i: R2 S0 C( [
  83. module_param(bcnt, int, S_IRUGO);
    ' y1 o' O, p& g9 }+ v* Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 _( E" F! U+ f0 M

* P- t6 a6 a$ y; U7 m# v0 q! x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) `- i- u* M- L% T* Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* V/ j+ _( Z  D; X5 ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 D0 ?' b: o- y
% E9 b/ G( A0 Z# m" d, m6 q2 M
1 X- e" n+ ?1 l: y2 `: j! m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 23:42 , Processed in 0.038987 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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