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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 p4 _/ n/ d& J, @! A
  1. [code]EDMA sample test application4 u( k% ?# F5 J& A6 [6 s
  2. /*
    5 w6 ~: u. j! |' `  k5 j5 H3 c
  3. * edma_test.c
    ) W4 z! I6 {9 {0 z
  4. *
    : O7 Y% _. w8 G5 o% w* Q
  5. * brief  EDMA3 Test Application1 X! m4 B7 G; V
  6. *: H  a1 _% ]- n+ V% a* P
  7. *   This file contains EDMA3 Test code.
    7 f' q  k' g2 f; w9 C
  8. *
    & r0 H( g8 z+ V2 b& j) @. Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& X' d/ V9 \4 t* Z2 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# O" [: |+ ~3 V. W- Q. p% G
  11. *         TO CHANGE.6 G: e- h) M0 t. Q) w- d# g. Q/ Z0 p/ L
  12. *
    ; @) S( T  p- I% {$ A, ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( \& A/ x" G; b1 u9 b1 d. G
  14. *
    5 P9 n% F- B' T1 ^- D+ v
  15. * This program is free software; you can redistribute it and/or* E2 p- Z- a) j
  16. * modify it under the terms of the GNU General Public License as' ?+ N) p2 W$ @
  17. * published by the Free Software Foundation version 2.$ U, i& A! N3 P3 I  x; m% p
  18. *
    * B  M: x+ k3 I( H" s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 N( [3 J' B9 T6 Q7 S" T
  20. * kind, whether express or implied; without even the implied warranty
    ( |' g2 r1 Y. \& a( f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; h# D: d  w1 O% b- Y! z* |
  22. * GNU General Public License for more details.
    # [! A) v7 D5 _0 ~
  23. */
    % K7 c# u$ z1 t$ Z  [3 B6 {( o
  24. . G7 Z% s" }. H2 n3 E
  25. #include <linux/module.h>2 ~) N  _9 W$ u
  26. #include <linux/init.h>; I9 N6 v+ d* N% s
  27. #include <linux/errno.h>
    + J4 T+ N. S# O" ?* q6 W4 ]7 R
  28. #include <linux/types.h>+ F/ |5 r; u6 D
  29. #include <linux/interrupt.h>
    0 o( N: w; _" g7 `. G
  30. #include <asm/io.h>
    ( x* w0 n! O* o
  31. #include <linux/moduleparam.h>) {  Z- v. l' u
  32. #include <linux/sysctl.h>
      |6 y4 q. h5 W! x4 A
  33. #include <linux/mm.h>
    # P' y5 R' a" D/ C! D& l: Z
  34. #include <linux/dma-mapping.h>) p7 L, G3 P8 t3 ?5 Z
  35. 2 s! [$ X0 S7 q. @2 }
  36. #include <mach/memory.h>8 ~5 j2 q+ t: w# b4 G. y* L& M) c
  37. #include <mach/hardware.h>
    7 q8 M% S; I1 w4 \' v
  38. #include <mach/irqs.h>
    5 |, b& Q: w  b7 \
  39. #include <asm/hardware/edma.h>
      L: Z( M2 r; u' @2 L1 G
  40. # Q" t. r, b6 N& G
  41. #undef EDMA3_DEBUG, z9 p' `! x) J9 H" _( g/ F
  42. /*#define EDMA3_DEBUG*/# I' L0 N) H0 I

  43. " T( r, V5 d4 Y6 k8 l
  44. #ifdef EDMA3_DEBUG
    8 z" w: P* u; {' ^, F# I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , y0 S/ U" S9 o5 e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; j* R. ~' n6 k5 e- ]2 F% U# f. {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 m5 m$ t  A4 m1 p+ ]9 l. r" x
  48. #else$ Q# |( k6 J1 k* @3 G3 J! Y/ o
  49. #define DMA_PRINTK( x... )
    % Y- A! t/ x$ z* j" f, `, }( `
  50. #define DMA_FN_IN
    5 b# _" w. n& b/ q
  51. #define DMA_FN_OUT* D/ n, Y" b  f6 H6 r9 a  ]
  52. #endif9 X0 _2 w" @0 I% g/ @

  53. & t( y8 x2 Z& p* L3 Q4 p" h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! w" U1 h9 T) q- {# e! g
  55. #define STATIC_SHIFT                3
    ( z2 [# @1 }3 r! h
  56. #define TCINTEN_SHIFT               20
    ! \5 j8 S& m/ y* f, R
  57. #define ITCINTEN_SHIFT              21# x9 W1 {( |" Q0 U
  58. #define TCCHEN_SHIFT                22
    8 k. W3 b1 @3 W; i9 ^
  59. #define ITCCHEN_SHIFT               23
    ( ]+ C0 |6 b. p/ W

  60. " N8 P! R- b" J# q# q3 ~
  61. static volatile int irqraised1 = 0;: d! E  R0 B2 ]# [" [
  62. static volatile int irqraised2 = 0;
    ; b% r/ K! A; G. D) }1 F

  63. 2 Q4 \9 Z3 p* i! ]4 v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; P4 J$ Z! Y; v1 v: l- R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 {1 }+ B/ V: R6 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 m7 c* i8 D5 ^) U  O: E* f

  67. ) y  i1 Z9 w3 a& i! ]: s
  68. dma_addr_t dmaphyssrc1 = 0;
    ; w" R. Z; C$ ~5 @/ r% x
  69. dma_addr_t dmaphyssrc2 = 0;$ j! z" d- _' P" l9 x9 o& ]8 ^
  70. dma_addr_t dmaphysdest1 = 0;
    0 }9 v) g+ U! ], E6 Z
  71. dma_addr_t dmaphysdest2 = 0;  C- K3 r2 C, k
  72. : c- ]* l% ]- X& R& k1 ~
  73. char *dmabufsrc1 = NULL;  W5 V. ~+ C* ^8 H7 h, _. I
  74. char *dmabufsrc2 = NULL;
    2 Y  u3 ?2 z. ~7 K! c
  75. char *dmabufdest1 = NULL;
    / j5 J* w, k" F" l* ^( B, j
  76. char *dmabufdest2 = NULL;
    4 @) E5 ]# a8 S2 M: d' }: l  o

  77. 0 L: C; k! l3 n4 ]8 |
  78. static int acnt = 512;  a% G/ _, z; ?% _. X& w
  79. static int bcnt = 8;
    * N& N9 B' k( b3 {7 @' q4 D7 X4 M
  80. static int ccnt = 8;
    5 G4 a$ w8 d% G% ?
  81. ' w, x* _9 C; r4 F' J3 O; l. i
  82. module_param(acnt, int, S_IRUGO);: q& i! T6 ^+ D
  83. module_param(bcnt, int, S_IRUGO);4 z8 @. d% g0 H! B# q% U4 p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. k4 Z0 l# R) c" o7 F& O) O

1 y" C5 f1 r/ q: W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 r8 Z9 Q9 p& Z( P& ^& Q1 N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 V1 `8 X/ j; ^1 S! n, F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ y; z1 s% I2 X

; A6 s$ y8 e5 s# O, N. k. |! O6 p7 w- p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 02:48 , Processed in 0.048121 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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