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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- z  a: J2 ~+ o6 v: b
  1. [code]EDMA sample test application. K, ?5 m& _3 \; Z6 h3 Z$ o! {
  2. /*# z" t, E1 Q3 d# H& P
  3. * edma_test.c8 [- G. T5 v; y" q
  4. *
    ! {3 V- T; N& T. }
  5. * brief  EDMA3 Test Application. d! A2 s  q& B' R. Z. n
  6. *- d7 Z! b  W& p, Z$ q' g
  7. *   This file contains EDMA3 Test code.
    1 b! R6 @( z. v: Z. ^
  8. *
    8 J: e$ m7 |2 H/ E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! A! i1 v( j0 [7 }: n$ O$ m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! ?. S. f( d: K5 r$ v3 Z
  11. *         TO CHANGE.
    . E- `3 C6 l& L1 o. D6 ~
  12. *0 [+ H2 `/ w5 C" ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % n8 O6 A/ [: L# \) |$ T/ n
  14. *
    # z3 U, R5 a3 X: x
  15. * This program is free software; you can redistribute it and/or; |8 E( U; V0 D3 Z
  16. * modify it under the terms of the GNU General Public License as
    : k8 S+ E; g6 I8 @/ z
  17. * published by the Free Software Foundation version 2.
    + K3 [# W1 E, |  ]! q
  18. *
    7 {8 r9 {$ ]7 Z# I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 ^/ U4 R9 q; o. e0 P; b
  20. * kind, whether express or implied; without even the implied warranty
    $ @, R$ n& |. ]' _3 _& p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # o6 i: ^5 c$ g" _  K/ d7 v+ D* O- O
  22. * GNU General Public License for more details.+ R! @3 L  |- A! M) l* P' D
  23. */7 \  @3 t7 U, ?4 i% c

  24. $ s+ Q# u/ o; |; N+ ~
  25. #include <linux/module.h>1 z5 _$ f: m6 _& N
  26. #include <linux/init.h>: o6 D. h' C- ]8 O5 s8 J0 v
  27. #include <linux/errno.h>
    % m% s, q+ H6 z0 A% M
  28. #include <linux/types.h>* _* g) F: G1 Z* h9 v
  29. #include <linux/interrupt.h>
    6 e7 r8 j7 w0 {" A+ I
  30. #include <asm/io.h>( \3 b6 G4 i. a! {' n
  31. #include <linux/moduleparam.h>, V6 d. D! k. p6 n
  32. #include <linux/sysctl.h>  H$ {" m8 R$ p+ w* y, h
  33. #include <linux/mm.h>
    5 Z! ^5 Y5 h- S: z9 j
  34. #include <linux/dma-mapping.h>' D" l7 P. Q# n# S
  35. $ m7 d3 w. x- O: w6 z
  36. #include <mach/memory.h>, W( c. h# T$ m  g% x
  37. #include <mach/hardware.h>4 O1 R* B  R: }& I5 E0 w) [" C
  38. #include <mach/irqs.h>
    ) O4 I* Q  ?* `; A# n
  39. #include <asm/hardware/edma.h>% X* U/ j4 N; C; E0 c/ Y+ `) B
  40. 3 n  P; R# O& B
  41. #undef EDMA3_DEBUG5 ~. w* c& h! [) G9 z3 g* O
  42. /*#define EDMA3_DEBUG*/& ^) w: i: v/ q& t
  43. 5 l2 T9 @2 [' a, A& a6 F" m0 X
  44. #ifdef EDMA3_DEBUG
    0 ?+ N* \% `# E$ Q. @' ~0 O+ N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* b3 R4 t: G8 R2 q' f5 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& j2 E6 q5 z1 X- j1 j: v6 ?' k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* @* C$ a. P: p% g
  48. #else
    7 K, J& {1 g# a! p( Q4 Z- [7 k
  49. #define DMA_PRINTK( x... )* Z( F  h3 d. n# X+ G
  50. #define DMA_FN_IN
    6 F7 c1 t. X; O+ D4 Y
  51. #define DMA_FN_OUT/ n: ^: c- _2 q8 X2 g
  52. #endif+ U6 l8 @& ]3 F
  53. 1 ?" ^: c3 K# U" A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). d* r: N- B1 M8 K6 C) F
  55. #define STATIC_SHIFT                3+ D: w5 J* X8 K+ s/ w3 E. O
  56. #define TCINTEN_SHIFT               20
    3 g. S, y! W0 a
  57. #define ITCINTEN_SHIFT              21: k2 P% }0 J7 v
  58. #define TCCHEN_SHIFT                22% X$ i7 o( Y( n
  59. #define ITCCHEN_SHIFT               23
    7 `9 g1 ~- z# D! ~/ j7 T& Y6 x

  60. ! S6 x  s3 D# K4 p( p7 ^  _$ A
  61. static volatile int irqraised1 = 0;5 @3 O4 G6 l6 d; G
  62. static volatile int irqraised2 = 0;
    # m% n8 @! O% [

  63. + _% A: r+ t; \) u" Z/ f, N0 ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; [$ G; b2 N. k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# u) {2 h7 {0 q" L. U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 }+ u. \7 n$ n2 z/ k; X, r, G7 ~

  67. & [$ y" G2 o4 E% C" l! T3 Y
  68. dma_addr_t dmaphyssrc1 = 0;
    : Q6 y1 I, L( n: v2 q# G8 M
  69. dma_addr_t dmaphyssrc2 = 0;
    6 t) T) t6 z) n' s
  70. dma_addr_t dmaphysdest1 = 0;. y- j, L, w( K& ]& ?, J- t2 v
  71. dma_addr_t dmaphysdest2 = 0;$ {. {( z7 g' z2 c& c3 O0 k0 L% j6 {

  72. 4 V9 v# c# v- |8 _
  73. char *dmabufsrc1 = NULL;% z2 K  ~! V) j8 k
  74. char *dmabufsrc2 = NULL;
    ! c: \7 j# d- x& l
  75. char *dmabufdest1 = NULL;
    1 w: r. z9 A. M
  76. char *dmabufdest2 = NULL;
    ! s* }, f( ~" b8 a% m. L9 D, E

  77. ; ?, w% u3 d3 {- v
  78. static int acnt = 512;9 i$ H$ h, W8 a2 Z
  79. static int bcnt = 8;! Y& [  p/ F2 f5 Q) z% c
  80. static int ccnt = 8;
    5 y9 P* Y; y  _

  81. : j7 w- e" v6 W  j: X. [
  82. module_param(acnt, int, S_IRUGO);
    " F) K/ {* R5 D' t7 y2 X
  83. module_param(bcnt, int, S_IRUGO);: ^! c8 s9 L, z& [5 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 }- P" k, w/ t' k+ Y3 i- W

8 \  _1 `4 L' ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& f5 @  j3 t. l! Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ C9 E: @, \& B4 w( s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* h  B: N: N% {2 i
9 }3 n, Z/ L- L7 L9 n2 F  I2 }/ h$ Y
9 n5 b" f- z. ]* M0 y0 B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 11:49 , Processed in 0.045452 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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