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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% t1 q- E( F9 b( N& n3 W
  1. [code]EDMA sample test application
    2 P" }0 [3 s0 R6 a3 X+ E" F+ Z2 G
  2. /*
    " k" D5 B/ J! N! K* o( K: G
  3. * edma_test.c: W- S, G8 K) h; L( S$ `' y
  4. *# @/ c- h- q/ |' d9 p+ p6 L
  5. * brief  EDMA3 Test Application
    ( F" E- U+ N: b/ [+ }, `
  6. */ Q* n! V/ A0 G/ s7 V
  7. *   This file contains EDMA3 Test code.0 s6 f2 Z* w6 |+ V% N$ S
  8. *
    0 O' f) {! v9 e' Y) ]) P/ x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 q9 ~& }* o  w' ?$ ]) g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# w$ J' S( _' |& ~. j/ ]
  11. *         TO CHANGE.$ z" L( e, I2 c) ?
  12. *; h: a: ]! k% r: H1 F5 q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 H+ X6 l! c* n9 Q
  14. *, J) M$ }8 C4 p; r
  15. * This program is free software; you can redistribute it and/or# L8 g1 ~9 f: {7 W  y9 W0 Y
  16. * modify it under the terms of the GNU General Public License as
    " @. }" M  D8 l' l$ I7 [6 f* R0 J
  17. * published by the Free Software Foundation version 2." S; S% B2 h* V
  18. *
    ; P3 `4 o8 {" z" o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 L; J* ^5 z3 F' V7 m% ~- _
  20. * kind, whether express or implied; without even the implied warranty5 `: n" C3 G% a  L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + P: u' z& q, |* W) u
  22. * GNU General Public License for more details.$ Y0 Y9 ?. b1 \  |8 P9 _. R
  23. */4 R4 z9 V$ ]1 D( T

  24. $ P3 \; o7 |5 `) _/ \
  25. #include <linux/module.h>
    ( q' l' t. u$ S, @1 W. s$ m
  26. #include <linux/init.h>8 B: E5 f4 `5 d7 w
  27. #include <linux/errno.h>- W5 G: j; ^# [  J; m0 I
  28. #include <linux/types.h>
    5 n1 O: M: O5 E$ ]8 Z. d
  29. #include <linux/interrupt.h>, W, h% o/ R- S7 K
  30. #include <asm/io.h>
    % c  P# |2 L9 b# s: Z* j' S+ L- o
  31. #include <linux/moduleparam.h>( V" o) |- ?! I6 F* x' w2 W
  32. #include <linux/sysctl.h>* P) u% F& M4 U5 a! b, B: b
  33. #include <linux/mm.h>
    8 D9 ]. Z# V' j( L4 t+ `7 ]) \6 I
  34. #include <linux/dma-mapping.h>
    8 E. ]3 z) ~8 w) c1 X: U. L
  35.   r; x; W2 r# j8 C0 C: d7 a. X
  36. #include <mach/memory.h>
    8 X8 O. i: W4 q2 X$ {' Z/ i5 w6 V
  37. #include <mach/hardware.h>
    & r/ B% R( H$ \  Y- F
  38. #include <mach/irqs.h>. y* i8 l# Q* K& B; K. e( m9 i. J6 E/ Y
  39. #include <asm/hardware/edma.h>1 |* |5 n8 {  y
  40. 4 X  K$ d, m0 I! N4 `
  41. #undef EDMA3_DEBUG/ Y% i5 ?8 |# W2 X3 A
  42. /*#define EDMA3_DEBUG*/3 {6 s) P: y/ f+ p9 l; t
  43. 2 L8 E; j; q& s7 D% j! ]- K0 ]
  44. #ifdef EDMA3_DEBUG! O* _. F) |3 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). A- _3 T9 C' n' ^! |  o& c2 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 L6 v4 O+ f; X2 t+ C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 S3 [0 m5 Y; A
  48. #else. b& t" j( l* x* B
  49. #define DMA_PRINTK( x... )$ O( [0 y0 s: e9 S  ?. R2 k
  50. #define DMA_FN_IN! i3 E7 h; c6 x! p6 d
  51. #define DMA_FN_OUT
    5 y- R. e  ~' k2 V1 n
  52. #endif
    . w; I- J3 ^$ Z: C9 _! R, R5 B# [' @* |
  53. 9 W# q4 Z$ I! E% v# `& E4 k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 o$ m9 g7 m! ]) D# f, A
  55. #define STATIC_SHIFT                3
    - J) E( d6 a! D6 P. n
  56. #define TCINTEN_SHIFT               20* `; h  p: p% \/ _9 w& s( N
  57. #define ITCINTEN_SHIFT              21
    - A! u, |4 _9 ]4 v8 ~6 w, z; J; ]( l8 `
  58. #define TCCHEN_SHIFT                227 V1 o* ]; n4 l6 a5 d  y+ w
  59. #define ITCCHEN_SHIFT               23
    + p9 j% K( O# s7 |5 v8 b

  60. . F! C+ @* M" M8 ?) s
  61. static volatile int irqraised1 = 0;" g: s& A' v3 s- G
  62. static volatile int irqraised2 = 0;
    3 E# v/ Y- c0 m- {8 |

  63. 7 m( U1 ~" H; D6 v1 w% a# x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: g1 r- A+ [6 ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 r, V! G1 U7 J! u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % l1 |; G+ D- t- n$ K+ i2 [

  67. * r3 k. B/ H: M, e3 H0 V3 A/ q$ `
  68. dma_addr_t dmaphyssrc1 = 0;$ m" T( S2 l7 \+ g
  69. dma_addr_t dmaphyssrc2 = 0;: r/ Q6 S1 a5 X# u/ R3 B  f6 d
  70. dma_addr_t dmaphysdest1 = 0;+ \: j* j2 ?7 I7 W* s9 [9 ]
  71. dma_addr_t dmaphysdest2 = 0;
    ; N; g; g7 ~# n+ n- b4 A. s
  72. : L( h0 N' J0 T& W2 ]8 I2 e6 M5 B
  73. char *dmabufsrc1 = NULL;7 O2 d; Z! W2 O, D3 \
  74. char *dmabufsrc2 = NULL;: O% k" ?" A  }% \: H* o0 `
  75. char *dmabufdest1 = NULL;# d) U* m8 W7 R' `" l
  76. char *dmabufdest2 = NULL;$ U4 x" [. G+ [9 B

  77. " l4 G( j# B1 c- N6 f
  78. static int acnt = 512;1 W+ [' l# V, f0 m: B9 p
  79. static int bcnt = 8;/ m4 `9 l0 T& n9 l# U. \" g
  80. static int ccnt = 8;( D  }1 U( A: y5 k( _

  81. . m6 J% U8 r, D6 |* k
  82. module_param(acnt, int, S_IRUGO);$ j5 A0 A  k' Y! {* D) f4 b$ Q
  83. module_param(bcnt, int, S_IRUGO);
    , [/ y3 ^. Y  i& q; i& p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" f  @  \2 s1 w" t8 ~, q/ ^- Q* e0 x1 X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* n- m4 R, w: {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 l& ]. F% a! {% g9 k# G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% F2 B" {; }8 f! n5 f
, f% Y, h  e, O+ [  P/ v# U% x4 @6 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-11 13:46 , Processed in 0.040435 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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