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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" y% v. m! k# m* E1 I
  1. [code]EDMA sample test application
    $ ^9 T! G- O/ @, F$ Q8 h
  2. /*
    " f2 v- r+ U% f  _" ^2 O3 Y
  3. * edma_test.c
    2 k; X6 Z7 Q3 T/ y$ l
  4. *. b1 Z, m, S2 G8 m, ~# k2 [
  5. * brief  EDMA3 Test Application8 b: J, d$ t7 X2 N; Y9 F
  6. *
    1 D3 }2 p; Z7 T$ Q3 |3 B
  7. *   This file contains EDMA3 Test code." i$ V8 ?0 T6 O4 y: B# z
  8. *" j+ f3 V- a) ?' Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( u' \( |3 Q" E3 j$ M+ o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* N3 K. v( U% h* P% l
  11. *         TO CHANGE.
    ( h& X: C# j/ u; N$ s3 t
  12. *
    1 i+ p7 j2 }' h9 |' r, a6 P) X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; k7 R9 N" t+ F1 e6 Q& B- h7 w
  14. *' r3 R1 |  U6 z' P, v
  15. * This program is free software; you can redistribute it and/or2 _4 v" M6 h- M/ g2 \8 g6 {
  16. * modify it under the terms of the GNU General Public License as! q7 A5 G3 C) O9 Z2 ]
  17. * published by the Free Software Foundation version 2.
    - o0 u% u2 E. x, l$ l6 H/ c
  18. *# d7 I; L1 V* u- ]* g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 k4 R. A: Q# d+ L( D9 X4 |
  20. * kind, whether express or implied; without even the implied warranty, t' b) l# C# `- ?3 j# X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # p6 S& v1 }$ H. ~
  22. * GNU General Public License for more details.) b9 c# e9 g* L8 D, @# g( r* N
  23. */5 Y' T& u) r5 o

  24. 3 Y% [- B- F+ g" B
  25. #include <linux/module.h>8 n$ R  i7 M5 Q/ z! u
  26. #include <linux/init.h>
    & K9 i4 n, d, E1 b6 l. e, }( c  O
  27. #include <linux/errno.h>
    * t4 ^3 V; S0 G
  28. #include <linux/types.h>
    " g/ B% t3 J: b) `' L) `
  29. #include <linux/interrupt.h>$ E; I  n& D7 ^
  30. #include <asm/io.h>
    , D" w  C: y( }2 R2 F5 u
  31. #include <linux/moduleparam.h>% @# r" J3 m# y; P' H3 U# Q9 w. y
  32. #include <linux/sysctl.h>
    * w; e1 b- o1 V; S
  33. #include <linux/mm.h>; u9 H% z1 P2 e$ k
  34. #include <linux/dma-mapping.h>
    ( @4 ^/ p/ L8 C$ x, D9 V

  35. $ s3 x/ y) u; W0 w2 \. v  g
  36. #include <mach/memory.h>( m/ c, f  k. G
  37. #include <mach/hardware.h>! M( s/ j3 X+ J$ F; D
  38. #include <mach/irqs.h>
    9 Q' Y9 s' y/ m9 |
  39. #include <asm/hardware/edma.h>6 U) o! ]$ K0 C! d

  40. 3 n1 r+ g: b1 x( l
  41. #undef EDMA3_DEBUG
    9 |; u- t! u  l4 r4 u% A
  42. /*#define EDMA3_DEBUG*/% ?+ q( s( K  e
  43. % E. C3 j* y( b5 a
  44. #ifdef EDMA3_DEBUG3 o3 M4 u: n, `! K: `! u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! E) Z, X0 k' T5 @9 ]8 Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 C3 w" G0 e7 K! d7 M+ j; [8 g! V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# p8 V) m4 k% K& a* E: v4 |
  48. #else
    + \! b- s5 f9 K5 l
  49. #define DMA_PRINTK( x... )- z  o4 s9 Z2 r: s( r
  50. #define DMA_FN_IN
    : r1 n& J) C& l2 c8 V9 t
  51. #define DMA_FN_OUT
    : B9 h3 V* m1 t# ]4 m& ^; Y; |. ^
  52. #endif
    * G& n; X4 T: w

  53. 0 T" _1 e4 O" J% U: _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) _0 y  F, l$ y& ?9 h: }. C
  55. #define STATIC_SHIFT                3
    * c! R& }" a( H& e0 Z0 `5 r
  56. #define TCINTEN_SHIFT               20  `( F6 e$ [8 W* s" i. R$ E
  57. #define ITCINTEN_SHIFT              21/ G# l4 w" d" x& O, R6 d  p- \
  58. #define TCCHEN_SHIFT                22
    + z+ R0 g9 Y. `6 x, U* F8 C- v) p- Z8 V* G
  59. #define ITCCHEN_SHIFT               237 F) Z2 C' y# G1 M# _
  60. & F& u  \0 l! t# O
  61. static volatile int irqraised1 = 0;* W7 D# J& w2 @; {2 j: i/ H
  62. static volatile int irqraised2 = 0;
    * k! \$ A; v# N% {0 e! V
  63. % u: ^. H# q1 L) P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& x' s. t7 a9 o4 G7 O- B- ~7 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 e+ V. w2 I5 q% [5 I; O& V4 t! ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 q* {  k  K: E! B
  67. / N0 T" R) |' \  E3 q' m
  68. dma_addr_t dmaphyssrc1 = 0;- Q  M% B" V" z/ T8 p4 M
  69. dma_addr_t dmaphyssrc2 = 0;
    1 _1 ]& R5 {! a- W9 C) ^
  70. dma_addr_t dmaphysdest1 = 0;
    2 t" q; a2 f" M- J* b/ y$ Q" N( t
  71. dma_addr_t dmaphysdest2 = 0;
    1 u/ j7 ?% P6 D( _% K8 l1 Z
  72. 9 f4 H7 n. Z1 _8 n4 P% o5 i" T1 |- a2 E
  73. char *dmabufsrc1 = NULL;2 Z) v, q' O7 ?/ \7 y( M
  74. char *dmabufsrc2 = NULL;
      j2 D! ?+ T- n+ c  J% }- Y
  75. char *dmabufdest1 = NULL;& P% Z# a- n) y) n% ^8 V
  76. char *dmabufdest2 = NULL;  c( a: o6 Z& {% H, E; ^' t

  77. . }6 d3 z+ t( P- i
  78. static int acnt = 512;
    2 R$ ~7 t7 P0 D/ f# G8 o
  79. static int bcnt = 8;" _# @  T8 J- W; y/ I
  80. static int ccnt = 8;
    - h4 K, d, u# L4 W

  81. . d6 A, S5 }" g3 ^) y& y+ b( F
  82. module_param(acnt, int, S_IRUGO);
    & {  e' f/ `* K4 c1 `. h
  83. module_param(bcnt, int, S_IRUGO);
    2 P2 c/ Z9 C' Y5 h) r# Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 e. r) y7 L# c6 X; ~4 N( }" U/ K' r0 @# R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; @  p4 p2 y1 n8 N: ~. V3 Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" Z0 j+ [( _2 `$ ^- y+ F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ S( G5 [3 D4 K( _# B
% n4 g5 s' L  [( S* E; e1 X: Q

2 C# s: h! M4 P: p+ g# q( I& m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-2 09:14 , Processed in 0.040037 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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