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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: A* E# [9 s$ e- K4 D
  1. [code]EDMA sample test application
    ) O6 J9 B+ I% O$ Q2 E4 [. _6 |% [
  2. /*, u! V' B5 ^( W& p5 R- D
  3. * edma_test.c
    ( p" i1 ^, H6 x; ?$ Y. j
  4. *; }+ w  g; ?" Q1 L- D- X/ \
  5. * brief  EDMA3 Test Application
    ; _9 {' D! j" I& P
  6. *9 J, a+ g4 o# H
  7. *   This file contains EDMA3 Test code.
    + i- z% |. m/ C" p
  8. *
    5 p" C. d- [; d5 \) v3 u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ Z2 Y/ M. i; |/ s  O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ u# S- k* e% g
  11. *         TO CHANGE.
    + T: k) `% N$ q- Z! B
  12. *
    : \& K  c5 _% P$ w" P9 k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ _3 \3 z% y! F2 l3 P
  14. *
    ! n: l+ Y; e& w7 z" }0 d
  15. * This program is free software; you can redistribute it and/or
    . M- j) Y6 H* a* I6 D
  16. * modify it under the terms of the GNU General Public License as
    % L5 @9 f* n3 y
  17. * published by the Free Software Foundation version 2.
    2 L3 n9 e& L9 c5 v% `9 p; k# n
  18. *5 ~% n2 k2 s4 o1 I; K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, J5 G/ P9 J2 d( J* H4 e
  20. * kind, whether express or implied; without even the implied warranty
    9 k% }- ?9 h6 m/ j+ `; u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / Y. ~9 A4 X% L
  22. * GNU General Public License for more details., U4 D8 \+ H. y8 O% ?7 l
  23. */! C; ?6 t3 l5 b5 y

  24. $ [. G. Y" q$ Y7 T! ^( t7 R
  25. #include <linux/module.h>6 a! P  t/ S. v7 D
  26. #include <linux/init.h>+ ?2 G) y- r/ r/ Z- o# g
  27. #include <linux/errno.h>4 K; Q" L" j- k+ m
  28. #include <linux/types.h>! |% y8 A( H8 P3 w
  29. #include <linux/interrupt.h>
    & x/ J. }! X7 W, |! P# o# k& l
  30. #include <asm/io.h>
    % w, Q5 w8 [. k" L2 j
  31. #include <linux/moduleparam.h>* i/ o1 ?8 H4 `, s4 d* f
  32. #include <linux/sysctl.h>
    % v! Q0 N& o6 }* p, h
  33. #include <linux/mm.h>
    3 x6 |% U* I; }! J5 K8 c/ G8 w
  34. #include <linux/dma-mapping.h>
      J9 w- |0 v( L" l# `2 t
  35. . [9 J2 f$ A2 s4 H8 w" R
  36. #include <mach/memory.h>& ~1 R1 O6 o% t; A; M9 [, ?
  37. #include <mach/hardware.h># W% M, p/ V; ?5 q/ v" f4 Z
  38. #include <mach/irqs.h>
    8 {0 n2 I5 \* X! |: n& N1 M3 e
  39. #include <asm/hardware/edma.h>
    7 J! W( K1 f4 G

  40.   g" O0 W" Z; l7 k
  41. #undef EDMA3_DEBUG
    4 B, J: Z. q! K
  42. /*#define EDMA3_DEBUG*/
    " ]7 Z# O$ s9 f; K' G
  43. 2 [9 J7 s7 z8 A; Y5 d2 Z" q
  44. #ifdef EDMA3_DEBUG
    ! n( E% ]2 Q1 a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( s+ S; b( G  i, j) D4 [% T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 A) V9 _% I4 T8 L$ V( o( a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- |% `; c6 B9 o  S
  48. #else
    . N3 x; f# E: _* P
  49. #define DMA_PRINTK( x... )
    ; X2 p: |( `3 [  s9 C8 ]
  50. #define DMA_FN_IN' ]; l1 [+ p# [
  51. #define DMA_FN_OUT" H" \8 T  w: s) F8 h1 k
  52. #endif& ~9 o9 \' ]5 F  \  m9 }
  53. # f; I+ X, L4 m- b* T: u( c: U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 O5 G5 b3 a" h/ ^6 U. a3 ]
  55. #define STATIC_SHIFT                3& |! Y+ q  M: l4 t9 c
  56. #define TCINTEN_SHIFT               204 ~! L, F& ^+ i+ L2 U
  57. #define ITCINTEN_SHIFT              219 w; m. m% w- `, b
  58. #define TCCHEN_SHIFT                22
    $ ]1 U7 R" h) C# {6 t8 |
  59. #define ITCCHEN_SHIFT               23
    - |) ]% W# ^6 d0 y  N* g+ |
  60. ' K! ^2 K- A8 a7 L3 r- F( s6 F; W
  61. static volatile int irqraised1 = 0;4 `% g; j  |8 Z$ \) i% z8 G
  62. static volatile int irqraised2 = 0;9 a% C/ S: y& s' Z, Q( Y2 i
  63. : U! `* K6 C1 T* O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' {4 @+ g$ N$ K+ a) V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! o  Z5 t7 S! x/ ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! o$ K7 H  b1 {: F! r' R

  67. : I. B& Y  i: ]" ^
  68. dma_addr_t dmaphyssrc1 = 0;
    % @+ g8 ^( j& U( b
  69. dma_addr_t dmaphyssrc2 = 0;
    9 G# e4 R" K( V( A
  70. dma_addr_t dmaphysdest1 = 0;& H; R) H, `. q' Z" P1 L& z' Q
  71. dma_addr_t dmaphysdest2 = 0;
    $ T- }2 t% `/ s5 m6 A: x

  72. 9 }& R" M# i; X" Q% u
  73. char *dmabufsrc1 = NULL;
    6 A+ Z) ]7 i- y' g6 k3 X
  74. char *dmabufsrc2 = NULL;
    1 E1 Q8 m, \$ E, @( u; D
  75. char *dmabufdest1 = NULL;
    # l8 M$ a  W% c# L# [! ]
  76. char *dmabufdest2 = NULL;+ [% b  b3 G3 X# x; u, R
  77. 1 z1 A% L6 F4 u! r- w! V
  78. static int acnt = 512;4 E; L5 W: g9 R: W
  79. static int bcnt = 8;
    6 _2 S+ Q* W9 N. y; U  _$ E
  80. static int ccnt = 8;, p3 x3 C* s3 y. M# R8 U8 T+ \4 B
  81. & z& X+ I: b) L  ~$ r2 |% p9 W
  82. module_param(acnt, int, S_IRUGO);/ p4 M$ x- n2 m8 B6 l7 f  Z# V
  83. module_param(bcnt, int, S_IRUGO);8 n. K' M! q% H7 |7 W% E/ L7 S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" `8 `' }0 n/ p8 ?9 `# i
7 \5 H) h4 E7 c  U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 \! e5 D) h7 ^0 O1 k; tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. {, @4 s4 r* d  g6 I4 h3 N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' [; X( |) ~+ O6 @: u/ m5 I1 b9 A" ]: E& H$ \% V' ?% y2 K6 t

; ]/ ~$ X/ {3 J0 m0 Z+ [" @" F* u; a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 17:52 , Processed in 0.039346 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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