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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 W. a, y9 M% }! q* J
  1. [code]EDMA sample test application
    6 r# }4 W( F7 a" R9 ?' B
  2. /*" e( T3 p0 \, i$ r- O5 V: J
  3. * edma_test.c% K2 \3 U) |6 g8 _( ?
  4. *8 g8 C* S! @' h6 [2 V$ X5 ]
  5. * brief  EDMA3 Test Application
    2 f7 i3 T# P& B5 M8 S
  6. *, @6 O: h4 m$ V/ n
  7. *   This file contains EDMA3 Test code.% d+ w5 z) X: Q
  8. *
    # J* i/ e5 x+ V. Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - L7 X6 v% {( i$ L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 X- ^6 c/ k8 B1 E6 ]4 [; E6 ]
  11. *         TO CHANGE., B7 N0 ~! B( d% J$ d+ J
  12. *
    " ^- f1 j% V$ T- u7 w, d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 P8 M2 D# q0 B& o' H
  14. *' V/ {5 a0 K  a! G& k
  15. * This program is free software; you can redistribute it and/or, W4 B) B; a+ w
  16. * modify it under the terms of the GNU General Public License as
    5 N9 @' M7 f0 t9 n2 Z: c) V- y
  17. * published by the Free Software Foundation version 2.
    5 Y4 {2 n) }) M! f! P% q6 g. Y
  18. *  |  f7 i. V: _: Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # {2 }9 x& z1 o1 X9 T0 \# E
  20. * kind, whether express or implied; without even the implied warranty" v/ E' M+ f5 b1 u6 B  M# a. e' {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! U- p7 T4 R9 }
  22. * GNU General Public License for more details.
    0 \6 M  H1 y, B; a8 H
  23. */8 f" A2 `8 a. N8 q, B6 \) T
  24. . }; I8 F4 [4 b7 ?1 S8 F; P; D
  25. #include <linux/module.h>% r4 y0 z3 l+ ~8 Z
  26. #include <linux/init.h>
    3 h% p  g9 z* e/ F" U1 c: {6 I7 j
  27. #include <linux/errno.h>, A. h, N7 P1 ^' O
  28. #include <linux/types.h>2 e$ G& m% V6 \4 e) k
  29. #include <linux/interrupt.h>' ]  `. m' B/ t: Q# ?! }
  30. #include <asm/io.h>1 w( g) z- R: {3 ^  }
  31. #include <linux/moduleparam.h>
    % k: _2 V1 Z$ N: W" }2 z
  32. #include <linux/sysctl.h>& X( m& A% C" r. r" v2 k5 A/ Z
  33. #include <linux/mm.h>* \! R" M; U7 E! \: k2 z
  34. #include <linux/dma-mapping.h>* X* s' a, h5 m

  35.   r- Q/ E4 k6 c( ~
  36. #include <mach/memory.h>
    6 U! u7 t% M- u
  37. #include <mach/hardware.h>
    6 p! P( Z1 A8 H) w  Q4 c. n
  38. #include <mach/irqs.h>
    ( F( l# p, G" z: Y  p
  39. #include <asm/hardware/edma.h>
    ! i: g4 C1 R: p: h1 H
  40. ( {5 _1 P0 b& T" Z, v' F
  41. #undef EDMA3_DEBUG
    1 s1 A, j  |8 ]7 Z
  42. /*#define EDMA3_DEBUG*/. f/ t4 w& i5 E9 v, v( q" I
  43. * T" D2 a: |( s; K" d
  44. #ifdef EDMA3_DEBUG
    * x$ G7 d8 g0 y' P$ V9 ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 v: o" u! {0 @/ B7 q& S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 W! s' C/ d2 m  Z9 ~8 p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): u: n0 l: j# ?
  48. #else1 q7 N& A; x% K
  49. #define DMA_PRINTK( x... )& N, u- f" @$ K: r
  50. #define DMA_FN_IN
    6 M3 q2 ^# a0 K* n9 }7 A9 s
  51. #define DMA_FN_OUT
    ) X) U% h/ s# l, `
  52. #endif: @1 O! {$ {7 j% G/ _  v& v! D
  53. + N3 T1 ~1 Y. g1 e5 }% F' V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 h& R9 t9 e/ B
  55. #define STATIC_SHIFT                3, V, P+ Q7 [4 T' F$ L
  56. #define TCINTEN_SHIFT               20) N6 p* o' v4 z$ S9 F0 W1 d4 {
  57. #define ITCINTEN_SHIFT              21
    + i/ _& u$ L7 T; j
  58. #define TCCHEN_SHIFT                22
    . ~$ G% A5 P7 k3 _; E# @: y9 x
  59. #define ITCCHEN_SHIFT               23
    6 p: o. o, i, n2 P

  60. * Z# Q( B0 c" D, ~
  61. static volatile int irqraised1 = 0;# U' ?2 v* x4 M" S4 W3 S# ?! [
  62. static volatile int irqraised2 = 0;# h1 ^& [9 U$ H

  63. 6 q- F) g; [1 U0 v9 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 u" t8 V* h3 ]" \" H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 L, i0 [7 {$ d3 T  O1 J+ e/ b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( B5 h* C& k5 I+ T* g" T6 \1 K  P

  67. 8 d% N8 }% R& e. b$ [% f
  68. dma_addr_t dmaphyssrc1 = 0;
    ; M& R1 Y" i8 [( R! {/ ^
  69. dma_addr_t dmaphyssrc2 = 0;
    6 \( p; J* M6 ]' W1 h- \
  70. dma_addr_t dmaphysdest1 = 0;9 h# B" U( e0 t5 J9 O0 p0 u
  71. dma_addr_t dmaphysdest2 = 0;
    $ |9 Q( Z6 h1 U8 [/ V
  72. 6 K5 A& s- v- @% o' R) ~0 X
  73. char *dmabufsrc1 = NULL;% a& L0 e3 {! b- e( K  s
  74. char *dmabufsrc2 = NULL;
    / q2 ]9 H) v) p, t3 W
  75. char *dmabufdest1 = NULL;) E( _5 I3 D+ N
  76. char *dmabufdest2 = NULL;
    , O& ?1 \: m% n- @+ ~/ U
  77. ! h" p% F, b* {+ Z- h
  78. static int acnt = 512;# s% D: v; z1 A& |; z* h
  79. static int bcnt = 8;
    0 g. Z  D& A2 l$ n4 T9 _" e
  80. static int ccnt = 8;4 O' J: s+ h* m

  81. 1 o+ d( X) J0 h1 V! t3 E( H( y) C
  82. module_param(acnt, int, S_IRUGO);
    7 g0 t7 _$ `: k! \
  83. module_param(bcnt, int, S_IRUGO);7 x, J  l+ g1 p7 e- a& e' ?# {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 I7 R9 w. Y: j1 v2 m# a0 D8 R/ Q* O* p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 ]( ]$ M% D" X) i' q2 T" _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 r" \. g5 v" L0 f7 t3 \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 `2 {7 _2 w/ n; s: u( B4 z% X8 c: [! |& j4 Y; W  B
6 Y5 s6 p. j; s5 x7 }+ V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 10:21 , Processed in 0.044610 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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