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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , I) \( y/ ~( m9 U# d; h& B# K
  1. [code]EDMA sample test application8 K* K- U" |) D
  2. /*. U, B3 E0 _" b
  3. * edma_test.c
    ; N, u! J% m3 {1 U3 E! C
  4. *
    ' \! a4 L' w! w) v8 j2 C! u
  5. * brief  EDMA3 Test Application( y+ ]) f, e9 N8 r0 U+ [
  6. *
    $ N# u2 T7 k6 O+ O3 C; r
  7. *   This file contains EDMA3 Test code.+ r/ J: d3 `2 t3 a) o# ~
  8. *6 x9 j' c% X% @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" _2 p0 b; C& z5 C- Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 I/ x! r* i2 d' S$ o
  11. *         TO CHANGE.
    ( Y" H5 M: a/ I/ F, r) o
  12. *  P! J# d$ A  s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 y! X; K, t7 B2 g
  14. ** f3 B. U! t$ d2 T( M
  15. * This program is free software; you can redistribute it and/or
    , {! y/ U) A$ G" Z  I# D: ^
  16. * modify it under the terms of the GNU General Public License as: ?( y. v4 [1 X& l' d: C; e- ]
  17. * published by the Free Software Foundation version 2.+ |' w8 v. z5 r# i4 m7 B" L8 o
  18. *
    ( e  _- M& ^3 N) |1 p* Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. Q9 t7 _3 J% {: l) p, V, X  k' t
  20. * kind, whether express or implied; without even the implied warranty  [7 V' S& a! N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ D: q& ^. T/ Q$ M
  22. * GNU General Public License for more details.
    7 X! D" q- T  d# `' V6 l
  23. */4 p2 V/ }1 x- u! G6 h) W
  24.   D; |) H- f0 L* ^2 L# d# j) P
  25. #include <linux/module.h>8 \8 |' I$ I8 l, F/ q6 l. A
  26. #include <linux/init.h>
    7 H* }# n. b& _5 X% F
  27. #include <linux/errno.h>
    . a* l; i# I. k3 Z: |  f* f
  28. #include <linux/types.h>
    + m, v5 g" L  D4 P' r' q
  29. #include <linux/interrupt.h>4 O. o7 T! P6 n# K+ S; T
  30. #include <asm/io.h>0 h# }. a1 h( R* P+ ^- G
  31. #include <linux/moduleparam.h>
    % ?) B- ~7 E, x2 J0 J$ Q0 c
  32. #include <linux/sysctl.h>
    ; Q7 Q1 ?9 I# N7 o/ C
  33. #include <linux/mm.h>/ z7 J5 k5 K7 q8 m1 _: k$ P
  34. #include <linux/dma-mapping.h>8 G/ f) k0 J1 d' ^! G

  35. 6 L3 R' w) d! Y3 h$ A9 b% \
  36. #include <mach/memory.h>
    ' y. `* F) p$ B8 Q! a2 o
  37. #include <mach/hardware.h>+ M4 r' g4 h% l
  38. #include <mach/irqs.h>
    $ @, x& r! f% F( L
  39. #include <asm/hardware/edma.h>
    ( `2 z- D, d$ Y0 m, P, J+ o. y

  40. 4 L+ c$ k) G! c
  41. #undef EDMA3_DEBUG
    0 P1 E( q4 Q# D. G, j
  42. /*#define EDMA3_DEBUG*/
    . }# P) N: ~( D  T9 w8 V( r, n4 Q

  43. ' K' y+ z0 z# m& Z  _5 e, o& x
  44. #ifdef EDMA3_DEBUG
    . Z( z6 a& e+ d( }0 F$ G) F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( a9 z( {* W* d. c' D0 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! z$ V9 A& b% s( h( d( J7 i$ S, t6 W# S9 ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 o2 y( h3 i9 X- W! E/ L0 B5 N. D
  48. #else# t, g2 `9 Z; v. M6 O
  49. #define DMA_PRINTK( x... )' w4 k8 u' Q" A8 J1 u# ^9 |
  50. #define DMA_FN_IN7 i9 r+ m- G. Z
  51. #define DMA_FN_OUT
    2 s9 Q1 G4 l  I9 b( L6 e
  52. #endif
    % n6 r2 c* I: n9 h* s0 g1 k
  53. * H. N( w0 i0 ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 d: h- ~' u& r+ F0 e& c4 ^
  55. #define STATIC_SHIFT                37 B9 \- H% ?4 _
  56. #define TCINTEN_SHIFT               20
    * z. I# L; Y* q9 K, Y
  57. #define ITCINTEN_SHIFT              21
    0 d* F6 f' h3 d3 n$ N, Q
  58. #define TCCHEN_SHIFT                22
    " W  x2 T2 q; Q1 U4 d& Q) D  L2 h
  59. #define ITCCHEN_SHIFT               23
    6 D4 C% W4 \  T& ?+ O. e

  60. # s. P; [- `( J, f3 K% T
  61. static volatile int irqraised1 = 0;
    + m! y- G% |3 K. K$ I" k% z
  62. static volatile int irqraised2 = 0;
    % |2 G& W7 `2 i5 P  D
  63. " O, N' E1 ^$ M& X% R; J3 {# C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      ]4 f  l  d$ @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 I- Z9 c4 p- B& D3 X* l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - X! {7 K. [+ H
  67. 8 F* C1 n. a$ p/ e$ f, a+ g
  68. dma_addr_t dmaphyssrc1 = 0;$ r3 X, J' @* u& O' b& E  [
  69. dma_addr_t dmaphyssrc2 = 0;
    , E/ {4 [" T5 ^9 V
  70. dma_addr_t dmaphysdest1 = 0;4 C! `1 B) P. P0 I' y& J
  71. dma_addr_t dmaphysdest2 = 0;
    4 G7 i- @# w" @0 H& [( y

  72. & }- H4 {$ I# }
  73. char *dmabufsrc1 = NULL;6 e# s7 s4 M, H8 c4 N0 U
  74. char *dmabufsrc2 = NULL;/ ~  f, [1 a% o! \% A
  75. char *dmabufdest1 = NULL;* M# D' r" q% X  W. C- }7 @
  76. char *dmabufdest2 = NULL;
    / U% |) P) n+ S9 ^/ C( k$ Z" o

  77. 9 `: f% x5 I4 x. ~
  78. static int acnt = 512;6 O$ ^6 p1 g; A: v3 S8 b3 ]
  79. static int bcnt = 8;, T& U" H0 t- _3 [- `
  80. static int ccnt = 8;
      N5 n1 q0 q' g9 V, }. f3 U1 n
  81. 8 b4 k: v( A7 I( a0 _0 Z  m
  82. module_param(acnt, int, S_IRUGO);3 s* A1 q; }3 x  O# g
  83. module_param(bcnt, int, S_IRUGO);. O6 n/ e8 b6 ?8 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 y# ^3 ?" d! Z- q/ D1 W% [
* C, W! P7 |0 O( L3 E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ t% Z/ @* N' ?9 g$ Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: ^& B  o: U# s# v! H5 @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 w" M  [$ g. f* M+ @/ @# m5 s# g* K4 c! n3 [7 Q
, s& D) q1 i) G# b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 19:37 , Processed in 0.038931 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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