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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; R, Y6 C6 |% E9 B- c
  1. [code]EDMA sample test application
    # L1 p; y# C+ Y( o, H% ]+ k1 y+ e
  2. /*
    - W! K& D# l' e) S9 f# }9 r" L
  3. * edma_test.c6 J2 N3 V( U/ b* L& A
  4. *& Q' _  Y: v, \) @! n
  5. * brief  EDMA3 Test Application5 [9 `/ c/ o$ R6 p) {! u
  6. *
    5 ^! B6 o  M' Z7 g# p3 v
  7. *   This file contains EDMA3 Test code.: U3 f3 u, Y. Y8 B+ ]
  8. *1 }3 p9 I. z  m) p. w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / A) A) |7 X, P5 j7 Y# p+ d9 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% l6 @  `; r, ]0 {- S! c/ }8 i
  11. *         TO CHANGE.) y" F+ {% Q- ?% M$ o7 B7 t* m* W
  12. */ A; T. G4 [7 F4 F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ u( |$ c, X6 _: j+ [
  14. *
    8 Z" e& R1 K( B; {$ m: m
  15. * This program is free software; you can redistribute it and/or
    / A' v5 v7 k# U$ y
  16. * modify it under the terms of the GNU General Public License as+ ]+ N; P3 ?7 }! t; A' U2 _
  17. * published by the Free Software Foundation version 2.. P) |( f1 a' D) [/ W& e
  18. *
    + h+ m$ j8 h5 a; X# y$ M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " t: ?4 d/ d/ t  m. \( j6 N" E
  20. * kind, whether express or implied; without even the implied warranty
    7 T" f: K7 N+ ^# K# a' @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 B" ^. z( x9 E1 J7 e6 |5 K1 V
  22. * GNU General Public License for more details.
    * e- [; |# R& g
  23. */. P. L" K( p  Y/ U, T: E
  24. 2 S: k  \/ t; o
  25. #include <linux/module.h>
    : P7 B6 Q! c. v
  26. #include <linux/init.h>. z# B& x; H, o. `- R, h
  27. #include <linux/errno.h>! B4 d& v7 h! o
  28. #include <linux/types.h>
    ; M. M) n2 @9 T
  29. #include <linux/interrupt.h>
    1 }2 H9 d3 n3 [7 W/ `9 E8 J8 w
  30. #include <asm/io.h>8 v9 o% I6 d3 T/ Z
  31. #include <linux/moduleparam.h>
    - E6 L) ^& K" _3 z8 j; P
  32. #include <linux/sysctl.h>
    " i: B; ^9 }$ Z" R4 l1 Y, `5 l
  33. #include <linux/mm.h>9 @$ w4 m# b( h; R7 I) R
  34. #include <linux/dma-mapping.h>
    7 `, Y% Q  Z3 H7 x9 J
  35. ! ?! M0 [7 f3 d
  36. #include <mach/memory.h>( S# \$ C: G- r/ C! z
  37. #include <mach/hardware.h>
    , }. Q5 x1 M; T1 x2 _( `
  38. #include <mach/irqs.h>* H8 Q% g5 t# k" ]6 J  G8 h
  39. #include <asm/hardware/edma.h>- N$ a5 _6 I/ @' W/ g3 c& T# Z
  40. / `! A, F* S7 g# M
  41. #undef EDMA3_DEBUG
    , u& r- v) `& ~4 c$ H$ |; Y
  42. /*#define EDMA3_DEBUG*/- `. @5 |2 k6 V0 x* S
  43. 3 _) p$ P2 A. j- |5 {
  44. #ifdef EDMA3_DEBUG+ l& o% L: b5 }( S& [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 D; C, v) b+ [- l, Y$ B4 b7 \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# ~* Q! V, q$ E2 ^$ W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% x2 I/ a- e- ~4 ]! q
  48. #else' ^3 d# R0 a2 E- [4 G! E" T6 T
  49. #define DMA_PRINTK( x... )
    ) Y: c1 E4 P3 b6 m& J
  50. #define DMA_FN_IN8 S( X6 G+ x+ ]# j( Q+ V6 e$ {
  51. #define DMA_FN_OUT; _: R3 B( y8 \2 u
  52. #endif
    - X, m; E/ x  V5 e0 ~

  53. + H! k3 Z) a' _% G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! U% [$ E- R9 B# K3 h
  55. #define STATIC_SHIFT                3
    0 m0 P, c" `; q. |0 N! d4 x
  56. #define TCINTEN_SHIFT               20
    " Z: a" I9 A6 W6 s' }
  57. #define ITCINTEN_SHIFT              21
    8 ^/ }3 O# L7 s: |5 A
  58. #define TCCHEN_SHIFT                22
    - _' `4 y9 F9 Q, R+ o
  59. #define ITCCHEN_SHIFT               23
    ' T" G9 u4 }+ h7 s. D0 f
  60. , T: U+ h6 q/ T- b5 S( S+ F  k& S
  61. static volatile int irqraised1 = 0;0 Q0 t, J; M- g4 L* W' ]
  62. static volatile int irqraised2 = 0;
    ( l8 s- r" i! z9 w  D

  63. + S/ u% b) h& A1 ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + f+ j- B1 J+ Z$ @& N5 [( C2 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 X# c$ M8 ]! g  Y, y2 v3 A. D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: B; x4 P6 h+ \4 v

  67. 7 M: \9 n. m% Q8 n7 S7 W. X( T* [
  68. dma_addr_t dmaphyssrc1 = 0;# ~: E( T/ g; c# O4 u. b
  69. dma_addr_t dmaphyssrc2 = 0;* |; G9 ^4 _. E* f1 N9 S4 J8 b9 t7 X2 F
  70. dma_addr_t dmaphysdest1 = 0;" O8 `" C; r" ~$ J# [, T5 x  l
  71. dma_addr_t dmaphysdest2 = 0;
    2 J- [; ^( ^3 r5 K

  72. ' b3 F3 y; Q( @
  73. char *dmabufsrc1 = NULL;
    5 Z- W5 ~  d8 D  o
  74. char *dmabufsrc2 = NULL;
    ( ?' c0 U; t% q1 ]4 x
  75. char *dmabufdest1 = NULL;5 E  e. T" Q6 L* U3 @. y
  76. char *dmabufdest2 = NULL;
    4 B0 t* o* j% z# Z# d
  77. 0 |3 ?. m+ S8 J2 t2 f9 _
  78. static int acnt = 512;
    ; [4 T5 Y* z( T
  79. static int bcnt = 8;* o  H% l7 Y% p0 F( l: D) o
  80. static int ccnt = 8;) A6 S) i) n7 l. e2 K1 M- R

  81. 8 Q4 D) m- S5 L& q4 H: h! M
  82. module_param(acnt, int, S_IRUGO);& V( j& H, N, x4 e* p; F
  83. module_param(bcnt, int, S_IRUGO);
    $ I0 P  P/ N- {9 b5 B. _9 @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% q* [  F8 m" I6 q
* L0 ^0 e2 g! N# v9 e- {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, U# s, H, _4 M8 C& l6 Zarm-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 b9 k. j' A9 C+ w  Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 B! J7 c; p  n; Y; G; w7 X/ ~

" \9 O2 G  v$ V) p: F" D. S: E) R: O: L0 K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 14:11 , Processed in 0.045947 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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