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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : ~# x# X5 S" J
  1. [code]EDMA sample test application& _8 {6 V/ Z+ c3 h
  2. /** ?- a+ [" a* T9 x6 B. q) d' c
  3. * edma_test.c
    ' V: z5 K) ^2 o9 G: R
  4. *" s! Y; r" ^6 X0 t6 y! r" W2 u$ W9 k
  5. * brief  EDMA3 Test Application
    ' d9 q0 T0 X4 R3 q& B5 ]3 o
  6. *
    $ D7 C8 U& R  ?3 d+ C& v: a+ `
  7. *   This file contains EDMA3 Test code.
      w6 S) Z( V, P* }4 @, R
  8. *
    . i- l; {5 `9 Z9 O* i" B3 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# T( \8 L  w! O3 c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; d' {: P  Y4 G7 v
  11. *         TO CHANGE.
    ' B, F8 S) b, H* Y$ e' b( H
  12. *
    , e, z( u  R$ ~+ X, ^- i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 Z+ p4 x& o, @
  14. *
    ( k2 N$ b+ k, t) f
  15. * This program is free software; you can redistribute it and/or+ z4 l. q' @" t1 Z& k* B
  16. * modify it under the terms of the GNU General Public License as' v2 `9 B! j, E
  17. * published by the Free Software Foundation version 2.
    6 h( R7 B( e3 ~2 {" S
  18. *
    2 A. J/ P/ k: V1 ^' c) ~5 a; J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 }, e. [: `1 i' {/ g5 k. Q" B$ y
  20. * kind, whether express or implied; without even the implied warranty9 ?8 t5 s* O. N6 @4 I8 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 _8 W8 g' e6 R1 s( _
  22. * GNU General Public License for more details.( p6 f9 [3 b- {# }8 n
  23. */( |3 F# k0 @1 w* x
  24. # k, P$ f7 p8 Y5 _0 {
  25. #include <linux/module.h>
    , ?- _) S0 E2 I6 {& S) ~; M0 J
  26. #include <linux/init.h>
    , }$ v7 i; R5 {7 S6 R
  27. #include <linux/errno.h>
    ; x. H5 a0 x. k. H# y
  28. #include <linux/types.h>
    3 f: V# \" R0 @' k0 a7 d1 z& O
  29. #include <linux/interrupt.h>
      P- j  j  S0 [. j0 t; C
  30. #include <asm/io.h>; |$ S) ^$ O1 k2 [* q! e: r/ T3 N
  31. #include <linux/moduleparam.h>  }; S: ~; D2 U, r& n8 F* U
  32. #include <linux/sysctl.h>/ J7 \( g9 C" k) I7 |2 f5 s0 A
  33. #include <linux/mm.h>
    : f; U, A5 p+ T
  34. #include <linux/dma-mapping.h>
    0 Y5 J- G' j! W/ K( W9 G

  35. , v/ `& T2 a( [& Y5 [
  36. #include <mach/memory.h>
    ) I( ~1 b- p6 X4 q/ q4 q
  37. #include <mach/hardware.h>7 r. \6 H5 e( S' Y* k
  38. #include <mach/irqs.h>$ D+ J5 }3 y) R
  39. #include <asm/hardware/edma.h>5 N9 b  n: W7 h/ r6 N7 P8 b
  40. 5 V* D1 O+ ~  S- B5 R
  41. #undef EDMA3_DEBUG& g2 W. e+ D; \" z" E0 O3 H8 f8 S
  42. /*#define EDMA3_DEBUG*/
    & C- O" H, k6 M) F
  43. : B2 C5 G% V; [+ p
  44. #ifdef EDMA3_DEBUG5 |# g. C) j% _2 ^) ~0 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 i3 j4 O% t/ L) a' S* j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . S3 l, s2 M3 `9 ]. M" B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( k6 d! v9 c8 Y  C9 ]# b( g7 l" O
  48. #else
    ( f  ~% S9 l# R6 C+ |
  49. #define DMA_PRINTK( x... )* g" o% n4 g( p4 g0 i8 `
  50. #define DMA_FN_IN
    $ D2 ^, g" }( h) y
  51. #define DMA_FN_OUT
    " z3 Q1 |* I! H9 n; ~: c/ k
  52. #endif
    ' E0 ^/ p  h/ u) A
  53. & E/ X  K* D0 c' b% Z* M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 c0 _; [& A( t) O, C% `: C
  55. #define STATIC_SHIFT                3( w; n% p5 M) v8 g. E7 Q8 @# w# s
  56. #define TCINTEN_SHIFT               20$ _" Q; l3 p" l: K% L0 @! I% A
  57. #define ITCINTEN_SHIFT              21
    0 \  [$ j4 f0 ~5 D% E
  58. #define TCCHEN_SHIFT                22
    1 X1 U$ U5 M& ?8 V2 Z& A
  59. #define ITCCHEN_SHIFT               23
      @' w; R+ a& I1 S' G0 @

  60. ! q# _' I/ ^+ N  l
  61. static volatile int irqraised1 = 0;
    1 {8 {6 X$ F4 w8 g4 @( h
  62. static volatile int irqraised2 = 0;4 M  u6 t0 b; U# X

  63. ( A( B9 G6 G. ?6 w& T. [+ F2 O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 P( l! r# D" g% J' j' m: T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : Q2 L, J. J7 Z/ b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' z; R+ s1 ^- @. c% H
  67. : J* Z' R/ r; ^! L* s' a  P0 c, p9 Y6 r& [
  68. dma_addr_t dmaphyssrc1 = 0;
    1 N$ q( F4 _* i8 w- [
  69. dma_addr_t dmaphyssrc2 = 0;0 i& U# k) U2 Z  d  D& R
  70. dma_addr_t dmaphysdest1 = 0;
    # n2 F! m- W' }! H- k; A, x! n
  71. dma_addr_t dmaphysdest2 = 0;
    9 X3 y* R% l; r- s6 P) q% p% J
  72. 1 }, o! p1 @7 X" V7 m% T4 n
  73. char *dmabufsrc1 = NULL;
    5 C/ o9 h$ k9 Y; M9 F) n6 i% n  G
  74. char *dmabufsrc2 = NULL;+ T+ x! j+ g! Y* F. T& \
  75. char *dmabufdest1 = NULL;4 o* K3 L3 j* P' O- |( h$ P
  76. char *dmabufdest2 = NULL;6 M0 X: ~, y+ o+ C1 E' N9 t6 U( j8 _
  77. ! K  y& n6 x+ |5 c0 c: r
  78. static int acnt = 512;
    2 D. t. O# l; ~5 @% u6 U
  79. static int bcnt = 8;0 p8 h8 P5 p& S7 Y& {) m
  80. static int ccnt = 8;
    ) R( }, q" `2 _. m

  81. # R/ Y9 Z4 T. z3 J5 @
  82. module_param(acnt, int, S_IRUGO);; P  G: P" B' g9 Z
  83. module_param(bcnt, int, S_IRUGO);
    * }  }% f3 A, y* S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ z- l5 i8 H9 _2 r: m, y. Q$ ?8 P8 ?( }7 L0 i* K" x" T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 E) j9 u5 U; b' B3 q5 g# Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ h. ^9 e3 G$ S% F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 w# p1 Y0 G0 P( _. z( F, I

, ]; v- n0 g" x2 Y7 o9 q3 r4 z
) y$ ]9 g* w7 j# G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 04:43 , Processed in 0.037917 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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