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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & O+ y* s' e( z  }) d& L
  1. [code]EDMA sample test application
    : y3 e& ]2 A7 P  c3 l
  2. /*
    ' B6 l' H( b- T* K% d
  3. * edma_test.c
      [8 b. R6 M: [+ a
  4. ** m) {# Y& T$ E% n# l
  5. * brief  EDMA3 Test Application" g$ \5 y$ G3 x' S$ h5 j
  6. *9 Y/ [0 S/ a+ d( |7 Q1 V( s
  7. *   This file contains EDMA3 Test code.) C+ z( `- |1 Z% {) J! v
  8. *8 w3 m" k. [6 v) k7 [# N  a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; l2 n' j, w5 [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # }8 I, i! P  |$ U5 A% i) b, G, J1 D5 k
  11. *         TO CHANGE.
    8 h9 w% d  ~# g
  12. *
    . R5 G9 |+ p% U5 U5 E- l# X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 o8 f# C; m/ Z" _/ q' l/ P% ^
  14. *
    6 Q$ R0 ?3 ?* L9 c
  15. * This program is free software; you can redistribute it and/or
    9 B2 w9 p) M" q% B7 v9 `
  16. * modify it under the terms of the GNU General Public License as
    # U7 c2 \& T8 `! }
  17. * published by the Free Software Foundation version 2.
    4 |6 u- P! h* z' k% B/ Y9 ]. g
  18. *  s- Y* V7 |" c8 B( s+ H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. {; F" N6 Z$ o( _
  20. * kind, whether express or implied; without even the implied warranty2 }1 ~: A$ T! C! p  w3 _/ @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 r% w8 W, ]2 H
  22. * GNU General Public License for more details.
    $ _. a9 \4 Z4 _. o/ `# n5 N& E# o
  23. */' y8 x6 |- M+ D7 @
  24. 0 p" V" F6 Y' m6 G
  25. #include <linux/module.h>
    7 @$ B: a- O5 y' {0 H3 f% {- e8 d
  26. #include <linux/init.h>! i! l+ k, X0 w4 r- r' h8 g
  27. #include <linux/errno.h>$ T1 s* U$ O+ x" V1 d+ a* ]6 c9 p8 F' R/ P
  28. #include <linux/types.h>
      o+ W! r. X8 u  Z
  29. #include <linux/interrupt.h>* S9 e6 Y" L1 m' D- d! B7 I5 r; H
  30. #include <asm/io.h>3 F( K. i0 z/ L. t% t) m* |9 ]
  31. #include <linux/moduleparam.h>& s8 s5 J# O! ^' X6 c! K
  32. #include <linux/sysctl.h>
    + r! n( m1 c/ T  \9 e' m* j
  33. #include <linux/mm.h>: C* N0 }6 C5 `$ K
  34. #include <linux/dma-mapping.h>
    , h3 h4 |  P- \# h. W) M, s. I9 L

  35. " o2 R; {6 N6 W/ k) x
  36. #include <mach/memory.h>
      b8 w$ B+ E/ u1 N* m0 x
  37. #include <mach/hardware.h>
    * k+ R$ S* O: g
  38. #include <mach/irqs.h>
    ! R3 T( h/ Z( j" n9 Z2 u* ?
  39. #include <asm/hardware/edma.h>
    + |+ w! t) t6 x9 l

  40. ) r; q( f: l* T8 D
  41. #undef EDMA3_DEBUG
    , @6 ]9 ?! M1 D. f/ g$ V7 L( P
  42. /*#define EDMA3_DEBUG*/% b0 g3 D' T$ t* `0 n( q

  43. ( e! m7 g9 B2 F6 b1 e  `0 ^3 }( A
  44. #ifdef EDMA3_DEBUG. c+ C( l* H+ N0 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # l9 g5 U- B- j! r0 S9 t7 ]7 ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 C6 B9 }+ b3 {4 k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 i( P' K( R* X! _# f1 J" X) |7 J
  48. #else
    $ C/ c* u7 W+ N
  49. #define DMA_PRINTK( x... )
    7 Y( M+ N7 o3 n0 e( T
  50. #define DMA_FN_IN: {4 |1 t+ E3 Y( i" Q
  51. #define DMA_FN_OUT5 R0 w  F/ M4 [
  52. #endif: N/ r& {. \# J! E& B
  53. ! D; A- @' ~3 h  `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; k: P3 b& ]% D6 S; {
  55. #define STATIC_SHIFT                3# `. q* p8 t/ `. o8 |0 w* I) l2 w
  56. #define TCINTEN_SHIFT               20, U, y1 {5 U! _/ f  M
  57. #define ITCINTEN_SHIFT              21+ X  R! D3 l4 T; M% i
  58. #define TCCHEN_SHIFT                22
    + X# A8 m! d! u" m4 t
  59. #define ITCCHEN_SHIFT               23
    9 Q. C: o0 q" `( f- M" v

  60. 0 S8 ]& h( y4 Y6 {0 R0 O
  61. static volatile int irqraised1 = 0;' e% `5 T& E1 `3 T6 ~1 Z
  62. static volatile int irqraised2 = 0;# Q0 y1 N( a$ ~9 [

  63.   o7 k- x6 v5 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ~; m- U0 \0 b8 I: N% Q* t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / y$ a3 A1 N1 F* |- f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 _* g& K; A) F' T8 {2 V* h

  67. $ w. R( l4 F1 }" a  _
  68. dma_addr_t dmaphyssrc1 = 0;
    % J1 b& S5 l1 K& e6 w' G
  69. dma_addr_t dmaphyssrc2 = 0;
    8 M. y& a( ]# v
  70. dma_addr_t dmaphysdest1 = 0;6 X$ u, @2 M) I9 t3 Q
  71. dma_addr_t dmaphysdest2 = 0;1 z1 m, r( \( G) r: {0 R$ c
  72. $ a7 i! s8 ]# g
  73. char *dmabufsrc1 = NULL;
    9 S  u, ~6 f) S
  74. char *dmabufsrc2 = NULL;
    2 R4 \. Y3 L2 E/ T2 _/ ]
  75. char *dmabufdest1 = NULL;- n3 a. V; o4 K
  76. char *dmabufdest2 = NULL;
    9 O1 K* U& f2 m# w6 N9 a: ?
  77. 5 E4 _, p. f7 |  S# `
  78. static int acnt = 512;7 ?2 d, Q* k( c8 S
  79. static int bcnt = 8;- l7 v2 _& w7 c# w& T2 |
  80. static int ccnt = 8;1 B' K7 y( q: L4 d
  81. " ~/ _/ ^4 T+ P7 H; D% S
  82. module_param(acnt, int, S_IRUGO);
      J$ @& P2 v& k" h
  83. module_param(bcnt, int, S_IRUGO);
    # l% M; D) K$ i6 Z: a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# E5 r& f/ S( _3 Q+ J  N! v5 _  }
7 B0 i6 S* Y1 D+ N" b) T3 D) q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* e& h' Z" z1 r7 K# R; Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 v& T$ q' a5 S# t; s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ a! G; U* l' s6 J' H/ \2 j8 H$ J

+ m9 W" Y) H# M) R: s. o2 i2 K# [) D% s, G/ v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 12:34 , Processed in 0.039566 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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