OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 {& _8 i: m1 A1 ?: u. T" G
  1. [code]EDMA sample test application& Q% i- x& ?, h8 S! K, _
  2. /*
    % c- X& [" l3 o* C6 q% s) E
  3. * edma_test.c
    ! l4 v- F, L! W* I% T0 m" b$ A
  4. *
    & X( Y5 t2 |, r
  5. * brief  EDMA3 Test Application7 G9 A2 t4 f# e* }+ b3 m
  6. *
    - J, ^* Z0 K, L3 {$ k7 d2 s8 f) J! ^
  7. *   This file contains EDMA3 Test code.
    1 ~" S" ^! c% M5 T
  8. *
    3 }2 ?4 O' Y5 d7 m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % U0 V+ V( n* j, [8 y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* [7 K2 S4 ?7 O* h( j
  11. *         TO CHANGE./ v* P" z4 M& t9 X0 u  r
  12. *1 w0 m; {$ x* C: F& k; Y! J. e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* _0 S7 s# J9 b! ~2 [' \/ K6 {0 {
  14. *' \: L- a% C9 r/ G/ l
  15. * This program is free software; you can redistribute it and/or% [' K; w" G1 K) ^
  16. * modify it under the terms of the GNU General Public License as
    ; r7 N5 B6 a1 [# k  Q9 B
  17. * published by the Free Software Foundation version 2.
    2 i. D# v  S5 g
  18. *
    8 p7 i4 J* q: t, O! z) r% ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 Q* T' c0 ~, j# f* E4 r+ z$ i
  20. * kind, whether express or implied; without even the implied warranty
    - A: H; [3 C& `/ N* f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 _+ B. D! a( ~" B
  22. * GNU General Public License for more details.( u8 {) `$ w$ X% o% o, ]
  23. */3 q1 H7 y" G! ^4 Y0 k$ r

  24. , R4 _$ z+ E& M8 X7 F$ H7 A
  25. #include <linux/module.h>
    3 D: E/ i  f1 t% K4 k4 j9 i
  26. #include <linux/init.h>
    , R2 e( d' |8 U; C
  27. #include <linux/errno.h>
    9 b8 c6 t; v# J/ N! K
  28. #include <linux/types.h>1 K5 o- @8 G1 n7 \" L7 |8 G& n
  29. #include <linux/interrupt.h>1 m1 w7 U* X( }) Q, K# X
  30. #include <asm/io.h>( O7 T1 d; g% i# K
  31. #include <linux/moduleparam.h>
    9 s# |. {  |* X! o
  32. #include <linux/sysctl.h>
    ) q4 g: m& Q/ D4 ]
  33. #include <linux/mm.h>; v- V1 }3 y, J. d. K
  34. #include <linux/dma-mapping.h>6 ~/ O( d0 j/ d0 q5 ?

  35. + L7 n1 q0 a4 y: l- E" u
  36. #include <mach/memory.h>
    7 J; Q! p( x3 `1 {3 }: `
  37. #include <mach/hardware.h>$ d  w( K1 ]) C7 Y* _& ?2 J
  38. #include <mach/irqs.h>
    / x; W. L, E' f9 q8 r
  39. #include <asm/hardware/edma.h>
    & b2 Z! n6 ~  c  V

  40. 0 P! c1 N3 T9 o# d; q
  41. #undef EDMA3_DEBUG- g6 l& u% _1 v1 Q% H( d. z/ ~4 H
  42. /*#define EDMA3_DEBUG*/
    + ]9 R1 q; G6 _' J9 K
  43. ! J4 b' _" s/ V, C1 b) k% ?
  44. #ifdef EDMA3_DEBUG
    $ r9 z( F) j/ f- W/ h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " G3 N! E) `% x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' h, u( i, {; p& U6 r  t( R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ p8 a' g# A# d% F+ a/ k$ K
  48. #else& F' S! b3 s" H- {1 a+ M4 R
  49. #define DMA_PRINTK( x... )
    9 t" S5 m, h2 {& }$ ^6 p/ O
  50. #define DMA_FN_IN( f, J+ T2 W# `' a- S! H! w
  51. #define DMA_FN_OUT0 J$ ^4 v( y  U' v5 v% t. [
  52. #endif6 Q' F5 F6 {; I' _4 E0 f( [/ _4 _

  53. 6 Y; t% [' t0 c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 ^5 h2 u8 X# a
  55. #define STATIC_SHIFT                3
    ! ?8 z" a3 ~9 {# F- Z2 ^, t
  56. #define TCINTEN_SHIFT               20
    + O$ g6 z5 A. J6 m) }" E; P
  57. #define ITCINTEN_SHIFT              21
    4 O- {: |3 O* P
  58. #define TCCHEN_SHIFT                228 q# V& _* e( x# |
  59. #define ITCCHEN_SHIFT               23; g4 [$ X( r# `6 r& @5 Q5 B
  60. # J6 k: g# y' l/ Q
  61. static volatile int irqraised1 = 0;% k9 K7 G, `6 p  p! _  r
  62. static volatile int irqraised2 = 0;
    / ]. P- f: d  |/ w
  63. 7 E! X+ }  Y4 q7 N; S# E$ O2 R  l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 U+ u) E$ T2 t6 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ q+ D$ x8 a+ e# Z( m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 V* O: S" q- C. h/ C

  67. ! r& j7 W# ^" J" o  j
  68. dma_addr_t dmaphyssrc1 = 0;
    1 A! f1 J9 {% E. v8 m0 z
  69. dma_addr_t dmaphyssrc2 = 0;
    $ x4 ~3 ?# O" v3 T* C, K9 `
  70. dma_addr_t dmaphysdest1 = 0;
    9 R+ d7 N) r: @' ?8 D  N$ U
  71. dma_addr_t dmaphysdest2 = 0;5 T9 n; y3 [! E% f" c
  72. : A! {1 E4 y8 l2 E% j( E( k
  73. char *dmabufsrc1 = NULL;0 m5 e- _2 }" c* a5 B; C4 l
  74. char *dmabufsrc2 = NULL;) i3 _2 o  B3 w/ o* z
  75. char *dmabufdest1 = NULL;6 m# U" P7 U$ ?" K7 [# B' R5 t( F
  76. char *dmabufdest2 = NULL;
    : D* |8 O( k+ v- P6 c" B$ y6 x$ U, C5 {
  77. " X" D9 v4 [6 [9 o
  78. static int acnt = 512;. }: N" T+ T/ t
  79. static int bcnt = 8;+ w/ j8 |& [2 P$ q' D' N6 s8 v
  80. static int ccnt = 8;
    8 {' K2 h6 M" O5 Y1 e

  81. 5 o3 |2 W+ H& c8 A# R2 {
  82. module_param(acnt, int, S_IRUGO);
    # N& J+ Y& N3 Z' ?( U; g8 P
  83. module_param(bcnt, int, S_IRUGO);8 T. P% q, i! w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! W! W( s3 {( L( n( E1 o& b, C

% |2 M7 U. O& |9 U) K$ ^' J6 o; O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& a2 R% t* `* L6 j, G# farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 W. ~4 D+ v* U5 @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 Z% c# ^3 a  w$ y% Y
* G. x4 o: @- \( c5 _, [5 ^
; K! s2 L7 `- p6 U* L$ o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-16 14:22 , Processed in 0.036449 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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