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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - H7 U, r2 g" ^
  1. [code]EDMA sample test application) ?1 d2 s0 a- o! N8 s
  2. /*) z+ N) x+ z5 e" b
  3. * edma_test.c
    ) k9 b* `# X7 e- m
  4. *
    3 j2 x, Z4 h0 g) z
  5. * brief  EDMA3 Test Application3 G$ s9 d" A7 ]' _$ O( R
  6. *: g* F' t5 e. `* q# [
  7. *   This file contains EDMA3 Test code.+ t6 C$ i" c3 E# J5 k6 a: z9 W
  8. *5 s& B+ i- L' \7 d5 c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( A' `8 R2 _" ~( g. s9 _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% g- i( H& L1 k' H; {
  11. *         TO CHANGE.8 {1 q" H0 A. P5 X' B6 s
  12. *
    6 c8 ^4 q) l/ D) h8 H9 Z0 h- j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 d- o. R) A3 O$ ^# P; e
  14. *
    3 p2 D5 s" {" K" g2 ^( B& j4 D
  15. * This program is free software; you can redistribute it and/or8 b8 z) Y- S9 k0 ?1 d, t
  16. * modify it under the terms of the GNU General Public License as
    $ H" p. t$ I1 q# s6 [* S& v
  17. * published by the Free Software Foundation version 2.
    4 a8 k1 Z3 E1 G) Z# e  Q" O
  18. *
    & J. Y3 H  d: j* r3 j3 j" e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & [; C( x' j2 ]# K" R
  20. * kind, whether express or implied; without even the implied warranty- l3 Y/ T& {* `; z8 a6 G$ @& g# p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" h6 q- s. a0 N) U) I( M$ A
  22. * GNU General Public License for more details.7 }$ [* w, w: ^& I/ g! G$ |1 o* s/ W
  23. */+ V! z% E4 F" b) [) P

  24. . I* ^4 b: j3 A2 E4 k
  25. #include <linux/module.h>
    ( \- x8 c5 h2 U  W5 y! h
  26. #include <linux/init.h>* t7 U8 s6 _: z% V* p& k
  27. #include <linux/errno.h>
    ( Q7 X$ V& f( J# T2 n9 X9 A
  28. #include <linux/types.h>
    / Z! \! L( H- B! \
  29. #include <linux/interrupt.h>
    7 d) |, J  L4 Z- t7 ~6 d/ V- S$ P
  30. #include <asm/io.h>
    8 S. L; ~" U2 R; `/ T
  31. #include <linux/moduleparam.h>
    * E$ E0 |( Y( S$ P) l
  32. #include <linux/sysctl.h>8 c9 d$ H( p/ N$ q
  33. #include <linux/mm.h>" ?( _( L, y& ?( y5 w! T3 ?
  34. #include <linux/dma-mapping.h>
    + m$ f8 W6 w2 _% r4 `* k' u1 v) I

  35. 1 d: ^. C5 o5 E0 }9 v, _- S
  36. #include <mach/memory.h>6 Y5 w# X' V! ?8 C! p/ X- `5 H
  37. #include <mach/hardware.h>. Y0 |  k! b4 P7 ^. E+ i
  38. #include <mach/irqs.h>
    , y; u  W# ~! v) V' j0 V
  39. #include <asm/hardware/edma.h>
    : c6 m( {* G; X* @  n0 `: d

  40. 4 w- e; i  X9 J6 c! B
  41. #undef EDMA3_DEBUG" _2 @! ~+ G6 i7 j) v
  42. /*#define EDMA3_DEBUG*/
    . w( V* S1 c! v3 n/ p' v

  43. : M: j1 `! E7 v, R: Z
  44. #ifdef EDMA3_DEBUG
    $ B0 z0 e; E0 K4 q5 Q! x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , B4 y( o% A( ^9 ^# a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 w" S/ r/ W4 V& `6 ~4 j% n, t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , t/ {5 k" v6 d" l7 }
  48. #else
    - q5 \, ~$ s1 R
  49. #define DMA_PRINTK( x... )2 w) {3 [* ?$ c! j
  50. #define DMA_FN_IN2 s/ f9 a0 s& m, f4 r$ P& E8 H
  51. #define DMA_FN_OUT
      F& R. R5 A# \+ J2 ~8 _. t0 G
  52. #endif
    + F' W& L$ e- H* F
  53. . T2 s/ a8 G8 `4 v8 {( s& C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; m& E  B: h6 A% M+ ]
  55. #define STATIC_SHIFT                3* }& U$ Q6 M  z5 h* o: C
  56. #define TCINTEN_SHIFT               20
    8 l* f) T* d, I& M# f
  57. #define ITCINTEN_SHIFT              21
    ( Y$ Y% i1 @! s5 @. m
  58. #define TCCHEN_SHIFT                22# ]+ B- ^. U$ V8 M7 Q
  59. #define ITCCHEN_SHIFT               234 H7 V# \1 g: C, Z$ `
  60. ! r: h# S8 a; Q2 ]. g  e/ m$ i! G
  61. static volatile int irqraised1 = 0;
    9 g5 F9 ?* o: `7 h, ?2 e1 t- y
  62. static volatile int irqraised2 = 0;3 U' W* b) l/ x
  63. 3 O  i3 i- X5 J% `7 Z6 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; s* q1 I& X) F  V8 A7 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % ^2 [  [/ S. y' O3 P( `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) K+ d; b: h+ b, @0 z
  67. * n5 I$ Y) Y8 P- u- D
  68. dma_addr_t dmaphyssrc1 = 0;
    ! W+ E1 k% n+ N4 V+ |% \0 i
  69. dma_addr_t dmaphyssrc2 = 0;' g( ^  @$ m# R* [9 }
  70. dma_addr_t dmaphysdest1 = 0;/ E/ e1 x8 ?. {, f: \' y
  71. dma_addr_t dmaphysdest2 = 0;- k2 [9 g8 E' q, _3 Y
  72. + o! E: D2 |$ g# F, g9 A0 ^
  73. char *dmabufsrc1 = NULL;+ \* h3 g. R) E$ o
  74. char *dmabufsrc2 = NULL;6 M6 G; w- S$ \
  75. char *dmabufdest1 = NULL;* o# q" Z7 t! b
  76. char *dmabufdest2 = NULL;: v3 u0 q" {8 Z9 ]1 i- \

  77.   @: t" h1 E  @; s4 P
  78. static int acnt = 512;
    ' z! H1 C- {: j6 Z  i; [" s
  79. static int bcnt = 8;, T# L  o- w5 B+ ^
  80. static int ccnt = 8;$ m$ F2 B7 o: p) ]( h. `) V, _

  81. 8 x- s9 Y. U9 @* A4 k9 ^
  82. module_param(acnt, int, S_IRUGO);& t" O  o! ?& z5 q- }
  83. module_param(bcnt, int, S_IRUGO);% W7 S1 p" {  U$ @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 t; y8 m' e4 x# ]. Z6 `
% B; q% u1 M7 A; ~5 a. z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. \# P: y  s$ Q4 F# E% V" D/ M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) L8 r  \0 ?' y( w3 V' [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; m# r) h; T6 s3 o2 i7 F
1 x4 j4 I; X7 @! T! M& `. D9 F6 h) V9 O: N+ c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-18 08:51 , Processed in 0.037896 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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