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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! n7 C6 f; l5 J
  1. [code]EDMA sample test application2 V2 Q* L* K2 H' c% y( @; @
  2. /*
    8 z. y% U% A% R/ |; \
  3. * edma_test.c
    . O, O4 K; `3 z  p) z
  4. *
    0 E4 X- I; ^- Y# y# v
  5. * brief  EDMA3 Test Application$ U  _  `5 T7 i  |" f( e
  6. ** i% t: ~1 f' |2 v9 H$ ?4 [/ k" y
  7. *   This file contains EDMA3 Test code.
    5 J5 c% Y4 p1 n$ V( P
  8. *0 U8 K2 Y# @( d  z# O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % I+ \! t+ O0 W0 T+ `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; V$ Z3 b% o$ q  y, z
  11. *         TO CHANGE.1 j% s' s: i+ B0 V
  12. *# e5 {* L5 C, g. N( F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 P) D# m' u2 e; u& r
  14. *
    8 ^4 }7 k+ f! j
  15. * This program is free software; you can redistribute it and/or% T* I( j' w5 r( c9 C& h- X
  16. * modify it under the terms of the GNU General Public License as; |' }' v5 M: q9 U. A
  17. * published by the Free Software Foundation version 2.
    + E/ _( g4 z. l2 S9 |
  18. *
    $ k( e( F' b4 K6 c- i% G' ?1 @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 o  E! G* [* Q( b" @
  20. * kind, whether express or implied; without even the implied warranty
    / b4 v, i0 l0 f/ p5 V0 \9 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! y5 J# v" ^& B% T
  22. * GNU General Public License for more details.5 o7 o4 `5 R- U
  23. */# {1 [. M! h( b0 ^" g
  24. / H% H+ W; i% M+ E
  25. #include <linux/module.h>
    ) p3 ]1 l1 ~9 i! Z/ Q4 @
  26. #include <linux/init.h>% \( }( X  N) U* E0 h6 Z& J# v
  27. #include <linux/errno.h>8 K$ V; U; a1 O0 V5 c4 D
  28. #include <linux/types.h>+ {7 N: E( G( g0 a/ ?* `
  29. #include <linux/interrupt.h>- N- m- |1 u* l
  30. #include <asm/io.h>% E7 g* m  s4 Z' P7 J; g, g
  31. #include <linux/moduleparam.h>
    , T3 k4 D1 ?+ R: P1 |0 k! X) w
  32. #include <linux/sysctl.h>
    & s  z/ ?  r  w1 |
  33. #include <linux/mm.h>; g! s$ H( ^; {; z8 G2 ]
  34. #include <linux/dma-mapping.h>
    9 l, }5 q; P4 b: z5 V& `
  35. ' |7 A! M/ f4 u6 t9 g
  36. #include <mach/memory.h>
    & A. I4 a( v0 f- n" Y
  37. #include <mach/hardware.h>
    8 _8 y1 u9 i) P
  38. #include <mach/irqs.h>+ `1 n" u* V% Y& m" G* y
  39. #include <asm/hardware/edma.h>4 x  g* c2 A/ d5 `

  40. 5 L3 W2 `- t' @& F( j4 {# {
  41. #undef EDMA3_DEBUG
    ( T: A# d# E! @% f( e
  42. /*#define EDMA3_DEBUG*/8 P9 f( ]3 b) v/ H8 s
  43. 4 h& P9 {' Q+ ]6 H7 d; _
  44. #ifdef EDMA3_DEBUG1 A9 B) ^, a2 r  c6 x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). m$ o2 m) V) h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 o2 n% v* J& o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). G* m9 {# M* U3 c# O7 u. t
  48. #else5 H) o8 w1 E7 M! `2 w
  49. #define DMA_PRINTK( x... )' S1 p2 o9 E# U9 d6 ]
  50. #define DMA_FN_IN* {! H+ a) y1 |$ @8 R
  51. #define DMA_FN_OUT* a' j- L- _- Q3 H
  52. #endif
    + d: }0 v& x( x9 V5 Z7 R& s

  53. , H: |6 I7 }+ p6 u, m7 P$ f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 t5 g, z0 _1 X: A4 }
  55. #define STATIC_SHIFT                34 n6 D/ }- q4 \- i  W+ ]
  56. #define TCINTEN_SHIFT               20
    , u* v' D# S$ \" g( T
  57. #define ITCINTEN_SHIFT              21- U: Q7 _/ T% \* s
  58. #define TCCHEN_SHIFT                22; ^7 W0 V/ e$ W& q3 Z. n
  59. #define ITCCHEN_SHIFT               23
    0 v7 K9 J; d3 a3 |* K" E

  60. $ Q$ S3 U8 x4 \. S2 I0 U8 U
  61. static volatile int irqraised1 = 0;
    & [+ M) Y. W9 O- U# ]
  62. static volatile int irqraised2 = 0;, e" {6 |4 `5 e. ]. R. Y  S6 K
  63. ; x) b; w  l7 I- s: D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 E+ a0 K8 G6 D5 j% T: o0 e$ q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * ~3 p  O* ^6 o+ H( \$ `9 K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: L; B/ \. Z5 j, s% i. b( {) ?

  67.   d* W) u5 C# M' X
  68. dma_addr_t dmaphyssrc1 = 0;
    ) x4 }8 D( r4 g6 f& S- c
  69. dma_addr_t dmaphyssrc2 = 0;: ~1 h: T, U7 E5 _- M9 }4 K
  70. dma_addr_t dmaphysdest1 = 0;
    ; C) Q( N2 H9 V
  71. dma_addr_t dmaphysdest2 = 0;
    9 g7 @' u& \2 s; i  a" \

  72. , f. p0 F4 X" |) O) y
  73. char *dmabufsrc1 = NULL;
    7 v" W# B% p% E1 L0 l
  74. char *dmabufsrc2 = NULL;
    9 z( d5 K( J4 m+ c
  75. char *dmabufdest1 = NULL;
    " ]/ i' r  l7 D4 V; U" E0 @
  76. char *dmabufdest2 = NULL;
    # }! {% A5 J9 Y

  77. 4 l9 n2 l  _7 B( C/ c- R
  78. static int acnt = 512;
    ' k) O5 g* f( Q2 h/ L7 h* D6 S
  79. static int bcnt = 8;
    0 O9 l% S7 o( \1 i. {
  80. static int ccnt = 8;- r) W8 i0 o" _5 u

  81. 8 r# F  e7 B6 B
  82. module_param(acnt, int, S_IRUGO);5 W) y0 d$ j& X: Y6 T% J
  83. module_param(bcnt, int, S_IRUGO);1 Z7 a) r  G) B9 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ ?8 d5 K$ m7 @7 f

  x( D+ E" ^4 D# a( A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! d5 R0 s; \6 P2 L# k/ U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) S& Z1 ?0 D6 }; E6 Z- a4 F; {3 C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% W% ~( G9 W7 J/ t' e+ ?6 F. t* w3 i. ?: C

4 A- y! M2 E9 c) O+ ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

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

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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