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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" t, v+ @6 q8 A, j3 r
  1. [code]EDMA sample test application
    - G* R2 |! e4 S9 O9 Q) J
  2. /*3 i$ `1 E9 \. m4 F5 {/ f
  3. * edma_test.c
    % X  f3 e: x( S% K) V( r3 u8 W% C
  4. *9 w+ R/ ?9 ~, L5 ]) v
  5. * brief  EDMA3 Test Application
    8 _0 P% g, J1 t4 G8 O  ^6 u$ x
  6. *. o- Y, t5 B4 _3 \4 ?6 R0 `
  7. *   This file contains EDMA3 Test code.) L9 W5 i/ N+ j3 d, _
  8. *' B, X6 F' b/ t% z: b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' i# ^! q6 [# c1 U/ X& R  z, m* R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 O' ]1 H! J5 u
  11. *         TO CHANGE.
    : e8 Y/ R) `9 @* p" _! G
  12. *
    + w4 Y6 ]+ w1 n( o% l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 s* ~; w$ {* @. _& i4 {, q8 @
  14. ** N* e  F7 ?5 P8 E4 t
  15. * This program is free software; you can redistribute it and/or- x3 C, n% F8 t
  16. * modify it under the terms of the GNU General Public License as
    % [4 C* _1 n5 x# b" T* M
  17. * published by the Free Software Foundation version 2.. W6 _8 k" _2 y6 L: T: q0 l
  18. ** c+ I6 W/ R. p2 z+ d8 z6 v$ Z% p- \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; G; F: m; t6 k1 I: q  @9 a
  20. * kind, whether express or implied; without even the implied warranty5 i) t6 f/ J+ V$ Q" e7 Q( Q6 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: A5 ~- @( y" \8 r: |/ H
  22. * GNU General Public License for more details./ E( u% W0 X' x  h( N
  23. */
    + [5 ^4 u. x. T! C1 c* \
  24. ! }" o$ }7 h0 B& B
  25. #include <linux/module.h>0 Y! H. W' J  {- @, H& R
  26. #include <linux/init.h>3 a# Y* A1 }7 J# e3 B, J
  27. #include <linux/errno.h>
    0 h$ k0 h0 I- \5 w$ @5 q
  28. #include <linux/types.h>" C4 x# w2 j& Q; r8 R( U
  29. #include <linux/interrupt.h>
    3 P- O- |( j8 x* z5 o2 I, \1 v
  30. #include <asm/io.h>8 j2 z9 d" a. z. s4 j
  31. #include <linux/moduleparam.h>3 v" E0 m/ H- A; }
  32. #include <linux/sysctl.h>
    ! Y3 I/ R% t  m2 U, P( \( `
  33. #include <linux/mm.h>
    . Q- Q: G- V0 [1 I+ z
  34. #include <linux/dma-mapping.h>
    * d8 i# U" K' X1 P
  35. " D3 K1 a) n( i& k9 {
  36. #include <mach/memory.h>/ H1 j, j9 O; U2 o; V5 o! w0 \
  37. #include <mach/hardware.h>+ P& E1 M' ?3 R# i7 D) F" f; E
  38. #include <mach/irqs.h>
    . ^9 Q; o% ^. M, a6 S% J2 D: g
  39. #include <asm/hardware/edma.h>8 b& o8 T3 e& Z" {0 ~
  40. . X) J& A+ O; N, ~& z5 Y$ f
  41. #undef EDMA3_DEBUG
    # k* n: O# k9 H( E: z
  42. /*#define EDMA3_DEBUG*/1 q4 W1 t7 m3 I. ]$ U0 Y' Y

  43. + j& p/ {. X( ?3 S8 a. w  p
  44. #ifdef EDMA3_DEBUG
    0 O3 m* j* `; \1 T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) J4 Y  v& t' f1 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; X" V& ^7 c7 H" R: M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , ?* l4 H  {/ j0 x$ Q& W5 _" @
  48. #else! p7 Z! O( s/ y$ b
  49. #define DMA_PRINTK( x... )
    1 T' A, d# K& l  m- e9 I: I
  50. #define DMA_FN_IN- o, \. u7 z9 P3 L) @6 ?7 l
  51. #define DMA_FN_OUT
    : J: l2 S% q6 ?4 s$ q# S
  52. #endif# y4 X. t" {0 D, F4 N: S

  53. 4 h: R) C# G: c# j# Q4 `: u) A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  u4 ^; n* d9 i7 u# L. x9 G
  55. #define STATIC_SHIFT                39 c. j, S. p0 p+ c
  56. #define TCINTEN_SHIFT               20" r% e  E: [0 F! \: y' v
  57. #define ITCINTEN_SHIFT              21: J0 S$ v7 Q1 c* w/ R7 a) A9 I# G& W
  58. #define TCCHEN_SHIFT                220 k7 X1 i1 m2 r# b
  59. #define ITCCHEN_SHIFT               23  A, H$ ^: F$ m9 P1 A4 S

  60. 4 J# t, k+ j4 c
  61. static volatile int irqraised1 = 0;
    4 y+ V- l- O4 v$ h
  62. static volatile int irqraised2 = 0;" ?7 Q6 j! ?) V* i, A

  63. ' h: x7 I: J; m3 S3 }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 a9 ?: C: O3 b8 a' @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 Y5 M4 a3 \7 h7 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- V7 \. P' u+ o( t& f7 i
  67. 1 P, d; X6 u6 ~( u6 a
  68. dma_addr_t dmaphyssrc1 = 0;
    ' g5 U$ y2 q: e; x% ~
  69. dma_addr_t dmaphyssrc2 = 0;9 d5 b. w: f' U! U
  70. dma_addr_t dmaphysdest1 = 0;' w8 _% T: ^2 v
  71. dma_addr_t dmaphysdest2 = 0;
    $ f9 p9 d3 P. f/ x% Q

  72. 7 W3 X8 [7 z, E; I# b( L
  73. char *dmabufsrc1 = NULL;+ t* k7 |; ~2 T0 G$ x8 w; i
  74. char *dmabufsrc2 = NULL;0 L( I+ L% s+ S& S, Y
  75. char *dmabufdest1 = NULL;
    ; y8 m1 m1 l" N6 n' |  r
  76. char *dmabufdest2 = NULL;
    2 q" R' ?' n$ S  o: o
  77. 5 P) Z8 Z! j0 T, T: |
  78. static int acnt = 512;  Z3 q# N1 K8 V% {
  79. static int bcnt = 8;5 b! c" F7 B' H) W' \5 R
  80. static int ccnt = 8;9 ?5 ?: s  p& d$ H% M9 u/ V+ ?
  81. 7 d% ^, o0 ^8 d# J& y, D
  82. module_param(acnt, int, S_IRUGO);
    ' E' ?, K6 o, o# g+ `4 K
  83. module_param(bcnt, int, S_IRUGO);
    ' i! Z5 }  M1 A; l5 G% M- I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ {9 F" X" i  z* H$ d) ]7 m
4 w; a- b  m! w, Y1 e6 v" @& z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 k- W0 i- R7 ?! u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 P& L. v7 f7 s- y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 f7 a* b) g7 y8 }6 ?7 z$ b
7 V. D. y/ ~0 v0 e% `* c
" s4 G. w: D7 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-30 20:46 , Processed in 0.040213 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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