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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 p/ L( O3 `1 z, |/ B  P- c
  1. [code]EDMA sample test application6 h( d7 f9 p# x1 L
  2. /*
    5 n5 }% J7 a) v% Y- L# j
  3. * edma_test.c+ Z* ~& |1 a  r
  4. *) }. F' e9 p3 o* ^+ T
  5. * brief  EDMA3 Test Application# Q7 C4 D* u, c% J1 [
  6. *
    / q) @: L6 G2 i" V
  7. *   This file contains EDMA3 Test code.
    1 q9 {7 X, p* p0 \
  8. *
    - G8 A1 Z/ U) u: ?: M% O0 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' T, R1 e2 d2 ^0 q) p  D3 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + _, r6 H& ?& L1 j0 i6 J. D* ~- b
  11. *         TO CHANGE./ ?( p# X0 y2 T' f: x4 O& n$ h2 ^
  12. *) L; _, R  _- q5 T2 K9 k$ T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: \% S5 F1 ~! n7 Q) H5 k1 _( ?1 ~* r
  14. *
    8 w/ w* J! \- y% O: W: g
  15. * This program is free software; you can redistribute it and/or
    6 X! |0 V/ c$ S! C4 L
  16. * modify it under the terms of the GNU General Public License as2 w' c9 I. e+ o: s4 X; U
  17. * published by the Free Software Foundation version 2.
    2 |! a/ x$ \" k
  18. *' f/ X# N% B, e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; `! `/ ?& b, n* h: I4 i
  20. * kind, whether express or implied; without even the implied warranty
    9 Y; h: U& a) @4 ^0 ~1 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      C# O# y- R7 T: N
  22. * GNU General Public License for more details.
    & M# C) X, q7 J4 Y
  23. */
    9 @% L& l! Q. `7 U5 Z% f' \

  24. % k4 `* Q% E+ o
  25. #include <linux/module.h>
    % A) s, @( h& H3 R# R1 i) E9 ?
  26. #include <linux/init.h>
    : v! U5 Q; Q& g, Z5 n
  27. #include <linux/errno.h>" X6 u  f+ p$ s; p4 y
  28. #include <linux/types.h>- ?" x6 T% Y2 F7 o  v6 Z7 [
  29. #include <linux/interrupt.h>
    0 f  V) D* P1 G1 E
  30. #include <asm/io.h>$ D& B/ u% Z4 H5 U7 P
  31. #include <linux/moduleparam.h>
    , K* `. j. o/ X7 L, Z
  32. #include <linux/sysctl.h>! {; m4 k( x& A7 Q( ^
  33. #include <linux/mm.h>0 g  g8 G% }& M3 |, w2 r$ S' P
  34. #include <linux/dma-mapping.h>+ b* s, M6 V1 F8 v9 v
  35. 3 K8 K4 k" o6 J0 t# C3 W' A
  36. #include <mach/memory.h>
    ! ^5 {% G3 A+ h; s
  37. #include <mach/hardware.h>
    9 Q, H& i+ B2 F& |
  38. #include <mach/irqs.h>+ \' }" w" z1 z/ c5 u1 w
  39. #include <asm/hardware/edma.h>, S, U) J5 D* S

  40. ; K2 ~/ k8 J: a7 v+ k
  41. #undef EDMA3_DEBUG' P& j( s1 Y2 @& O, `$ \; u
  42. /*#define EDMA3_DEBUG*/$ U" W$ P/ e1 M2 E  T

  43. - w% Y6 B$ Q+ h$ j5 w1 [
  44. #ifdef EDMA3_DEBUG
    3 p( l8 y; p: s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- C+ d/ S  C3 S6 [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* S- R4 F2 g+ A- u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 S% a9 k. u/ F% f/ ^/ J! L
  48. #else
    4 Y% |: c0 D8 G6 u% ?
  49. #define DMA_PRINTK( x... )5 n0 i) v: v' {, N/ g2 G
  50. #define DMA_FN_IN
    & f2 E" P0 O8 T% F! e# S, S  h+ g
  51. #define DMA_FN_OUT# e, q! x9 I$ C, o- D& p8 J
  52. #endif" t% I  X) a/ \
  53. + _5 M+ R: R7 i8 I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 k& @' D- _1 v% s
  55. #define STATIC_SHIFT                3
    9 l/ K, b' e+ Z& t0 z' C8 p
  56. #define TCINTEN_SHIFT               20* W6 P+ @6 }* S2 T' |; _( \
  57. #define ITCINTEN_SHIFT              210 t* k' q, q8 ~: P
  58. #define TCCHEN_SHIFT                22( O* r5 u$ d+ ]' d1 R+ i
  59. #define ITCCHEN_SHIFT               23$ K' K; l) c( \( S) G6 X( @# g

  60. 0 q7 C5 [& p" G5 q9 {( z3 W
  61. static volatile int irqraised1 = 0;) _" j/ a# M: B" o
  62. static volatile int irqraised2 = 0;
    " L1 f) O. d. d9 X* w4 j

  63. $ q9 E( t; Y7 E4 f8 n5 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 g( T- J" l) u4 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 A$ B. m' N  l/ M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 T( }8 X% T0 s# m
  67. & H$ L0 k- |# t% C3 ?
  68. dma_addr_t dmaphyssrc1 = 0;, r, Q1 P1 o) l/ ]& Q2 v3 e
  69. dma_addr_t dmaphyssrc2 = 0;
    2 Y- w5 I9 u+ y8 ^' B+ V
  70. dma_addr_t dmaphysdest1 = 0;' ]5 a5 L# E# k: |# P  K( f7 {
  71. dma_addr_t dmaphysdest2 = 0;
    & M; s4 o7 |& z/ G* ~& U

  72. 8 e, }3 Y5 S! L' W5 X
  73. char *dmabufsrc1 = NULL;
    # D8 n7 |$ W: O# y- z0 o% l
  74. char *dmabufsrc2 = NULL;3 u4 y' a- \% C: r# ^, L( W
  75. char *dmabufdest1 = NULL;
    " N. k+ D9 M7 l) V. Z$ ~9 P; `
  76. char *dmabufdest2 = NULL;5 z( M  \# T* g+ h6 s$ x

  77. ' d, w' c, l6 ^% p6 \& a
  78. static int acnt = 512;4 A$ S' `( J. g  ?, u: U0 t
  79. static int bcnt = 8;; D8 @  \/ D. p4 {. ]
  80. static int ccnt = 8;
    1 g+ c* G, g' e
  81. % x/ H2 a" f# @$ s- B
  82. module_param(acnt, int, S_IRUGO);
    - x5 r( N9 ?( b% \8 J2 }
  83. module_param(bcnt, int, S_IRUGO);
    9 f, w; e2 H" P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  {* R/ G: f: q* H' d. d* @3 l% H/ S; r  J; E' r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 ?+ o( C3 O9 larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 q- P& r$ k" i$ U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: x+ Y0 G, N7 I- u$ ]
9 y- u1 S3 J4 K$ v$ X0 I3 D/ Y- l% _8 N) U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 22:41 , Processed in 0.050115 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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