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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 R( C2 B8 F. j+ c; u3 I2 L* I' W
  1. [code]EDMA sample test application3 j$ P9 C3 u$ G2 d9 J
  2. /*' Y9 h  D) _: M
  3. * edma_test.c
    " x* `* s2 `+ b6 N1 q0 M
  4. *
    * `+ k4 v, w5 D' q9 [$ o
  5. * brief  EDMA3 Test Application
    ) L3 g6 j* y: E
  6. *8 R* {2 _* r! o6 S4 Y9 w, A
  7. *   This file contains EDMA3 Test code./ o* w, X4 @2 n
  8. *. [- r: K5 F+ T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, b: K& k% N* G5 n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " I; d* R* y) M* j& l1 k
  11. *         TO CHANGE.
    6 L# F7 [9 L; ]! ?: y, r
  12. *! a3 x/ P, y. d0 M! h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 ~& g: b1 ~% f8 q0 [
  14. *
    2 j8 \  n0 b8 |! h% j
  15. * This program is free software; you can redistribute it and/or: `8 X% t! P3 F# @1 t$ N
  16. * modify it under the terms of the GNU General Public License as7 |, A% S2 o9 i# u  c+ j! H" R
  17. * published by the Free Software Foundation version 2.
    2 C( r$ J0 \' B9 }8 E9 a
  18. */ m$ V* X) l% k0 h4 b8 @  Z/ X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      `/ Q$ B' O3 X$ g5 P) c! n
  20. * kind, whether express or implied; without even the implied warranty
    3 T4 ^$ s$ P# `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 n: F- u. r" q& }; K& N
  22. * GNU General Public License for more details.4 m/ R4 M1 s7 _) ]6 f
  23. */: G6 }1 x- x! S' E7 u! t

  24. - ^7 o5 E' @9 t$ g* }9 A1 L& J) g9 e
  25. #include <linux/module.h>
    ; ]. g6 U4 T! a0 ?6 c6 I
  26. #include <linux/init.h>2 W. u+ v: ^+ J1 m
  27. #include <linux/errno.h>% P; X7 N4 _6 `. E
  28. #include <linux/types.h>
    9 d2 H: V; d& X. U
  29. #include <linux/interrupt.h>
    # y+ [' D9 B2 G, Q  f! o* y, g7 \
  30. #include <asm/io.h>
    7 A; d9 W, i; d# P+ X2 ~( V
  31. #include <linux/moduleparam.h>
    # Y; q3 t& z0 l& C8 O2 _. l
  32. #include <linux/sysctl.h>& ~  y' I: |( _$ d
  33. #include <linux/mm.h>
    # ?6 Q. E' @; e. S' W
  34. #include <linux/dma-mapping.h>
    ! j6 U- h/ N: F8 o

  35. . R4 A  [6 _% n8 h8 h  U. R$ [
  36. #include <mach/memory.h>6 L0 u5 w5 k/ F6 M% H, ]) w( o( C
  37. #include <mach/hardware.h>
    8 w8 x, w# x' Z, w0 S9 d
  38. #include <mach/irqs.h>9 u( t) H6 H0 W2 F; H
  39. #include <asm/hardware/edma.h>
    & j4 v; c% `8 L# T# B  {2 e

  40. % |3 b5 q* k' {
  41. #undef EDMA3_DEBUG+ S( z) {; B& k0 z% d  R- @: A
  42. /*#define EDMA3_DEBUG*/$ W1 H. ]3 l+ l( j

  43. 7 q$ B  E+ Z+ i! d4 c, }
  44. #ifdef EDMA3_DEBUG% t$ [# h" r. d% F7 G' \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 W" M& a( y( t4 V9 e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), l, O" [' t, Z5 W. m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; G1 O1 e* y$ e9 X0 b& G
  48. #else1 B- z; ~5 m$ p
  49. #define DMA_PRINTK( x... )
    " t- ^  I5 L* s* c
  50. #define DMA_FN_IN" _2 q' l0 ?4 c
  51. #define DMA_FN_OUT
    , f0 M" J- j7 `
  52. #endif
    3 g1 o1 D2 l4 E! J) n4 B
  53. 8 K# r! B0 `) B7 D: h4 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 I$ O' I- Q( A
  55. #define STATIC_SHIFT                3
    1 ^- d  l4 n. U( i9 v
  56. #define TCINTEN_SHIFT               20. ?9 Z! z9 K; o0 _- f
  57. #define ITCINTEN_SHIFT              21
      i& @( b. e! W9 Z
  58. #define TCCHEN_SHIFT                22
    % l5 A& R& T* J
  59. #define ITCCHEN_SHIFT               23
    ( W0 i+ d5 c/ l! h
  60. " a1 k4 {8 d5 y. Y! b
  61. static volatile int irqraised1 = 0;8 b2 n- f7 m) Q# O; }
  62. static volatile int irqraised2 = 0;3 m$ ]2 C/ y( K$ h
  63. / C' O+ D0 k9 ~8 p# s# T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 H0 c) F  G& ]. i+ I6 Z: G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 \! j5 ]2 t* f& ~' R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 W% f. u; O$ C* ]1 n7 M! C6 [: V
  67. / q7 Y$ L. e; i% h! g. X
  68. dma_addr_t dmaphyssrc1 = 0;
    2 w6 m8 W! ]5 k$ t' d0 Q' o3 K
  69. dma_addr_t dmaphyssrc2 = 0;4 R+ G* G5 V3 g; P
  70. dma_addr_t dmaphysdest1 = 0;
    - o7 y( P" v7 k  n0 F
  71. dma_addr_t dmaphysdest2 = 0;
      k+ H" `, Q6 W

  72. ! s6 U$ s# a& \/ U8 l3 ^6 e# g! G
  73. char *dmabufsrc1 = NULL;
    ( V# `3 E8 @0 W$ f. W
  74. char *dmabufsrc2 = NULL;; X+ Y. k* O0 P3 L7 g- b2 Q
  75. char *dmabufdest1 = NULL;
    3 l" Y8 i9 q. q( T1 y2 T
  76. char *dmabufdest2 = NULL;8 ]; d: Y0 f0 w6 W9 o6 s
  77. * `4 H4 z- m; t3 F* \! L
  78. static int acnt = 512;
      I7 o0 x0 F& ^) o* e8 P9 X" A' |6 Y
  79. static int bcnt = 8;+ R  M6 T  D, G! q
  80. static int ccnt = 8;
    % n8 {! u% [- f" G( c
  81. ( |* n$ q6 f$ G0 M( x) H
  82. module_param(acnt, int, S_IRUGO);0 S- H: m3 @; n2 h, X
  83. module_param(bcnt, int, S_IRUGO);$ h4 p0 U7 p0 l0 Q  i: U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, X% f- O, i  W" L  K" _7 I
# |$ x: _7 R' i. `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* d. G4 J2 ]& x2 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! m5 v+ o6 g, {9 M7 o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 \3 G4 b* R! I# `

4 Y2 M' j# b9 J' i* x1 Z0 a% _( M5 L$ z- _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-15 16:19 , Processed in 0.041204 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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