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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 X! R$ D7 n* _" D
  1. [code]EDMA sample test application  e4 N  T$ Z# Y# u  P. B5 [
  2. /*, B$ r9 S( d- x; N/ e4 B: @! z
  3. * edma_test.c' K+ Q; v8 f2 r, x- ~
  4. *
    ( R! E4 E  _8 q# f. L
  5. * brief  EDMA3 Test Application1 T$ d% L4 `3 x" k+ X
  6. *9 \8 B' T: f. \+ a! B
  7. *   This file contains EDMA3 Test code.
    4 l; J1 [1 D+ m+ b) p! x- C! s' ~" j
  8. *) C; p# C* j6 Q3 V2 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 M  L) Q; ?0 E% i: v* k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ R1 Q; F3 \: b+ s2 Z! U9 \
  11. *         TO CHANGE.( z- Y( h" u8 h) l8 z/ e, Z
  12. *' ~/ G+ e) d5 t1 Y  Z4 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . [4 p# A/ E1 n  p9 `
  14. *
    1 C9 G% l* B5 Q
  15. * This program is free software; you can redistribute it and/or# S5 b' Z8 a; F) O8 z! e
  16. * modify it under the terms of the GNU General Public License as* O& }' n: R6 y
  17. * published by the Free Software Foundation version 2.2 u6 ?- n* K" r3 R8 T$ [9 }
  18. *
    ; W' I1 a! B  E# Y- V0 f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * e' [  Q# o1 j/ W
  20. * kind, whether express or implied; without even the implied warranty, c7 u! D" N4 Y' v6 V# C. n5 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, E2 H0 V% E3 g; f6 z
  22. * GNU General Public License for more details.! S5 f7 g4 a. g7 _1 j
  23. */$ o% C+ E4 D- B6 @  K/ k1 m
  24. , d' T0 R8 Z( G
  25. #include <linux/module.h>
    : G3 [+ {) m0 y
  26. #include <linux/init.h>' X6 ^0 P( A) X! k) ]
  27. #include <linux/errno.h>" G$ s1 a' T; E
  28. #include <linux/types.h>. g; j. G$ Q0 L& z! j- `
  29. #include <linux/interrupt.h>3 x7 k4 d! I1 _! }6 J
  30. #include <asm/io.h>
    1 D2 Z7 M6 D. t' N+ N, @- r0 v7 a5 _; |
  31. #include <linux/moduleparam.h>% F6 M8 G8 E( l
  32. #include <linux/sysctl.h>
    * z7 h7 I  m2 I% ]. T' Q# P) l
  33. #include <linux/mm.h>
    - M) w7 j5 D" i+ y/ M, Q! x
  34. #include <linux/dma-mapping.h>. n5 I# w$ Q1 f# g& ?2 z

  35. % ~' N; _! k" I9 n8 D9 }7 U+ m
  36. #include <mach/memory.h>3 R/ z% s# T* K
  37. #include <mach/hardware.h>( c* ]5 c2 t* W/ c6 W- f
  38. #include <mach/irqs.h>/ j7 J& o% `6 }1 w) d3 o, U
  39. #include <asm/hardware/edma.h>% h9 O( {1 N7 d
  40. 2 v/ D* p2 J7 C; w- o5 @" o! b
  41. #undef EDMA3_DEBUG& s8 z9 W; T0 X- }
  42. /*#define EDMA3_DEBUG*/3 u+ i9 S  E4 E& w

  43. ; i" _2 I- e8 r2 ~: h' m0 p
  44. #ifdef EDMA3_DEBUG7 ?/ G6 B) @& a, }% z: |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' f  F3 @$ x4 `' d) W+ D- O3 U6 t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . E: O& H: R; x+ W! Y$ A  F1 G" ]4 }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 r& h) l4 X8 z/ i" o
  48. #else
    & M4 R7 g. f! n9 L, I6 }3 c3 x
  49. #define DMA_PRINTK( x... ). ]' d0 ~% o" S5 Y
  50. #define DMA_FN_IN
    ' O: {4 Q* c* ~; |
  51. #define DMA_FN_OUT
    7 Z# F8 ?( a  c& h( K# J( W* D
  52. #endif
    5 T/ w+ J  k0 Z2 }* x; n( o  H

  53. " K/ U$ ?! b2 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 V3 b6 a7 p5 q8 a. n" F3 w
  55. #define STATIC_SHIFT                3$ d( |: g' P* U8 x
  56. #define TCINTEN_SHIFT               20
    $ \2 R9 z( f+ g+ S+ A; P
  57. #define ITCINTEN_SHIFT              21! z& a5 w/ c2 }# R! J! p
  58. #define TCCHEN_SHIFT                22% z" O( ]4 Q+ b
  59. #define ITCCHEN_SHIFT               23
    6 d: \2 J* T+ O0 u* y6 e) r
  60. ' Y7 \5 o2 \7 D
  61. static volatile int irqraised1 = 0;, }/ q! K4 b5 `4 X! t( P8 h
  62. static volatile int irqraised2 = 0;! P% Z% c( l, P. {
  63. 7 J; c7 L6 l4 N8 Q% N- H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& Y3 J+ T0 a+ E: k; o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; f8 [# u1 N" u2 f- u; t- L1 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " R! O( o' l1 C5 a3 K! ~
  67. - n" Y/ S3 H6 b! G# ]( E
  68. dma_addr_t dmaphyssrc1 = 0;
    9 W4 ]) C( W) ^( Y/ N- @
  69. dma_addr_t dmaphyssrc2 = 0;* P' f( M/ e; b: L1 o6 p
  70. dma_addr_t dmaphysdest1 = 0;- f3 \* J' T5 a8 [
  71. dma_addr_t dmaphysdest2 = 0;& A" T4 A  Z- B( h1 x; n3 H2 o: e

  72. / J; x; p; A3 Y, e
  73. char *dmabufsrc1 = NULL;
    + L- K% L9 G# g3 \: I- i
  74. char *dmabufsrc2 = NULL;
    . r) J/ I( }0 w) B4 D
  75. char *dmabufdest1 = NULL;
    6 p* b6 Z  c7 L
  76. char *dmabufdest2 = NULL;, B4 l' z; |( u) S

  77. % R5 ^5 Z0 H7 B; X' Z
  78. static int acnt = 512;
    : ?6 b- M# B$ u2 l2 b  c' C
  79. static int bcnt = 8;3 q$ j  O5 f1 ?- j  e
  80. static int ccnt = 8;* N( D+ L8 e( |* j  N' U9 m2 m" L
  81. , _; J, o2 G# V" R: Y* @/ g) x
  82. module_param(acnt, int, S_IRUGO);+ e1 e$ h8 m0 G) x+ S
  83. module_param(bcnt, int, S_IRUGO);+ e+ J, T4 _( @+ p( |7 p1 X+ d% h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( g3 y) @: U8 a; G  c
7 C* z. g3 w% G5 K" t) U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; Z5 B* q4 C# U  rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( u3 ~$ F7 W/ q8 @; L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: ~' j0 T( F, P) F1 N$ z

" Q% E  O3 o$ ^. Y- r
7 u0 U9 z6 p. R1 y; i% N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-20 17:35 , Processed in 0.038191 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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