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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ T' a) d0 S  R. T/ M
  1. [code]EDMA sample test application
    & t9 y( C1 [6 r
  2. /*; ?2 t, y1 @& E  E
  3. * edma_test.c
    9 B, n. d+ V9 r, ~. u
  4. *: G. o2 J2 q: s# U0 `6 \% |9 Y6 c) X
  5. * brief  EDMA3 Test Application
    : Z! ~; a7 a7 ]* E
  6. *
    9 Y' y" a: F( I0 n' o
  7. *   This file contains EDMA3 Test code.* E/ B( @. r9 g3 n% E
  8. *
    9 f" V3 ^1 y+ f+ `9 d* q8 k  s/ E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# }! O( X" l6 d  ~/ r! U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 N3 v+ n3 o  O8 u6 }* ^
  11. *         TO CHANGE.
    * D* n: `3 P2 ^$ G% |( ?0 m
  12. *
    ' E2 I" x7 r/ P/ h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- L. h! q6 \, C, s/ H
  14. *! z6 s& B. h0 N/ o  ?% g
  15. * This program is free software; you can redistribute it and/or. }8 W' w; J$ B* w, i6 T
  16. * modify it under the terms of the GNU General Public License as
    , i' H* M$ Y  {' {9 b% S
  17. * published by the Free Software Foundation version 2.
    ; t: t  b; g6 L8 e+ i
  18. *. y" h% h! I+ ?* B. A; \6 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & i% k) s6 b% T
  20. * kind, whether express or implied; without even the implied warranty& h4 F' A! \5 J( X1 L7 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) z6 V6 b( A' h8 K, C
  22. * GNU General Public License for more details.
    9 ]3 S/ M4 S# o' w
  23. */# f. ~5 f, f5 \" o0 r% [8 t3 `
  24. 0 r/ ]; s% d. a# {2 K
  25. #include <linux/module.h>2 \, Y2 _& ?' e/ W! R
  26. #include <linux/init.h>
    4 R. d" ^- N: \+ J, c  `
  27. #include <linux/errno.h>
    ! J" Q+ h2 @( P$ V
  28. #include <linux/types.h>
    9 D6 t9 |! s7 d: q" b1 y! \: L
  29. #include <linux/interrupt.h>
    % T" [3 @! v. U0 C, h! Q
  30. #include <asm/io.h>+ _% N; }- p$ v
  31. #include <linux/moduleparam.h>
    # F$ ?- R' v  N& K
  32. #include <linux/sysctl.h>
    : n6 l8 o2 j5 a& B/ ^5 c/ N3 v
  33. #include <linux/mm.h>  s2 j6 p& ^9 c5 \$ P) C
  34. #include <linux/dma-mapping.h>
    & `) u7 u8 Q1 R: g6 C- ^
  35. ( J1 m  ^6 Q3 ?
  36. #include <mach/memory.h>
    " J# A( V8 \( t1 {
  37. #include <mach/hardware.h>
    , |8 V: Z1 }& ]; M; S9 G
  38. #include <mach/irqs.h>
    / n4 m' D; @. b( Z. C( H% |
  39. #include <asm/hardware/edma.h>+ m# i% s: |/ t' r
  40. $ `) [; K; z8 f( f8 Z
  41. #undef EDMA3_DEBUG# `+ E+ N' @) P
  42. /*#define EDMA3_DEBUG*/
    # b) l  w' R; n9 M: s/ e0 }3 t
  43. ! B; x- k6 b0 w! Y! b, w
  44. #ifdef EDMA3_DEBUG8 G5 m. H4 O' }1 p% Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 T# i1 B+ |$ m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 ^/ \1 [0 j% L9 _! e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 ^0 n/ B& Z7 M/ g; u  X: Y4 I
  48. #else: X- X( C4 N$ ]
  49. #define DMA_PRINTK( x... )9 u" b) w! s, |0 D
  50. #define DMA_FN_IN
    * r- e& V# n* y
  51. #define DMA_FN_OUT
    % Y8 I' w# R# a- h: Y) F9 Q
  52. #endif
    9 Z0 I: ^, o6 ^) ^, ?
  53. ' Q1 q8 H+ q+ b6 D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 e* y# `  [( i9 w
  55. #define STATIC_SHIFT                3
    3 t# i7 \; F! K, \
  56. #define TCINTEN_SHIFT               20
    3 O7 w- \  I9 X
  57. #define ITCINTEN_SHIFT              215 ?* L" i4 T2 l# R8 R" L" s8 L% u
  58. #define TCCHEN_SHIFT                22: q- n2 y$ ~, J8 v5 C/ ]- A& V6 V' A" A
  59. #define ITCCHEN_SHIFT               231 g8 G% _) X; X; M0 B* @; U0 w+ C
  60. 9 Z8 ~0 b" r  |2 ^" Y& Y# }2 d
  61. static volatile int irqraised1 = 0;
    : h5 ^& }4 |5 T
  62. static volatile int irqraised2 = 0;
    / [" h% ?" f- E* h3 d/ X

  63. 9 C* P/ t: i" {' u1 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% y7 z8 [. `/ ?, Z# N, n: Z# i1 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 L3 |: t5 a/ h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# R2 ^1 M* V6 l2 ?. c+ T

  67. % r0 i1 @6 ^' M# X  T
  68. dma_addr_t dmaphyssrc1 = 0;' c$ u+ l2 o" D$ ^8 i$ {
  69. dma_addr_t dmaphyssrc2 = 0;' T' x' j& q! {6 d' D1 h8 l! M
  70. dma_addr_t dmaphysdest1 = 0;$ c8 O9 l6 c7 }4 ~. F: {+ f
  71. dma_addr_t dmaphysdest2 = 0;4 q1 y8 g4 [) H7 X
  72. + L, l/ X8 X# C/ t* i' Y4 N8 W6 G
  73. char *dmabufsrc1 = NULL;2 p) F. C* b. n
  74. char *dmabufsrc2 = NULL;
    8 c0 r6 ~7 D: ~& g& _5 ]' C
  75. char *dmabufdest1 = NULL;
    0 |2 F( P3 Q& d) M6 _( T
  76. char *dmabufdest2 = NULL;5 H2 p0 e2 L6 Z2 ?2 g/ P1 Z: t
  77. , D6 f; U3 t4 K8 m6 b
  78. static int acnt = 512;
    6 Y; T# o  Z+ H: ?  x  ~
  79. static int bcnt = 8;' W! R" n6 {% q5 j  ^( ?
  80. static int ccnt = 8;
    & U) t* Z+ \9 Z5 l

  81. ' @4 L3 T' A2 j% V8 W5 B* l
  82. module_param(acnt, int, S_IRUGO);
    ; }; X, m* L" [. L
  83. module_param(bcnt, int, S_IRUGO);
    * U/ N5 B% s' ~3 s4 Q- c$ L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& |- x# S- D8 T6 m4 K6 v2 U; V

# B8 a) d" o0 ~9 E* d2 D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 N3 n) U0 A' K5 q- W" k- M2 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ o# U4 w; D7 y' C3 y% c5 X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) Z5 {/ N7 `% v
% S$ i% @, D' T+ E
! n, w  l8 g" ~% q0 a9 Z, r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 05:17 , Processed in 0.038588 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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