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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - _8 w$ n5 P, a7 _4 I4 \0 a. D9 U
  1. [code]EDMA sample test application
      u, e% e# i+ U, d, o
  2. /*/ f% N2 r4 d) n0 A" O8 b9 q
  3. * edma_test.c% z$ m" a9 L$ Y: ~9 `: b. F
  4. *
    , e# ]$ K! @* g( w* m( B
  5. * brief  EDMA3 Test Application
    " L) J  B+ ^, d8 Y: U8 a* P% |
  6. *
    ! H* M6 b4 t) u" u* N9 p
  7. *   This file contains EDMA3 Test code.
    ( g3 C& x, }6 Y+ s0 p( Y7 P
  8. *
    9 k$ d/ I4 D/ \3 V: r+ ^" \" r! {. _- E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ a" b" p2 O0 ~8 m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 p; Q  D* J+ Y# g( t
  11. *         TO CHANGE.
    ' m' L" u. |. K$ A, K
  12. *4 A7 W- c5 s/ T5 i8 \! ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& N& Q) ^& M/ m3 {- U
  14. *
    , Y* p* D( p$ U3 j4 Z# k. q* G
  15. * This program is free software; you can redistribute it and/or9 X' Q( t8 z8 |2 M5 G/ x8 |. J
  16. * modify it under the terms of the GNU General Public License as
    ) l! v6 q- B) N  R: u7 O' @
  17. * published by the Free Software Foundation version 2.) s. [9 |; H( f; n5 y3 |
  18. *8 Q0 J" v8 s2 G  k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : g7 Z8 R6 N2 ?7 M: a
  20. * kind, whether express or implied; without even the implied warranty/ y+ w# b0 B* `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % r3 ^' H* H# [, ~) I
  22. * GNU General Public License for more details.
    * p; w) _1 {  I2 t" x* A. o
  23. */: ]! O7 E2 o; J8 Y* \2 w

  24. 5 Z9 U: Q' G7 o1 g2 f6 @
  25. #include <linux/module.h>2 O' s% l# \* G. l5 ^
  26. #include <linux/init.h>5 C) ~, a9 ^* y  T) S0 H* x4 W
  27. #include <linux/errno.h>+ t) C+ l& Y/ i1 f4 K3 t% m/ B
  28. #include <linux/types.h>. Y! m0 u8 i3 s7 V
  29. #include <linux/interrupt.h>( z( e6 ^8 L4 t! n7 P9 w
  30. #include <asm/io.h>" T; E' v$ {7 b. T+ r; m
  31. #include <linux/moduleparam.h>
    3 U7 r" W- u( Z" [7 p; Z
  32. #include <linux/sysctl.h>
    ) e) K* l6 \1 C$ f& e
  33. #include <linux/mm.h>: L: C! B% {  A( b) B5 n
  34. #include <linux/dma-mapping.h>
    + K8 E4 @+ d' ^+ w# ?: a
  35. - {3 {& f  V% b& s
  36. #include <mach/memory.h>
    ) F. i8 v+ s: B7 b1 v
  37. #include <mach/hardware.h>% U6 j# f8 g# P% D6 e; q- L
  38. #include <mach/irqs.h>
    * j7 }  s& ]8 P: u
  39. #include <asm/hardware/edma.h>+ U/ n/ s; P$ }- F
  40. : ]% Y) w8 N. \) i7 X9 }$ ^) I3 o
  41. #undef EDMA3_DEBUG
    6 v6 F7 r0 D9 \
  42. /*#define EDMA3_DEBUG*/* E4 u. e5 B: Y, i1 [$ w
  43. 1 G* _. h: ?8 Y3 w
  44. #ifdef EDMA3_DEBUG
    2 i5 m- D4 F% }5 Q8 H( r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 Z1 ^6 w9 A6 l3 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). F4 l" H9 ~* T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 Z! E. u& r- D/ t: X: e2 s7 ?
  48. #else4 g9 Q/ z8 Y3 @$ r0 Y2 N- I' l! w! w6 ]
  49. #define DMA_PRINTK( x... )
    8 B5 Q" U$ I! l5 G' Z% ^3 r% }
  50. #define DMA_FN_IN
    + V8 h4 g' `) @; N& H7 O
  51. #define DMA_FN_OUT. f$ M  o- c" w! X# F+ K5 K
  52. #endif" ^3 Q! Q& u" r5 u

  53. 5 Q( w( _0 p0 a0 k: ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' E; Z/ S7 I. e# W: t
  55. #define STATIC_SHIFT                3
    ( s( S8 c; [, t5 D+ P+ ^- w
  56. #define TCINTEN_SHIFT               20
    ) u0 ~& O' ]2 y' [: v+ [2 ~4 h
  57. #define ITCINTEN_SHIFT              21! t) T, @" J/ K* \6 n
  58. #define TCCHEN_SHIFT                223 X7 l4 ?8 `/ p" e. i7 a% F
  59. #define ITCCHEN_SHIFT               23% M& r' ?6 y" \8 L* ^9 N& |$ X

  60. . s( t) A: P, c: G! G; z4 g
  61. static volatile int irqraised1 = 0;
    ; u9 Y4 ^# r" j, M
  62. static volatile int irqraised2 = 0;
    ) t4 Y7 g  m* @* R4 g& a

  63. , j' B. G* P" l5 U) i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : V# H  P: F( A1 D! X+ I+ O5 x6 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 n) F5 q$ W. e6 L+ t, N- b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' b" J+ N* l% N0 [
  67. 0 K( r- |% h, L4 R* D/ _9 Q; v$ i' j3 Q5 \
  68. dma_addr_t dmaphyssrc1 = 0;
    " ]5 H8 i- o- t% g! u* ]
  69. dma_addr_t dmaphyssrc2 = 0;) v; ]: }# C& T6 b
  70. dma_addr_t dmaphysdest1 = 0;9 U, @$ t/ x, B
  71. dma_addr_t dmaphysdest2 = 0;
    - @# B7 Y/ ]' l5 Q0 v' L, j

  72. 0 s$ f6 ?; H) U6 Q: R
  73. char *dmabufsrc1 = NULL;
      f0 B: K: }# J
  74. char *dmabufsrc2 = NULL;5 I4 L# ^$ y2 Y9 {0 g( D
  75. char *dmabufdest1 = NULL;
    0 H# K8 x2 g! ?  ^0 ]8 f; l2 w
  76. char *dmabufdest2 = NULL;
    0 F5 M. U( P" t( \1 ^0 v$ @' D. h
  77. # T+ ^+ i0 s0 C
  78. static int acnt = 512;2 s# M) d$ J4 {; T: T
  79. static int bcnt = 8;, R2 a+ G6 @& o+ [
  80. static int ccnt = 8;
    ) x# a& }6 B+ q
  81. 5 {, O+ i) ~5 }! @5 _
  82. module_param(acnt, int, S_IRUGO);+ }4 d% }% m. A$ l
  83. module_param(bcnt, int, S_IRUGO);
    5 G  n) s: y( Y1 M0 [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% Y9 G; z2 s& [( Q9 Y
4 I/ w& f8 J7 v7 _/ }0 \- t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& A, s8 s$ \( j1 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# K2 t& F$ z  q0 p. x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 ^( U7 T) ~" {* V& n) V" M
0 h7 ~* A3 e1 I  m  w5 {
8 R# L$ \# N  t, a) i% `% N" G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 23:19 , Processed in 0.039896 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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