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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( O5 {* ^1 M6 S( p% b& S
  1. [code]EDMA sample test application: `0 G$ Y' h* g% J
  2. /*
    ; C+ w" b5 G7 l7 f+ c
  3. * edma_test.c
    6 {2 E2 d. ~: z0 W7 I# _7 j" f+ y9 y4 |
  4. *6 w1 Z7 D  y1 K
  5. * brief  EDMA3 Test Application
    ' l' F, [* f: W
  6. *1 W: S# g/ s0 y" P
  7. *   This file contains EDMA3 Test code.
    $ X0 ?+ v3 ^( \' F6 {
  8. *
      @0 ?( y* @# F9 ^1 O; o: Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 N7 I$ ]/ N* @& @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' d% g+ K) y: e- E# [
  11. *         TO CHANGE.  f$ g, ]. e3 A* J
  12. *( K% T& W- S' S. g2 M5 m2 T: U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' n4 ~: l1 D# m% C
  14. *) R4 S) Z6 }, H. w) B
  15. * This program is free software; you can redistribute it and/or
    , @  w1 r: c6 K
  16. * modify it under the terms of the GNU General Public License as5 n) Q. [, u. R* w
  17. * published by the Free Software Foundation version 2.
    , [1 V' _* M  R, W) ]  l1 ~
  18. *
    1 I6 B- l8 P# W8 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + y9 P3 w% F9 @8 {" t+ X6 f( Z
  20. * kind, whether express or implied; without even the implied warranty- P# W7 ~! [8 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- ~/ {1 y5 P0 i. O& I/ f
  22. * GNU General Public License for more details.
    9 Y9 x4 a. f) V; G
  23. */4 M0 _( U6 y+ g% h7 h' i! c

  24. ( }) n; U( O3 R9 e6 y
  25. #include <linux/module.h>
    + P9 D% |7 P* y9 r$ S; h" o, \, j
  26. #include <linux/init.h>
    & k% J; G. N+ j9 N
  27. #include <linux/errno.h>
    6 T/ W1 e8 |8 x8 p! J9 }
  28. #include <linux/types.h>* G  c6 b' A6 W% d
  29. #include <linux/interrupt.h>
    ( d- s) `" I9 K3 [2 W* |% `9 |
  30. #include <asm/io.h>6 D8 t$ U' g$ g
  31. #include <linux/moduleparam.h>
      f, W6 u( v1 M1 x! ~% m/ ?
  32. #include <linux/sysctl.h>8 [% w4 `  B- p+ X& W- v- `6 ^
  33. #include <linux/mm.h>! i4 e  I$ {, a- _
  34. #include <linux/dma-mapping.h>
    3 Z' S) M9 G6 s3 ~5 ?, P6 c5 {1 N

  35. " N: G; [2 |' I! j/ g+ q  z
  36. #include <mach/memory.h>
    7 K! X! l+ g# m7 s
  37. #include <mach/hardware.h>
    ! T% S/ J$ y: U1 d5 [( @$ ^/ s+ Q
  38. #include <mach/irqs.h>
    8 m, I9 f, u8 J* [6 a
  39. #include <asm/hardware/edma.h>9 y4 X4 [$ Q: w
  40. 8 F+ s: u; z3 v+ v! J3 K0 R
  41. #undef EDMA3_DEBUG6 @" m8 O, I5 ~! a) b* L
  42. /*#define EDMA3_DEBUG*/& j' e1 b! ^+ ~
  43. 3 k/ G2 r! `9 @( P
  44. #ifdef EDMA3_DEBUG  f1 [% ]$ Z8 M8 b" F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). {$ ?% x/ V3 j: Z9 t- h6 [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 E4 F! s; d# B" g3 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& L) u' K$ Q# W, D
  48. #else
    ' k1 U8 r0 P! n" D$ ]
  49. #define DMA_PRINTK( x... )( R* y7 T$ w7 i* U& ^( Q
  50. #define DMA_FN_IN9 c8 l7 L* V# a$ @# `/ x+ R: u
  51. #define DMA_FN_OUT- a$ w/ X% ?1 W7 F
  52. #endif( a- M/ Q2 Y% \3 g
  53. $ D* d! D: W1 m; F" E$ K" D' t1 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 @4 n9 `0 J& `6 Y
  55. #define STATIC_SHIFT                3
    6 g, S( w4 i' g/ j8 C& @' a  L# [
  56. #define TCINTEN_SHIFT               20
    ) h" s; s! y4 `8 m
  57. #define ITCINTEN_SHIFT              21
    % Y0 B, p8 F8 z8 j6 T
  58. #define TCCHEN_SHIFT                228 R8 s' ~+ _& m& I+ d% I3 t% q
  59. #define ITCCHEN_SHIFT               23
    9 V# s9 x9 ^, j( ]# q
  60. , W& \+ A' [* |; M: M; C
  61. static volatile int irqraised1 = 0;6 d$ b" ?/ x; C2 U, q
  62. static volatile int irqraised2 = 0;7 o: R1 U( V! i5 s

  63. ( K% x+ j8 I6 J  s0 `4 o% I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: `: j1 A3 j* K7 n; J1 E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* r  ?4 {/ W& n6 d  f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 v; C, i6 l) }) ^

  67. 6 n, G! s+ ?( b; A) L( P6 _( j! ~
  68. dma_addr_t dmaphyssrc1 = 0;
    3 v  a* b  g( F' X
  69. dma_addr_t dmaphyssrc2 = 0;. K3 T4 i' G6 o0 U+ x  }
  70. dma_addr_t dmaphysdest1 = 0;
      @( e+ W) z7 S3 T/ X9 k% O
  71. dma_addr_t dmaphysdest2 = 0;) m- v# l( H9 O0 }! o/ G% i) C
  72. 7 x- l. _7 k0 L( W& |% [# w$ a
  73. char *dmabufsrc1 = NULL;+ ]1 c$ x2 W" L8 U. S
  74. char *dmabufsrc2 = NULL;
    : F" p& ?# s* p: [) Z2 U7 z( l* G+ t
  75. char *dmabufdest1 = NULL;
    # k/ N+ f4 B( H7 j8 L
  76. char *dmabufdest2 = NULL;1 q# P% O, `" j, R" M( B

  77. ; a4 A- a( o- a) l# G# o
  78. static int acnt = 512;- F9 C+ C' M& P$ Y0 U, ^
  79. static int bcnt = 8;, v/ z+ v# z  z& K0 J
  80. static int ccnt = 8;5 r& }$ J" v8 l+ a+ L; Q

  81. ( L2 k! b) \! N; e
  82. module_param(acnt, int, S_IRUGO);8 x" {0 P) U3 I& P* F
  83. module_param(bcnt, int, S_IRUGO);
    / `: P) `: M" N' P1 p: s% d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 ~2 I, Q7 f' M# l% J( M1 {
9 w5 x: {& O: p' |" j9 A5 D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& T4 Q0 B0 O; _  p5 E0 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 a* I% |2 n% ?2 C0 E6 B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; Y8 r# A) n7 I2 Y1 r4 y' N3 y% G. Z. W- c& G# ?, G
" W2 T( ~4 t. K! }; q" j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 14:35 , Processed in 0.037473 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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