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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 ^0 R! j. r5 [( j5 x
  1. [code]EDMA sample test application" l+ `5 Q; i# @7 T& ^1 B; V9 v# c  h
  2. /*4 X* ^, a8 X# S, U
  3. * edma_test.c
    4 E' y1 @  _) z, o  ]9 M/ b( E; I4 @+ j5 k
  4. *1 R+ Y; N. U$ Q0 h& D4 A
  5. * brief  EDMA3 Test Application
    5 x% G( W* Y* V0 d7 N$ f
  6. *4 ~$ b. f8 y) m% S2 S5 e' ~& D8 p
  7. *   This file contains EDMA3 Test code.1 Y6 v4 V' T, F. G6 ?
  8. *2 s# F( q% v; F) L6 s4 [: x5 W, o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : Y/ l$ G& E  ^, r& ]8 K7 u0 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + S7 I( s. h+ c
  11. *         TO CHANGE.
    4 t9 U7 Z% J7 q, }4 H
  12. *- s4 {; Y) a+ e  L4 o5 `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# W' s' V, \# d, J$ E, \( L1 k
  14. *
    : P* Y' g) N4 H. u
  15. * This program is free software; you can redistribute it and/or+ k( p$ |# v2 W/ j6 A
  16. * modify it under the terms of the GNU General Public License as' w6 J/ m* [2 k1 [$ I* n9 W  ^6 I
  17. * published by the Free Software Foundation version 2.
    ; S- q6 }) {4 _- G) T( A. T
  18. *
      q5 B# h/ _' _( G2 ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % c; Q5 d: C3 e- y7 U
  20. * kind, whether express or implied; without even the implied warranty
    : ~' m+ e+ X# @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - N+ p) r, j+ J' d1 L  o
  22. * GNU General Public License for more details.
    * x& \, v* H9 I8 r
  23. */  E8 ]: N. j7 N3 i# X2 s
  24. 2 u# l0 a, j% r( r' V2 H
  25. #include <linux/module.h>
    ! J& V% t, H) r# r1 c0 S1 Y5 H
  26. #include <linux/init.h>
    0 m+ `/ I3 ~+ Z
  27. #include <linux/errno.h>' A: i8 f0 U8 Q+ n5 V6 r. J' \
  28. #include <linux/types.h>
    , N, A' }) c$ |0 g) `9 Q" e
  29. #include <linux/interrupt.h>$ ^7 B6 t; }! i3 O6 P
  30. #include <asm/io.h>( a. o& f5 P* e) `- U
  31. #include <linux/moduleparam.h>
    . q3 M) O" K: x1 l# t, R
  32. #include <linux/sysctl.h>
    6 y1 x, P7 O  u! Z8 i1 v
  33. #include <linux/mm.h>
    9 c+ T# g/ t" D# v; H6 X3 k
  34. #include <linux/dma-mapping.h>+ o) V/ d3 p7 }4 _
  35. 4 y9 f3 s) a3 v- `' q" p  }
  36. #include <mach/memory.h>0 G/ i$ S0 g# T% j  Y- q/ r
  37. #include <mach/hardware.h># B+ v, L2 g7 L6 G- Y3 N
  38. #include <mach/irqs.h>- P* U1 `7 \+ c7 U
  39. #include <asm/hardware/edma.h>
    * n/ G- H& p0 b% p* D. `

  40. $ t6 ]5 b: C' j% B2 P1 u+ I
  41. #undef EDMA3_DEBUG
    ! U$ V' @4 J9 \
  42. /*#define EDMA3_DEBUG*/3 X% `/ W2 ]% g; x: i3 Y

  43. 8 i7 v% e- E7 g8 @
  44. #ifdef EDMA3_DEBUG9 {& v0 L" J" W7 }: V- H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ x5 e7 m+ w! Z5 p6 I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 Q; u9 Y( d6 z' U# g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 F/ R" R! @1 w0 I
  48. #else
    4 ^8 p; u- C. e: i& X* U
  49. #define DMA_PRINTK( x... ): n0 v" G2 O: A! Z
  50. #define DMA_FN_IN$ n9 p' n( _/ t7 ]: N
  51. #define DMA_FN_OUT
      U/ [( |$ h! e* f. g) p
  52. #endif: H# Z! p2 l! g6 k% y$ ]: C8 _. G2 r

  53. 4 x4 W" q1 ?; z. y6 ?0 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % R( e' `6 g8 P
  55. #define STATIC_SHIFT                3
    3 r* T, f3 ~8 O: q4 d# b' }8 e
  56. #define TCINTEN_SHIFT               20
    2 e, |, ~0 i" s6 U% U1 E& e
  57. #define ITCINTEN_SHIFT              21
    . y( G% Q  G3 p! o# I
  58. #define TCCHEN_SHIFT                22; M$ O( S6 p3 r: y6 _
  59. #define ITCCHEN_SHIFT               23! j! j. F- H9 D# Z: ?" c

  60. 2 B6 t% w+ n  {! B1 O0 }
  61. static volatile int irqraised1 = 0;3 _! g4 f5 k  F% [$ w
  62. static volatile int irqraised2 = 0;4 \- |3 a' L/ |# e- l9 l& E) Y

  63. 3 ?% d  D! V  M! r% N. U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' Y. ~: v5 r2 H$ j( w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: w" L5 i. _. ?$ B: x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ d! ?' ]  S; ]- O# \; u5 r
  67. / ^/ e/ {# e# Q9 }
  68. dma_addr_t dmaphyssrc1 = 0;
    / F7 Q3 E  B/ `/ j) O" `- B' m) x
  69. dma_addr_t dmaphyssrc2 = 0;' C0 k6 S# I) H( R  f! ^2 V7 H( a
  70. dma_addr_t dmaphysdest1 = 0;5 `/ q5 ~: F8 V/ ~5 W
  71. dma_addr_t dmaphysdest2 = 0;' |6 L' a5 i- o: e6 ?& E$ \1 b
  72. / x) z* j2 H5 g# n) z
  73. char *dmabufsrc1 = NULL;
    & R& O( H1 ?+ \9 ~) n4 z; I/ J
  74. char *dmabufsrc2 = NULL;4 T# A% N* J2 [
  75. char *dmabufdest1 = NULL;- a. X* F0 ~  k% F* Y2 A
  76. char *dmabufdest2 = NULL;, C( v: \1 c& R4 t

  77. 1 N3 j, f8 _7 c* I8 y% g
  78. static int acnt = 512;
    - R! H8 y7 @" A. D* e; y
  79. static int bcnt = 8;  ^4 k' c6 v, e, J# Z
  80. static int ccnt = 8;4 s7 H% x2 y/ \- e" m
  81. 1 S5 Q1 V, B& [2 C* Y" i" z
  82. module_param(acnt, int, S_IRUGO);
    - [# K$ o# G" s
  83. module_param(bcnt, int, S_IRUGO);
    + x; s" R( K( Q8 N% ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* L4 q  P/ Z0 @5 i, o. P8 ~- u7 o. i' Q2 b* k+ R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 {/ J- ~% r  j# {. w8 `5 t8 D- [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  ]2 S9 o9 N6 C! x9 }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* T3 k1 Z+ [& q6 F
- u1 V; D0 D3 h  Z& z9 A
* G9 y- r% H0 F8 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-28 02:44 , Processed in 0.042610 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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