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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 Z. l& g: f. \& d
  1. [code]EDMA sample test application% U( W8 X7 r8 W) L: K
  2. /*! U5 O1 f  e& j3 l" ?9 t
  3. * edma_test.c
    ) a5 S; y0 L( t
  4. *
    ' O3 k6 ~1 Z$ _
  5. * brief  EDMA3 Test Application) I7 }* R+ M/ k; v1 h# R# E
  6. *% s& ~; P) D+ l6 F, _2 z- ~
  7. *   This file contains EDMA3 Test code.
    ) x' y* y- p) k1 N- A8 m8 u
  8. *$ S, O) d4 n$ N3 p% f% K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , a) O5 G) e2 X4 l. u% |* O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + }, J+ c5 V. I! ^5 W
  11. *         TO CHANGE.: _% d+ ~/ f+ Y5 s; B/ O4 y# I
  12. *: D& b* H2 b# a5 B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( d/ N. w. |3 `3 ~
  14. *0 a8 G) @' l6 k. A
  15. * This program is free software; you can redistribute it and/or3 M/ c9 F! u  C4 V
  16. * modify it under the terms of the GNU General Public License as+ @6 E  F3 M) o+ f" ^: k
  17. * published by the Free Software Foundation version 2.
    ) \2 L- d+ k" L, j0 Q! d
  18. *
    8 U4 y' b+ Z& z1 s3 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 ?2 V5 h0 z! p. P
  20. * kind, whether express or implied; without even the implied warranty
    + v9 m/ E7 {& y$ u7 l+ ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 y! _# H$ T' R8 C' t
  22. * GNU General Public License for more details.
    & j, `* \: q8 I& ?: ^! q7 G  C- Y
  23. */
    ( N3 m/ P- x7 Z+ E

  24. # @: }: u+ R8 E. F
  25. #include <linux/module.h>5 Z  D- o, |, r/ B& ^8 f
  26. #include <linux/init.h>- @' k4 q# w5 o+ ~" c! h8 I* m1 L  T
  27. #include <linux/errno.h>
    3 F7 p& ^6 l  C
  28. #include <linux/types.h>
    - w. N( `7 t, Q1 M8 ?; Q% z& S
  29. #include <linux/interrupt.h>+ ]7 u9 Z! E4 s5 G
  30. #include <asm/io.h>  o+ I: r' w8 n8 r
  31. #include <linux/moduleparam.h>: \, v- A8 m% D5 T7 q" X/ k
  32. #include <linux/sysctl.h>
    7 |* m( s5 `1 _' |& q- w
  33. #include <linux/mm.h>
    6 ~8 @5 o7 `; i
  34. #include <linux/dma-mapping.h>, b, o+ H  m8 }1 _/ \- b

  35. % C; \; L9 P+ v
  36. #include <mach/memory.h>6 w8 P0 u/ A/ ~8 b/ e
  37. #include <mach/hardware.h>
    - V9 O  T. {3 |3 q
  38. #include <mach/irqs.h>
    9 Z& {8 v+ J+ v+ R8 o! d
  39. #include <asm/hardware/edma.h>  x' e* ?8 n/ g3 u

  40. ' ]9 F& J/ ^5 O+ Y
  41. #undef EDMA3_DEBUG/ Q1 J0 F, a) m' V
  42. /*#define EDMA3_DEBUG*/: p' T6 B' e* Y3 p' e5 F; w/ U
  43. ; f! K9 I+ r* l& O: H
  44. #ifdef EDMA3_DEBUG
    4 y  A+ I" g  g2 F) ^0 K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# S& U( B, |  L. }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  W( i. l; X$ Y3 R' \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( t$ T8 x$ Z! h# |# M2 W
  48. #else
    1 m/ S0 B  v8 p' L
  49. #define DMA_PRINTK( x... )
    ! x: }$ D& }& D# O" m6 U! w
  50. #define DMA_FN_IN* H7 U6 n0 H% @+ h9 ?
  51. #define DMA_FN_OUT7 k; Z9 h4 j  f  S/ _3 |  i
  52. #endif
    " I: d6 }% c: `8 E! C9 D7 k

  53. ( _; \9 _7 W5 C! `# ~2 `7 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 g, k7 i  H: _7 N6 u
  55. #define STATIC_SHIFT                3
    5 _  r' t9 i& r1 u5 K
  56. #define TCINTEN_SHIFT               204 {& u% x. d" l$ Y, `
  57. #define ITCINTEN_SHIFT              21. x/ S) p2 l; y
  58. #define TCCHEN_SHIFT                22
    2 U9 U# E6 z( L! N# [3 B
  59. #define ITCCHEN_SHIFT               23$ w9 R4 O; Y) U* c. h+ B6 H' E

  60. . q* V6 Z/ n0 b/ z: l
  61. static volatile int irqraised1 = 0;8 M; b1 X' v3 c" ^$ l( S+ b
  62. static volatile int irqraised2 = 0;; h! T, h) o7 O
  63. 5 L' ~6 P$ ?* \* v4 n8 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 Z  t1 [2 |# x) m3 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 D  n* T% j/ Q& I. p! j! q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! ]# j1 D* Z- ~# ?) B; C+ ?

  67. ; w+ U+ N5 \: |( T- v
  68. dma_addr_t dmaphyssrc1 = 0;8 O: M  I8 z7 b- a8 z# B( o. {
  69. dma_addr_t dmaphyssrc2 = 0;/ _3 `9 C1 D; S. q( c1 G) Q4 q
  70. dma_addr_t dmaphysdest1 = 0;  W6 t1 I) j( p  ~4 m* c. F* u
  71. dma_addr_t dmaphysdest2 = 0;
    " w( S8 H8 q4 B8 Q/ G5 @

  72. , _0 x6 R# ], v  Q# e+ F
  73. char *dmabufsrc1 = NULL;( P; O& G5 K) r% g; `0 t: P  W) k
  74. char *dmabufsrc2 = NULL;
    " z* N: o, H8 J/ }5 N4 t8 b" v
  75. char *dmabufdest1 = NULL;2 d& l$ s0 L7 `- \1 z
  76. char *dmabufdest2 = NULL;1 C" ^$ f0 D* I4 l# `7 l2 K
  77. & F. r* m7 C+ m$ v) n( P8 k2 h
  78. static int acnt = 512;! |3 J5 o* D* y5 F: z
  79. static int bcnt = 8;' d. [# I/ H* T$ P
  80. static int ccnt = 8;
    ) B0 @+ G+ Y. g. A! H+ \
  81. 8 d9 w1 j3 a7 I- T5 c1 `
  82. module_param(acnt, int, S_IRUGO);/ m  g( L2 q! q# c/ {
  83. module_param(bcnt, int, S_IRUGO);
    ( o' B# ^, B& ?& W  k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) k8 ]* F0 W0 e+ g# |+ ?0 t! x) ~- J; Q8 u' k: R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! g' g* a; L( s. a3 g- E5 sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 U4 w, @, V. m* g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' V/ ^, H( l6 y0 \5 j: W/ {: |6 R

2 t, O1 U. ~5 ~7 i+ X! ^
. E* `$ j0 q' Z  b! S6 ]2 c; ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 00:12 , Processed in 0.039968 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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