OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 a/ t/ F& u1 n( u( h2 i$ \, z# U
  1. [code]EDMA sample test application
    9 d1 H$ p  u+ j) J7 A. v: r
  2. /*
    & N4 n$ y4 n, j" F7 c, G$ z# |% r) Q
  3. * edma_test.c2 {0 x- L1 P8 I9 [- {
  4. *
    - B  l; e2 @. g& \
  5. * brief  EDMA3 Test Application
    2 [' O4 d) ~2 Z: o% i  f
  6. *# ^% H9 @8 E8 y9 h" G% U0 o9 r5 |
  7. *   This file contains EDMA3 Test code.9 h4 u3 h5 u" ]# b1 {; t6 [8 i
  8. *% j+ @$ q. L( F7 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& B) D! x' l9 D4 w1 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , `  o3 g& I7 Y4 G. n
  11. *         TO CHANGE.2 V  Z4 {  l9 n6 S3 `# v
  12. */ w' o0 V; ^$ V* N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) u+ B3 F# ^5 l' \
  14. *7 P: b+ a8 T! J$ y  z; ^
  15. * This program is free software; you can redistribute it and/or
    / \% s& V# a! v) e
  16. * modify it under the terms of the GNU General Public License as
    ) o4 _, {7 q" u/ _& u* I2 n, [
  17. * published by the Free Software Foundation version 2.
    ; Y0 o- e7 v; ]1 f6 e: D' E+ `
  18. ** S1 N5 k" s5 \" x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; u0 V6 I: u" E
  20. * kind, whether express or implied; without even the implied warranty
    7 ~8 Q! Z* x! Q8 q4 z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # n! g; W8 g8 ]+ {; q- Y% b4 Y# r
  22. * GNU General Public License for more details.' i5 D  O$ i& Z4 \7 n
  23. */" X! N4 M. T1 J
  24. 7 M7 L$ k/ a0 ^7 k0 n( P
  25. #include <linux/module.h>
    9 a1 ^1 e! A. T' }- ]3 b
  26. #include <linux/init.h>! z* O. ~8 b. y" O# R
  27. #include <linux/errno.h>
    " B; |' ?. K' t/ k& A% c' L, G7 D
  28. #include <linux/types.h>& p9 U/ S% ~. R9 T
  29. #include <linux/interrupt.h>
    2 e; r( [' H% N, `
  30. #include <asm/io.h># j+ _' \1 J" X8 J. m
  31. #include <linux/moduleparam.h>
    * H; I& G2 m$ R6 T
  32. #include <linux/sysctl.h>  d" i- B% f+ g; L. }* L% v/ h! h
  33. #include <linux/mm.h>
    9 N6 `! E3 s" P2 j, J7 I! u) n
  34. #include <linux/dma-mapping.h>5 z' I1 T4 i6 [4 F  D4 D

  35. , h9 y. U5 G4 M$ g* x
  36. #include <mach/memory.h>; W) m1 F; }  \! w" \9 @
  37. #include <mach/hardware.h>
      H% O7 ]4 Y2 T' Z6 p( m
  38. #include <mach/irqs.h>9 r7 c9 {' ?# m$ H1 }4 T& `
  39. #include <asm/hardware/edma.h>
    % _" c* X6 b4 B) ]; d

  40. , f+ Q$ [/ u1 c/ |6 d# q0 G
  41. #undef EDMA3_DEBUG' t' A/ K9 @2 _6 S7 n
  42. /*#define EDMA3_DEBUG*/4 C3 X/ X* F+ c, z% r% i0 x

  43. ; {5 I* a2 V) E, w8 h! R
  44. #ifdef EDMA3_DEBUG
    6 r2 L, Z  ~$ b. k6 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 d/ P/ k7 v# Z; k% k, n+ P$ ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % Q# m! L! T, T' _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 a$ V1 H, u' Y8 v% ?
  48. #else
    " R9 [( m& C% ]+ Z
  49. #define DMA_PRINTK( x... )$ G  P  X; @0 T- ?
  50. #define DMA_FN_IN; n" k! ^8 n' W+ `; X
  51. #define DMA_FN_OUT2 S. F  I6 d1 i, H9 e
  52. #endif
    ) ]- B" F* S8 i$ e" z
  53. 4 t  O7 h* f. `- R, U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( H$ f* _; t( {* J
  55. #define STATIC_SHIFT                3  X/ r  W' b7 a4 i
  56. #define TCINTEN_SHIFT               20$ D4 E' n' b, B/ ~# [
  57. #define ITCINTEN_SHIFT              21' D8 G; j% Q9 p/ f/ B
  58. #define TCCHEN_SHIFT                22
    ) w- w7 U/ w+ |  z6 q: Z6 \
  59. #define ITCCHEN_SHIFT               23( }. D' e5 ?" y0 ~  ]
  60. ! }# N) L/ _) ^4 m& k: V& f
  61. static volatile int irqraised1 = 0;
    ( r" E0 @1 c; m; T# k& I' I
  62. static volatile int irqraised2 = 0;* g# ]8 [7 K- B4 u
  63. - |  I/ I% e- ^% L# r) L3 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ x& Y$ S. J0 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; W5 ^2 ~. P9 f8 g1 P- C1 ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& C7 h9 @1 x7 J) e- e, P6 v* C9 c
  67. : E* s6 p' ]% ^( J, V" T3 }
  68. dma_addr_t dmaphyssrc1 = 0;/ [$ Z& I' Q2 S  P, D1 M: o: n
  69. dma_addr_t dmaphyssrc2 = 0;8 K8 F7 ?( O% ?, g1 \5 O
  70. dma_addr_t dmaphysdest1 = 0;+ S  |& w4 C. \
  71. dma_addr_t dmaphysdest2 = 0;; Y) x" [$ d6 R5 D* s
  72. 1 ^+ t& e5 A6 S* U
  73. char *dmabufsrc1 = NULL;
    " N$ A( V0 E  G
  74. char *dmabufsrc2 = NULL;
    7 s7 B! ?8 J0 R6 V$ {, e6 x8 T
  75. char *dmabufdest1 = NULL;( |+ `6 }# U  s  S( D9 z
  76. char *dmabufdest2 = NULL;. R/ U4 P/ v7 w' \
  77. , M3 d5 w( q" d
  78. static int acnt = 512;
    . L) @! m, k- ?6 ?: v
  79. static int bcnt = 8;
    % |. }8 ^, T8 k9 X+ e  j/ z6 L
  80. static int ccnt = 8;3 d+ O* X. N2 N4 f+ ?+ B+ r  _

  81. 5 V5 Z, m' {4 x8 k8 e8 x9 h3 t
  82. module_param(acnt, int, S_IRUGO);) h9 T3 z" q9 a, x0 @" h1 b
  83. module_param(bcnt, int, S_IRUGO);( L0 G9 r9 V: b  _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ x/ U; _; C% `

! Z* G% b( e+ i0 }1 A2 i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  @6 |- e9 F9 g' s* _0 \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 v& M# M- \+ w3 ^/ X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 J- X; j( q6 @* \

( U1 K; j- `( ^: e# e( ]9 K
& a/ e- r$ c" I  o3 y3 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-13 16:02 , Processed in 0.042745 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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