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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; V0 t5 @' K7 E  a
  1. [code]EDMA sample test application. s. x; H- @# g) @- y# [& x: p
  2. /*
    . b0 H2 N' w& H, i8 J" i; m
  3. * edma_test.c
    - Q$ t- E5 R  E5 R# I, a
  4. *+ U2 {5 A7 I9 d! V
  5. * brief  EDMA3 Test Application
    " c) m* ?5 v: b; ~5 ~) G+ E; D" {
  6. *
    4 m6 V! [8 E2 U# r. P0 P
  7. *   This file contains EDMA3 Test code.7 }3 [4 e  \: ^' Q" K3 s: z( p; [
  8. *! y3 [* \7 |+ }- i/ ?% f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 s' a! R  s) O7 v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 M5 s9 J5 x0 K- P4 b! g
  11. *         TO CHANGE.+ T2 r( a4 X! A8 H# E( L
  12. *
    . m' d7 @, v+ C6 S+ V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * Q5 E+ G' w& s* \5 l: O; K, U
  14. *
      n7 ^5 ^8 Q+ R$ j+ n9 P
  15. * This program is free software; you can redistribute it and/or
    + M4 p! k7 d6 t7 Q% O" s7 q
  16. * modify it under the terms of the GNU General Public License as
    $ J. L9 y/ v6 y$ @' X, W) y
  17. * published by the Free Software Foundation version 2.. u& i4 h* o" N4 p
  18. *% A- l* Q7 [* h3 V' H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! T, B8 l* l2 P+ v! v" g% c& g0 ?
  20. * kind, whether express or implied; without even the implied warranty
    : P. p! x0 d+ C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 F# ~' q+ W" |6 H' M
  22. * GNU General Public License for more details.
    & f, y% n" J9 }
  23. */
    & {/ ?3 E9 P$ z

  24. 4 V" h) p: B# Z9 r+ x" L
  25. #include <linux/module.h>
    * r. k% |4 g  \/ V
  26. #include <linux/init.h>
    ) x2 _- k/ H% D6 o: M/ O* z0 ]5 m
  27. #include <linux/errno.h>
    6 Z6 d2 V/ O0 u% v2 M
  28. #include <linux/types.h>
    % I+ u/ P+ h4 a3 I
  29. #include <linux/interrupt.h>
    8 n* _; j- G* l& s: r; m* b( p
  30. #include <asm/io.h>
    2 o) q, o# R8 e
  31. #include <linux/moduleparam.h>
    " V' Q1 k) n* n( k
  32. #include <linux/sysctl.h>- J3 ?3 ]- ]: b; O% B4 n" t3 U
  33. #include <linux/mm.h>9 `) [9 h& {  t7 @, W
  34. #include <linux/dma-mapping.h>* O* Y5 a. {! L" @2 z. i* Z5 z: M3 r

  35. 3 F: o7 C$ V! @. c" J, I+ x) {5 W. R
  36. #include <mach/memory.h>
    2 J- P# o# V2 D& ~/ j$ x: x
  37. #include <mach/hardware.h>" L  ~% m  L4 X, u! e
  38. #include <mach/irqs.h>! f8 ]1 p( D" y: P) V2 c* x3 D
  39. #include <asm/hardware/edma.h>
    2 g! O( V2 W7 z9 `. \

  40. 8 ?( {8 a8 H9 T* ~# Z& H8 a6 ~* G
  41. #undef EDMA3_DEBUG4 X/ O. M' p& v( m& Y
  42. /*#define EDMA3_DEBUG*/
    - w7 ~/ m) j3 ~5 l* I+ g8 r
  43. ; M' g$ q# X1 h$ \( O- W
  44. #ifdef EDMA3_DEBUG
    6 B( O3 j! c9 R: b* X/ g6 b' D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 F2 F% t7 N- H; R! c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 H$ y  c$ A0 W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 e( T& {/ ]' S1 I8 u2 h
  48. #else
    , F3 [$ U9 e2 H) N  h% F9 I4 _
  49. #define DMA_PRINTK( x... )* o* f  A$ J' ^
  50. #define DMA_FN_IN7 f0 D3 ]8 Y( E1 Q$ b6 A
  51. #define DMA_FN_OUT
    " x! ~' c, C  h' y4 q
  52. #endif
    ; ]: D1 c/ J. m4 D7 s0 K9 l
  53. 1 I. y( t# z0 j5 k% X+ i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # a  Z3 ~3 c: L  }  v
  55. #define STATIC_SHIFT                3
    & }# u% Y+ `! R7 Q, T6 _% U
  56. #define TCINTEN_SHIFT               20
    5 Q# e* H8 M* W/ m) a
  57. #define ITCINTEN_SHIFT              21
    & C) ^) I6 |+ B) i
  58. #define TCCHEN_SHIFT                228 R# F6 m" K( S. W
  59. #define ITCCHEN_SHIFT               23
    " s, r$ U1 t/ W9 Z/ B' g* {1 u7 h% D
  60. 6 Q0 U3 Q# N" ^& J- e3 B+ A
  61. static volatile int irqraised1 = 0;
    0 j# d# U) m' Z3 B
  62. static volatile int irqraised2 = 0;
    0 W4 _! S# ?, r- ^+ M

  63. 9 e% V/ t8 v7 d6 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- d  x) @- N( }: g6 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 N; E; B2 V+ I8 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# l/ C7 L; \; ^2 s9 W9 q- t3 [2 W
  67. : D$ p3 O0 f8 i+ l; |3 m
  68. dma_addr_t dmaphyssrc1 = 0;. }5 g+ ?  r. W) ~
  69. dma_addr_t dmaphyssrc2 = 0;
    ( `6 c. `& W4 D5 ^& h3 `
  70. dma_addr_t dmaphysdest1 = 0;3 h4 g& z$ E7 P3 o4 }2 o8 J
  71. dma_addr_t dmaphysdest2 = 0;: H9 L5 t+ c0 t5 N* v9 v/ W

  72. / x4 {* d; A( L- O0 A% O  @  x3 s( z
  73. char *dmabufsrc1 = NULL;
    ( B7 u' g' \( T! \( i6 n
  74. char *dmabufsrc2 = NULL;+ ]( X$ {: Q' ?+ d; p
  75. char *dmabufdest1 = NULL;5 R; I" e6 }/ x3 I! E8 q
  76. char *dmabufdest2 = NULL;
      g4 X" i: Q/ w" T& T
  77. ; R" {2 |% r" ?! s5 ~: o
  78. static int acnt = 512;: I' {. f9 c% F$ c3 P- h7 V
  79. static int bcnt = 8;: ^2 m' I+ q" c- r
  80. static int ccnt = 8;
    # l4 P, M9 p* V- J8 X* y7 X( L) L7 g
  81. ( w. G4 o, c0 V2 A( y" e: ?
  82. module_param(acnt, int, S_IRUGO);4 w8 y& N! c3 \6 Z# ^; F, w
  83. module_param(bcnt, int, S_IRUGO);
    % p8 X& n1 P0 j; w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 z% B7 Z1 H2 z6 c: R
' L  Z9 C" V, E8 Z' W) t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! i: W8 h1 E3 y) ^3 n7 ~) warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ B3 c, L$ i6 q! x% O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! W0 h8 |, V4 x8 `

( r8 e, F7 N+ l) v7 L( @" ]' s( T, Y: O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 00:57 , Processed in 0.043114 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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