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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 {4 ^6 m1 I% ]4 j1 V: j4 n) W
  1. [code]EDMA sample test application
    . E/ s1 D. N6 D' G, W+ U
  2. /*! I! B% M/ R! a. M. F
  3. * edma_test.c8 o3 o+ r* ^  O! x2 Q1 `
  4. *
    3 p' ^  ^* R# p& t- Y* e* C
  5. * brief  EDMA3 Test Application
    . v1 H3 p! J# X: f1 W/ x  c) `8 z
  6. *% k1 X; g8 e/ @) t1 P# K
  7. *   This file contains EDMA3 Test code.
    , k% c% s/ a' H6 E5 L" P2 D
  8. *
    7 r, c' T/ O* g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 Y1 l$ K+ u! L7 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! u/ \  ^3 Q& P+ k  H
  11. *         TO CHANGE.
    # c' ?3 ~3 M8 V* h7 W7 @$ y
  12. *
    ) ^  g! A0 z/ I& S- n; s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' m- K7 W! q" q& [8 v7 }. o
  14. *
    8 Y  l9 K7 T0 \, r
  15. * This program is free software; you can redistribute it and/or& {, d2 F/ O: a
  16. * modify it under the terms of the GNU General Public License as1 s0 D( @. @7 z9 J
  17. * published by the Free Software Foundation version 2.
    ( j& j+ S1 O( t3 Y  A* @7 \0 P
  18. *
    + G, h6 |0 p7 w8 s9 I2 y( }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, w; [$ B' S6 U) ^, g2 E) m
  20. * kind, whether express or implied; without even the implied warranty: D. [/ C7 U2 B/ I; d6 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 o, q$ O6 o9 O
  22. * GNU General Public License for more details.
    5 S) z2 _2 d( p; N
  23. */
    * S) ]& C% Z  B( _/ z" X' E
  24. % G+ A: @7 ]; z/ G( L
  25. #include <linux/module.h>
    2 l3 N8 X) h* b+ j, N5 k4 f! b' i
  26. #include <linux/init.h>8 o0 d) R5 M( V0 M$ W$ x
  27. #include <linux/errno.h>5 z/ Y! ^9 d4 L0 X  c
  28. #include <linux/types.h>
    4 N2 r9 L$ G1 o+ p
  29. #include <linux/interrupt.h>
    8 o7 }1 P0 M: q% q! `$ ~& B
  30. #include <asm/io.h>8 a3 j5 c; m2 F2 t( g. m5 C
  31. #include <linux/moduleparam.h>
    * Q, L0 y7 \" u$ g: R2 [
  32. #include <linux/sysctl.h>
    % Q- V4 k( _  G6 Y% Q4 Y: A+ X
  33. #include <linux/mm.h>3 U, `5 _- l$ ~
  34. #include <linux/dma-mapping.h>
    3 M+ K* x+ Q4 c6 M2 Z
  35. + Y8 ~6 M, g) K
  36. #include <mach/memory.h>
    0 h4 F& s3 J! P; W0 M; F
  37. #include <mach/hardware.h>% R0 r7 R3 z$ ^& H0 U1 ^$ E
  38. #include <mach/irqs.h>, w+ Q% f/ P1 e
  39. #include <asm/hardware/edma.h>
    ! M9 x+ e* ?% `0 f" U
  40. ; H( m) H3 {2 L  y
  41. #undef EDMA3_DEBUG9 l. X) x( v/ [1 J/ y# _5 c
  42. /*#define EDMA3_DEBUG*/; P8 {* d9 e, R2 B! k

  43. 7 x6 k" U8 A. ^1 D) Z
  44. #ifdef EDMA3_DEBUG$ O& O0 R; Y& G1 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); _. d% C. [. I6 b, q2 I5 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): Y- \% {, U3 L8 k3 \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 l& g7 H3 {2 ~! @* ]* b+ Z, D
  48. #else4 n* I  k0 c- V. v4 U( l
  49. #define DMA_PRINTK( x... )
    - k% n9 G" x7 R, i4 Y- Q- {: U* ^
  50. #define DMA_FN_IN
    ; F7 d5 l# l3 j) T. s6 q
  51. #define DMA_FN_OUT
    " K! z, c) c2 n- R- @
  52. #endif
    9 Q9 B* ~+ @) O

  53. * H5 ^/ b) T4 ~7 M2 |4 t  S* w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 x5 K8 r0 |0 L( x
  55. #define STATIC_SHIFT                3
    ) ^* G' ~% A7 i% f% d5 l
  56. #define TCINTEN_SHIFT               20
    6 x$ S( F5 t. E: P& i% K4 ?/ x
  57. #define ITCINTEN_SHIFT              21
    ; _( @! Z# i9 d. C9 ]
  58. #define TCCHEN_SHIFT                22
    7 P, y9 I5 s, w& K, T
  59. #define ITCCHEN_SHIFT               232 X( d% h0 d; M5 ^$ a1 D/ @7 `

  60. * q% p9 E, C1 X: m7 ~; N4 h
  61. static volatile int irqraised1 = 0;
    - K* T- B3 l6 V# v, H$ K4 J9 b" L% b
  62. static volatile int irqraised2 = 0;: d4 i9 T6 c9 j, m

  63. - t  W* l3 y+ O# Y9 O/ U( `5 |+ ~, a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : @. ?& P! p( {1 c$ }/ \0 I* W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: i% s8 D( _; |% N6 |: _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& }7 f* }2 V& D
  67. # x3 E# c5 \8 D; k$ |
  68. dma_addr_t dmaphyssrc1 = 0;
    " M# E9 M$ j* b. W8 E
  69. dma_addr_t dmaphyssrc2 = 0;
    2 R" A( J7 j1 E: T5 d- l# T
  70. dma_addr_t dmaphysdest1 = 0;. b" X3 w/ [: |3 N: n, ^/ C3 ^
  71. dma_addr_t dmaphysdest2 = 0;
    % L1 e# ]+ y" m' a) L: x/ g* [5 R
  72. & Z& Z: y4 D2 }3 R( n
  73. char *dmabufsrc1 = NULL;
    " {  B; R3 g0 m8 P* k2 N# D8 Q
  74. char *dmabufsrc2 = NULL;
    8 w- I/ R7 P" {. t0 [8 p0 z
  75. char *dmabufdest1 = NULL;
    - h  k! Z$ I1 {& j* c
  76. char *dmabufdest2 = NULL;
    ! ]# a. A' p. X0 T& ]% H6 R' o

  77. ; ^  r8 T; m2 O$ W7 R
  78. static int acnt = 512;& a% g" g. F4 f3 S
  79. static int bcnt = 8;
    & ?" M. d% L; u% ?
  80. static int ccnt = 8;: s+ w9 y5 \# k# V. A& _8 E: O
  81. ' X/ S% e" L" B2 c& s6 e
  82. module_param(acnt, int, S_IRUGO);# l. p; c3 X( d
  83. module_param(bcnt, int, S_IRUGO);
    + S0 `$ q3 ^  m5 J* N( y( Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 D; b1 b5 d& l7 W

! e9 d1 B8 H5 h4 t) \- N: ?7 p1 I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 E6 J2 `3 R9 e* v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* m' S, }4 A- t4 b6 y1 ~7 C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: h9 G, v, A1 ?" p
& V/ q: a: ]6 u# A. @# ~" I. C% T" J2 U0 r; ^! {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 05:06 , Processed in 0.038733 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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